// JavaScript Document
function ZmienObrazek(id,plik,typ)
{
if(typ=='on')
{
var dot=plik.indexOf('_');
document.getElementById(id).src=plik.substring(0,dot)+'.jpg';
document.getElementById(id+'h').className='lewe_menu';
}
else
{
document.getElementById(id).src=plik;
document.getElementById(id+'h').className='lewe_menu1';
}
}

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";
       }
    };
}

function kalk() {
        if (document.getElementById("c_n")) {
            kalkinit();
        } else {
            if (document.getElementById("kwota")) {
                kalkinit2();
            }
        }
}

function pokaz(blok,td) {
       document.getElementById(blok).style.visibility="visible";
       document.getElementById(td).style.cursor="pointer";
//       odslon(blok,0);
}
function odslon(blok,bottom) {
       var max=200;

       if (bottom<max) {
           document.getElementById(blok).style.clip="rect(auto,500,"+bottom+",auto)";
           bottom++;
           setTimeout("odslon('"+blok+"',"+bottom+")",1);
       }
}
function ukryj(blok,td) {
       document.getElementById(blok).style.visibility="hidden";
}
function podmenu_over(id) {
       document.getElementById(id).style.color="#ffff00";
}
function podmenu_out(id) {
       document.getElementById(id).style.color="#ffffff";
}

// jscript //

/*function Z(o,i){
	if (i==1) {o.style.borderBottomColor="#DF001D";} else {o.style.borderBottomColor="";};
}
*/
function Z(o){
	var el=o.getElementsByTagName("div");
	el[0].style.visibility="visible";
}
function O(o){
	var el=o.getElementsByTagName("div");
	el[0].style.visibility="hidden";

}
function GO(url){
	document.location.href=url;
}

function Browser() {
  var ua,s,i;
  this.isIE=false; this.isOP=false; this.isNS=false;
  this.version=null;
  ua = navigator.userAgent;
  s="Opera";		if ((i = ua.indexOf(s)) >= 0) {this.isOP = true;this.version=parseFloat(ua.substr(i + s.length));return;}
  s="Netscape6/";	if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;this.version = parseFloat(ua.substr(i + s.length));return;}
  s="Gecko";		if ((i = ua.indexOf(s)) >= 0) {this.isNS = true;this.version = 6.1;return;}
  s="MSIE";			if ((i = ua.indexOf(s))) {this.isIE = true;this.version = parseFloat(ua.substr(i + s.length));return;}
}

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() {
}

function GO(){
	var b = new Browser;
	
	var intro=document.getElementById("naglowek_foto");
	var grafika=document.getElementById("grafika");
	if (b.isIE) {
		intro.filters[0].apply();
		intro.style.backgroundImage="url("+grafika.src+")";
		intro.filters[0].play();
	} else {
		intro.style.backgroundImage="url("+grafika.src+")";
	}

}
function S(o){
	if (o=="tab1"){return "1"};
	if (o=="tab2"){return "2"};
}
function Tb(o){
	var tabs=document.getElementById("tabs");
	tabs.style.backgroundImage="url(img/"+o.id+".gif)";
	document.getElementById("tabid").value=S(o.id);
}
function SE(t){
	var d=document.getElementById("szablon_"+t);
	var c=d.getElementsByTagName("input");
	var x;
	for(i=0;i<c.length;i++) {
		if (i==0){if (c[i].checked){x=false} else {x=true};}
		c[i].checked=x;
	}
}

function ulubione(){
	if (document.all){
		window.external.addFavorite('http://www.bakun.nieruchomosci.pl','www.bakun.nieruchomosci.pl');
	}else{
		alert('Wymagany_ie');
	}
}

function MapKlik(o,t){
	var dz=document.getElementById("hidDzielnie");
	if (o.style.color=="") {
		o.style.color="#FF7099";
		dz.value+=","+t
	} else {
		o.style.color="";
		var b=dz.value;
		b=b.replace(","+t,"");
		dz.value=b;
	};
	
}
function ZaznaczChk(i,t){
	var l=document.getElementById(t);
	var c=l.getElementsByTagName("input");
	var x;
	if (i==0){x=false} else {x=true};
	for(var s=0;s<c.length;s++) {
		c[s].checked=x;
	}
}

function ZKB(o,i){
    if (i==1) {
        o.style.backgroundColor="#fafbb9";
    } else {
        o.style.backgroundColor="";
    }
}
function GoOf(i){
    document.location.href="oferta.aspx?id="+String(i);
}

// skrypt //

function ZmienStyl(id,typ)
{
if(typ=='on')
{
document.getElementById(id).className='link1hover';
document.getElementById('dz'+id).className='DzialyHover';
}
else
{
document.getElementById(id).className='link1';
document.getElementById('dz'+id).className='dzialy';
}
}

// oferta.js //

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 ShowPrint(i){
	var w=window.open("wydruk.aspx?id="+i,"","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";
    }


