//0 means disabled; 1 means enabled;  
var loginPopupStatus = 0;  
var siteMapPopupStatus = 0;  
var mailerPopupStatus = 0;  

function loadLoginPopup(){  
  //loads popup only if it is disabled  
  if(loginPopupStatus==0){  
    jQuery("#backgroundPopup").css({  
  	  "opacity": "0.7"  
    });  
    jQuery("#backgroundPopup").fadeIn("slow");  
    jQuery("#popupLogin").fadeIn("slow");  
    loginPopupStatus = 1;  
  }  
}
function loadSiteMapPopup(){  
  //loads popup only if it is disabled  
  if(siteMapPopupStatus==0){  
    jQuery("#backgroundPopup").css({  
  	  "opacity": "0.7"  
    });  
    jQuery("#backgroundPopup").fadeIn("slow");  
    jQuery("#popupSiteMap").fadeIn("slow");  
    siteMapPopupStatus = 1;  
  }  
}
function loadMailerPopup(){  
  //loads popup only if it is disabled  
  if(mailerPopupStatus==0){  
    jQuery("#backgroundPopup").css({  
  	  "opacity": "0.7"  
    });  
    jQuery("#backgroundPopup").fadeIn("slow");  
    jQuery("#popupMailer").fadeIn("slow");  
    mailerPopupStatus = 1;  
  }  
}

function disablePopups(){  
  //disables popup only if it is enabled  
  if(loginPopupStatus==1){  
	jQuery("#backgroundPopup").fadeOut("slow");  
	jQuery("#popupLogin").fadeOut("slow");  
	loginPopupStatus = 0;
  }else if(siteMapPopupStatus==1){  
	jQuery("#backgroundPopup").fadeOut("slow");  
	jQuery("#popupSiteMap").fadeOut("slow");  
	siteMapPopupStatus = 0;
  }else if(mailerPopupStatus==1){  
	jQuery("#backgroundPopup").fadeOut("slow");  
	jQuery("#popupMailer").fadeOut("slow");  
	mailerPopupStatus = 0;  
  }
}  


function disableLoginPopup(){  
  //disables popup only if it is enabled  
  if(loginPopupStatus==1){  
	jQuery("#backgroundPopup").fadeOut("slow");  
	jQuery("#popupLogin").fadeOut("slow");  
	loginPopupStatus = 0;
  }
}  
function disableSiteMapPopup(){  
  //disables popup only if it is enabled  
  if(siteMapPopupStatus==1){  
	jQuery("#backgroundPopup").fadeOut("slow");  
	jQuery("#popupSiteMap").fadeOut("slow");  
	siteMapPopupStatus = 0;
  }
}  
function disableMailerPopup(){  
  //disables popup only if it is enabled  
  if(mailerPopupStatus==1){  
	jQuery("#backgroundPopup").fadeOut("slow");  
	jQuery("#popupMailer").fadeOut("slow");  
	mailerPopupStatus = 0;  
  }
}  

function centerPopups(){  
  //request data for centering  
  var windowWidth = document.documentElement.clientWidth;  
  var windowHeight = document.documentElement.clientHeight;  
  var popup1Height = jQuery("#popupLogin").height();  
  var popup1Width = jQuery("#popupLogin").width();  
  var popup2Height = jQuery("#popupSiteMap").height();  
  var popup2Width = jQuery("#popupSiteMap").width();  
  var popup3Height = jQuery("#popupMailer").height();  
  var popup3Width = jQuery("#popupMailer").width();  
  //centering  
  jQuery("#popupLogin").css({  
	"position": "fixed",  
	"top": windowHeight/2-popup1Height/2,  
	"left": windowWidth/2-popup1Width/2  
  });  
  jQuery("#popupSiteMap").css({  
	"position": "fixed",  
	"top": windowHeight/2-popup2Height/2,  
	"left": windowWidth/2-popup2Width/2  
  });  
  jQuery("#popupMailer").css({  
	"position": "fixed",  
	"top": windowHeight/2-popup3Height/2,  
	"left": windowWidth/2-popup3Width/2  
  });  
  //only need force for IE6  
  
  jQuery("#backgroundPopup").css({  
	"height": windowHeight  
  });  

}
