var popupStatus = 0;
function loadPopup(){
//loads popup only if it is disabled
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.0"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact").fadeIn("slow");
popupStatus = 1;
}
}
//disabling popup
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$("#backgroundPopup").fadeOut("fast");
$("#popupContact").fadeOut("fast");
popupStatus = 0;
}
}
$(document).ready(function(){
//LOADING POPUP
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
if(($.browser.msie==true)&&(($.browser.version=="7.0"))) {
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
var xie = windowWidth/2-popupWidth/2;
var yie = windowHeight/2-popupHeight/2;
var ie = 1;
};
$(".popupx").click(function(e){
//centering with css
var x = e.pageX;
var y = e.pageY;
if (''=="Y") {
if(x>350){
x = x-170;
};
if(y>280){
y = y-150;
};
} else {
if(ie==null) {
if(x>330){
x = x-180;
};
if(y>700){
y = y-600;
} else {
if(y>550){
y = y-340;
} else {
if(y>330){
y = y-230;
};
};
};
} else {
x = xie;
y = yie;
};
};
$("#popupContact").css({
"position": "fixed",
"top": y,
"left": x,
"z-index": 10000
});
$("#backgroundPopup").css({
"height": windowHeight
});
//load popup
loadPopup();
});
//CLOSING POPUP
$("#popupContactClose").click(function(){
disablePopup();
});
$("#backgroundPopup").click(function(){
disablePopup();
});
$(document).keypress(function(e){
if(e.keyCode==27&&popupStatus==1){
disablePopup();
}
});
//END LOADING INFO
if (cookiesEnabled()) {
$(window).load(function(){
$("#loadingContact").fadeOut("fast");
$("#loadingPopup").fadeOut("fast");
});
};
// ALERT INFORMACYJNY NA STRONIE GŁÓWNEJ

});