function goHref(where) {
	 document.location.assign(where);
	 return false;
}

function onMOver(obj) { if(ie) obj.className='mbrdra'; }
function onMOut(obj) { if(ie) obj.className='mbrdr'; }

function show(id){
	if(!ie) return;
	clearTimeout(timer);
	if((id != lastid) && (lastid)){
		((document.all)?document.all['menu'+lastid]:document.getElementById('menu'+lastid)).style.visibility = 'hidden';
	}
	lastid = id;
	((document.all)?document.all['menu'+lastid]:document.getElementById('menu'+lastid)).style.visibility = 'visible';
}
function hid(id){
	if(!ie) return;
	timer = setTimeout("if('"+id+"' == '"+lastid+"'){((document.all)?document.all['menu"+lastid+"']:document. getElementById('menu"+lastid+"')).style.visibility = 'hidden';}", 500)
}

function hid2(id){
	if(!ie) return;
	timer = setTimeout("if('"+id+"' == '"+lastid+"'){((document.all)?document.all['menu"+lastid+"']:document. getElementById('menu"+lastid+"')).style.visibility = 'hidden';}", 500)
}

function gopayed(pth)
{
	if(opener)
	{
		opener.document.location.assign(pth);
		opener.focus();
		self.close();
	}
}

function onhor(pic,picture,pth)   {
	document.images[pic].src=pth+picture+'a.gif';
	}
function offhor(pic,picture,pth)  {
	document.images[pic].src=pth+picture+'.gif';
	}

function dovote(pth,v)
{
	var cur=document.forms['votefrm'].vote.value;
	if(cur=='') cur=5;

	for(i=1; i<=cur; i++)
	{
	document.images['vote'+i].src=pth+'i/votep.gif';
	}

	for(i=1; i<=v; i++)
	{
	document.images['vote'+i].src=pth+'i/votea.gif';
	}
	document.forms['votefrm'].vote.value=v;
}

function docontest(pth,itm)
{
	if(itm!='') document.location.assign(pth+'photos/'+itm+'/');
	else document.location.assign(pth);
}

function getnames(pth,itm)
{
	document.location.assign(pth+itm+'/');
}

function docontestsort(pth,itm,p)
{
	document.location.assign(pth+itm+'/'+p+'/');
}

function send(obj,m1,m2)
{
	obj.href='mailto:'+m1+'@'+m2;
}

function goTo(where) {
	 document.location.assign(where);
	 return false;
}

function popupWindow(goLocation,wname,wdth,hght,stl)
{
 var v=parseInt(navigator.appVersion);
 isNetscape=navigator.appName.indexOf('Netscape')>=0;
 isExplorer=navigator.appName.indexOf('Explorer')>=0;

 var ww = wdth;
 var wh = hght;

 positionCode='';
 if(v>=4)
 {
  if(isExplorer) positionCode='left='+(screen.width/2-ww/2)+',top='+(screen.height/2-wh/2)+',';
  if(isNetscape) positionCode='screenX='+(screen.width/2-ww/2)+',screenY='+(screen.height/2-wh/2)+',';
 }
positionCode='left=35,top=35,';

 newWindow=window.open(goLocation,wname,
 'width='+ww+',height='+wh+','+
 positionCode+
 'location=0,'+
 'toolbar=0,'+stl+
 'scrollbars=1,'+
 'status=0,'+
 'resizable=1');
  if(v>=3) newWindow.focus();
  return false;
}

function ShowPicWnd(id,pth,lng)
{
popupWindow(pth+'inc/showphotos.php?act=1&msg='+id+'&lang='+lng,'adresephoto',780,540,'');
return false;
}

function ShowStatWnd(id,pth,lang)
{
popupWindow(pth+'objekti/statistika/?print=1&msg='+id+'&lang='+lang,'statwnd',600,200,'');
return false;
}

function ShowInfoWnd(q)
{
popupWindow('../objekti/info/?'+q,'info',780,540,'');
return false;
}

function gotop(purl,w,h)
{
	popupWindow(purl,'pwnd',w,h);
	return false;
}


function popup_wnd()
{
//alert(getCookie('popupwnd'));
if(getCookie('popupwnd')==null)
{
var cexpireDate=new Date();
var offs=cexpireDate.getTimezoneOffset()*60*1000;
cexpireDate.setTime(cexpireDate.getTime()+60000*15-offs);
var cexpire=cexpireDate.toGMTString();
document.cookie='popupwnd=1; path=/; expires='+cexpire;

popupWindow('/popupwnd.php','popupwnd',450,460,'');
}
}

function printselected(pics,lng,path)
{
	var MyCookie='';
	MyCookie=getCookie('CSELITM');
	if(!MyCookie || MyCookie=='') return;
	var citems=MyCookie.split('|');
	if(citems.length>0) popupWindow(path+'printobj.php?withpics='+pics+'&lang='+lng,'printobj',650,550,1);
}

function AdDelChechMsg(obj)
{
 var mycookie='';
 if(obj.checked)
 {
 document.ObjCatFrm.checkedItems.value++;
 SetMyCookie('+',obj.value);
 }
 else
 {
 document.ObjCatFrm.checkedItems.value--;
 SetMyCookie('-',obj.value);
 }
}

function removeselected()
{
 document.cookie='CSELITM=; path=/; expires=Mon, 13 Dec 1999 12:25:34 UTC';
 chk=document.ObjCatFrm.elements['msg[]'];
 for(i=0; i<chk.length; i++)
 {
 	chk[i].checked=false;
 }
 document.ObjCatFrm.checkedItems.value=0;
}

function getCookie(name)
{
	var cookie=" "+document.cookie;
	var search=" "+name+"=";
	var setStr=null;
	var offset=0;
	var end=0;
	if(cookie.length>0)
	{
	 offset=cookie.indexOf(search);
	 if(offset!=-1)
	 {
	  offset+=search.length;
	  end=cookie.indexOf(";",offset)
	  if(end==-1) end=cookie.length;
	  setStr=unescape(cookie.substring(offset,end));
	 }
	}
	return(setStr);
}

function SetMyCookie(param,data)
{
	var MyCookie='';
	MyCookie=getCookie('CSELITM');
	if(!MyCookie) MyCookie='';

	if(MyCookie!='' && param=='-')
	{
	var citems=MyCookie.split('|');
	MyCookie='';
	for(var j=0; j<citems.length; j++)
	{
	 if(citems[j]!=data)
	 {
	 if(MyCookie=='') MyCookie=citems[j];
	 else MyCookie+='|'+citems[j];
	 }
	}
	}

	//-- add item ----
	if(param=='+')
	{
	 if(MyCookie=='') MyCookie=data; else MyCookie+='|'+data;
	}
	//-- add item ----

	document.cookie='CSELITM=; path=/; expires=Mon, 13 Dec 1999 12:25:34 UTC';//+cexpire;
	//if(MyCookie!='')
	//{
	 var cexpireDate=new Date();
	 var offs=cexpireDate.getTimezoneOffset()*60*1000;
	 cexpireDate.setTime(cexpireDate.getTime()+60000*15-offs);
	 var cexpire=cexpireDate.toGMTString();
	 document.cookie='CSELITM='+MyCookie+'; path=/; expires='+cexpire;
	 //}
	return true;
}

function calculateheight(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['regfrm'].feet[document.forms['regfrm'].feet.selectedIndex].value*30.5;
	c+=(document.forms['regfrm'].inches[document.forms['regfrm'].inches.selectedIndex].value*2.5);
	c=Math.round(c);
	//alert(c);
	document.forms['regfrm'].cm.selectedIndex=c-89;
	} else
	{
	c=document.forms['regfrm'].cm[document.forms['regfrm'].cm.selectedIndex].value/30.5;
	inc=document.forms['regfrm'].cm[document.forms['regfrm'].cm.selectedIndex].value-(Math.round(c)*30.5);
	if(inc>0) inc=inc/2.54; else inc=0;
	c=Math.round(c); inc=Math.round(inc);
	//alert(c+' '+inc);
	document.forms['regfrm'].feet.selectedIndex=c-3;
	document.forms['regfrm'].inches.selectedIndex=inc;
	}
	return true;
}

function calculatepetheight(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['regfrm'].feet[document.forms['regfrm'].feet.selectedIndex].value*30.5;
	c+=(document.forms['regfrm'].inches[document.forms['regfrm'].inches.selectedIndex].value*2.5);
	c=Math.round(c);
	//alert(c);
	document.forms['regfrm'].cm.selectedIndex=c-9;
	} else
	{
	c=document.forms['regfrm'].cm[document.forms['regfrm'].cm.selectedIndex].value/30.5;
	inc=document.forms['regfrm'].cm[document.forms['regfrm'].cm.selectedIndex].value-(Math.round(c)*30.5);
	if(inc>0) inc=inc/2.54; else inc=0;
	c=Math.round(c); inc=Math.round(inc);
	//alert(c+' '+inc);
	document.forms['regfrm'].feet.selectedIndex=c; //-3;
	document.forms['regfrm'].inches.selectedIndex=inc;
	}
	return true;
}

function calculateweight(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['regfrm'].pound[document.forms['regfrm'].pound.selectedIndex].value*16;
	c=c+(document.forms['regfrm'].ounce[document.forms['regfrm'].ounce.selectedIndex].value*1);
	c=c*0.02835;
	var kg=Math.floor(c);
	var gr=Math.round((c-kg)*1000);
	document.forms['regfrm'].kg.selectedIndex=kg;
	document.forms['regfrm'].gram.selectedIndex=gr;
	} else
	{
	c=document.forms['regfrm'].kg[document.forms['regfrm'].kg.selectedIndex].value*1000;
	c=c+(document.forms['regfrm'].gram[document.forms['regfrm'].gram.selectedIndex].value*1);
	c=c*0.0022
	var p=Math.round(c);
	var o=Math.round((c-p)*10);
	if(o<0) o=0;
	document.forms['regfrm'].pound.selectedIndex=p;
	document.forms['regfrm'].ounce.selectedIndex=o;
	}
	return true;
}














function calculateheightsf(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['srchfrm'].feetfrom[document.forms['srchfrm'].feetfrom.selectedIndex].value*30.5;
	c+=(document.forms['srchfrm'].inchesfrom[document.forms['srchfrm'].inchesfrom.selectedIndex].value*2.5);
	c=Math.round(c);
	//alert(c);
	document.forms['srchfrm'].cmfrom.selectedIndex=c-89;
	} else
	{
	c=document.forms['srchfrm'].cmfrom[document.forms['srchfrm'].cmfrom.selectedIndex].value/30.5;
	inc=document.forms['srchfrm'].cmfrom[document.forms['srchfrm'].cmfrom.selectedIndex].value-(Math.round(c)*30.5);
	if(inc>0) inc=inc/2.54; else inc=0;
	c=Math.round(c); inc=Math.round(inc);
	//alert(c+' '+inc);
	document.forms['srchfrm'].feet.selectedIndex=c-3;
	document.forms['srchfrm'].inches.selectedIndex=inc;
	}
	return true;
}

function calculatepetheightsf(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['srchfrm'].feetfrom[document.forms['srchfrm'].feetfrom.selectedIndex].value*30.5;
	c+=(document.forms['srchfrm'].inchesfrom[document.forms['srchfrm'].inchesfrom.selectedIndex].value*2.5);
	c=Math.round(c);
	//alert(c);
	document.forms['srchfrm'].cmfrom.selectedIndex=c-9;
	} else
	{
	c=document.forms['srchfrm'].cmfrom[document.forms['srchfrm'].cmfrom.selectedIndex].value/30.5;
	inc=document.forms['srchfrm'].cmfrom[document.forms['srchfrm'].cmfrom.selectedIndex].value-(Math.round(c)*30.5);
	if(inc>0) inc=inc/2.54; else inc=0;
	c=Math.round(c); inc=Math.round(inc);
	//alert(c+' '+inc);
	document.forms['srchfrm'].feetfrom.selectedIndex=c; //-3;
	document.forms['srchfrm'].inchesfrom.selectedIndex=inc;
	}
	return true;
}


function calculateheightst(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['srchfrm'].feetto[document.forms['srchfrm'].feetto.selectedIndex].value*30.5;
	c+=(document.forms['srchfrm'].inchesto[document.forms['srchfrm'].inchesto.selectedIndex].value*2.5);
	c=Math.round(c);
	//alert(c);
	document.forms['srchfrm'].cmto.selectedIndex=c-89;
	} else
	{
	c=document.forms['srchfrm'].cmto[document.forms['srchfrm'].cmto.selectedIndex].value/30.5;
	inc=document.forms['srchfrm'].cmto[document.forms['srchfrm'].cmto.selectedIndex].value-(Math.round(c)*30.5);
	if(inc>0) inc=inc/2.54; else inc=0;
	c=Math.round(c); inc=Math.round(inc);
	//alert(c+' '+inc);
	document.forms['srchfrm'].feet.selectedIndex=c-3;
	document.forms['srchfrm'].inches.selectedIndex=inc;
	}
	return true;
}

function calculatepetheightst(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['srchfrm'].feetto[document.forms['srchfrm'].feetto.selectedIndex].value*30.5;
	c+=(document.forms['srchfrm'].inchesto[document.forms['srchfrm'].inchesto.selectedIndex].value*2.5);
	c=Math.round(c);
	//alert(c);
	document.forms['srchfrm'].cmto.selectedIndex=c-9;
	} else
	{
	c=document.forms['srchfrm'].cmto[document.forms['srchfrm'].cmto.selectedIndex].value/30.5;
	inc=document.forms['srchfrm'].cmto[document.forms['srchfrm'].cmto.selectedIndex].value-(Math.round(c)*30.5);
	if(inc>0) inc=inc/2.54; else inc=0;
	c=Math.round(c); inc=Math.round(inc);
	//alert(c+' '+inc);
	document.forms['srchfrm'].feetto.selectedIndex=c; //-3;
	document.forms['srchfrm'].inchesto.selectedIndex=inc;
	}
	return true;
}


function calculateweightf(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['srchfrm'].poundfrom[document.forms['srchfrm'].poundfrom.selectedIndex].value*16;
	c=c+(document.forms['srchfrm'].ouncefrom[document.forms['srchfrm'].ouncefrom.selectedIndex].value*1);
	c=c*0.02835;
	var kg=Math.floor(c);
	var gr=Math.round((c-kg)*1000);
	document.forms['srchfrm'].kgfrom.selectedIndex=kg;
	document.forms['srchfrm'].gramfrom.selectedIndex=gr;
	} else
	{
	c=document.forms['srchfrm'].kgfrom[document.forms['srchfrm'].kgfrom.selectedIndex].value*1000;
	c=c+(document.forms['srchfrm'].gramfrom[document.forms['srchfrm'].gramfrom.selectedIndex].value*1);
	c=c*0.0022
	var p=Math.round(c);
	var o=Math.round((c-p)*10);
	if(o<0) o=0;
	document.forms['srchfrm'].poundfrom.selectedIndex=p;
	document.forms['srchfrm'].ouncefrom.selectedIndex=o;
	}
	return true;
}

function calculateweightt(dir)
{
	var c=0; var inc;
	if(dir=='1')
	{
	c=document.forms['srchfrm'].poundto[document.forms['srchfrm'].poundto.selectedIndex].value*16;
	c=c+(document.forms['srchfrm'].ounceto[document.forms['srchfrm'].ounceto.selectedIndex].value*1);
	c=c*0.02835;
	var kg=Math.floor(c);
	var gr=Math.round((c-kg)*1000);
	document.forms['srchfrm'].kgto.selectedIndex=kg;
	document.forms['srchfrm'].gramto.selectedIndex=gr;
	} else
	{
	c=document.forms['srchfrm'].kgto[document.forms['srchfrm'].kgto.selectedIndex].value*1000;
	c=c+(document.forms['srchfrm'].gramto[document.forms['srchfrm'].gramto.selectedIndex].value*1);
	c=c*0.0022
	var p=Math.round(c);
	var o=Math.round((c-p)*10);
	if(o<0) o=0;
	document.forms['srchfrm'].poundto.selectedIndex=p;
	document.forms['srchfrm'].ounceto.selectedIndex=o;
	}
	return true;
}
