$(document).ready(function(){

	$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
	
	$(".mainTab").hover(function() { //When trigger is clicked...		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click


	 	/*if($.browser.msie && $.browser.version=="6.0") $('#quickSearch_tool iframe, #SearchPanel_quicksearch_New').css('visibility','hidden');;*/


		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
			
			/*$('#quickSearch_tool iframe').css('visibility','visible');*/
			
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"


		

	});

$("#searchlink").click(function(){
	

		loadPopup();
	});

$("#popupContactClose").click(function(){
		disablePopup();
	});

$("#popupContactClose2").click(function(){
		disablePopup2();
	});



$("#searchlinkbottom").click(function(){
	
		bottomloadPopup();
	});

$("#popupContactClose").click(function(){
		disablePopup2();
	});

})

var popupStatus = 0;

// popup starts //
function loadPopup(){
	
	if(popupStatus==0){
		$("#subcontent").fadeIn("slow");
		$("#subcontent").css('top', '480');
		$("#subcontent").css('left', '10');
		popupStatus = 1;
	}
}


function disablePopup(){

	if(popupStatus==1){
		$("#subcontent").fadeOut("slow");
		popupStatus = 0;
	}
}

// popup starts //
function bottomloadPopup(){
	
	if(popupStatus==0){
		$("#subcontent2").fadeIn("slow");
		$("#subcontent2").css('top', '1380');
		$("#subcontent2").css('left', '240');
		popupStatus = 1;
	}
}


function disablePopup2(){

	if(popupStatus==1){
		$("#subcontent2").fadeOut("slow");
		popupStatus = 0;
	}
}
