function wysz(prefix) {
    var rodz = document.getElementById("ctl00_lstRodzaje");

    rodz.onclick = function() {
       var pok = document.getElementById("ctl00_trpokoje");
            
       if (this.value == "2") {
           pok.style.visibility = "hidden";
           pok.style.display = "none";
       } else {
           pok.style.visibility = "visible";
           pok.style.display = "table-row";
       }
    };
}

var a=0;

function step2(){
	var b = new Browser;
	a+=1;
	if (a>9) {a=1;}
	var grafika=document.getElementById("grafika");
	grafika.src="img/foto"+String(a)+".jpg";
}
function skrol(){
	var kol=document.getElementById("kol");
	if (kol) {
		if (document.body.scrollTop>40) {kol.style.marginTop=document.body.scrollTop-40;} else {
			kol.style.marginTop=0;
		}
	}
}
var dfggty=window.setInterval("skrol()",100);

function start() {
}

var scroll=0;
var scrollValue = 0;
var scrollrodzaj=1;
var gal=document.getElementById("galeria");

function scrolldown(i){
	scroll=1;
	scrollrodzaj=i;	
}
function scrollout(){
	scroll=0;	
}
function startscroll(){
	gal=document.getElementById("galeria");
	var dcx=window.setInterval("step()",50); 
	
	scrollValue = 0;
}
function step(){
	if (scroll==1){
	    gal=document.getElementById("galeria");
	    
	    scrollValue += scrollrodzaj;
	    
	    if (scrollValue < 0) scrollValue = 0;
	    gal.style.marginLeft = -scrollValue*20 + "px"	 
	}
}

function Taba(i,prefix){
	if (!prefix)prefix="";
	var x=document.getElementById(prefix+"tab"+String(i));
	if (x.style.display!="block"){x.style.display="block"} else {x.style.display="none"};
}
function Pokaz(o){
	var x=document.getElementById(o);
	if (x.style.display!="block"){x.style.display="block"} else {x.style.display="none"};
}
function Big(i){
	window.open("virgobig.ashx?"+String(i));

}
function OpenMap(u,i){
	var de=window.open(u+"mapa.aspx?id="+i,"","width=600,height=400")
}

//function ShowPrint(i,j,k, file){
//	var w=window.open(file+"?id="+i+"&lng="+j+"&iduser="+k,"","width=700,scrollbars=yes,resizable=yes,menubar=yes ");
//}

function ShowPrint(url){
	var w=window.open(url,"","width=700,scrollbars=yes,resizable=yes,menubar=yes ");
}

function ShowNotatnikPrint(){
	var w=window.open("wydruk_notatnik.aspx","","width=700,scrollbars=yes,resizable=yes,menubar=yes ");
}

function hideTab($tabId) {
    document.getElementById('ctl00_cntMain_div' + $tabId).style.display = "none";
    document.getElementById('ctl00_cntMain_div' + $tabId).className = "";
}
function hideTabs() {
    hideTab('Brief');
    hideTab('Main');
    hideTab('Form');
}
function showTab($tabId) {
    hideTabs();
    document.getElementById('ctl00_cntMain_div' + $tabId).style.display = "block";
    document.getElementById('ctl00_cntMain_div' + $tabId).attributes["class"] = "selected";
}

// ================================= Obsługa onEnter dla całego serwisu ========================= //
    
var KeyID = 0;

document.onkeydown = KeyCheck;       

function KeyCheck(e) {
   KeyID = getEventKeyCode(e);
      
   var inpClass = getEventTarget(e).className;
   if (KeyID == 13) {
        if ($('wyszukiwarkaPanelBox') != null) {
            WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$cntWyszukiwarka$WebWyszukiwarka$wysz_submit', '', true, 'wyszukiwarka', '', false, true));
        }
   }
}

// ================================= Obsługa onEnter dla całego serwisu ========================= //


function DodajDoNotatnika(Id, msg) {
    var c = readCookie("notatnik");
    
    if (c === null) c = "";
    
    if (c.indexOf(","+Id+",") == -1) c += Id+",";
    
    eraseCookie("notatnik");
    
    createCookie("notatnik", c, 31);
    
    if (msg != "") alert(msg);
}

function UsunZNotatnika(Id, msg, reload) {
    var c = readCookie("notatnik");
    
    if (c === null) c = "";
    
    if (c.indexOf(Id+",") > -1) {
        c = c.replace(Id+",", "");
    }
    
    eraseCookie("notatnik");
    
    createCookie("notatnik", c, 31);

    if (msg != "") alert(msg);
    
    if (reload) {
        document.location.reload(false);
    }
}
var tim;
var licznik =0;
function anim_inwe() {
    tim = setInterval('pokazInw()', 5000);
}

function pokazInw() {
    $("inw" + licznik).fade();
    if (licznik == $$(".inwe").length-1) { licznik = 0; } else { licznik++;}
    $("inw" + licznik).appear();
}


