jQuery.noConflict();

jQuery(document).ready(function(){

	//jQuery("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)

	//jQuery("ul.topnav li span").click(function() { //When trigger is clicked...
	var functionHover=function() {
		//Following events are applied to the subnav itself (moving subnav up and down)		
		if(!this.isShowing){
			this.isShowing=true;
			var parentElement=this;
			jQuery(this).addClass("subhover");
			//jQuery(this).find("a.firstlevel").hide();
			if(jQuery(this).find("a").length>1){
			
			//jQuery(this).find("a.firstlevel").slideDown(600).show(function(){
					jQuery(parentElement).find("ul.subnav").slideDown('fast').show(function(){
									parentElement.isShowing=false;
																}
																);
			//		});		
			}else{
			//	jQuery(this).find("a").slideDown(600).show(function(){
									parentElement.isShowing=false;
															   
			//		});
			}
			//window.setTimeout("jQuery(document).find('ul.subnav').slideUp('slow');",5000);
			//window.setTimeout(function(){jQuery(parentElement).find('ul.subnav').slideUp('slow');},4000);
		//Drop down the subnav on click
		
		}
		}
		var functionHoverOut=function(){
			//alert(jQuery(this).parent().find("ul.subnav").length);
			jQuery(this).parent().find("ul.subnav").slideUp('slow',function(){jQuery(this).parent().removeClass("subhover");}); //When the mouse hovers out of the subnav, move it back up
			
			jQuery(this).removeClass("subhover");
		};
    jQuery("ul.topnav li").hover(functionHover,
	 functionHoverOut);
	jQuery("ul.topnav li ul.subnav").hover(function(){},
	 function(){
		  jQuery(this).slideUp('slow');
		 jQuery(this).parent().removeClass("subhover");});
	jQuery("body>table").hover(
	 function(){
		 jQuery(this).find("ul.subnav").slideUp('slow',function(){jQuery(this).parent().removeClass("subhover");}); //When the mouse hovers out of the subnav, move it back up
			
		 },function(){});

		//Following events are applied to the trigger (Hover events for the trigger)
		
jQuery('.top_pics').cycle({ 
    fx:     'fade', 
    speed:  1300, 
    next:   '.top_pics', 
    timeout: 6000 
});
});
