//menu kontekstowe
var mnOn=true;
var menuLeftTmp=0;


function mnLight(obj)
{
obj.className='content_menu_ov';
}

function mnDelight(obj)
{
obj.className='content_menu';
}

function mnHide(obj)
{
obj.style.visibility='hidden';
obj.style.left=menuLeftTmp;
}

function mnShow(obj)
{
menuLeftTmp=obj.offsetLeft;
obj.style.left=obj.offsetLeft+menuOffset();
obj.style.visibility='visible';
}

function go(site)
{
var site_array=new Array;
site_array['kimjestesmy']='onas/kimjestesmy';
site_array['historia']='onas/historia';
site_array['iso']='onas/iso';
site_array['aktualnosci']='onas/aktualnosci';
site_array['multimedia']='onas/multimedia';
site_array['stomatologia']='kliniki/stomatologia/stomatologia';
site_array['konsultacje']='kliniki/konsultacje/konsultacje';
site_array['szpital']='kliniki/szpital/szpital';
site_array['rehabilitacja']='kliniki/rehabilitacja/rehabilitacja';
site_array['diagnostyka']='kliniki/diagnostyka/diagnostyka';
site_array['dlafirm']='oferta/enelcare/enelcare_main';
site_array['ubezpieczenie']='oferta/uzdrowotne/medicare_main';
site_array['profilaktyczne']='oferta/prprofilaktyczne/prprofilaktyczne';
site_array['specjalne']='oferta/ospecjalne';
site_array['partnerskie']='oferta/prpartnerskie';
site_array['turystyka']='oferta/turystykamedyczna';
site_array['kredytowanie']='oferta/kredytowanie';
site_array['obstawy_medyczne']='oferta/obstawy_medyczne';
site_array['cennik']='oferta/cennik_konsultacje';
site_array['oddzialy']='obslugapacjenta/oddzialy/oddzialy';
site_array['rezerwacja']='obslugapacjenta/rezerwacja';
site_array['pytania']='obslugapacjenta/pytania1';
site_array['nfz']='obslugapacjenta/nfz';
site_array['telefony']='obslugapacjenta/telefony';
site_array['ankieta']='obslugapacjenta/ankieta';
site_array['przygotowaniedobadan']='obslugapacjenta/przygotowanie';
site_array['informacje']='dlaprasy/informacje';
site_array['galeria']='dlaprasy/galeria';
site_array['napisali']='dlaprasy/napisali';
site_array['kontaktprasa']='dlaprasy/kontaktprasa';
site_array['enelwliczbach']='dlaprasy/enelwliczbach';
site_array['prasawitamy']='dlaprasy/dlaprasy';
site_array['oferty']='praca/oferty_wybor';
site_array['profil']='praca/profil';
site_array['zasady']='praca/zasady';
site_array['formularz']='praca/formularz_main';
site_array['obslugapacjenta']='kontakt/obslugapacjenta';
site_array['administracja']='kontakt/administracja';
site_array['cpem']='kliniki/cpem/cpem';
site_array['med_wyj']='kliniki/medycyna_wyjazdowa/med_wyj';

	if (site=="ankieta")
	{
		document.location='http://www.enel.pl/'+site_array[site]+'.asp';
	}

	else
	{
		document.location=root+site_array[site]+'.asp';
	}

}

function menuOffset() {
  var offset=0;
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
	} else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
		myWidth = document.documentElement.clientWidth;
		myWidth=myWidth+21;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		myWidth = document.body.clientWidth;
		myWidth=myWidth+21;
	}
	if(myWidth<844)
	{
	 myWidth=844;
	}
	offset=(myWidth-1024)/2;
	return offset;
}

//cennik oddzialu
function goPrices(obj)
{
 var prices_array=new Array;
 
 prices_array['warszawa']='oferta/cennik7';
 prices_array['poznan']='oferta/cennik7a';
 
 oddzial=obj.options[obj.selectedIndex].value;
 
 document.location=root+prices_array[oddzial]+'.asp';
}

//nowe okno
function winOpen(url)
{
var winOpen=window.open(url, '', 'toolbar=no,location=no,status=no,resizable=yes');
}

function winOpenFull(url)
{
var winOpen=window.open(url, '');
}

//ankieta
function validate(form) 
{

  var QUESTIONS = new Array("a","b","c","d");
	var LENGTHS = new Array(4,4,3,4);
	var empty = true;
	var radio_length = 0;
	var alertstr = "Brakuje odpowiedzi na pytania:\n";
	var question;
	var length;
	
	for (var i1=0; i1<QUESTIONS.length; i1++)
	{
	     question = QUESTIONS[i1];
	     length = LENGTHS[i1];
	     for (var i2=1; i2<=length; i2++)
	     {
	          radio_length = (eval("document.form."+question+i2+".length"));
		      empty = true;
	          for (var i3=0; i3<radio_length; i3++)
		      {
	               if (eval("document.form."+question+i2+"["+i3+"].checked"))
		              {empty= false;}			  
		      }
	          if (empty)
		          {alertstr += "- w formularzu "+question.toUpperCase()+"\n";break;}		  
	     }
	} 
	
	if (alertstr == "Brakuje odpowiedzi na pytania:\n") 
	    {return true;}
	
	alert(alertstr);
	return false;
}

//wyszukiwarka
function search()
{
 document.getElementById('frm_szukaj').submit();
}

//tool tip
function showTt(tab_name)
{
tab=document.getElementById(tab_name);

tab.style.visibility="visible";
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) {
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}
if(tab.style.visibility!="visible")
{
tempX = 0;
tempY = 0;
}
tab.style.left = tempX-180;
tab.style.top = tempY+10;
return true;
}
}
function hideTt(tab_name)
{
tab=document.getElementById(tab_name);

tab.style.visibility="hidden";
document.onmousemove = null;
}

function form_praca_submit()
{
 validator=true;
 rodzaj=document.getElementById('rodzaj').value;
 
 imie=document.getElementById('imie').value;
 nazwisko=document.getElementById('nazwisko').value;
 tel=document.getElementById('tel').value;
 
 if(imie=='' || nazwisko=='' || tel=='')
 {
  document.getElementById('blad').style.display='block';
	document.location='#';
	validator=false;
 }
 
 if(rodzaj=="lekarze" && document.getElementById('sz_specjalnosc').value=='')
 {
  document.getElementById('blad').style.display='block';
	document.location='#';
	validator=false;
 }
 
 if(validator) document.getElementById('frm_praca').submit();
}

//preload obrazkow
function preload(imgObj,imgSrc) 
{
	if (document.images) 
	{
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
  }
}

function changeImg(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!='') eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
		else document.images[imgName].src = eval(imgObj+".src")
	}
}

function newWindow1(src,w,h)
{
   var popup= window.open(src,"","TOOLBAR=NULL,SCROLLBARS=YES, WIDTH="+w+",HEIGHT="+h+"");
   popup.focus();
}

function toggleDisplay(id) 
{
   var obj=document.getElementById(id);

   if (obj.style.display=='none')
      {obj.style.display='';}
      else
      {obj.style.display='none';}
}

function uslugiToggle(id) 
{
   var obj=document.getElementById("div_uslugi_"+id);
   if (obj.style.display=='none')
   {
    obj.style.display='block';
   }
   else
   {
    obj.style.display='none';
   }
}

////Pobieranie zmiennych z GET
function get(variable)
   {
    var allVariables=document.location.toString().split('?');
    var getVariables=new Array();
	var returnStr;

    if (allVariables[1]!='' && allVariables[1]!=undefined)
       {
        var variablesStr=allVariables[1].toString().split('&');
	
	    for (i in variablesStr)
	       {
	        var variableStr=variablesStr[i].toString().split('=');
		    if (variableStr[1]!='' && variableStr[1]!=undefined)
		       {
		        getVariables[variableStr[0]]=variableStr[1];
		       }
		
	       }
        
		if (getVariables[variable]==undefined) returnStr=""; else returnStr=getVariables[variable];
       }

	 if (returnStr==undefined) returnStr="";
	 return returnStr;
    }
///////

//////////MULTIMEDIA
var autostartedNumber=3;

function setCurrentTitle (nr)
{
   for (i=1;i<=11;i++ )
     {
	   if (i==nr) 
	   {
		   document.getElementById('mnFilm'+i).style.textDecoration="underline";
		   document.getElementById('mnFilm'+i).style.color="#31b992";
	   }
	   else
	   {
           document.getElementById('mnFilm'+i).style.textDecoration="none";
		   document.getElementById('mnFilm'+i).style.color="#006A4C";
	   }
	 }
 }

function loadMovie (src,number)
{
   setCurrentTitle(number);
   flashProxy.call('playVideo',src);
}

function autostartMovie ()
{
   var returnStr;
   var movieSRCs= new Array();
   movieSRCs[0]='/onas/filmy/centrum_diagnostyczne.flv';
   movieSRCs[1]='/onas/filmy/enel_care.flv';
   movieSRCs[2]='/onas/filmy/enel_med.flv';
   movieSRCs[3]='/onas/filmy/laboratorium_protetyczne.flv';
   movieSRCs[4]='/onas/filmy/medi_care.flv';
   movieSRCs[5]='/onas/filmy/program_24h_dla_zdrowia.flv';
   movieSRCs[6]='/onas/filmy/przychodnie_specjalistyczne.flv';
   movieSRCs[7]='/onas/filmy/stomatologia.flv';
   movieSRCs[8]='/onas/filmy/szpital.flv';
   movieSRCs[9]='/onas/filmy/usg.flv';
   movieSRCs[10]='/onas/filmy/TV_biznes.flv';

   var movieNumber=get('film');

   if (movieNumber!='' && movieNumber!=undefined)
      {
	   autostartedNumber=movieNumber;
	   returnStr="file="+ movieSRCs[movieNumber-1] +"&autoStart=1";
      }
	  else
	  {
       returnStr="file=/onas/filmy/enel_med.flv&autoStart=0";
	  }

	  return returnStr;
}
//////// /MULTIMEDIA

preload("dowiedz",root+"graph/oferta/enelcare/bt_dowiedzsiewiecej.gif");
preload("dowiedz_ov",root+"graph/oferta/enelcare/bt_dowiedzsiewiecej_ov.gif");
preload("zobacz",root+"graph/oferta/enelcare/bt_zobaczplacowki.gif");
preload("zobacz_ov",root+"graph/oferta/enelcare/bt_zobaczplacowki_ov.gif");
preload("wiecej",root+"graph/oferta/enelcare/bt_wiecej.gif");
preload("wiecej_ov",root+"graph/oferta/enelcare/bt_wiecej_ov.gif");
preload("wiecejk",root+"graph/oferta/enelcare/hd_zobaczwiecej.gif");
preload("wiecejk_ov",root+"graph/oferta/enelcare/hd_zobaczwiecej_ov.gif");
preload("powrot",root+"graph/oferta/enelcare/hd_powrotglowne.gif");
preload("powrot_ov",root+"graph/oferta/enelcare/hd_powrotglowne_ov.gif");
preload("zasady",root+"graph/obsluga/bt_zasadykorzystania.gif");
preload("zasady_ov",root+"graph/obsluga/bt_zasadykorzystania_ov.gif");


function pokazUkryj(id)
{
 obj=document.getElementById(id);
 if(obj.style.display=='none') obj.style.display='block';
 else obj.style.display='none';
}






///////// FORMULARZ KONTAKTOWY

function checkTresc(){
if(document.formularz.tresc.value==""){
alert("Proszę wpisać pytanie...");
return false;
}
return true;
}

function checkKontakt(){
if((document.formularz.email.value=="") && (document.formularz.telefon.value=="")){
alert("Proszę wybrać formę kontaktu oraz podać dane kontaktowe...");
return false;
}
return true;
}

function checkEmail() {
var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;

if (dobryEmail.test(document.formularz.email.value) || (document.formularz.email.value=="") )
  return true
else {
  alert('"' + document.formularz.email.value +
        '" to nie jest poprawny adres e-mail...');
return false;
}
}

function checkTel(){
 if (document.formularz.telefon.value.replace(/[-0-9() ]+/,'')!='')
  {
alert('Nie prawidłowy numer telefonu...');
return false;
} 
return true;
}
 
function resetTelArea() {
if( document.formularz.kontakt_tel.checked == false)
{
document.formularz.telefon.value='';
}
}

function resetMailArea() {
if( document.formularz.kontakt_mail.checked == false)
{
document.formularz.email.value='';
}
}

function areaTel()
{
if( document.formularz.kontakt_tel.checked == true)
   {
   document.formularz.telefon.disabled = false;

   }
else
{
document.formularz.telefon.disabled = true;

}
}

function areaMail()
{
if( document.formularz.kontakt_mail.checked == true)
   {
   document.formularz.email.disabled = false;

   }
else
{
document.formularz.email.disabled = true;

}
}

 function send(){
 if (checkTresc() && checkKontakt() && checkEmail() && checkTel()) {
 document.formularz.submit()
 alert("Twoja wiadomość została wysłana...");
 //alert("Wersja testowa - wysyłanie formularza zablokowane");
 }
 }