function addtofavorite(obj,pth)
{
 obj.style.behavior='url(#default#homepage)';
 var ohp=obj.isHomePage(pth);
 obj.setHomePage(pth);
 return false;
}

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)+',';
 }

 newWindow=window.open(goLocation,wname,
 'width='+ww+',height='+wh+','+
 positionCode+
 'location=0,'+
 'toolbar=1,'+
 '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,570,'');
return false;
}

function sendtofrend(id,lng,pth)
{
popupWindow(pth+'inc/sendobject.php?&id='+id+'&lang='+lng,'adresesend',400,200,'');
return false;
}

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

function ShowPlaniWnd(pth,lang)
{
popupWindow(pth,'statwnd',600,500,'');
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;
}