/*function Z(o,i){
	if (i==1) {o.style.borderBottomColor="#DF001D";} else {o.style.borderBottomColor="";};
}
*/

function kalk() {
        if (document.getElementById("c_n")) {
            kalkinit();
        } else {
            if (document.getElementById("kwota")) {
                kalkinit2();
            }
        }
}

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>6) {a=1;}
	var grafika=document.getElementById("logo");
	if (grafika)
	    grafika.src="grafika/logo"+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()",300);*/
/*
function start() {
    window.setInterval("step2()", 6000);
}
*/
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;
	}
}

var last_bg;

function ZKB(o,i,k){
    if (i==1) {
        last_bg = o.style.backgroundColor
        o.style.backgroundColor=k;
    } else {
        o.style.backgroundColor=last_bg;
    }
}
function GoOf(i,ln){
    document.location.href="oferta.aspx?id="+String(i)+"&ln="+ln;
}


// 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';
}
}

// JavaScript Document
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 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); 
}
function step(){
	if (scroll==1){
		gal.scrollTop+=scrollrodzaj*20;
	}
}
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,j,k){
	var w=window.open("wydruk.aspx?id="+i+"&lng="+j+"&iduser="+k,"","width=700,scrollbars=yes,resizable=yes,menubar=yes ");
}

function WaitLoaded(scr) {
    Event.observe(window, 'load', function() { eval(scr); });
}