/*
 * 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;var TRANSLATIONS={"FI":new Array()};var ROOT;if(!ROOT)ROOT="";var LANG;if(!LANG)LANG="fi";var COUNTRY;if(!COUNTRY)COUNTRY="FI";var PROVIDED=new Array();var CHARSET="ISO-8859-1";function api_version(require){if(require&&(Math.floor(CMSAPI)!=Math.floor(require)||CMSAPI<require)){throw new Error("Invalid API version");}return CMSAPI;}function defined(v){return typeof(window[v])!="undefined";}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+=escape(t.substr(i,start-i));i=start;}else{out+=escape(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+=escape(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 $(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";}}function is_identifier(id){return id.match(/^[_a-z][_a-z0-9]*$/i)&&id.length<64;}provides("html");function h1(title){var f=document.createElement("h1");if(title){var data=translate.apply(this,arguments);f.appendChild(document.createTextNode(unescape(data)));}return f;}function h2(title){var f=document.createElement("h2");if(title){var data=translate.apply(this,arguments);f.appendChild(document.createTextNode(unescape(data)));}return f;}function para(str){var f=document.createElement("p");if(str){var data=translate.apply(this,arguments);f.appendChild(document.createTextNode(unescape(data)));}return f;}function div(attrs){var f=document.createElement("div");set_attribute(f,attrs);return f;}function anchor(href,title){var textnode;if(title){var args=Array.prototype.slice.call(arguments);textnode=text.apply(this,args.slice(1));}else{textnode=text(href);}var f=document.createElement("a");set_attribute(f,{href:href});f.appendChild(textnode);return f;}function text(str){var data=translate.apply(this,arguments);return document.createTextNode(unescape(data));}function set_style(f,styles){for(var key in styles){f.style[key]=styles[key];}}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 "className":f[key]=value;break;default:throw new Error("Invalid attribute "+key);}}}function set_opacity(f,x){if(0<=x&&x<=100){f.style.opacity=(x/100).toString();f.style.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:unescape(title)});}function set_class(f,classname){f.className=trim(classname);}function add_class(f,classname){if(!in_class(f,classname)){f.className=trim(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];}}f.className=trim(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;}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();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 client_left(f){var x=0;if(f.offsetParent){x=f.offsetLeft;while(f=f.offsetParent){x+=f.offsetLeft;}}return x;}function client_top(f){var y=0;if(f.offsetParent){y=f.offsetTop;while(f=f.offsetParent){y+=f.offsetTop;}}return y;}function 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 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 winwidth(){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 winheight(){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 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,winwidth());return w;}function _scroll_width(f,w){var x=client_left(f)+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(winheight(),document.body.scrollHeight+margin_top(document.body)+margin_bottom(document.body));}function margin_top(f){return parseInt(get_css(f,"margin-top"))||0;}function margin_bottom(f){return parseInt(get_css(f,"margin-bottom"))||0;}function margin_left(f){return parseInt(get_css(f,"margin-left"))||0;}function margin_right(f){return parseInt(get_css(f,"margin-right"))||0;}function border_top(f){return parseInt(get_css(f,"border-top-width"))||0;}function border_bottom(f){return parseInt(get_css(f,"border-bottom-width"))||0;}function border_left(f){return parseInt(get_css(f,"border-left-width"))||0;}function border_right(f){return parseInt(get_css(f,"border-right-width"))||0;}function padding_top(f){return parseInt(get_css(f,"padding-top"))||0;}function padding_bottom(f){return parseInt(get_css(f,"padding-bottom"))||0;}function padding_left(f){return parseInt(get_css(f,"padding-left"))||0;}function padding_right(f){return parseInt(get_css(f,"padding-right"))||0;}function min_width(f){var w=parseInt(get_css(f,"min-width"))||0;return w>0?w:0;}function max_width(f){var w=parseInt(get_css(f,"max-width"))||1920;return w>0?w:1920;}function min_height(f){var h=parseInt(get_css(f,"min-height"))||0;return h>0?h:0;}function max_height(f){var h=parseInt(get_css(f,"max-height"))||999999;return h>0?h:999999;}function get_css(f,prop){var w=0;if(f.currentStyle){var propName=prop;while(1){var i=propName.indexOf("-");if(i>=0){propName=propName.substr(0,i)+propName.substr(i+1,1).toUpperCase()+propName.substr(i+2);}else{break;}}w=f.currentStyle[propName];}else if(window.getComputedStyle&&f.style){w=document.defaultView.getComputedStyle(f,null).getPropertyValue(prop);}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=match[1];month=match[2];day=match[3];}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 "e":output+=day;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 offset_days(n,t){var msecs=24*60*60*1000;if(t==null){t=new Date();}var r=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0,0);r.setTime(r.getTime()+n*msecs+msecs/4);r.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return r;}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]);TRANSLATIONS[from]=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 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 add_handler(id,f){if(window.addEventListener){window.addEventListener(id,f,false);}else if(window.attachEvent){window.attachEvent("on"+id,f);}}function stop_propagation(e){if(!e)e=window.event;e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();}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=height(document.body);}function LayoutController_ontimer(){if(this.height!=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(w){if(w<this.minw)w=this.minw;if(w>this.maxw)w=this.maxw;}if(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(w){f.style.width=Math.round(w)+"px";}if(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=height(document.body)-client_top(f)-height(f);var h=winheight()-client_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=client_left(p)+this.offset(this.xoffs,width(p),width(f));var y=client_top(p)+this.offset(this.yoffs,height(p),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,winwidth(),width(f));var y=scroll_top()+this.offset(this.yoffs,winheight(),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,width(p));h=Math.max(h,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=1000;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.nframes=0;this.frames=new Array();this.links=new Array();this.curframe=0;this.nextframe=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.animate=Slideshow_animate;this.randomize=Slideshow_randomize;this.show=Slideshow_show;this.jump=Slideshow_jump;this.select=Slideshow_select;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.nframes++;this.frames[j]=p;this.links[j]=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.nframes;j++){if(this.frames[j].id==anchor){var arr=this.links[j];arr[arr.length]=links[i];links[i].slideshow=this;links[i].frame=j;links[i].onclick=function(){return this.slideshow.show(this.frame);};links[i].onmouseover=function(){return this.slideshow.show(this.frame);};}}}}this.jump(0);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){if(0<=i&&i<this.nframes){if(this.curdelay<=0){if(this.nextframe!=i){this.jump(i);}}else{if(this.curframe!=i){this.curdelay=0;this.nextframe=i;this.phase=100;this.animate();}}}this.extradelay=slideshow_show_delay*this.frequency;return false;}function Slideshow_jump(i){if(0<=i&&i<this.nframes){this.phase=100;this.curframe=i;this.curdelay=this.delay;for(var j=0;j<this.nframes;j++){set_style(this.frames[j],{zIndex:"-1",position:"absolute"});set_opacity(this.frames[j],0);}set_opacity(this.frames[i],100);this.frames[i].style.zIndex=1002;this.select(i);}return false;}function Slideshow_select(i){if(i!=this.selframe){for(var j=0;j<this.nframes;j++){for(var k=0;k<this.links[j].length;k++){remove_class(this.links[j][k],"selected");}}for(var k=0;k<this.links[i].length;k++){add_class(this.links[i][k],"selected");}this.selframe=i;}}function Slideshow_animate(){if(this.curdelay<=0){var p=this.curframe;var q=this.nextframe;var view1=scroll_top();var view2=view1+winheight();var y1=client_top(this.frames[this.curframe]);var y2=y1+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.curdelay=this.delay+this.extradelay;this.extradelay=0;}}else{this.curdelay--;this.extradelay=0;this.nextframe=(this.curframe+1)%this.nframes;if(this.curdelay<=0){var now=new Date();if(now.valueOf()-slideshow_last.valueOf()<slideshow_idle_delay){this.curdelay=1;}}}}function Slideshow_randomize(){var oframes=this.frames;this.frames=new Array();var n=this.nframes;while(n>0){var i=Math.floor(Math.random()*n);this.frames[this.frames.length]=oframes[i];oframes.splice(i,1);n--;}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.6,10,20,"flash");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);requires("browser");provides("autoscroll");var autoscroll_timer=null;var autoscroll_y1=0;var autoscroll_y2=0;function autoscroll(id){var f=$(id);if(f){return autoscroll_to(client_top(f));}else{return true;}}function autoscroll_to(y){if(y+winheight()>height(document.body)){y=height(document.body)-winheight();}if(autoscroll_timer){window.clearInterval(autoscroll_timer);}autoscroll_y1=scroll_top();autoscroll_y2=y;autoscroll_timer=window.setInterval(function(){autoscroll_update();},20);autoscroll_update();autoscroll_update();autoscroll_update();return false;}function autoscroll_update(){var cy=scroll_top();var y1=autoscroll_y1;var y2=autoscroll_y2;var d;var max=100;var min=2;if(y1<y2){d=Math.sin(3.14*(cy-y1)/(y2-y1))*(y2-y1)/10;if(d<min){d=min;}if(d>max){d=max;}if(cy+d>y2){d=y2-cy;}}else{d=Math.sin(3.14*(cy-y2)/(y1-y2))*(y2-y1)/10;if(d>-min){d=-min;}if(d<-max){d=-max;}if(cy+d<y2){d=y2-cy;}}window.scrollBy(0,Math.round(d));if(Math.abs(cy-y2)<min||scroll_top()==cy){window.clearInterval(autoscroll_timer);autoscroll_timer=null;}}function autoscroll_links(){var pageurl=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search;var elems=$$("a");for(var i=0;i<elems.length;++i){var url=elems[i].href;var base;var id;var j=url.indexOf("#");if(j>=0){base=url.substr(0,j);id=url.substr(j+1);}else{base=url;id="";}if(id!=""&&pageurl==base&&!elems[i].onclick){elems[i].autoscroll_id=id;elems[i].onclick=function(){return autoscroll(this.autoscroll_id);};}}}onload_handler(function(){autoscroll_links();});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(count){var f=$("counter");while(f.childNodes.length>=1)f.removeChild(f.firstChild);for(var i=0;i<count.length;i++){var c=count.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 count=null;if(add||display){count=http_get(ROOT+"counter/addcount.php",vars);}if(display&&count){update_count(count);}if(add){setcookie("counter","1",null,"/");}}onload_handler(function(){init_counter();});
