var myPromoTick;

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.getElementById(divID).clientHeight;			
				return(docH);
}

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);
   }
   
  
function goto(url) {
	window.location=url;	
}

function debug(data) {
	
	if (document.getElementById('debug')) {
		pokaz('debug');
		document.getElementById('debug').innerHTML=data;
	}
}

function setSound(mode) {

	if (mode == true) setCookie('empi_sound', '1', 365);
	else setCookie('empi_sound', '0', 365); 

}

function setCookie(c_name,value,expiredays) {

	var exdate=new Date();
	
	exdate.setDate(exdate.getDate()+expiredays);
	
	document.cookie=c_name+ "=" +escape(value)+
	
	((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
	
}

 // get our flash movie object
 
  function init() {
  	setTimeout("getFlashMovieObject('flash1')",1250);
  	fadeIn('content');
  }
 
function getFlashMovieObject(movieName) {
  if (window.document[movieName]) {
      return window.document[movieName];
  }
  
  if (navigator.appName.indexOf("Microsoft Internet")==-1) {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
    return document.getElementById(movieName);
  }
}

function dzial(inst) {
     var flashMovie=getFlashMovieObject("flash1");
     flashMovie.SetVariable("dzial",inst);
}
function mark(inst) {
     var flashMovie=getFlashMovieObject("flash1");
     flashMovie.SetVariable("mark",inst);
}
function mainPage() {
	 fadeIn('logo');
     var flashMovie=getFlashMovieObject("flash1");
     flashMovie.SetVariable("mainpage",true);
}
