//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
			"opacity": "0"
		});
		$("#backgroundPopup").show();
		$("#search_menu").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").hide();
		$("#search_menu").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	var sf_pos    = $("#search_form_location").offset();
	var sf_top    = sf_pos.top+4;
	var sf_left   = sf_pos.left;

	$("#search_menu").css("top",sf_top+20);
	$("#search_menu").css("left",sf_left);
	$("#search_menu").css("position","absolute");
	//only need force for IE6

}

//CRUISER
//loading popup with jQuery magic!
function loadCruiserPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundCruiserPopup").css({
			"opacity": "0"
		});
		$("#backgroundCruiserPopup").show();
		$("#search_cruiser_menu").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disableCruiserPopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundCruiserPopup").hide();
		$("#search_cruiser_menu").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerCruiserPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	var sf_pos    = $("#search_form_cruiser_location").offset();
	var sf_top    = sf_pos.top+4;
	var sf_left   = sf_pos.left;

	$("#search_cruiser_menu").css("top",sf_top+20);
	$("#search_cruiser_menu").css("left",sf_left);
	$("#search_cruiser_menu").css("position","absolute");
	//only need force for IE6

}

//BUS

//loading popup with jQuery magic!
function loadbusPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundbusPopup").css({
			"opacity": "0"
		});
		$("#backgroundbusPopup").show();
		$("#search_bus_menu").fadeIn("slow");
		popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablebusPopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundbusPopup").hide();
		$("#search_bus_menu").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerbusPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	
	var sf_pos    = $("#search_form_bus_location").offset();
	var sf_top    = sf_pos.top+4;
	var sf_left   = sf_pos.left;

	$("#search_bus_menu").css("top",sf_top+20);
	$("#search_bus_menu").css("left",sf_left);
	$("#search_bus_menu").css("position","absolute");
	//only need force for IE6

}
