function viewgallery(m,p) { window.open("/gallery.php?m="+m+"&p="+p, "gallery","width=750,height=610,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no"); } function banner() { window.open("/banner.html", "banner","width=249,height=165,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no"); } function popup(src) { window.open(src,"Popup","width=980,height=650,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes"); } var popupStatus = 0; function loadPopup(){ if(popupStatus==0){ var popupHeight = 284; var popupWidth = 436; var windowWidth = document.documentElement.clientWidth; var windowHeight = document.documentElement.clientHeight; var popupTop = windowHeight/2-popupHeight/2; var popupLeft = windowWidth/2-popupWidth/2; $("#popUpBanner").animate({opacity: "1",top: popupTop, left: popupLeft, width: "436", height: "284"},"slow"); popupStatus = 1; } } function disablePopup(){ if(popupStatus==1){ $("#popUpBanner").animate({opacity: "0.7", top: "585", left: "0", width: "219", height: "141"},"slow") .animate({opacity: "0", width: "219", height: "141"},"slow") return false; popupStatus = 0; } } function centerPopup(){ //var popupHeight = $("#popUpBanner").height(); //var popupWidth = $("#popUpBanner").width(); //centering $("#popUpBanner").css({ "display":"none", "position": "absolute", "top": 585, "left": 0, "width": 1, "height": 1 }); } $(document).ready(function(){ //centering with css centerPopup(); //load popup setTimeout("loadPopup()",3000); $("#button").click(function(){ centerPopup(); loadPopup(); }); $("#popUpBannerClose").click(function(){ disablePopup(); }); $("#backgroundPopup").click(function(){ disablePopup(); }); $(document).keypress(function(e){ if(e.keyCode==27 && popupStatus==1){ disablePopup(); } }); });