var cookieEnabled=(navigator.cookieEnabled)? true : false

//if not IE4+ nor NS6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
document.cookie="testcookie"
cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false
}

if (!cookieEnabled) //if cookies are enabled on client's browser
{alert( "Vas browser nepodporuje cookies, stranka nebude zobrazena!");
window.top.location.href="indexlb.asp";}

function checkEnter(event)
{     
    var code = 0;
    if ( navigator.appName == "Netscape" )
        code = event.which;
    else
        code = event.keyCode;
    if (code==13){
        document.searchForm.Search.focus();
        document.searchForm.Search.click();
}
}

 function clearBox(){
 		document.tblForm.SearchTerm.value='';
}


function kH(e) {
var pK = document.all? window.event.keyCode:e.which;
return pK != 13;

}
document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);



//menu
var dom = document.getElementById ? true : false;
var ie4 = ((document.all) && (!dom)) ? true : false; // IE5 a IE6 znají i zápis s document.all - proto musí být proměnná dom false
var ns4 = document.layers ? true : false;
var opera = navigator.userAgent.indexOf('Opera') != -1 ? true : false; // tato proměnná nemá význam pro rozdělení prohlížečů - budete ji potřebovat až při vytváření dynamického menu
var dhtml = dom ? true : ie4 ? true : ns4 ? true : false;

// kod an nastevenie css stylu pre dynamicke menu 
if (dhtml) document.write ('<style type="text/css"> #scriptSupport {display: none;} 	#hlavneMENU {	position: absolute; visibility: visible; z-index: 1;}  </style>');  
// zde následuje JavaScriptový kód, který celé dynamické menu vytvoří a rozhýbe

var timer, i, ns4_menuFunction, justVisibleMenuId = 0, may_hideMenu = true; // několik proměnných, které budete používat

if (screen.width < 820)  document.write ('<style type="text/css"> .layout {    position: absolute; top: 0px; left: 50%; margin-left: -50%; }</style>');  


function menu()
{
  if (dhtml)
  {
    if (opera) for (i = 1; i <= 5; i++) document.getElementById('subMenu' + i).style.top = 20;
    if (ie4) for (i = 1; i <= 5; i++) document.all['subMenu' + i].style.top = 18;
    setVisibility('hlavneMENU','visible');
  }
} 

// pre potreby netscape 4
function ns4_moveMenu1(){moveMenu(1);}
function ns4_moveMenu2(){moveMenu(2);}
function ns4_moveMenu2(){moveMenu(3);}
function ns4_moveMenu2(){moveMenu(4);}
function ns4_moveMenu2(){moveMenu(5);}

// funkcia na zobrazenie menu nastavy ho na viditelne
function setVisibility(element,newVisibility)
{
  if (dhtml)
  {
    if (dom) document.getElementById(element).style.visibility = newVisibility;
    else if (ie4) document.all[element].style.visibility = newVisibility;
    else if (ns4) eval('document.' + element + '.visibility = newVisibility');
  }
} 

// funkcia na pohyb menu - zobrazovanie  submenu
var timer, i, menuId; // několik proměnných, se kterými budete pracovat

function showMenu(id)
{
  if (dhtml) // opět podmiňujete běh menu proměnnou dhtml
  {
    clearTimeout(timer); // viz [5]
    for (i = 1; i <= 5; i++) if (i != id) setVisibility((ns4 ? 'hlavneMENU.document.' : '') + 'subMenu' + i,'hidden'); // nejdříve všechna menu zneviditelníte (kromě jednoho, viz [5])
    setVisibility((ns4 ? 'hlavneMENU.document.' : '') + 'subMenu' + id,'visible'); // viz [1]
  }
}


// funkcia na skrytie submenu
function hideMenu(id)
{
  if (dhtml)
  {
    menuId = (ns4 ? 'hlavneMENU.document.' : '') + 'subMenu' + id;
    timer = setTimeout("setVisibility(menuId,'hidden')",300); // viz [2], [3]
  }
}

// funkcia na stopnutie timeru pre skrytie submenu
function dontHideMenu() // viz [3]
{
  if (dhtml) clearTimeout(timer);
}



function doGiveUrl()
{var ccode=document.curForm.curr.value;
document.cookie="CCur="+ccode;
var url=document.location.href;
var lenh=url.length;
var is_cur=url.substring(lenh-3,lenh);
var is_cursk=url.substring(lenh-2,lenh);
if (is_cursk=='SK'){
document.location.href=url.substring(0,lenh-2)+ccode;
//window.top.location.reload;
}
else{ 
	if (is_cur=='EUR' || is_cur=='USD' || is_cur=='CZK' || is_cur=='GBP') {
	document.location.href=url.substring(0,lenh-3)+ccode;
	window.top.location.reload;}
	else{
	var qm = url.indexOf("?")
	if (qm>0){document.location.href=url+"&cur="+ccode;}
	else{document.location.href=url+"?cur="+ccode;}}
	//window.top.location.reload;
	}
}

function GiveUrlnNum(ordb,pg,ascc)
{var nnum=document.navigForm.nNum.value;
document.cookie="nNum="+nnum;
document.location.href="indexlb.asp?orderBy="+ordb+"&pg="+pg+"&nNum="+nnum+"&ascc="+ascc;
//window.top.location.reload;
}


function GiveUrlnewLoc(trans,neh,kat)
{var nloc=document.tblForm.loc.value;
document.cookie="newLoc="+nloc;
//alert(nloc);
document.location.href="indexlb.asp?pg=list&trans="+trans+"&neh="+neh+"&kat="+kat+"&loc="+nloc;
//window.top.location.reload;

}

function GiveUrlnewLocN(nov)
{var nloc=document.tblForm.loc.value;
document.cookie="newLoc="+nloc;
//alert(nloc);
document.location.href="indexlb.asp?pg=list&nov="+nov+"&loc="+nloc;
//window.top.location.reload;

}

function Kalkulator(x){
	var URL = 'calcul_pop.asp?price='+x;
	day = new Date();
	id = day.getTime();
	window.open(URL, 'hk', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=0,width=290,height=320,left = 632,top = 164');
}

function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
//<body onLoad="MM_preloadImages('/images/hrb_tert_company_ov.gif','/images/hrb_tert_media_ov.gif')">
}

function DoSearch(){
	var search=document.tblForm.SearchTerm.value;
	if ((search!=''&&search!=null&&search!='zadajte ID'&&search!='Enter ID')) {
		document.location.href="indexlb.asp?pg=detail&idz="+search+"&SearchT="+search;
		}
	else {
	var loc=document.tblForm.loc_hl.value;
	document.cookie="newLoc="+loc;
	var trans=document.tblForm.trans_hl.value;
	var neh=document.tblForm.tneh_hl.value;
	var kat=document.tblForm.kat_hl.value;
	var nov=document.tblForm.novin_hl.value;
	var cena=document.tblForm.cena_hl.value;
	document.location.href="indexlb.asp?pg=list&srch=y&trans="+trans+"&neh="+neh+"&kat="+kat+"&loc="+loc+"&cena="+cena+"&novin="+nov;

 }
}

function ReloadTypNenSearch(){
var neh=document.tblForm.tneh_hl.value;
var trans=document.tblForm.trans_hl.value;
var novin=document.tblForm.novin_hl.value;
var cena=document.tblForm.cena_hl.value;	
var loc=document.tblForm.loc_hl.value;
document.location.href="indexlb.asp?pg=list&srch=y&trans="+trans+"&neh="+neh+"&loc="+loc+"&cena="+cena+"&novin="+novin;
}

function DoSearchPon(xx){
	var loc=document.tblFormPon.loc_p.value;
	var trans=document.tblFormPon.trans_p.value;
	var neh=document.tblFormPon.tneh_p.value;
	if (xx==1){
	document.location.href="indexlb.asp?pg=listPon&trans="+trans+"&neh="+neh+"&loc="+loc;}
	else{
	document.location.href="indexlb.asp?pg=listDop&trans="+trans+"&neh="+neh+"&loc="+loc;}
}

function ReloadTypNenSearchPon(){
var neh=document.tblFormPon.tneh_p.value;
var trans=document.tblFormPon.trans_p.value;
var loc=document.tblFormPon.loc_p.value;
document.location.href="indexlb.asp?pg=listPon&trans="+trans+"&neh="+neh+"&loc="+loc;
}


