// IE - fix blikajicich backgroundu 
eval("try {document.execCommand('BackgroundImageCache', false, true);} catch(e) {}"); 


// BrowserCheck Object
function BrowserCheck() {
	var o = navigator.userAgent;
	if (o.indexOf("Opera")>=0) { this.b = "Opera"; this.v = o.substring(o.indexOf("Opera")+6, o.indexOf(" ",o.indexOf("Opera")+6)); }
	else if (o.indexOf("MSIE")>=0) { this.b = "IE"; this.v = o.substring(o.indexOf("MSIE")+5, o.indexOf(";",o.indexOf("MSIE")+5)); }
	else if (o.indexOf("Netscape6")>=0) { this.b = "Netscape"; this.v = o.substring(o.indexOf("Netscape")+10, o.length); }
	else if (o.indexOf("Netscape")>=0) { this.b = "Netscape"; this.v = o.substring(o.indexOf("Netscape")+9, o.indexOf(" ",o.indexOf("Netscape")+9)); }
	else if (o.indexOf("Firefox")>=0) { this.b = "Firefox"; this.v = o.substring(o.indexOf("Firefox")+8, o.length); }
	else if (o.indexOf("Gecko")>=0) { this.b = "Mozilla"; this.v = o.substring(o.indexOf("rv:")+3, o.indexOf(")",o.indexOf("rv:")+3)); }
	this.v = (this.v.indexOf(" (") != -1)? this.v.substring(0,this.v.indexOf(" (")) : this.v;
	this.op = (this.b=="Opera" && this.v>=5);
	this.ns = (this.b=="Netscape" && this.v>=4);
	this.ns4 = (this.b=="Netscape" && parseInt(this.v)==4);
	this.ns6 = (this.b=="Netscape" && parseInt(this.v)==6);
	this.ns7 = (this.b=="Netscape" && parseInt(this.v)==7);
	this.ff = (this.b=="Firefox");
	this.mo = (this.b=="Mozilla" && parseInt(this.v)>=1);
	this.ie = (this.b=="IE" && this.v>=4);
	this.ie4 = (this.b=="IE" && parseInt(this.v)==4);
	this.ie5 = (this.b=="IE" && parseInt(this.v)==5);
	this.ie6 = (this.b=="IE" && parseInt(this.v)==6);
	this.min = (this.op||this.ns||this.mo||this.ie);
}
var is = new BrowserCheck();


/////////////// DHTML MENU ///////////////////////
function toogleDHTML(i, state) {
	if ( state == true ) showDHTML(i);
	else hideDHTML(i);
}
function hideDHTML(i) {
	eObj("dhtml" + i).style.visibility = "hidden";
}
function showDHTML(i) {
	eObj("dhtml" + i).style.visibility = "visible";
}
function eObj(eId) {
	return document.getElementById(eId);
}
/////////////// DHTML MENU - end /////////////////


self.defaultStatus="vrata-brany.biz";

function SetStatus(text){
 self.status=text;
}

function GoToURL(url){
 top.location.href=url;
}


function go2URL(url) {
        window.location.href = url;
}
function tdOver(eTD) { eTD.className = "over"; }
function tdOutSude(eTD) { eTD.className = "out_sude"; }
function tdOutLiche(eTD) { eTD.className = "out_liche"; }


function ShowPic(URL,name,properties)
{
 window.open(URL,name,properties);
}


function Picture(src,name,title,w,h)
{
  var wokno, hokno;
  w_okno = w+25;
  h_okno = h+25;

 window.open("picture.php?file=cms/foto/"+src+"&title="+title+"&width="+w+"&height="+h,name,"width="+w_okno+",height="+h_okno+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,copyhistory=no,left=20, top=20");

}


function Close()
{
 window.close();
}



function hideObj(i) {
	eObj(i).style.display = "none";
}
function showObj(i) {
	eObj(i).style.display = "block";
}
function eObj(eId) {
	return document.getElementById(eId);
}


/* selekce pro PO, FO v registraci */
function selectprvek(hodnota) {

 document.RegistraceFirmy.Typ2.value=hodnota;

}

/* selekce pro PO, FO v editaci */
function selectprvek_e(hodnota) {

 document.EditaceFirmy.Typ2.value=hodnota;

}


/* pocitani znaku ve formularovem prvku - funguje ve FF, nefunguje v IE */
function countChars(id, name, maxcount) {
	if (maxcount == 0) return;
	input = eObj(id);
	if (is.ie) {
     input = eObj(name);
	} else {
    input = eObj(id);
	}

	actual = input.value.length;
	if (actual > maxcount) {
		input.value = input.value.substring(0, maxcount);
	}
	actual = input.value.length;
	output = 'Zbývá <strong>'+ (maxcount - actual) +'</strong> znaků';
	eObj(id+"Count").innerHTML = output;
}



/* kontoluje delku dat*/
var alrtText = '';
function checkSize(obj,size,text,cnt) {
	alrtText = text;
	/* pokud pouzivame pocitadlo pak cnt = idecko inputu, jinak nastav na "no"*/
	if	(cnt != 'no') {
		document.getElementById(cnt).value = obj.value.length;
	}

	if (obj.value.length > size-1) {
		obj.value = obj.value.substring(0,size-1);
		setTimeout(alrt,10);

		return false;
	}
	else
		return true;
};
function alrt () { alert(alrtText); };	



///////////
function OnlyNum(){
     if ((keyCode>47 && keyCode<58)) returnValue=true; else returnValue=false;
}


/////////////////
function AddFavourite() {
  if (navigator.appName == "Microsoft Internet Explorer") {
     if (parseInt(navigator.appVersion) >=4) {
        window.external.AddFavorite('http://www.vrata-brany.biz/','vrata-brany.biz - Vaše cesta k obchodu s vratovou technikou');
        alert('Adresa www.vrata-brany.biz byla uložena mezi oblíbené stránky.');
     }
  } else { 
    alert('Pro uložení www.vrata-brany.biz mezi oblíbené stránky musíte stisknout Ctrl + D.');
  }
}












