/* funkcja wyswietla baner ghost */
function initGhost(){
	if(getCookie('reklama')=="displayed"){
		//nic w chwili obecnej
	}else{
		document.cookie = "reklama=displayed";
		document.write("<script language='JavaScript' type='text/javascript' src='http://ads.on-time.pl/adx.js'></script>");
		document.write("<script language='JavaScript' type='text/javascript' src='http://ads.on-time.pl/adlayer.php?what=zone:1&amp;layerstyle=simple&amp;align=center&amp;valign=middle&amp;padding=0&amp;closetime=30&amp;padding=0&amp;shifth=0&amp;shiftv=0&amp;closebutton=t&amp;backcolor=3A3A3A&amp;bordercolor=000000'></script>");
	}
	
}
/* funkcja do pobierania ciacha*/
function getCookie(c_name){
	if (document.cookie.length>0){
	  c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1){ 
	    c_start=c_start + c_name.length+1;
	    c_end=document.cookie.indexOf(";",c_start);
	    if (c_end==-1){
			c_end=document.cookie.length;
		}
	    return unescape(document.cookie.substring(c_start,c_end));
	  } 
	}
	return null
}


function newsletterWindowOpen(msg){
	if(msg=="newuser"){
		newWindow = window.open('templates/strona_glowna/newsletter_zapisano.html','Raport','width=370,height=240,resizable,scrollbars=yes,top=200,left=300');
	}else if(msg=="deluser"){
		newWindow = window.open('templates/strona_glowna/newsletter_wypisano.html','Raport','width=350,height=130,resizable,scrollbars=yes,top=200,left=300');
	}else{
		newWindow = window.open('templates/strona_glowna/newsletter_blad.html','Raport','width=350,height=150,resizable,scrollbars=yes,top=200,left=300');
	}
}

function printit(layer){
	var html = document.getElementById(layer).innerHTML;
	newWindow = window.open('','Raport','width=800,height=500,resizable,scrollbars=yes');
	newWindow.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-2"><title>Rezerwacje</title>');
	newWindow.document.write('<link rel="stylesheet" type="text/css" href="style/print_style.css">');
	newWindow.document.write('</head><body>');
	newWindow.document.write('<div class="donotprint" style="margin: 15px 10px 15px 10px"><input type="button" class="wyslij" onclick="javascript:window.print()" value="drukuj"> <input type="button" class="wyslij" onclick="javascript:window.close()" value="zamknij okno"></div>');
	newWindow.document.write(html);
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	//newWindow.print();
	//newWindow.close();
	
}



function zaznaczWszytkie(name, checked){
	var checkboxList = document.getElementsByName('powiadomienie_'+name+'[]');
	for(var i=0; i<checkboxList.length; i++){
		checkboxList[i].checked = checked;
	}
	if(checked){
		document.getElementById('zaznacz_'+name).style.visibility="hidden";
		document.getElementById('odznacz_'+name).style.visibility="visible";
	}else{
		document.getElementById('zaznacz_'+name).style.visibility="visible";
		document.getElementById('odznacz_'+name).style.visibility="hidden";
	}
}

function confirmWithAction(pytanie, akcja){
	if (confirm(pytanie)){
			document.serwisy.krok.value=akcja;
			document.serwisy.submit();
	}
}




function pop_r(e,id)
{
		
var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
if(isMinNS4 || isMinNS6){
	//left = window.innerWidth - 300;
	left = parseInt(e.clientX) + 250;
}else{
	//left = window.document.body.clientWidth - 300;
	left = parseInt(e.clientX) + 250;
}

	
window_rezerwacjia = window.open("?res=serwis_rezerwacja_realizacja&p=1&id="+id+"", 'szczegoly_rezerwacji', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=300,height=460,top=150,left="+ left);	  
window_rezerwacjia.focus();
}
function pop_anuluj(id)
{
var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
if(isMinNS4 || isMinNS6){
left = window.innerWidth - 300;
}else{
left = window.document.body.clientWidth - 300;
}
window_rezerwacjia = window.open("?res=serwis_rezerwacja_realizacja&p=1&anuluj=1&id="+id+"", 'anuluj_rezerwacje', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=300,height=200,top=100,left="+left);
window_rezerwacjia.focus();
}
function pop_zalegle()
{
window_statusy = window.open("?res=serwis_zalegle_statusy&p=1", "zalegle_statusy", "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=yes,width=780,height=500");
window_statusy.focus();
}
function pop_oczekujace()
{
window_statusy = window.open("?res=klient_oczekujace_statusy&p=1", "oczekujace_statusy", "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=yes,width=780,height=500");
window_statusy.focus();
}
function popup( opis, nazwa, width, height )
{
	okno = window.open( opis, nazwa, "resizable=no, width="+width+", height="+height+"" );
}
function popupResizeable( opis, nazwa, width, height )
{
	okno = window.open( opis, nazwa, "resizable=yes, scrollbars=yes, width="+width+", height="+height+"" );
}

function ZmienStatus(par)
{
	if (par == 3)
	{
		document.getElementById('stat_button').style.display = 'none';
		document.getElementById('stat_komentarz').style.display = '';
	}
	else
	{
		document.getElementById('stat_button').style.display = '';
		document.getElementById('stat_komentarz').style.display = 'none';
	}	
}

function pop_opis(typ, id)
{
	var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
	var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	
	if(isMinNS4 || isMinNS6)
	{
		left = window.innerWidth - 400;
	}
	else
	{
		left = window.document.body.clientWidth - 400;
	}
	
	window_rezerwacja_opis = window.open("?res=serwis_rezerwacja_opis&p=1&typ="+typ+"&id="+id+"", 'rezerwacje_opis', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=350,height=450,top=100,left="+left);
	window_rezerwacja_opis.focus();
}

function pop_ulubiony(id)
{
	var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
	var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	
	if(isMinNS4 || isMinNS6)
	{
		left = window.innerWidth - 500;
	}
	else
	{
		left = window.document.body.clientWidth - 500;
	}
	
	window_rezerwacja_ulubiony = window.open("?res=serwis_rezerwacja_ulubiony&p=1&id="+id+"", 'rezerwacje_ulubiony', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=250,height=200,top=200,left="+left);
	window_rezerwacja_ulubiony.focus();
}

function pop_MarketingListaSzczegoly(id)
{
	window_marketing_lista_szczegoly = window.open("?res=marketing_lista_szczegoly&p=1&id=" + id + "", 'marketing_lista_szczegoly', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no, width=800, height=600");
	window_marketing_lista_szczegoly.focus();
}

function pop_usun_ulubiony(id)
{
	if (confirm('Czy na pewno chcesz usun±ć ten serwis z zakładki Ulubione?'))	
	{
		document.location.href='?res=usun_ulubiony&id='+id;
	}
}

function pop_serwis_email(id, id_rezerwacji)
{
	var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
	var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	
	if(isMinNS4 || isMinNS6)
	{
		left = window.innerWidth - 400;
	}
	else
	{
		left = window.document.body.clientWidth - 400;
	}
	url = "?res=email&p=1&id="+id+(id_rezerwacji != undefined ? "&id_rezerwacji=" + id_rezerwacji : "");
	window_rezerwacja_opis = window.open(url, 'email', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=350,height=420,top=100,left="+left);
	window_rezerwacja_opis.focus();
}

function pop_do_klienta_email(id)
{
	var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
	var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	
	if(isMinNS4 || isMinNS6)
	{
		left = window.innerWidth - 400;
	}
	else
	{
		left = window.document.body.clientWidth - 400;
	}
	
	window_rezerwacja_opis = window.open("?res=email_do_klienta&p=1&id="+id, 'email', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=350,height=420,top=100,left="+left);
	window_rezerwacja_opis.focus();
}

function pop_do_klienta_sms(id)
{
	var isMinNS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;
	var isMinNS6 = (parseFloat(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape")>=0 )? true: false;
	
	if(isMinNS4 || isMinNS6)
	{
		left = window.innerWidth - 400;
	}
	else
	{
		left = window.document.body.clientWidth - 400;
	}
	
	window_rezerwacja_opis = window.open("?res=sms_do_klienta&p=1&id="+id, 'sms', "toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes,resizable=no,width=350,height=320,top=100,left="+left);
	window_rezerwacja_opis.focus();
}
