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(i){
	var de=window.open("mapa.aspx?id="+i,"","width=600,height=400")
}
function OpenInwMap(i){
	var de=window.open("mapa.aspx?id="+i+"&inw=1","","width=600,height=400")
}
function ShowPrint(i){
	var w=window.open("wydruk.aspx?id="+i,"","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('Description');
    //hideTab('Rooms');
    //hideTab('Map');
    hideTab('Form');
}
function showTab($tabId) {
    hideTabs();
    document.getElementById('ctl00_cntMain_div' + $tabId).style.display = "block";
    document.getElementById('ctl00_cntMain_div' + $tabId).attributes["class"] = "selected";
}

function zmien(nazwaObrazka,naJakiSrc, naJakiHref, naJakiTitle) 
{
    if (document.images)
     {
        window.document.images[nazwaObrazka].src=naJakiSrc;
     }             
  try
  {
    window.document.getElementById("OfertaPokaz").setAttribute('href', naJakiHref);
    window.document.getElementById("OfertaPokaz").setAttribute('title', naJakiTitle);  
  }
  catch(e){
    alert(e);      
  }
}
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);
    }
}



//----------------------- funkcje do formularza zgłoszeniowego (pobieranie zawartości wszystkich selectów i inputów) -------------------------//
function pobierz_select() {
    var selectedValue = "";

    $$('#domaila select').each(function (elem) {
        var span = new Element('span');
        span.innerHTML = elem[elem.selectedIndex].text;
        elem.replace(span);
    });
}

function pobierz_input() {
    var selectedValue = "";

    $$('#domaila input').each(function (elem) {
        var span = new Element('span');
        span.innerHTML = elem.value
        elem.replace(span);
    });
}
//------------------------------------------------------------ KONIEC --------------------------------------------------------------------------//