function pokaz(ref) {
	if (ref) document.getElementById(ref).style.display = 'block';	
}

function ukryj(ref) {
	if (ref) document.getElementById(ref).style.display = 'none';	
}

function nS(user,domain) {
         locationstring = "mailto:" + user + "@" + domain;
         window.location = locationstring;
} 


 if(typeof HTMLElement!='undefined'&&!HTMLElement.prototype.click)
    HTMLElement.prototype.click=function()
    {
        var evt = this.ownerDocument.createEvent('MouseEvents');
        evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
        this.dispatchEvent(evt);
    }

    
function klik(id) {
	  document.getElementById(id).click();
}
    
function closeRokbox() {
    window.parent.window.klik('rokbox-overlay');
}

function addStyle(el, s){
  if(typeof(el) == 'string'){el = document.getElementById(el);}
  var st = s.split(';');
  for(var i=0; i<st.length; i++){
    var stl = st[i].split(':');
    if(stl.length == 2){
      stl[0] = stl[0].replace(/^\s*|\s*$/g,"");
      stl[1] = stl[1].replace(/^\s*|\s*$/g,"");
      stl[1] = stl[1].replace(/'/g, "\"");
      tmpStl = stl[0].split('-');
      stl[0] = tmpStl[0];
      for(var j=1; j < tmpStl.length; j++){
        stl[0] += tmpStl[j].charAt(0).toUpperCase() + tmpStl[j].substr(1).toLowerCase();
      }
      delete tmpStl;
      if(stl[0].length > 3){eval('el.style.' + stl[0] + ' = \'' + stl[1] + '\';');}
    }
  }
  return false;
}

function getH(divID) {

				var docH = document.body.clientHeight;
								
				var winH = 460;
				
				if (parseInt(navigator.appVersion)>3) {
				 if (navigator.appName=="Netscape") {
				  winH = window.innerHeight;
				 }
				 if (navigator.appName.indexOf("Microsoft")!=-1) {
				  winH = document.body.offsetHeight;
				 }
				}
				
				if (winH > (docH + 45)) docH = winH - 47;
				
				docH = docH - 123;				
				
				var style = 'margin-top: ' + (docH)+'px; display: block;';
				addStyle('footer', style);
}

function getmail() {
   
   	var alertMessage = '';
   
    if (!document.getElementById("title").value) { alertMessage = alertMessage + 'Proszę podać tytuł wiadomości. '; }
    if (!document.getElementById("message").value) { alertMessage = alertMessage + 'Proszę podać źródło informacji o naszej firmie. '; }  
    if (!document.getElementById("from").value) { alertMessage = alertMessage + 'Proszę podać imię i nazwisko. '; } 
    if (!document.getElementById("email").value) { alertMessage = alertMessage + 'Proszę podać adres e-mail. '; } 
   
   	if (alertMessage == '') {
   						get(document.getElementById('contactForm'));
						pokaz('contactPrelo'); 
						ukryj('contactForm');
	}
	else alert(alertMessage);
   }
