
function in_array(mxd, arr, strict)
{if(strict)
{for(var i=arr.length-1;i>=0;i--)
if(arr[i]===mxd)
return true;}
else
{for(var i=arr.length-1;i>=0;i--)
if(arr[i]==mxd)
return true;}
return false;}
function trim(str)
{return str.replace(/^\s+/,'').replace(/\s+$/,'');}
function array_rtrim(arr)
{for(var i=arr.length-1;i>=0;i--)
if(typeof(arr[i])=="object")
array_rtrim(arr[i]);else
arr[i]=trim(arr[i]);return true;}
function array_trim(arr)
{var res=[];for(var i=0;i<arr.length;i++)
res[i]=trim(arr[i]);return res;}
function array_noempty(arr)
{var res=[];for(var i=0;i<arr.length;i++)
if(arr[i]!='')
res[i]=arr[i];return res;}
function delFromList(item, list)
{var temp=[];var len=list.length;for(var i=0;i<len;i++)
if(list[i]!=item)
temp.push(list[i]);return temp;}
function object_merge(o1, o2)
{for(var i in o2)
o1[i]=o2[i];return true;}
function copyOf(obj)
{if(obj&&typeof(obj)=="object")
{var copy=new obj.constructor();for(var i in obj)
copy[i]=copyOf(obj[i]);return copy;}
return obj;}
function getLeft(node)
{if(node.offsetParent)
return getLeft(node.offsetParent)+node.offsetLeft;return node.offsetLeft;}
function getTop(node)
{if(node.offsetParent)
return getTop(node.offsetParent)+node.offsetTop;return node.offsetTop;}
function getRelLeft(node, rel)
{return(getLeft(node)-getLeft(rel.offsetParent));}
function getRelTop(node, rel)
{return(getTop(node)-getTop(rel.offsetParent));}
function addEventHandler(n,e,o,f)
{if(o&&f)
{if(n.attachEvent)
n.attachEvent("on"+e, function(e){return o[f](e)});else
n.addEventListener(e, function(e){return o[f](e)},false);}
else
{if(n.attachEvent)
n.attachEvent("on"+e,o);else
n.addEventListener(e,o,false);}
}
function delEventHandler(n,e,o,f)
{if(o&&f)
{if(n.detachEvent)
n.detachEvent("on"+e, function(e){return o[f](e)});else
n.removeEventListener(e, function(e){return o[f](e)},false);}
else
{if(n.detachEvent)
n.detachEvent("on"+e,o);else
n.removeEventListener(e,o,false)
}
}
function gId(id)
{return document.getElementById(id);}
function gTags(id, node)
{return(arguments.length<2)? document.getElementsByTagName(id):node.getElementsByTagName(id);}
function gTag(id, node, n)
{return gTags(id, node).item(n);}
function cElement(name)
{return document.createElement(name);}
function getTime()
{return new Date().getTime();}
function pad_left(str, pad, n)
{var i=0;var res=str.toString();while(res.length<n)
{res=pad.charAt(i%pad.length)+res;i++;}
return res;}
function parseDate(str)
{var temp=str.split(" ");var ymd=temp[0].split("-");var his=temp[1].split(":");var date=new Date();date.setFullYear(ymd[0]);date.setMonth(parseFloat(ymd[1])-1);date.setDate(parseFloat(ymd[2]));date.setHours(parseFloat(his[0]));date.setMinutes(parseFloat(his[1]));date.setSeconds(parseFloat(his[2]));return date.getTime();}
function getDayOfWeek(time)
{var date=new Date();if(time)
{if((typeof(time)=="string")&&isNaN(time))
var time=parseDate(time);date.setTime(time);}
return date.getDay();}
function getDate(format, time)
{var date=new Date();if(time&&(time !="undefined")&&(time !='NOW'))
{if((typeof(time)=="string")&&isNaN(time))
var time=parseDate(time);date.setTime(time);}
var res=format;res=res.replace(/Y/g, date.getFullYear());res=res.replace(/m/g, pad_left(date.getMonth()+1,"0",2));res=res.replace(/d/g, pad_left(date.getDate(),"0",2));res=res.replace(/H/g, pad_left(date.getHours(),"0",2));res=res.replace(/i/g, pad_left(date.getMinutes(),"0",2));res=res.replace(/s/g, pad_left(date.getSeconds(),"0",2));return res;}
function isOpera()
{return(navigator.userAgent.toUpperCase().indexOf("OPERA")!=-1);}
function isMSIE(ver)
{if(ver)
return((navigator.userAgent.indexOf("MSIE "+ver)!=-1)&&!isOpera());return((navigator.userAgent.indexOf("MSIE")!=-1)&&!isOpera());}
function getMouse()
{return{x:getMouse.prototype.x,y:getMouse.prototype.y};}
getMouse.prototype=
{instance:null,x:0, 
y:0,onMove:function(e)
{this.x=e.clientX;this.y=e.clientY;}
}
addEventHandler(document, "mousemove", function(e){getMouse.prototype.onMove(e||event)});Math.sgn=function(v)
{switch(true)
{case(v>0):return+1;case(v<0):return-1;default:return 0;}
}
function execJS(id)
{var code=gId(id);if(code)
{eval(code.innerHTML);removeNode(id);}
}
function removeNode(node)
{if(typeof(node)=="string")
var node=gId(node);try{node.parentNode.removeChild(node);}catch(e){};}
function addHTML(node, html)
{if(typeof(node)=="string")
var node=gId(node);var tempNode=document.createElement('div');tempNode.innerHTML=html;for(var n=tempNode.firstChild;n;n=n.nextSibling)
node.appendChild(n.cloneNode(true));}
function replaceHTML(node, html)
{if(typeof(node)=="string")
var node=gId(node);while(node.firstChild)
node.removeChild(node.firstChild);var tempNode=document.createElement('div');tempNode.innerHTML=html;for(var n=tempNode.firstChild;n;n=n.nextSibling)
node.appendChild(n.cloneNode(true));}
function moveContent(source, target)
{if(typeof(source)=="string")
var source=gId(source);if(typeof(target)=="string")
var target=gId(target);while(source.firstChild)
{target.appendChild(source.firstChild.cloneNode(true));source.removeChild(source.firstChild);}
}
function copyContent(source, target)
{if(typeof(source)=="string")
var source=gId(source);if(typeof(target)=="string")
var target=gId(target);for(var n=source.firstChild;n;n=n.nextSibling)
target.appendChild(n.cloneNode(true));}
function clearNode(node)
{if(typeof(node)=="string")
var node=gId(node);while(node.firstChild)
node.removeChild(node.firstChild);}
function jsu(sv)
{try
{eval("var d=decodeURIComponent;var o=("+sv+");");return o;}
catch(e)
{return null}
}
function jss(v)
{var res=null;if(v==null)
return 'null';if(v===false)
return 'false';if(v===true)
return 'true';switch(typeof(v))
{case 'string':return 'd("'+encodeURIComponent(v)+'")';case 'object':if(v.constructor==Array)
{var sub=[];for(var i=0;i<v.length;i++)
sub.push(jss(v[i]));return '['+sub.join(',')+']';}
var sub=[];for(var i in v)
sub.push('d("'+encodeURIComponent(i)+'"):'+jss(v[i]));return '{'+sub.join(',')+'}';default:return v;}
}
function canvasWidth()
{return(document.width)? document.width:document.body.offsetWidth;}
function canvasHeight()
{if(gId('canvas_bottom'))
return gId('canvas_bottom').offsetTop+gId('canvas_bottom').offsetHeight;return(document.height)? document.height:document.body.offsetHeight;}
function hideNode(node)
{if(typeof(node)=="string")
var node=gId(node);node.style.visibility='hidden';}
function showNode(node)
{if(typeof(node)=="string")
var node=gId(node);node.style.visibility='visible';}
function setHTML(node, html)
{if(typeof(node)=="string")
var node=gId(node);node.innerHTML=html;}
function setStyle(node, style)
{if(typeof(node)=="string")
var node=gId(node);for(var i in style)
node.style[i]=style[i];}
function alphaFixIE(css){var s, i, j;if(!isMSIE())
return false;var els=document.getElementsByTagName("IMG");for(i=0;i<els.length;i++){s=els[i].src;if(s.toLowerCase().indexOf(".png")!=-1){els[i].src="/images/blank.gif";els[i].style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s+"', sizingMethod=image);";}
}
if(css)
{for(i=0;i<document.styleSheets.length;i++){var pos=document.styleSheets[i].href.lastIndexOf("/");var cssDir=(pos !=-1)? document.styleSheets[i].href.substring(0, pos+1):"";for(j=0;j<document.styleSheets[i].rules.length;j++){var style=document.styleSheets[i].rules[j].style;if(style.backgroundImage.toLowerCase().indexOf(".png")!=-1){var filename=style.backgroundImage.substring(4, style.backgroundImage.length-1);if(filename.indexOf("http://")!=0&&filename.indexOf("/")!=0)
filename=cssDir+filename;style.backgroundImage="none";style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+filename+"', sizingMethod='crop');";}
}
}
}
}
function encodeUTF8(str){str=str.replace(/[\u0080-\u07ff]/g,function(c){var cc=c.charCodeAt(0);return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f);}
);str=str.replace(/[\u0800-\uffff]/g,function(c){var cc=c.charCodeAt(0);return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f);}
);return str;}
function decodeUTF8(str){str=str.replace(/[\u00c0-\u00df][\u0080-\u00bf]/g,function(c){var cc=(c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f;return String.fromCharCode(cc);}
);str=str.replace(/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(c){var cc=(c.charCodeAt(0)&0x0f)<<12 |(c.charCodeAt(1)&0x3f<<6)| c.charCodeAt(2)&0x3f;return String.fromCharCode(cc);}
);return str;}
function formatPrice(input)
{try{var value=input.value.replace(/[^0-9]/g,'');var l=value.length;var res=[];for(var i=1;i<=l;i++)
if((i>1)&&(i%3==1))
res.unshift(value.charAt(l-i)+" ");else
res.unshift(value.charAt(l-i));input.value=res.join("");}
catch(e){}
}
function watchEnter(node, e, fn)
{if(e.keyCode==13)
{eval(fn);return false;}
}
function setSelectValue(node, value)
{if(typeof(node)=="string")
var node=gId(node);for(var i=0;i<node.options.length;i++)
node.options[i].selected=(node.options[i].value==value);return true;}
function initClassInstance(proto, obj, list)
{var list=list.split(",");for(var i=list.length-1;i>=0;i--)
obj[list[i]]=copyOf(proto[list[i]]);}
function hasCSSClass(node, cls)
{if(node.className&&in_array(cls, node.className.split(" ")))
return true;return false;}
function setCSSClass(node, cls)
{if(delCSSClass(node, cls))
{var newClass=node.className+" "+cls;if(node.className !=newClass)
node.className=newClass;return true;}
return false;}
function delCSSClass(node, cls)
{if(node)
{var newClass=node.className.replace(" "+cls,"").replace(cls,"");if(node.className !=newClass)
node.className=newClass;return true;}
return false;}
function setSafeFocus(id)
{try{var id=id.split("::");if(id.length>1)
document.forms[id[0]][id[1]].focus();else
gId(id[0]).focus();}catch(e){};}
function rot38(str)
{var res="";var l=str.length;for(var i=0;i<l;i++)
{var c=str.charCodeAt(i)-47;if((c>=0)&&(c<=75))
c=(c+38)%76;res+=String.fromCharCode(c+47);}
return res;}
function openPopupPage(url,wndName,width,height,paramStr, returnWithInstane)
{var res=[];var left=10;var top=10;var sb=false;var mb=false;var op=(navigator.userAgent.search("Opera")!=-1);var ms=(navigator.userAgent.search("MSIE")!=-1)&&(!op);var	param=paramStr.split(";");for(var i in param)
{var nam=param[i].split(":")[0].toLowerCase();var val=param[i].split(":")[1];switch(nam)
{case "fullscreen":res.push("fullscreen="+val);break;case "location":res.push("location="+val);break;case "menubar":res.push("menubar="+val);mb=(val=='yes');break;case "resizable":res.push("resizable="+val);break;case "scrollbars":res.push("scrollbars="+val);sb=(val=='yes');break;case "status":res.push("status="+val);break;case "titlebar":res.push("titlebar="+val);break;case "toolbar":res.push("toolbar="+val);break;case "left":left=val;break;case "top":top=val;break;case "center":if(val=='yes')
{left=Math.round((screen.width-width)/2);top=Math.round((screen.height-height)/2);}
break;}
}
if(ms)
{width+=(sb)? 13:-4;height+=(sb)? 0:-4;if(mb)height-=20;}
res.push("width="+width);res.push("height="+height);res.push("left="+left);res.push("top="+top);var win=window.open(url, wndName, res.join(","));win.focus();if(returnWithInstane)
return win;}
function setCookie(name, value, expiredays, path)
{var res=[];res.push(name+"="+escape(value));if(expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);res.push("expires="+exdate.toGMTString());}
if(path)
res.push("path="+path);document.cookie=res.join(";");}
function getCookie(name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(name+"=");if(c_start!=-1)
{c_start=c_start+name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}
}
return "";}
function setAlpha(node, a)
{if(typeof(node)=="string")
var node=gId(node);try{node.style.opacity=a;}catch(e){};try{node.style.MozOpacity=a;}catch(e){};try{node.style.filter="alpha(opacity="+Math.round(100*a)+")";}catch(e){};}
function startGA(uid)
{try{var pageTracker=_gat._getTracker(uid);pageTracker._initData();pageTracker._trackPageview();}catch(e){}
}
function __LOCKBAR(b)
{try
{if(b)
{var div=document.createElement('div');var html=document.getElementsByTagName('html').item(0);var w=document.body.clientWidth || html.scrollWidth;var h=html.scrollHeight;var oh=window.innerHeight || document.documentElement.offsetHeight;var ot=document.documentElement.scrollTop || html.scrollTop;var t=Math.floor(ot+oh/2-10);div.innerHTML='<div id="lockbar" style="display:block;margin:0px;padding:0px;position:absolute;z-index:999999;top:0px;left:0px;width:'+w+'px;height:'+h+'px;background:#000000 url(\'/cms/images/lockbar.gif\') no-repeat 50% '+t+'px;opacity:0.8;filter:alpha(opacity=80);-moz-opacity:0.8">'+(isMSIE(6)?'<iframe style="width:'+w+'px;height:'+h+'px;position:absolute;top:0px;left:0px;margin:0px;padding:0px;filter=alpha(opacity=0);opacity:0;-moz-opacity:0" frameborder="0"></iframe>':'')+'</div>';document.body.insertBefore(div.firstChild, document.body.firstChild);}
else
{var n=document.getElementById('lockbar');n.parentNode.removeChild(n);}
}catch(e){};}
try{document.execCommand("BackgroundImageCache", false, true);}catch(err){}
function fetch(str, _tpl_vars)
{var res=str.replace(/\{\$[a-zA-Z0-9\_\.]+\}/g, function(token,pos,str){var token=token.substring(2,token.length-1).replace(/[\.]/g,"']['");try{eval("var res = _tpl_vars['"+token+"'];");}catch(e){var res=""};return res;});var res=res.replace(/\{if([^\}]+)\}(.*?)\{\/if\}/g, function(token,eq,content,pos,str){eq=eq.replace(/\$[a-zA-Z0-9\_\.]+/g, function(token,pos,str){var token=token.substring(1).replace(/[\.]/g,"']['");try{eval("var res = _tpl_vars['"+token+"'];");}catch(e){var res=null};if(typeof(res)=="string")
return '"'+res.replace(/([\"\\])/g,'\$1')+'"';

			return res;
		});

		var res = "";
		try{eval("if ("+eq+") var res = content;")} catch(e){};

		return res;
	});

	return res;
}

function dump(param)
{
	var res = [];for(var i in param)res.push(i+":"+param[i]);alert(res.join("\n"));
}

function Tooltip(list_nodename)
{if(list_nodename)
{this.list_nodename=list_nodename.split(',');if(gId('toolnode'))
{Tooltip.prototype.instance=this;this.node=gId('toolnode');this.bound();if(isMSIE(6))
this.addIFrameCover();delEventHandler(document, 'mousemove', function(e){if(Tooltip&&Tooltip.prototype.instance)Tooltip.prototype.instance.updatePos(e||event)});addEventHandler(document, 'mousemove', function(e){if(Tooltip&&Tooltip.prototype.instance)Tooltip.prototype.instance.updatePos(e||event)});}
}
else if(Tooltip.prototype.instance)
return Tooltip.prototype.instance;}
Tooltip.prototype=
{instance:null,mx:0,my:0,state:'none',list_text:[],list_class:[],list_nodename:['span','a','img','div'],getInstance:function()
{return Tooltip.prototype.instance;},setNodesList:function(list_nodename)
{this.list_nodename=list_nodename.split(',');},bound:function(list)
{if(list)
this.list_nodename=list;for(var i in this.list_nodename)
{var list_node=gTags(this.list_nodename[i]);if(list_node)this.alterNodes(list_node);}
return true;},alterNodes:function(list_node)
{for(var i=0;i<list_node.length;i++)
{var node=list_node.item(i);if(node&&node.title&&(node.title.indexOf('tooltip:')===0))
{var txt=node.title.toString().substring(8);if(window._STRING&&(window._STRING[txt]!=undefined))
txt=window._STRING[txt];var id=this.list_text.push(txt)-1;this.list_text[id]=this.list_text[id].split('|').join('\r\n');try{this.list_class[id]=node.className.split('::')[1];}catch(e){this.list_class[id]=''};node.title="";eval('addEventHandler(node, "mouseover", function(e){try{ if(Tooltip.prototype.instance) Tooltip.prototype.instance.show('+id+', (e||event) );}catch(err){}});');eval('addEventHandler(node, "mouseout", function(e){try{ if(Tooltip.prototype.instance) Tooltip.prototype.instance.hide();}catch(err){}});');}
}
},addIFrameCover:function()
{if(!gId('toolnode:frame'))
{var fr=cElement('iframe');fr.id="toolnode:frame";fr.style.cssText="position:absolute;top:0px;left:0px;width:0px;height:0px;background-color:red;display:block;visibility:hidden;filter:alpha(opacity=0)";this.node.parentNode.appendChild(fr);}
},show:function(id,e)
{this.node.innerHTML="<pre>"+this.list_text[id]+"</pre>";this.node.className=this.list_class[id];this.state="block";hideNode('toolnode');if(gId('toolnode:frame'))
{hideNode('toolnode:frame');gId('toolnode:frame').style.display='block';}
this.updatePos(e);this.node.style.display="block";showNode(this.node);if(gId('toolnode:frame'))
{gId('toolnode:frame').style.width=this.node.offsetWidth+"px";gId('toolnode:frame').style.height=this.node.offsetHeight+"px";showNode('toolnode:frame');}
},hide:function()
{this.state="none";this.node.style.display="none";try{if(isMSIE(6))gId('toolnode:frame').style.display='none';}catch(e){};},updatePos:function(e)
{this.mx=e.clientX+-10;this.my=e.clientY+25;if(window.pageXOffset)
this.mx+=window.pageXOffset;else if(document.documentElement.scrollLeft)
this.mx+=document.documentElement.scrollLeft;else if(document.body.scrollLeft)
this.mx+=document.body.scrollLeft;if(window.pageYOffset)
this.my+=window.pageYOffset;else if(document.documentElement.scrollTop)
this.my+=document.documentElement.scrollTop;else if(document.body.scrollTop)
this.my+=document.body.scrollTop;if((this.mx+this.node.offsetWidth)>canvasWidth())
this.mx=canvasWidth()-this.node.offsetWidth-5;if(this.state=="block")
{this.node.style.left=this.mx+"px";this.node.style.top=this.my+"px";try{if(isMSIE(6))
setStyle('toolnode:frame',{left:this.mx+"px",top:this.my+"px",width:this.node.offsetWidth+"px",height:this.node.offsetHeight+"px"
});}catch(e){}
}
}
}


var SeigiMap=
{map:null,geocoder:null,id:"map",addr:"",caption:"",init:function(id, addr)
{SeigiMap.id=id;SeigiMap.addr=addr.split("||")[0];SeigiMap.caption=addr.split("||").pop();},show:function()
{if(GBrowserIsCompatible())
{SeigiMap.map=new GMap2(gId(SeigiMap.id));SeigiMap.geocoder=new GClientGeocoder();SeigiMap.map.addControl(new GSmallMapControl());SeigiMap.map.addControl(new GScaleControl());SeigiMap.map.addControl(new GMapTypeControl());return SeigiMap.showAddress(decodeURIComponent(SeigiMap.addr), 15, true);}
gId(SeigiMap.id).style.visibility="hidden";return false;},showLocation:function(point, zoom, address, tryagain)
{if(!point)
{if(address&&tryagain)
{var na=address.split(",").pop();if(na==address)
{na=address.split(" ");for(var i=0;i<na.length;i++)
if(!na[i].match(/[0-9]/))
break;na=na.splice(0,i).join(" ");}
return SeigiMap.showAddress(na, 13, false);}
var point=new GLatLng(46.08, 18.12);var zoom=3;}
SeigiMap.map.setCenter(new GLatLng(46.08, 18.12), 2);SeigiMap.map.setCenter(point, zoom);try{var marker=new GMarker(point);SeigiMap.map.addOverlay(marker);marker.openInfoWindowHtml(decodeURIComponent(SeigiMap.caption));}catch(e){};},	
showAddress:function(address, zoom, tryagain)
{try{eval("var point = "+address+";");if(!point || !point[0]|| !point[1])
var point=false;}
catch(e){var point=false;}
if(point)
{var point=new GLatLng(point[0], point[1]);SeigiMap.showLocation(point, zoom, address, false);}
else
{SeigiMap.geocoder.getLatLng(address, function(point){SeigiMap.showLocation(point, zoom, address, tryagain)});}
}
}