Kotisivukone={popup:function(b,c,a){var d=window.open(b,name,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+c+", height="+a);d.focus();return false;}};function init(){if(window.initEdit!=null){initEdit();Initialize.checkContentWidth("content_view");}else{Initialize.checkContentWidth("content");}if(window.stateFunction!=null){stateFunction();}if(window.pageInit!=null){pageInit();}}Initialize={checkContentWidth:function(f){if(document.getElementById&&document.getElementById(f)){var d=document.getElementById(f);var g=d.innerHTML;if(window.disableWidthCheckIfScripts!=null&&window.disableWidthCheckIfScripts!=undefined&&window.disableWidthCheckIfScripts==true&&g.indexOf("script")!=-1){return;}if(window.disableWidthCheck!=null&&window.disableWidthCheck!=undefined&&window.disableWidthCheck==true){return;}var b=40;if(window.decreaseWidthBy!=null&&window.decreaseWidthBy!=undefined&&window.decreaseWidthBy>0){b=window.decreaseWidthBy;}var e=0;if(window.XMLHttpRequest){e=d.offsetWidth;}else{d.innerHTML="";var e=d.offsetWidth;d.innerHTML=g;}if(e>100){var a=document.getElementById(f).getElementsByTagName("img");for(var c=0;c<a.length;c++){if(a[c].offsetWidth>e){a[c].style.width=(e-b)+"px";}}a=document.getElementById(f).getElementsByTagName("table");for(var c=0;c<a.length;c++){if(a[c].offsetWidth>e){a[c].style.width=(e-b)+"px";}}}}}};menu=function(){if(document.getElementById&&document.getElementById("navi")){var a=document.getElementById("navi").getElementsByTagName("LI");for(var b=0;b<a.length;b++){a[b].onmouseover=function(){this.className+=" hover";};a[b].onmouseout=function(){this.className=this.className.replace(new RegExp(" hover\\b"),"");};}}};if(window.attachEvent){window.attachEvent("onload",menu);}function swapImage(b,a){if(document.getElementById&&document.getElementById(b)){document.getElementById(b).src=a;}}function popUpImage(d,b,a){if(document.getElementById&&document.getElementById(d)){var c=window.open(document.getElementById(d).src,"image","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+b+", height="+a);c.focus();return false;}}function popup(a){var b=window.open(a,"kotisivukone_popup","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=250, height=300");b.focus();return false;}function changeCalendarDate(b,h,e,c,g,a,d,f){new Ajax.Updater(d,a+"?ajax",{parameters:"resource=calendar_block_change_date&action="+e+"&year="+c+"&month="+g+"&subset="+f+"&pageid="+b+"&hash="+h+"&page_root_url="+a,asynchronous:true,evalScripts:true});}function positionLogo(){var b=findPosX(document.getElementById("top-bar"));var a=findPosY(document.getElementById("top-bar"));$("logo").style.left=(logo_position_x+b)+"px";$("logo").style.top=(logo_position_y+a)+"px";$("logo_text").style.left=(logo_text_position_x+b)+"px";$("logo_text").style.top=(logo_text_position_y+a)+"px";}function findPosX(a){var b=0;if(a.offsetParent){while(1){b+=a.offsetLeft;if(!a.offsetParent){break;}a=a.offsetParent;}}else{if(a.x){b+=a.x;}}return b;}function findPosY(b){var a=0;if(b.offsetParent){while(1){a+=b.offsetTop;if(!b.offsetParent){break;}b=b.offsetParent;}}else{if(b.y){a+=b.y;}}return a;}function go(a){window.location=a;}function albumModernImproveBoxHeight(a){$(a).select(".album_image_modern_borders").each(function(b){b.style.height=b.offsetWidth+"px";b.select("img").each(function(c){c.style.maxHeight="89%";});if(b.up().className.indexOf("album_modern_right_bar_sizer")==-1){b.up().style.height=b.offsetWidth+35+"px";}});}function URLDecode(b){var a=/\+/g;return unescape(String(b).replace(a," "));}shareData={prepareImage:function(c,h,f,e,g){var d;if(e!=null&&typeof(e)!="undefined"&&e){d=$("madpages_content").select(".madpages_component img.madpages_image ").first();}else{d=$("content").select(".content_table img").first();}if(d!=null){var a=d.src;if(e!=null&&typeof(e)!="undefined"&&e){a=d.getAttribute("data-src-orig");}a=a.substring(a.indexOf("/files"),a.length);thumbUrl=a;var b=thumbUrl.substring(thumbUrl.lastIndexOf("."));thumbUrl=thumbUrl.replace(b,"_50x50"+b);b=thumbUrl.substring(0,thumbUrl.lastIndexOf("/"));thumbUrl=thumbUrl.replace(b,b+"/.thumbs");var i="/Kotisivukone/app/thumbnail?waitfor=false&height=50&width=50&img="+a+"&hash="+h+"&id="+c;var d=new Element("img");$(f).insert(d);d.src=i;}else{switch(g){case"blog":thumbUrl=root_img+"www/pics/social_network/icon_blog.png";break;case"news":thumbUrl=root_img+"www/pics/social_network/icon_news.png";break;case"madpages":thumbUrl=root_img+"www/pics/social_network/icon_sites.png";break;case"page":thumbUrl=root_img+"www/pics/social_network/icon_sites.png";break;default:thumbUrl="";break;}}this.initImage(thumbUrl);},initUrl:function(a){if($("url_meta")!=null){$("url_meta").content=a;}else{document.getElementsByTagName("head").item(0).appendChild(new Element("meta",{property:"og:url",id:"url_meta",content:a}));}$$("a[class^=addthis_button]").each(function(b){b.setAttribute("addthis:url",a);});},initImage:function(a){if($("facebook_image")!=null){$("facebook_image").href=a;}else{document.getElementsByTagName("head").item(0).appendChild(new Element("link",{rel:"image_src",id:"facebook_image",href:a}));}if($("image_meta")!=null){$("image_meta").content=a;}else{document.getElementsByTagName("head").item(0).appendChild(new Element("meta",{property:"og:image",id:"image_meta",content:a}));}}};
