/*
 * Tämän tiedoston omistaa Tamnet Avoin Yhtiö.  Lähdekoodin kopioiminen,
 * jälleenmyynti tai muokkaus ilman omistajan kirjallista lupaa on
 * kielletty!
 *
 * Copyright 2009 Tamnet Avoin Yhtiö
 * http://www.tamnet.fi
 */
var CMSAPI=3.2;var TRANSLATIONS={"en":new Array()};var ROOT;if(!ROOT)ROOT="";var LANG;if(!LANG)LANG="en";var COUNTRY;if(!COUNTRY)COUNTRY="US";var PROVIDED=new Array();var CHARSET="ISO-8859-1";function api_version(require){var eps=1.0e-6;if(require&&(Math.floor(CMSAPI+eps)!=Math.floor(require+eps)||CMSAPI+eps<require)){throw new Error("Invalid API version");}return CMSAPI;}function requires(mod){if(!PROVIDED[mod]){throw new Error("Missing module "+mod);}}function provides(mod){if(!PROVIDED[mod]){PROVIDED[mod]=1;}else{throw new Error("Duplicate module "+mod);}}function translate(phrase){phrase=phrase.replace(/^\s+|\s+$/g,'');phrase=phrase.replace(/\s+/g,' ');var t;var from=phrase.toLowerCase();if(TRANSLATIONS[from]!=null){t=TRANSLATIONS[from];}else{t=phrase;}var out="";var n=t.length;var i=0;while(i<n){var start=t.indexOf("%",i);if(start>=0){out+=t.substr(i,start-i);i=start;}else{out+=t.substr(i);i=n;}if(i<n){i++;len=0;while(i+len<n){var c=t.substr(i+len,1);if("0"<=c&&c<="9"){len++;}else{break;}}if(len>0){var varno=parseInt(t.substr(i,len));i+=len;if(1<=varno&&varno<arguments.length){out+=arguments[varno].toString();}else{out+="%"+varno;}}else{out+="%";i++;}}}return out;}function trim(str){return str.replace(/^\s+|\s+$/g,'');}function count(arr){var length=0;for(var key in arr){length++;}return length;}function clone(obj){var newobj;if(obj!==null&&typeof(obj.clone)=="function"){newobj=obj.clone();}else if(obj instanceof Array){newobj=obj.slice(0);}else if(obj!==null&&typeof(obj)=="object"){newobj=new obj.constructor();for(var key in obj){if(obj.hasOwnProperty(key))newobj[key]=obj[key];}}else{newobj=obj;}return newobj;}Date.prototype.clone=function(){return new Date(this.getTime());};function strspn(s1,s2){for(var i=0;i<s1.length;i++){if(s2.indexOf(s1.charAt(i))<0)break;}return i;}function strcspn(s1,s2){for(var i=0;i<s1.length;i++){if(s2.indexOf(s1.charAt(i))>=0)break;}return i;}function isset(v){return v!==null&&typeof(v)!="undefined";}function is_identifier(id){return id.match(/^[_a-z][_a-z0-9]*$/i)&&id.length<64;}function $(id){if(id.constructor==String){return document.getElementById(id);}else{return id;}}function $$(name,root){if(!root){root=document;}else{root=$(root);}if(root){return root.getElementsByTagName(name);}else{throw new Error("Invalid element");}}function reparent(id,parenid,repl){var f=$(id);var p=$(parenid);if(f&&p){if(repl){while(p.childNodes.length>=1)p.removeChild(p.firstChild);}p.insertBefore(f,p.firstChild);f.style.display="block";}}provides("html");function h1(title){var f=document.createElement("h1");if(title){var data=translate.apply(this,arguments);f.appendChild(document.createTextNode(data));}return f;}function h2(title){var f=document.createElement("h2");if(title){var data=translate.apply(this,arguments);f.appendChild(document.createTextNode(data));}return f;}function para(str){var f=document.createElement("p");if(str){var data=translate.apply(this,arguments);f.appendChild(document.createTextNode(data));}return f;}function div(attrs){var f=document.createElement("div");set_attribute(f,attrs);return f;}function span(attrs){var f=document.createElement("span");set_attribute(f,attrs);return f;}function anchor(href,title){var f=document.createElement("a");set_attribute(f,{href:href});if(title){var args=Array.prototype.slice.call(arguments);var textnode=text.apply(this,args.slice(1));f.appendChild(textnode);}return f;}function text(str){var data=translate.apply(this,arguments);return document.createTextNode(data);}function generate_identifier(name){var id;if(!name||name.constructor!=String){name="id";}if(isNaN(HTML_COUNTER[name])){HTML_COUNTER[name]=1;}return name+(HTML_COUNTER[name]++);}var HTML_COUNTER=new Array();function set_attribute(f,attrs){for(var key in attrs){var value=attrs[key];switch(key){case "alt":case "height":case "href":case "id":case "src":case "target":case "title":case "width":f.setAttribute(key,value);break;case "onclick":case "className":f[key]=value;break;default:throw new Error("Invalid attribute "+key);}}}function get_attribute(f,key){var value;switch(key){case "alt":case "height":case "href":case "id":case "src":case "target":case "title":case "width":value=f.getAttribute(key);break;case "onclick":case "className":value=f[key];break;default:throw new Error("Invalid attribute "+key);}return value;}function set_style(f,styles){for(var key in styles){f.style[key]=styles[key];}}function set_opacity(f,x){if(0<=x&&x<=100){set_style(f,{opacity:(x/100).toString(),filter:"alpha(opacity="+x+")"});}}function set_title(f,str){var args=Array.prototype.slice.call(arguments);title=translate.apply(this,args.slice(1));set_attribute(f,{title:title});}function set_class(f,classname){set_attribute(f,{className:trim(classname)});}function add_class(f,classname){if(!in_class(f,classname)){set_class(f,f.className+" "+classname);}}function remove_class(f,classname){var arr=f.className.split(" ");var classes="";for(var i=0;i<arr.length;++i){if(arr[i]!=classname){classes+=" "+arr[i];}}set_class(f,classes);}function in_class(f,classname){var classes=f.className.split(" ");for(var i=0;i<classes.length;++i){if(classes[i]==classname){return true;}}return false;}api_version(3);provides("mailto");requires("html");function mailto_links(){var arr=$$("a");for(var i=0;i<arr.length;i++){mailto_replace(arr[i]);}var arr=$$("span");for(var i=0;i<arr.length;i++){mailto_replace(arr[i]);}}function mailto_replace(f){var addr=f.innerHTML;addr=addr.replace(/\((at|miuku|a)\)/,"@");addr=addr.replace(/\b(atsign|at|miuku)\b/,"@");addr=addr.replace(/\b(dot|piste|point)\b/g,".");addr=addr.replace(/\b(nospam|remove)\b/g,"");addr=addr.replace(/[\x2f\x20\t\r\n]/g,"");addr=addr.replace(/\(\w+\)/g,"");if(addr.match(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+[a-z]{2}[mtgvu]?$/i)){while(f.childNodes.length>=1)f.removeChild(f.firstChild);if(f.nodeName.toUpperCase()=="A"){f.appendChild(text(addr));f.href="mailto:"+addr;}else{f.appendChild(anchor("mailto:"+addr,addr));}}}mailto_links();provides("net");function is_addr(name){return is_addr4(name);}function is_addr4(name){return name.match(/^([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])([.]([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}$/);}function is_host(name){return name.match(/^([a-z0-9][-0-9a-z]*[a-z0-9]\.)+[a-z]{2,6}$/i);}function is_localhost(name){return name.match(/^(localhost|127\.0\.0\.1)$/i);}function server_name(){return window.location.hostname;}function server_port(){return parseInt(window.location.port)||80;}function domain(name){var result;if(!name)name=server_name();if(is_addr(name)||is_identifier(name)){result=name;}else if(is_host(name)){var part=name.split(".");result=part[part.length-2]+"."+part[part.length-1];}else{throw new Error("Invalid host name "+name);}return result;}function subdomain(name){var sub;if(!name)name=server_name();if(is_addr(name)||is_localhost(name)){sub="";}else if(is_identifier(name)){sub=name;}else if(is_host(name)){part=name.split(".");if(part.length>2){sub=part[part.length-3];}else{sub="";}}else{throw new Error("Invalid host name "+name);}return sub;}provides("request");var request_wait=new Array();function HttpRequest(f){var req=null;if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){req=new ActiveXObject("Microsoft.XMLHTTP");}}if(!req&&window.XMLHttpRequest){req=new XMLHttpRequest;}if(req){req.onreadystatechange=request_state;this.req=req;this.completed=f;this.async=(f!=null);this.request_header=new Array();this.get=HttpRequest_get;this.post=HttpRequest_post;this.query_string=HttpRequest_query_string;this.response=HttpRequest_response;this.header=HttpRequest_header;}else{throw new Error("Unable to construct HTTP Request");}}function HttpRequest_header(name,value){var req=this.req;if(value){this.request_header[name]=value;}if(req.readyState>=2){return req.getResponseHeader(name);}else{return null;}}function HttpRequest_get(fn,vars){request_add(this);var req=this.req;req.open("GET",fn+this.query_string(vars),this.async);for(var i in this.request_header){req.setRequestHeader(i,this.request_header[i]);}req.send(null);return this.response();}function HttpRequest_post(fn,vars){var data=this.query_string(data);this.header("Content-Type","application/x-www-form-urlencoded; charset="+CHARSET);this.header("Content-length",data.length);request_add(this);var req=this.req;req.open("POST",fn,this.async);for(var i in this.request_header){req.setRequestHeader(i,this.request_header[i]);}req.send(data);return this.response();}function HttpRequest_query_string(vars){var query="";if(vars){for(var i in vars){query+=(query?"&":"?")+i;if(vars[i])query+="="+encodeURIComponent(vars[i]);}}return query;}function HttpRequest_response(){var result=null;var req=this.req;if(req.readyState==4){if(req.status==200){if(req.responseXML&&req.responseXML.childNodes.length){result=req.responseXML;}else{result=req.responseText;}}else{throw new Error(req.statusText);}}return result;}function http_get(fn,vars){var http=new HttpRequest();return http.get(fn,vars);}function http_post(fn,vars){var http=new HttpRequest();return http.post(fn,vars);}function request_add(http){request_wait.push(http);}function request_state(req){for(var i=0;i<request_wait.length;i++){var http=request_wait[i];if(http.req.readyState==4){if(http.completed){http.completed(http.response());}request_wait.splice(i,1);break;}}}provides("file");function dequote(str){str=trim(str);if(str.substr(0,1)=="\""&&str.substr(str.length-1,1)=="\""){str=str.substr(1,str.length-2);}if(str.substr(0,1)=="\'"){str=str.substr(1);}str=str.replace(/""/,"\"");return str;}provides("browser");function scroll_left(){var x=0;if(document.documentElement.scrollLeft){var t=document.documentElement.scrollLeft;if(t>x){x=t;}}if(document.body.scrollLeft){var t=document.body.scrollLeft;if(t>x){x=t;}}if(window.pageXOffset){var t=window.pageXOffset;if(t>x){x=t;}}return x;}function scroll_top(){var y=0;if(document.documentElement.scrollTop){var t=document.documentElement.scrollTop;if(t>y){y=t;}}if(document.body.scrollTop){var t=document.body.scrollTop;if(t>y){y=t;}}if(window.pageYOffset){var t=window.pageYOffset;if(t>y){y=t;}}return y;}function scroll_width(){var w=document.body.scrollWidth+margin_left(document.body)+margin_right(document.body);w=_scroll_width(document.body,w);w=Math.max(w,inner_width());return w;}function _scroll_width(f,w){var x=offset_left(f)+offset_width(f);if(w<x)w=x;for(var i=0;i<f.childNodes.length;i++){w=_scroll_width(f.childNodes[i],w);}return w;}function scroll_height(){return Math.max(inner_height(),document.body.scrollHeight+margin_top(document.body)+margin_bottom(document.body));}function inner_width(){var w=0;if(typeof(window.innerWidth)=='number'){w=window.innerWidth;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){w=document.documentElement.clientWidth;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){w=document.body.clientWidth;}return w;}function inner_height(){var h=0;if(typeof(window.innerHeight)=='number'){h=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){h=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){h=document.body.clientHeight;}return h;}function offset_left(f){var x=0;if(f.offsetParent){x=f.offsetLeft;while(f=f.offsetParent){x+=f.offsetLeft;}}return x;}function offset_top(f){var y=0;if(f.offsetParent){y=f.offsetTop;while(f=f.offsetParent){y+=f.offsetTop;}}return y;}function offset_width(f){var w=0;if(f.offsetWidth){w+=f.offsetWidth;}else if(f.style&&f.style.pixelWidth){w+=f.style.pixelWidth;}return w;}function offset_height(f){var h=0;if(f.offsetHeight){h+=f.offsetHeight;}else if(f.style&&f.style.pixelHeight){h+=f.style.pixelHeight;}return h;}function margin_top(f){return parseInt(get_style(f,"marginTop"))||0;}function margin_bottom(f){return parseInt(get_style(f,"marginBottom"))||0;}function margin_left(f){return parseInt(get_style(f,"marginLeft"))||0;}function margin_right(f){return parseInt(get_style(f,"marginRight"))||0;}function border_top(f){return parseInt(get_style(f,"borderTopWidth"))||0;}function border_bottom(f){return parseInt(get_style(f,"borderBottomWidth"))||0;}function border_left(f){return parseInt(get_style(f,"borderLeftWidth"))||0;}function border_right(f){return parseInt(get_style(f,"borderRightWidth"))||0;}function padding_top(f){return parseInt(get_style(f,"paddingTop"))||0;}function padding_bottom(f){return parseInt(get_style(f,"paddingBottom"))||0;}function padding_left(f){return parseInt(get_style(f,"paddingLeft"))||0;}function padding_right(f){return parseInt(get_style(f,"paddingRight"))||0;}function min_width(f){var w=parseInt(get_style(f,"minWidth"))||0;return w>0?w:0;}function max_width(f){var w=parseInt(get_style(f,"maxWidth"))||1920;return w>0?w:1920;}function min_height(f){var h=parseInt(get_style(f,"minHeight"))||0;return h>0?h:0;}function max_height(f){var h=parseInt(get_style(f,"maxHeight"))||999999;return h>0?h:999999;}function get_style(f,prop){var w=0;if(f.currentStyle){w=f.currentStyle[prop];}else if(window.getComputedStyle&&f.style){var name="";for(var i=0;i<prop.length;i++){var c=prop[i];if("A"<=c&&c<="Z"){name=name+"-"+c.toLowerCase();}else{name=name+c;}}w=document.defaultView.getComputedStyle(f,null).getPropertyValue(name);}return w||0;}provides("cookie");function getcookie(cookie){var cookies=document.cookie.split(";");for(var i=0;i<cookies.length;++i){var item=cookies[i];var value,name;var pos=item.indexOf("=");if(pos>=0){name=trim(item.substr(0,pos));value=item.substr(pos+1);}else{name=trim(item);value="";}if(name==cookie){return value;}}return "";}function setcookie(cookie,value,expire,path,domain){var cookiedef;cookiedef=cookie+"="+escape(value)+";";if(expire!=null){cookiedef+="expires"+"="+expire.toGMTString()+";";}if(path!=null){cookiedef+="path"+"="+path+";";}if(domain!=null){cookiedef+="domain"+"="+domain+";";}document.cookie=cookiedef;}provides("time");var SHORT_DATE_FORMAT={"US":"%b %e %Y"};var LONG_DATE_FORMAT={"US":"%A %B %e %Y"};var FULL_DATE_FORMAT={"US":"%a %b %e %Y %I:%M %p"};var day_name=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");var month_name=new Array("January","February","March","April","May","June","July","August","September","October","November","December");var abbreviated_month=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var abbreviated_day=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");function parse_date(str){var re,match;var year,month=0,day;re=new RegExp(/^([1-2][0-9]{3})-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/);match=re.exec(str);if(match){year=parseInt(match[1],10);month=parseInt(match[2],10);day=parseInt(match[3],10);}if(match){var r=new Date();r.setYear(year);r.setMonth(month-1,day);r.setHours(0,0,0,0);if(r.getFullYear()==year&&r.getMonth()+1==month&&r.getDate()==day){return r;}}return null;}function short_date(t){return format_date(SHORT_DATE_FORMAT[COUNTRY],t);}function long_date(t){return format_date(LONG_DATE_FORMAT[COUNTRY],t);}function full_date(t){return format_date(FULL_DATE_FORMAT[COUNTRY],t);}function format_date(format,t){var day=t.getDate();var month=t.getMonth()+1;var year=t.getFullYear();var hour=t.getHours();var min=t.getMinutes();var sec=t.getSeconds();var weekday=t.getDay();var i=0;var n=format.length;var output="";while(i<n){var c=format.substr(i++,1);if(c=="%"){c=format.substr(i++,1);switch(c){case "a":output+=translate(abbreviated_day[weekday]);break;case "A":output+=translate(day_name[weekday]);break;case "d":output+=(day<10?"0":"")+day;break;case "j":case "e":output+=day;break;case "n":output+=month;break;case "m":output+=(month<10?"0":"")+month;break;case "h":case "b":output+=translate(abbreviated_month[month-1]);break;case "B":output+=translate(month_name[month-1]);break;case "Y":output+=year;break;case "H":output+=(hour<10?"0":"")+hour;break;case "M":output+=(min<10?"0":"")+min;break;case "I":var x=hour%12;if(x==0)x=12;output+=(x<10?"0":"")+x;break;case "p":if(hour<12){output+="AM";}else{output+="PM";}break;case "P":if(hour<12){output+="am";}else{output+="pm";}break;case "S":output+=(sec<10?"0":"")+sec;break;default:output+=c;}}else{output+=c;}}return output;}function timezone_offset(t){if(!isset(t)){t=now();}return-t.getTimezoneOffset()*60*1000;}function offset_days(n,t){var msecs=24*60*60*1000;if(!isset(t)){t=now();}var x=t.getTime()+n*msecs;return new Date(x+timezone_offset(t)-timezone_offset(new Date(x)));}function now(t){return isset(t)?t:new Date();}function leap_year(year){return((year%4)==0&&(year%100)!=0)||((year%400)==0);}function days_in_month(year,month){switch(month){case 0:return 31;case 1:return leap_year(year)?29:28;case 2:return 31;case 3:return 30;case 4:return 31;case 5:return 30;case 6:return 31;case 7:return 31;case 8:return 30;case 9:return 31;case 10:return 30;case 11:return 31;default:throw new Error("Invalid month "+month);}}api_version(3);provides("i18n");requires("file");requires("request");requires("cookie");requires("time");FULL_DATE_FORMAT={"GB":"%a %e %b %H:%M %Y","US":"%a, %b %e, %Y %I:%M %p","FI":"%d.%m.%Y klo %H.%M"};SHORT_DATE_FORMAT={"GB":"%e %b %Y","US":"%b %e %Y","FI":"%d.%m.%Y"};LONG_DATE_FORMAT={"GB":"%A %e %B %Y","US":"%A, %B %e, %Y","FI":"%A, %e. %Bta %Y"};function load_translations(lang){var fn=ROOT+lang+"/"+lang+".csv";var file=http_get(fn);if(file.constructor!=String){throw new Error("Expecting string");}var lines=file.split("\n");for(var i=0;i<lines.length;i++){var fields=lines[i].split("\t");if(fields.length==2){from=dequote(fields[0].toLowerCase());to=dequote(fields[1]);add_translation(from,to);}}}function add_translation(from,to){var key=from.toLowerCase().replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ');TRANSLATIONS[key]=to;}function init_i18n(){var arr=$$("meta");for(var i=0;i<arr.length;i++){var eq=arr[i].getAttribute("http-equiv");var val=arr[i].getAttribute("content");if(eq=="content-language"){LANG=val.substr(0,2);COUNTRY=val.substr(3,2);}}if(getcookie("lang")!=LANG){setcookie("lang",LANG,offset_days(365),"/");}load_translations(LANG);}init_i18n();provides("event");function onload_handler(f){add_handler("load",f);}function onresize_handler(f){add_handler("resize",f);}function onscroll_handler(f){add_handler("scroll",f);}function onmousemove_handler(f){add_handler("mousemove",f);}function onexit_handler(f){add_handler("beforeunload",f);}function add_handler(id,f){if(window.addEventListener){window.addEventListener(id,f,false);}else if(window.attachEvent){window.attachEvent("on"+id,f);}}function event_key(e){if(!e)e=window.event;var key="";if(e.which==null){key=String.fromCharCode(e.keyCode);}else{switch(e.which){case 8:key=null;break;case null:case 0:key=null;break;default:key=String.fromCharCode(e.which);}}return key;}function event_specialkey(e){if(!e)e=window.event;if(e.keyIdentifier){switch(e.keyIdentifier){case "U+0008":return "Back";case "U+0009":return "Tab";case "U+001B":return "Esc";case "U+0020":return "Space";case "U+007F":return "Delete";default:return e.keyIdentifier;};}else{switch(e.keyCode){case 32:return "Space";case 38:return "Up";case 40:return "Down";case 37:return "Left";case 39:return "Right";case 36:return "Home";case 35:return "End";case 13:return "Enter";case 45:return "Insert";case 34:return "PageDown";case 33:return "PageUp";case 8:return "Back";case 9:return "Tab";case 27:return "Esc";case 46:return "Delete";default:return String.fromCharCode(e.keyCode);};}}function stop_propagation(e){if(!e)e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();}function cancel_event(e){if(!e)e=window.event;e.returnValue=false;if(e.preventDefault)e.preventDefault();}function dispatch_event(f,name){var e;if(document.createEvent){switch(name){case "mousedown":case "mousemove":case "mouseout":case "mouseover":case "mouseup":case "click":e=document.createEvent("MouseEvents");e.initEvent(name,true,true);break;case "abort":case "blur":case "change":case "error":case "focus":case "load":case "reset":case "resize":case "scroll":case "select":case "submit":case "unload":case "keydown":case "keypress":case "keyup":throw new Error("Unsupported event "+name);break;default:throw new Error("Invalid event "+name);}}else if(document.createEventObject){switch(name){case "mousedown":case "mousemove":case "mouseout":case "mouseover":case "mouseup":case "click":e=document.createEventObject();break;case "abort":case "blur":case "change":case "error":case "focus":case "load":case "reset":case "resize":case "scroll":case "select":case "submit":case "unload":case "mousedown":case "mousemove":case "mouseout":case "mouseover":case "mouseup":case "keydown":case "keypress":case "keyup":throw new Error("Unsupported event "+name);break;default:throw new Error("Invalid event "+name);}}else{throw new Error("Cannot construct event "+name);}var value;if(f.dispatchEvent){value=!f.dispatchEvent(e);}else if(document.createEventObject){value=f.fireEvent("on"+name,e);}else{throw new Error("Cannot dispatch event "+name);}return value;}requires("browser");requires("event");provides("layout");function LayoutController(){this.mgrs=new Array();this.nmgrs=0;this.height=0;this.add=LayoutController_add;this.remove=LayoutController_remove;this.update=LayoutController_update;this.ontimer=LayoutController_ontimer;this.onscroll=LayoutController_onscroll;}function LayoutController_add(obj){this.mgrs[this.nmgrs++]=obj;obj.update();return obj;}function LayoutController_remove(id){var i=0;while(i<this.nmgrs){if(this.mgrs[i].id==id){this.mgrs.splice(i,1);this.nmgrs--;}else{i++;}}}function LayoutController_update(){for(var i=0;i<this.nmgrs;i++){this.mgrs[i].update();}this.height=offset_height(document.body);}function LayoutController_ontimer(){if(this.height!=offset_height(document.body)){this.update();}}function LayoutController_onscroll(){for(var i=0;i<this.nmgrs;i++){this.mgrs[i].onscroll();}}function Layout(id){var f=$(id);this.id=id;this.element=f;if(f){this.minw=min_width(f);this.maxw=max_width(f);this.minh=min_height(f);this.maxh=max_height(f);}this.update=Layout_update;this.resize=Layout_resize;this.setpos=Layout_setpos;this.offset=Layout_offset;this.onscroll=Layout_onscroll;}function Layout_update(){;}function Layout_onscroll(){;}function Layout_resize(w,h){var f=this.element;if(isset(w)){if(w<this.minw)w=this.minw;if(w>this.maxw)w=this.maxw;}if(isset(h)){if(h<this.minh)h=this.minh;if(h>this.maxh)h=this.maxh;}if(w&&w<0){throw new Error("Invalid width "+w);}if(h&&h<0){throw new Error("Invalid height "+h);}if(f){if(isset(w)){f.style.width=Math.round(w)+"px";}if(isset(h)){f.style.height=Math.round(h)+"px";}}}function Layout_setpos(x,y){if(x<0)x=0;if(y<0)y=0;var f=this.element;if(f){f.style.left=Math.round(x)+"px";f.style.top=Math.round(y)+"px";f.style.position="absolute";}}function Layout_offset(s,w1,w2){var offset=0;var re=new RegExp(/^([-+]?)([0-9]+)([%px]*)$/);var match=re.exec(s);if(match){var offset=parseInt(match[2])||0;if(match[3]=="%"){offset=(offset/100)*w1-(offset/100)*w2;}if(match[1]=="-"){offset=w1-offset-w2;}}return offset;}function StretchLayout(id,minh,maxh){this.parent=Layout;this.parent(id);if(minh)this.minh=minh;if(maxh)this.maxh=maxh;this.update=StretchLayout_update;}function StretchLayout_update(){var f=this.element;if(f){var bottom=offset_height(document.body)-offset_top(f)-offset_height(f);var h=inner_height()-offset_top(f)-bottom;this.resize(null,h);}}function RelativeLayout(id,xoffs,yoffs){this.parent=Layout;this.parent(id);this.xoffs=xoffs;this.yoffs=yoffs;this.update=RelativeLayout_update;}function RelativeLayout_update(){var f=this.element;if(f){var p=f.parentNode;var x=offset_left(p)+this.offset(this.xoffs,offset_width(p),offset_width(f));var y=offset_top(p)+this.offset(this.yoffs,offset_height(p),offset_height(f));this.setpos(x,y);}}function MaxLayout(id){this.parent=Layout;this.parent(id);this.update=MaxLayout_update;}function MaxLayout_update(){this.setpos(0,0);this.resize(scroll_width(),scroll_height());}function FloatLayout(id,xoffs,yoffs){this.parent=Layout;this.parent(id);this.update=FloatLayout_update;this.onscroll=FloatLayout_onscroll;if(!xoffs)xoffs="50%";this.xoffs=xoffs;if(!yoffs)yoffs="50%";this.yoffs=yoffs;}function FloatLayout_update(){var f=this.element;if(f){var x=scroll_left()+this.offset(this.xoffs,inner_width(),offset_width(f));var y=scroll_top()+this.offset(this.yoffs,inner_height(),offset_height(f));this.setpos(x,y);}}function FloatLayout_onscroll(){this.update();}function StackLayout(id){this.parent=Layout;this.parent(id);this.update=StackLayout_update;var f=this.element;f.style.position="relative";f.style.overflow="hidden";this.children=new Array();for(var i=0;i<f.childNodes.length;i++){var p=f.childNodes[i];var type=p.nodeName.toUpperCase();if(type=="IMG"||type=="DIV"||type=="A"){p.style.position="absolute";p.style.left=padding_left(f)+"px";p.style.top=padding_top(f)+"px";p.xminWidth=min_width(p)+"px";p.xminHeight=min_height(p)+"px";this.children[this.children.length]=p;}}}function StackLayout_update(){var f=this.element;for(var i=0;i<this.children.length;i++){var p=this.children[i];p.style.minWidth=p.xminWidth;p.style.minHeight=p.xminHeight;}var t;var w=min_width(f);var h=min_height(f);for(var i=0;i<this.children.length;i++){var p=this.children[i];w=Math.max(w,offset_width(p));h=Math.max(h,offset_height(p));}if(w>max_width(f))w=max_width(f);if(h>max_height(f))h=max_height(f);this.resize(w,h);for(var i=0;i<this.children.length;i++){var p=this.children[i];var wt=w-padding_left(p)-padding_right(p)-border_left(p)-border_right(p);var ht=h-padding_top(p)-padding_bottom(p)-border_top(p)-border_bottom(p);p.style.minWidth=wt+"px";p.style.minHeight=ht+"px";}}var layout=new LayoutController();onresize_handler(function(){layout.update();});onscroll_handler(function(){layout.onscroll();});window.setInterval(function(){layout.ontimer();},1000);api_version(3);requires("browser");requires("html");requires("event");requires("layout");provides("slideshow");var slideshow_last=new Date();var slideshow_idle_delay=50;var slideshow_show_delay=12;function Slideshow(id){var container=$(id);if(container){var slidetime=arguments[1]?arguments[1]:3;var holdtime=arguments[2]?arguments[2]:6;var frequency=arguments[3]?arguments[3]:20;var animtype=arguments[4]?arguments[4]:"meta";this.id=id;this.frequency=frequency;this.frames=new Array();this.curframe=0;this.nextframe=1;this.nextframe2=-1;this.selframe=-1;this.phase=100;this.stepsize=100/slidetime/frequency;this.delay=holdtime*frequency;this.extradelay=0;this.curdelay=this.delay;this.container=container;this.animtype=animtype;this.reset=1;this.animate=Slideshow_animate;this.randomize=Slideshow_randomize;this.show=Slideshow_show;this.jump=Slideshow_jump;this.select=Slideshow_select;this.init=Slideshow_init;this.find=Slideshow_find;this.erase=Slideshow_erase;for(var i=0;i<container.childNodes.length;i++){var p=container.childNodes[i];var type=p.nodeName.toUpperCase();if(type=="IMG"||type=="DIV"||type=="A"){var j=this.frames.length;this.frames[j]=p;this.frames[j].ssinit=0;this.frames[j].links=new Array();}}var base=window.location.host.toLowerCase();var links=$$("a");for(var i=0;i<links.length;i++){var protocol="";if(links[i].href){protocol=links[i].protocol.toLowerCase().replace(/:$/g,'');}var domain="";if(links[i].href){domain=links[i].host.toLowerCase().replace(/:[0-9]*$/g,'');}var anchor="";if(links[i].href){anchor=links[i].hash.substring(1);}if((protocol=="http"||protocol=="https")&&domain==base&&anchor){for(var j=0;j<this.frames.length;j++){if(this.frames[j].id==anchor){var arr=this.frames[j].links;arr[arr.length]=links[i];links[i].slideshow=this;links[i].frame=this.frames[j];links[i].onclick=function(e){stop_propagation(e);return this.slideshow.show(this.frame);};links[i].onmouseover=function(){return this.slideshow.show(this.frame);};}}}}container.slideshow=this;window.setInterval(function(){var container=$(id);if(container&&container.slideshow){container.slideshow.animate();}},1000/frequency);set_style(container,{position:"relative",display:"block"});layout.add(new StackLayout(id));}}function Slideshow_show(i){i=this.find(i);if(i>=0){if(this.curdelay<=0){if(this.nextframe!=i){this.nextframe2=i;}}else{if(this.curframe!=i){this.curdelay=1;this.nextframe=i;}}this.extradelay=slideshow_show_delay*this.frequency;}return false;}function Slideshow_jump(i){i=this.find(i);if(i>=0){this.phase=100;this.curframe=i;this.nextframe=(i+1)%this.frames.length;this.nextframe2=-1;this.curdelay=this.delay;this.reset=1;}return false;}function Slideshow_find(id){if(id.constructor==Number){if(0<=id&&id<this.frames.length){return id;}}else if(id.constructor==String){for(var i=0;i<this.frames.length;i++){if(this.frames[i].id==id){return i;}}}else{for(var i=0;i<this.frames.length;i++){if(this.frames[i]==id){return i;}}}return-1;}function Slideshow_erase(i){i=this.find(i);if(i>=0){set_style(this.frames[i],{zIndex:"-1",position:"absolute"});set_opacity(this.frames[i],0);for(var j=0;j<this.frames[i].links.length;j++){remove_class(this.frames[i].links[j],"selected");}this.frames.splice(i,1);if(this.curframe==i)this.curframe=0;if(this.curframe>i)this.curframe--;this.nextframe=(this.curframe+1)%this.frames.length;this.nextframe2=-1;}}function Slideshow_select(i){if(i!=this.selframe){for(var j=0;j<this.frames.length;j++){for(var k=0;k<this.frames[j].links.length;k++){remove_class(this.frames[j].links[k],"selected");}}for(var k=0;k<this.frames[i].links.length;k++){add_class(this.frames[i].links[k],"selected");}this.selframe=i;}}function Slideshow_animate(){if(this.curdelay<=0&&this.frames.length>1){var p=this.curframe;var q=this.nextframe;if(!this.frames[q].ssinit){this.init(q);}var view1=scroll_top();var view2=view1+inner_height();var y1=offset_top(this.frames[this.curframe]);var y2=y1+offset_height(this.frames[this.curframe]);if(y2<view1||view2<y1){this.phase=0;}var phase=this.phase-this.stepsize;this.phase=phase;if(phase<=0){phase=0;}var opa;switch(this.animtype){case "flash":opa=Math.round(50+Math.sin(phase/50*Math.PI+Math.PI/2)*50);if(phase>50){set_opacity(this.frames[p],opa);this.frames[p].style.zIndex=1002;set_opacity(this.frames[q],0);this.frames[q].style.zIndex=-1;}else{set_opacity(this.frames[p],0);this.frames[p].style.zIndex=-1;set_opacity(this.frames[q],opa);this.frames[q].style.zIndex=1002;}break;case "jump":phase=0;case "meta":default:opa=Math.round(50-Math.cos(phase/100*Math.PI)*50);set_opacity(this.frames[p],opa);this.frames[p].style.zIndex=1002;set_opacity(this.frames[q],100);this.frames[q].style.zIndex=1001;}if(phase<=0){set_opacity(this.frames[p],0);this.frames[p].style.zIndex=-1;}if(this.selframe!=q){this.select(q);}if(phase<=0){this.phase=100;this.curframe=q;this.nextframe=(q+1)%this.frames.length;this.curdelay=this.delay+this.extradelay;this.extradelay=0;this.reset=1;if(this.nextframe2>=0){this.nextframe=this.nextframe2;this.nextframe2=-1;this.curdelay=1;}}}else{this.curdelay--;this.extradelay=0;if(this.reset){this.init(this.curframe);for(var j=0;j<this.frames.length;j++){if(j!=this.curframe){set_style(this.frames[j],{zIndex:"-1",position:"absolute"});set_opacity(this.frames[j],0);}}set_style(this.frames[this.curframe],{display:"block",zIndex:1002});set_opacity(this.frames[this.curframe],100);this.select(this.curframe);this.reset=0;}if(this.curdelay<=0){var now=new Date();if(now.valueOf()-slideshow_last.valueOf()<slideshow_idle_delay){this.curdelay=1;}}}}function Slideshow_init(q){if(!this.frames[q]){throw new Error("Invalid frame "+q);}if(!this.frames[q].ssinit){set_style(this.frames[q],{display:"block",zIndex:-1});set_opacity(this.frames[q],0);var imgs=$$("img",this.frames[q]);for(var i=0;i<imgs.length;i++){var p=imgs[i];dispatch_event(p,"mouseover");}this.frames[q].ssinit=1;}}function Slideshow_randomize(){var oframes=this.frames;this.frames=new Array();while(oframes.length>0){var i=Math.floor(Math.random()*oframes.length);this.frames[this.frames.length]=oframes[i];oframes.splice(i,1);}this.jump(0);}onmousemove_handler(function(){slideshow_last=new Date();});var autoslideshow1=new Slideshow("autoslideshow1",3,10,20,"meta");if(autoslideshow1.randomize){autoslideshow1.randomize();}var autoslideshow2=new Slideshow("autoslideshow2",2,10,20,"meta");var autoslideshow3=new Slideshow("autoslideshow3",1.0,10,20,"flash");if(autoslideshow3.randomize){autoslideshow3.randomize();}var autoslideshow4=new Slideshow("autoslideshow4",0.5,10,20,"flash");api_version(3);provides("menu");requires("browser");var menu_timer=null;var menu_cur_button=null;var menu_close_delay=500;function Menubar(id){var container=$(id);if(container){this.container=container;this.nbuttons=0;this.buttons=new Array();for(var i=0;i<container.childNodes.length;i++){var node=container.childNodes[i];var type=node.nodeName.toUpperCase();if(type=="LI"){this.buttons[this.nbuttons++]=new Menubutton(node);}}}}function Menubutton(id){var container=$(id);if(container){this.submenu=null;this.container=container;this.open=Menubutton_open;this.close=Menubutton_close;this.close_immediately=Menubutton_close_immediately;container.focused=0;container.menubutton=this;container.submenu=null;container.onmouseover=function(){this.focused=1;this.menubutton.open();};container.onmouseout=function(){this.focused=0;this.menubutton.close();};for(var i=0;i<container.childNodes.length;i++){var node=container.childNodes[i];var type=node.nodeName.toUpperCase();if(type=="UL"){container.submenu=node;this.submenu=node;node.style.position="absolute";node.style.left="-2000px";node.style.display="block";node.style.zIndex=30000;node.menubutton=this;node.focused=0;node.onmouseover=function(){this.focused=1;};node.onmouseout=function(){this.focused=0;this.menubutton.close();};break;}}var links=$$("a",container);for(var i in links){var node=links[i];if(node.href!=""&&!node.onclick){node.menubutton=this;node.onclick=function(){this.menubutton.close_immediately();return true;};}}}}function Menubutton_open(){if(menu_timer){window.clearTimeout(menu_timer);menu_timer=null;if(menu_cur_button&&menu_cur_button!=this){menu_cur_button.close_immediately();}}if(this.submenu){var x=offset_left(this.submenu.parentNode);if(x+offset_width(this.submenu)>inner_width()){x=inner_width()-offset_width(this.submenu)-5;}if(x<0){x=0;}this.submenu.style.left=x+"px";}}function Menubutton_close(){if(this.submenu&&this.container.focused==0&&this.submenu.focused==0){if(!menu_timer){menu_cur_button=this;menu_timer=window.setTimeout(function(){if(menu_cur_button){menu_cur_button.close_immediately();}menu_timer=null;},menu_close_delay);}else{this.close_immediately();}}}function Menubutton_close_immediately(){if(this.submenu){this.submenu.style.left="-2000px";this.submenu.focused=0;}menu_cur_button=null;this.focused=0;}var automenu1=new Menubar("automenu1");api_version(3);provides("target");requires("net");function targeted_links(){var base=server_name().toLowerCase();var links=$$("a");for(var i=0;i<links.length;i++){var domain;var protocol;var href=links[i].href;var start=href.indexOf("://");if(start>=0){protocol=href.substring(0,start).toLowerCase();start+=3;}else{start=0;protocol="";}var end=href.indexOf("/",start);if(end<0){end=href.length;}domain=href.substring(start,end).toLowerCase();if((protocol=="http"||protocol=="https")&&domain!=base&&!links[i].target){links[i].setAttribute("target","_blank");}}}onload_handler(function(){targeted_links();});api_version(3);provides("popup");requires("html");requires("net");requires("layout");requires("browser");requires("event");var popup_frequncy=25;var popup_time=0.4;var popup;var popup_opacity=50;function Popup(){this.phase=0;this.counter=0;this.sx1=this.sy1=this.sx2=this.sy2=0;this.tx1=this.ty1=this.tx2=this.ty2=0;this.timer=null;this.curimg=null;this.images=new Array();this.index=new Array();this.nimages=0;this.open=Popup_open;this.close=Popup_close;this.animate=Popup_animate;this.begin_animation=Popup_begin_animation;this.end_animation=Popup_end_animation;this.animate_frame=Popup_animate_frame;this.animate_show=Popup_animate_show;this.animate_hide=Popup_animate_hide;this.add=Popup_add;this.next=Popup_next;this.prev=Popup_prev;this.visible=Popup_visible;var bg=div({id:"popup_background"});set_style(bg,{display:"none",left:"0",top:"0",position:"absolute"});bg.popup=this;bg.onclick=function(){this.popup.close();};document.body.appendChild(bg);layout.add(new MaxLayout("popup_background"));this.bg=bg;var f=div({id:"popup_frame"});set_style(f,{display:"none",left:"0",top:"0",position:"absolute"});f.popup=this;f.onclick=function(){this.popup.close();};document.body.appendChild(f);this.frame=f;var w=div({id:"popup_window"});set_style(w,{top:"-2000px",left:"-2000px",position:"absolute"});w.popup=this;w.onclick=function(){this.popup.close();};var inner=div({id:"popup_inner"});inner.style.position="relative";w.appendChild(inner);var p1=div({id:"popup_div1"});var p2=div({id:"popup_div2"});var p3=div({id:"popup_div3"});p3.appendChild(p2);p1.appendChild(p3);inner.appendChild(p1);var p4=div({id:"popup_div4"});var p5=div({id:"popup_div5"});var p6=div({id:"popup_div6"});var pa=div({id:"popup_content"});p5.appendChild(pa);p6.appendChild(p5);p4.appendChild(p6);inner.appendChild(p4);var p7=div({id:"popup_div7"});var p8=div({id:"popup_div8"});var p9=div({id:"popup_div9"});p9.appendChild(p8);p7.appendChild(p9);inner.appendChild(p7);var pc=div({id:"popup_close"});pc.popup=this;pc.onclick=function(){this.popup.close();};set_title(pc,"Close Image");pc.appendChild(text("Sulje"));inner.appendChild(pc);var prev=div({id:"popup_prev"});prev.popup=this;prev.onclick=function(e){stop_propagation(e);this.popup.prev();};set_title(prev,"Previous Image");inner.appendChild(prev);var next=div({id:"popup_next"});next.popup=this;next.onclick=function(e){stop_propagation(e);this.popup.next();};set_title(next,"Next Image");inner.appendChild(next);document.body.appendChild(w);this.window=w;var base=domain(server_name()).toLowerCase();var links=$$("a");var count=0;for(m=0;m<links.length;m++){var dom="";if(links[m].href){dom=domain(links[m].hostname).toLowerCase();}var ext="";if(links[m].href){ext=popup_extension(links[m].pathname);}if((ext=="jpg"||ext=="gif"||ext=="png"||ext=="JPG")&&base==dom){this.add(new PopupImage(links[m]));}}if(this.nimages>0){var query_params=new Array();for(var i in this.images){var p=this.images[i];query_params[p.id]=p.filename;}var xml=http_get(ROOT+"popup/getimage.php",query_params);var arr=xml.getElementsByTagName("img");for(var i=0;i<arr.length;i++){var img=arr[i];var id=img.getAttribute("id");var w=parseInt(img.getAttribute("width"))||0;var h=parseInt(img.getAttribute("height"))||0;if(typeof(this.images[id])!="undefined"){this.images[id].size(w,h);}}}}function Popup_add(obj){var i=this.nimages++;obj.number=i;this.images[obj.id]=obj;this.index[i]=obj;}function Popup_next(){if(this.curimg){var i=(this.curimg.number+1)%this.nimages;this.open(this.index[i]);}}function Popup_prev(){if(this.curimg){var i=(this.curimg.number+this.nimages-1)%this.nimages;this.open(this.index[i]);}}function Popup_visible(){return this.curimg!=null;}function Popup_open(obj){var w=this.window;var f=this.frame;var bg=this.bg;var init_visible=this.visible();w.style.top="-2000px";w.style.left="-2000px";this.curimg=obj;if(!init_visible){set_opacity(bg,0);}var p=$("popup_content");if(p){while(p.childNodes.length>=1)p.removeChild(p.firstChild);var title;if(this.nimages>1){title=translate("Image %1 of %2",obj.number+1,this.nimages)+(obj.title?": "+obj.title:"");}else{title=obj.title;}var imgsize=obj.image_dimensions();var img=document.createElement("img");set_attribute(img,{width:imgsize[0],height:imgsize[1],alt:"",src:obj.url});p.appendChild(img);p.appendChild(text(title));p.style.width=imgsize[0]+"px";}var bw=(border_left(f)+border_right(f));var bh=(border_top(f)+border_bottom(f));var pos=obj.thumbnail_dimensions();if(pos[3]<scroll_top()||pos[1]>scroll_top()+inner_height()){window.scrollTo(scroll_left(),(pos[1]+pos[3])/2-inner_height()/2);}this.sx1=pos[0];this.sy1=pos[1];this.sx2=pos[2]-bw;this.sy2=pos[3]-bh;this.tx1=scroll_left()+inner_width()/2-offset_width(w)/2;if(this.tx1+offset_width(w)>scroll_left()+inner_width()){this.tx1=inner_width()-offset_width(w)-20;}if(this.tx1<scroll_left())this.tx1=scroll_left();this.ty1=scroll_top()+inner_height()/2-offset_height(w)/2;if(this.ty1+offset_height(w)>scroll_top()+inner_height()){this.ty1=inner_height()-offset_height(w)-20;}if(this.ty1<scroll_top())this.ty1=scroll_top();this.tx2=this.tx1+offset_width(w)-bw;this.ty2=this.ty1+offset_height(w)-bh;var prev=$("popup_prev");var next=$("popup_next");if(this.nimages>1){prev.style.display="block";next.style.display="block";}else{prev.style.display="none";next.style.display="none";}if(!init_visible){this.begin_animation();}else{this.phase=1;}return false;}function Popup_close(){if(this.phase<3){this.phase=3;this.counter=0;this.animate();}return false;}function Popup_begin_animation(){this.phase=0;this.counter=0;if(this.timer){window.clearInterval(this.timer);}this.timer=window.setInterval(function(){var f=$("popup_frame");if(f){f.popup.animate();}},1000/popup_frequncy);this.animate();}function Popup_animate(){switch(this.phase){case 0:this.animate_frame();break;case 1:this.animate_show();break;case 2:break;case 3:this.animate_hide();break;case 4:this.animate_frame();break;default:this.end_animation();}}function Popup_animate_frame(){var w=this.window;var f=this.frame;var bg=this.bg;w.style.top="-2000px";w.style.left="-2000px";bg.style.zIndex=32000;bg.style.display="block";f.style.zIndex=32100;f.style.display="block";var counter=this.counter;counter=counter+100/popup_time/popup_frequncy;if(counter>=100)counter=100;var a=Math.cos(counter/100*Math.PI)*0.5+0.5;var b=1-a;var x1=Math.floor(this.sx1*a+this.tx1*b);var y1=Math.floor(this.sy1*a+this.ty1*b);var x2=Math.ceil(this.sx2*a+this.tx2*b);var y2=Math.ceil(this.sy2*a+this.ty2*b);f.style.left=x1+"px";f.style.top=y1+"px";f.style.width=(x2-x1)+"px";f.style.height=(y2-y1)+"px";if(counter>=100){this.phase++;counter=0;}this.counter=counter;}function Popup_animate_show(){var w=this.window;var f=this.frame;var bg=this.bg;var counter=this.counter;counter=counter+100/popup_time/popup_frequncy;if(counter>=100)counter=100;set_opacity(bg,popup_opacity);bg.style.zIndex=32000;bg.style.display="block";f.style.left=this.sx1+"px";f.style.top=this.sy1+"px";f.style.width=(this.sx2-this.sx1)+"px";f.style.height=(this.sy2-this.sy1)+"px";f.style.zIndex=32050;f.style.display="block";w.style.left=this.tx1+"px";w.style.top=this.ty1+"px";w.style.zIndex=32100;if(counter>=100){counter=0;this.phase++;}this.counter=counter;}function Popup_animate_hide(){var w=this.window;var f=this.frame;var bg=this.bg;set_opacity(bg,0);w.style.top="-2000px";w.style.left="-2000px";this.sx1=this.tx1;this.sy1=this.ty1;this.sx2=this.tx2;this.sy2=this.ty2;var initpos=this.curimg.thumbnail_dimensions();this.tx1=initpos[0];this.ty1=initpos[1];this.tx2=initpos[2]-(border_left(f)+border_right(f));this.ty2=initpos[3]-(border_top(f)+border_bottom(f));this.counter=0;this.phase++;}function Popup_end_animation(){var f=this.frame;var bg=this.bg;var w=this.window;if(this.timer){window.clearInterval(this.timer);this.timer=null;}f.style.display="none";bg.style.display="none";w.style.top="-2000px";w.style.left="-2000px";this.curimg=null;}function PopupImage(obj){var img=null;for(var i=0;i<obj.childNodes.length;i++){var type=obj.childNodes[i].nodeName.toUpperCase();if(type=="IMG"){img=obj.childNodes[i];break;}}if(obj.id){id=obj.id;}else{id=generate_identifier("pop");}this.id=id;this.link_element=obj;this.url=obj.href;this.filename=popup_file(obj.pathname);this.thumbnail=img;this.title=obj.title;if(img&&img.title)this.title=img.title;this.width=-1;this.height=-1;this.size=PopupImage_size;this.open=PopupImage_open;this.image_dimensions=PopupImage_image_dimensions;this.thumbnail_dimensions=PopupImage_thumbnail_dimensions;obj.id=id;obj.popup=this;obj.onclick=function(){if(this.popup.width>=0&&this.popup.height>=0){return this.popup.open();}else{return true;}};}function PopupImage_image_dimensions(){if(this.width<0||this.height<0){throw new Error("PopupImage not initialized");}return new Array(this.width,this.height);}function PopupImage_thumbnail_dimensions(){var obj;if(this.thumbnail){obj=this.thumbnail;}else{obj=this.link_element;}var x1=offset_left(obj);var y1=offset_top(obj);var x2=x1+offset_width(obj);var y2=y1+offset_height(obj);return new Array(x1,y1,x2,y2);}function PopupImage_size(w,h){this.width=w;this.height=h;}function PopupImage_open(){popup.open(this);return false;}function popup_extension(base){var pos=base.lastIndexOf(".");if(pos>=0){return base.substr(pos+1);}else{return "";}}function popup_file(path){var part=window.location.pathname.split(/[\/\\]/);var i=part.length-1;var j=0;while(ROOT.substring(j,3)=="../"){i--;j+=3;}var dir="";for(var k=0;k<i;k++){dir+=part[k]+"/";}if(path.substr(0,dir.length)==dir){return path.substr(dir.length);}else{throw new Error("Invalid path "+path+" ("+dir+")");}}var popup=null;onload_handler(function(){popup=new Popup();});api_version(3);provides("counter");requires("cookie");requires("event");requires("request");requires("html");var counter_inhib;if(!counter_inhib)counter_inhib=0;function update_count(cnt){var f=$("counter");while(f.childNodes.length>=1)f.removeChild(f.firstChild);for(var i=0;i<cnt.length;i++){var c=cnt.substr(i,1);if("0"<=c&&c<="9"){f.appendChild(div({className:"counter"+c}));}}var cl=div();set_style(cl,{clear:"both"});f.appendChild(cl);}function init_counter(){var add=0;if(counter_inhib==0&&!getcookie("counter")){add=1;}var display=0;if($("counter")){display=1;}var vars=new Array();if(add){vars["add"]=Math.random();}var cnt=null;if(add||display){cnt=http_get(ROOT+"counter/addcount.php",vars);}if(display&&cnt){update_count(cnt);}if(add){setcookie("counter","1",null,"/");}}onload_handler(function(){init_counter();});
