$(document).ready(function(){
	Cufon.replace("div#menu a", {
		hover: true
	});
});

function getPageSize(){
   
   var xScroll, yScroll;
   
   if (window.innerHeight && window.scrollMaxY) {   
      xScroll = document.body.scrollWidth;
      yScroll = window.innerHeight + window.scrollMaxY;
   } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
      xScroll = document.body.scrollWidth;
      yScroll = document.body.scrollHeight;
   } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
      xScroll = document.body.offsetWidth;
      yScroll = document.body.offsetHeight;
   }
   
   var windowWidth, windowHeight;
   if (self.innerHeight) {   // all except Explorer
      windowWidth = self.innerWidth;
      windowHeight = self.innerHeight;
   } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowWidth = document.documentElement.clientWidth;
      windowHeight = document.documentElement.clientHeight;
   } else if (document.body) { // other Explorers
      windowWidth = document.body.clientWidth;
      windowHeight = document.body.clientHeight;
   }   
   
   // for small pages with total height less then height of the viewport
   if(yScroll < windowHeight){
      pageHeight = windowHeight;
   } else {
      pageHeight = yScroll;
   }

   // for small pages with total width less then width of the viewport
   if(xScroll < windowWidth){   
      pageWidth = windowWidth;
   } else {
      pageWidth = xScroll;
   }


   arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
   return arrayPageSize;
}


var IE = document.all?true:false


function LoadingOff() {
document.getElementById('loading').style.display = "none";
}

function LoadingOn() {
document.getElementById('loading').style.display = "block";
}

function ShowMessage(msg) {
if(IE) {
var poz_y = (document.documentElement.scrollTop + 50) + 'px';
}
else {
var poz_y = (window.pageYOffset + 50) +'px';
}
var poz_x = ((document.body.clientWidth/2)-300) +'px';
document.getElementById("SystemMessage").style.left = poz_x;
document.getElementById("SystemMessage").style.top = poz_y;
document.getElementById('SystemMessage').style.display = "block";
document.getElementById('systemMessageTxt').innerHTML = msg;

}

function HideMessage() {
document.getElementById('SystemMessage').style.display = "none";
}
function ShowClientAdder() {
document.getElementById('ClientAdder').style.display = "block";
}
function HideClientAdder() {
document.getElementById('ClientAdder').style.display = "none";
}
function Cover() {

var wymiary = getPageSize();


document.getElementById('Covering').style.height = wymiary[1] + 'px';

document.getElementById('Covering').style.width = '100%';
//alert(document.documentElement.clientHeight);
}
function ShowNewsletter() {
if(IE) {
var poz_y = (document.documentElement.scrollTop + 50) + 'px';
}
else {
var poz_y = (window.pageYOffset + 50) +'px';
}
var poz_x = ((document.body.clientWidth/2)-216) +'px';
document.getElementById("newsletterBox").style.left = poz_x;
document.getElementById("newsletterBox").style.top = poz_y;
document.getElementById('newsletterBox').style.display = "block";
}
function HideNewsletter() {
document.getElementById('newsletterBox').style.display = "none";
}

function ShowRulesBox() {
if(IE) {
var poz_y = (document.documentElement.scrollTop + 50) + 'px';
}
else {
var poz_y = (window.pageYOffset + 50) +'px';
}
var poz_x = ((document.body.clientWidth/2)-216) +'px';
document.getElementById("rulesBox").style.left = poz_x;
document.getElementById("rulesBox").style.top = poz_y;
document.getElementById('rulesBox').style.display = "block";
}
function HideRulesBox() {
document.getElementById('rulesBox').style.display = "none";
}

function ShowRecommend() {
if(IE) {
var poz_y = (document.documentElement.scrollTop + 50) + 'px';
}
else {
var poz_y = (window.pageYOffset + 50) +'px';
}
var poz_x = ((document.body.clientWidth/2)-216) +'px';
document.getElementById("recommendBox").style.left = poz_x;
document.getElementById("recommendBox").style.top = poz_y;
document.getElementById('recommendBox').style.display = "block";
}
function HideRecommend() {
document.getElementById('recommendBox').style.display = "none";
}
         function changeMap(mapka) {
         document.getElementById('googleMap').innerHTML = '<iframe width="440" height="370" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="'+mapka+'"></iframe>';
         document.getElementById('mapBox').style.display = "block";
         }
        
          function closeGoogleMap() {
          document.getElementById('mapBox').style.display = "none";
          }
          
function checkRuleForm() {
var re = new RegExp("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$","i");
var tel = new RegExp("^[(0-9- ^(a-z))]{7,100}$","i");
var rule_name = document.getElementById("rules_name");
var rule_surname = document.getElementById("rules_surname");
var rule_company = document.getElementById("rules_company");
var rule_contact = document.getElementById("rules_contact");
//alert(email.value);
if ((re.test(rule_contact.value)||tel.test(rule_contact.value))&&rule_name.value&&rule_surname.value&&rule_company.value) {
document.getElementById("checkboxRule").disabled = false;
} else {
document.getElementById("checkboxRule").disabled = true;
}
}

function checkboxTest() {
  document.getElementById('rulesButton').disabled=!document.getElementById('checkboxRule').checked;
}

