var popupStatus 	= 0;  
var clubPopupStatus = 0;

function loadPopup(linkid, catid){  
if(popupStatus==0){  
 $("#jQueryPopup").load("ajax/frontend/clickout.popup.php?id="+linkid+"&catid="+catid);
 $("#backgroundPopup").css({ "opacity": "0.7"  });  
 $("#backgroundPopup").fadeIn("fast");  
 $("#jQueryPopup").fadeIn("fast");  
 centerPopup();
 popupStatus = 1;  
 }  
}  

function loadPopupProduct(linkid, catid, prodid){  
	if(popupStatus==0){  
	 $("#jQueryPopup").load("ajax/frontend/clickout.popup.php?id="+linkid+"&catid="+catid+"&prodid="+prodid);
	 $("#backgroundPopup").css({ "opacity": "0.7"  });  
	 $("#backgroundPopup").fadeIn("fast");  
	 $("#jQueryPopup").fadeIn("fast");  
	 centerPopup();
	 popupStatus = 1;  
	 }  
}  

function disablePopup(){  
 if(popupStatus==1){  
 $("#jQueryPopup").html('<img src="images/frontend/ajaxloader.gif" alt="ajaxload.gif" />');
 $("#backgroundPopup").fadeOut(0);  
 $("#jQueryPopup").fadeOut(0);  
 popupStatus = 0;  
 }  
 return;
}

function centerPopup(){  
 //request data for centering  
 var windowWidth  = document.documentElement.clientWidth;  
 var windowHeight = document.documentElement.clientHeight;  
 var lefttest     = (windowWidth / 2) - (popupWidth / 2);
 
 var popupHeight = $("#jQueryPopup").height();  
 var popupWidth = $("#jQueryPopup").width();  
 //centering  
 $("#jQueryPopup").css({  
 "position": "fixed",  
 "top": windowHeight/2-popupHeight/2,  
 "left": windowWidth/2-popupWidth/2  
 });  
 //only need force for IE6  
 $("#backgroundPopup").css({  
 "height": windowHeight  
 });  
}  

function loadClubsPopup(type){
	if(popupStatus==0){  
		 $("#jQueryPopup").load("ajax/frontend/clubs.popup.php?type="+type);
		 $("#backgroundPopup").css({ "opacity": "0.7"  });  
		 $("#backgroundPopup").fadeIn("fast");  
		 $("#jQueryPopup").fadeIn("fast");  
		 centerPopup();
		 popupStatus = 1;  
	}  	
}


$(document).ready(function(){  
	$("#jQueryPopupClose").click(function(){ 
		disablePopup();  
	});
	
	$("#backgroundPopup").click(function(){  
		disablePopup();  
	}); 
	
	$(document).keypress(function(e){  
	}); 
});