var Hyphenator=function(){var I="cs, da, bn, de, en, es, fi, fr, gu, hi, hu, it, kn, ml, nl, or, pa, pl, pt, ru, sv, ta, te, tr, uk",y=function(){for(var b,a=0,d=I.split(", "),c={};b=d[a++];)c[b]=true;return c}(),z={cs:"Jazyk t\u00e9to internetov\u00e9 str\u00e1nky nebyl automaticky rozpozn\u00e1n. Ur\u010dete pros\u00edm jej\u00ed jazyk:",da:"Denne websides sprog kunne ikke bestemmes. Angiv venligst sprog:",de:"Die Sprache dieser Webseite konnte nicht automatisch bestimmt werden. Bitte Sprache angeben:",
en:"The language of this website could not be determined automatically. Please indicate the main language:",es:"El idioma del sitio no pudo determinarse autom%E1ticamente. Por favor, indique el idioma principal:",fi:"Sivun kielt%E4 ei tunnistettu automaattisesti. M%E4%E4rit%E4 sivun p%E4%E4kieli:",fr:"La langue de ce site n%u2019a pas pu %EAtre d%E9termin%E9e automatiquement. Veuillez indiquer une langue, s.v.p.%A0:",hu:"A weboldal nyelv\u00e9t nem siker\u00fclt automatikusan meg\u00e1llap\u00edtani. K\u00e9rem adja meg a nyelvet:",
it:"Lingua del sito sconosciuta. Indicare una lingua, per favore:",ml:"\u0d08 \u0d35\u0d46%u0D2C%u0D4D%u200C\u0d38\u0d48\u0d31\u0d4d\u0d31\u0d3f\u0d28\u0d4d\u0d31\u0d46 \u0d2d\u0d3e\u0d37 \u0d15\u0d23\u0d4d\u0d1f\u0d41\u0d2a\u0d3f\u0d1f\u0d3f\u0d2f\u0d4d\u0d15\u0d4d\u0d15\u0d3e%u0D28%u0D4D%u200D \u0d15\u0d34\u0d3f\u0d1e\u0d4d\u0d1e\u0d3f\u0d32\u0d4d\u0d32. \u0d2d\u0d3e\u0d37 \u0d0f\u0d24\u0d3e\u0d23\u0d46\u0d28\u0d4d\u0d28\u0d41 \u0d24\u0d3f\u0d30\u0d1e\u0d4d\u0d1e\u0d46\u0d1f\u0d41\u0d15\u0d4d\u0d15\u0d41\u0d15:",
nl:"De taal van deze website kan niet automatisch worden bepaald. Geef de hoofdtaal op:",pt:"A l\u00edngua deste site n\u00e3o p\u00f4de ser determinada automaticamente. Por favor indique a l\u00edngua principal:",ru:"\u042f\u0437\u044b\u043a \u044d\u0442\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438. \u041f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u044f\u0437\u044b\u043a:",
sv:"Spr%E5ket p%E5 den h%E4r webbplatsen kunde inte avg%F6ras automatiskt. V%E4nligen ange:",tr:"Bu web sitesinin dilini otomatik olarak tespit edilememi\u015ftir. L\u00fctfen ana dili g\u00f6sterir:",uk:"\u041c\u043e\u0432\u0430 \u0446\u044c\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0430\u0439\u0442\u0443 \u043d\u0435 \u043c\u043e\u0436\u0435 \u0431\u0443\u0442\u0438 \u0432\u0438\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u043d\u043e. \u0411\u0443\u0434\u044c \u043b\u0430\u0441\u043a\u0430, \u0432\u043a\u0430\u0436\u0456\u0442\u044c \u0433\u043e\u043b\u043e\u0432\u043d\u0443 \u043c\u043e\u0432\u0443:"},
J=function(){for(var b=document.getElementsByTagName("script"),a=0,d,c;d=b[a++];)if(d.src){c=d.src;d=c.indexOf("Hyphenator.js");if(d!==-1)return c.substring(0,d)}return"http://hyphenator.googlecode.com/svn/trunk/"}(),$=function(){var b=false;if(window.location.href.indexOf(J)!==-1)b=true;return b}(),o=false,aa={script:true,code:true,pre:true,img:true,br:true,samp:true,kbd:true,"var":true,abbr:true,acronym:true,sub:true,sup:true,button:true,option:true,label:true,textarea:true},r=true,K=true,L=false,
A="hyphenate",s="donthyphenate",t=6,M=function(){var b=null,a=false,d=document.getElementsByTagName("script"),c,e;c=0;for(e=d.length;c<e;c++){if(d[c].getAttribute("src"))b=d[c].getAttribute("src");if(b)if(b.indexOf("Hyphenator.js?bm=true")!==-1)a=true}return a}(),h=null,p=[],i={},j={},m=0,N="(\\w*://)?((\\w*:)?(\\w*)@)?((([\\d]{1,3}\\.){3}([\\d]{1,3}))|(([\\w]*\\.)+([\\w]{2,4})))(:\\d*)?(/[\\w#!:\\.?\\+=&%@!\\-]*)*",O="[\\w-\\.]+@[\\w\\.]+",P=new RegExp("("+N+")|("+O+")","i"),Q=function(){var b;b=
navigator.userAgent.toLowerCase();return b=b.indexOf("msie 6")===-1?String.fromCharCode(8203):""}();function R(){}function n(b){alert("Hyphenator.js says:\n\nAn Error ocurred:\n"+b.message)}function S(){var b,a=[],d,c;if(document.getElementsByClassName)a=document.getElementsByClassName(A);else{b=document.getElementsByTagName("*");c=b.length;for(d=0;d<c;d++)b[d].className.indexOf(A)!==-1&&b[d].className.indexOf(s)===-1&&a.push(b[d])}return a}var B="hidden",q=String.fromCharCode(173),T=Q,C=function(){var b=
{},a="HyphenatorExpando_"+Math.random(),d=0;return{getDataForElem:function(c){return b[c[a]]},setDataForElem:function(c,e){var f;if(c[a]&&c[a]!=="")f=c[a];else{f=d++;c[a]=f}b[f]=e},appendDataForElem:function(c,e){var f;for(f in e)if(e.hasOwnProperty(f))b[c[a]][f]=e[f]},delDataOfElem:function(c){delete b[c[a]]}}}();function ba(b,a){var d=b.onload;if(o)a();else{function c(){if(!o){o=true;a()}}if(document.addEventListener)document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",
arguments.callee,false);c()},false);else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);c()}});document.documentElement.doScroll&&window==window.top&&function(){if(!o){try{document.documentElement.doScroll("left")}catch(e){setTimeout(arguments.callee,0);return}a()}}()}b.onload=function(){c();typeof d==="function"&&d()}}}function D(b,a){if(b.getAttribute("lang"))return b.getAttribute("lang").substring(0,
2).toLowerCase();try{if(b.getAttribute("xml:lang"))return b.getAttribute("xml:lang").substring(0,2).toLowerCase()}catch(d){}if(b.tagName!=="HTML")return D(b.parentNode,true);if(a)return h;return null}function ca(){var b=document.getElementsByTagName("html")[0],a=document.getElementsByTagName("meta");h=D(b);if(!h)for(b=0;b<a.length;b++){if(a[b].getAttribute("http-equiv")&&a[b].getAttribute("http-equiv")==="content-language")h=a[b].getAttribute("content").substring(0,2).toLowerCase();if(a[b].getAttribute("name")&&
a[b].getAttribute("name")==="DC.language")h=a[b].getAttribute("content").substring(0,2).toLowerCase();if(a[b].getAttribute("name")&&a[b].getAttribute("name")==="language")h=a[b].getAttribute("content").substring(0,2).toLowerCase()}if(!h){b=navigator.language?navigator.language:navigator.userLanguage;b=b.substring(0,2);a=z.hasOwnProperty(b)?z[b]:z.en;a+=" (ISO 639-1)\n\n"+I;a=window.prompt(unescape(a),b).toLowerCase();if(y[a])h=a;else{a=new Error('The language "'+a+'" is not yet supported.');throw a;
}}}function da(){var b,a,d=0;function c(e,f,g){var k=0,l={};if(f&&B==="hidden"){l.hasOwnStyle=e.getAttribute("style")?true:false;l.isHidden=true;e.style.visibility="hidden"}l.language=e.lang&&typeof e.lang==="string"?e.lang.toLowerCase():g?g.toLowerCase():D(e,true);g=l.language;if(y[g])j[g]=true;else n(new Error("Language "+g+" is not yet supported."));C.setDataForElem(e,l);for(p.push(e);f=e.childNodes[k++];)f.nodeType===1&&!aa[f.nodeName.toLowerCase()]&&f.className.indexOf(s)===-1&&!(f in b)&&c(f,
false,g)}if(Hyphenator.isBookmarklet()){b=document.getElementsByTagName("body")[0];c(b,false,h)}else for(b=S();a=b[d++];)c(a,true);if(Hyphenator.languages.hasOwnProperty(h))Hyphenator.languages[h].prepared||(j[h]=true);else j[h]=true;p.length>0&&C.appendDataForElem(p[p.length-1],{isLast:true})}function ea(b){var a,d,c,e,f,g={};c=Hyphenator.languages[b].patterns;for(a in c)if(c.hasOwnProperty(a)){a=parseInt(a,10);for(d=0;e=c[a].substr(d,a);){f=e.replace(/\d/g,"");g[f]=e;d+=a}}Hyphenator.languages[b].patterns=
g;Hyphenator.languages[b].patternsConverted=true}function fa(b){b=b.split(", ");var a={},d,c,e;d=0;for(c=b.length;d<c;d++){e=b[d].replace(/-/g,"");a.hasOwnProperty(e)||(a[e]=b[d])}return a}function ga(b){var a,d;if(y[b]&&!Hyphenator.languages[b]){a=J+"patterns/"+b+".js";if($&&!M){d=null;if(typeof XMLHttpRequest!=="undefined")d=new XMLHttpRequest;if(!d)try{d=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){d=null}if(d){d.open("HEAD",a,false);d.setRequestHeader("Cache-Control","no-cache");d.send(null);
if(d.status===404){n(new Error("Could not load\n"+a));delete j[b];return}}}if(document.createElement){b=document.getElementsByTagName("head").item(0);d=document.createElement("script");d.src=a;d.type="text/javascript";b.appendChild(d)}}}function E(b){var a=Hyphenator.languages[b];if(!a.prepared){if(r)a.cache={};if(a.hasOwnProperty("exceptions")){Hyphenator.addExceptions(b,a.exceptions);delete a.exceptions}if(i.hasOwnProperty("global"))if(i.hasOwnProperty(b))i[b]+=", "+i.global;else i[b]=i.global;
if(i.hasOwnProperty(b)){a.exceptions=fa(i[b]);delete i[b]}else a.exceptions={};ea(b);b="[\\w"+a.specialChars+"@"+String.fromCharCode(173)+"-]{"+t+",}";a.genRegExp=new RegExp("("+N+")|("+O+")|("+b+")","gi");a.prepared=true}}function ha(b){var a,d=true,c;if(K){m=1;for(a in j)if(j.hasOwnProperty(a)){ga(a);d=false}if(d){m=2;b()}else c=window.setInterval(function(){var e=false,f;for(f in j)if(j.hasOwnProperty(f))if(Hyphenator.languages[f]){e=true;delete j[f];E(f)}else{e=false;break}if(e){window.clearInterval(c);
m=2;b()}},100)}else{for(a in Hyphenator.languages)Hyphenator.languages.hasOwnProperty(a)&&E(a);m=2;b()}}function u(b){var a,d,c,e;if(a=document.getElementById("HyphenatorToggleBox"))a.firstChild.data=b?"Hy-phe-na-ti-on":"Hyphenation";else{b=document.getElementsByTagName("body")[0];a=document.createElement("div");d=document.createAttribute("id");d.nodeValue="HyphenatorToggleBox";e=document.createAttribute("class");e.nodeValue=s;c=document.createTextNode("Hy-phe-na-ti-on");a.appendChild(c);a.setAttributeNode(d);
a.setAttributeNode(e);a.onclick=Hyphenator.toggleHyphenation;a.style.position="absolute";a.style.top="0px";a.style.right="0px";a.style.margin="0";a.style.backgroundColor="#AAAAAA";a.style.color="#FFFFFF";a.style.font="6pt Arial";a.style.letterSpacing="0.2em";a.style.padding="3px";a.style.cursor="pointer";a.style.WebkitBorderBottomLeftRadius="4px";a.style.MozBorderRadiusBottomleft="4px";b.appendChild(a)}}function F(b,a){var d=Hyphenator.languages[b],c,e,f,g,k,l,v,G=false,U,w,H,x,V,W;if(a==="")return"";
if(a.indexOf(q)!==-1)return a;if(r&&d.cache.hasOwnProperty(a))return d.cache[a];if(d.exceptions.hasOwnProperty(a))return d.exceptions[a].replace(/-/g,q);if(a.indexOf("-")!==-1){a=a.split("-");c=0;for(d=a.length;c<d;c++)a[c]=F(b,a[c]);return a.join("-")}e="_"+a+"_";f=e.length;b=e.split("");e=e.toLowerCase();g=[];V={"0":true,"1":true,"2":true,"3":true,"4":true,"5":true,"6":true,"7":true,"8":true,"9":true};W=f-d.shortestPattern;for(k=0;k<=W;k++){l=Math.min(f-k,d.longestPattern);for(v=d.shortestPattern;v<=
l;v++)if(d.patterns.hasOwnProperty(c=e.substr(k,v))){G=d.patterns[c];H=1;U=G.length;for(c=0;c<U;c++){w=G.charAt(c);if(V[w]){x=c===0?k-1:k+c-H;if(!g[x]||g[x]<w)g[x]=w;H++}}}}e=0;for(c=d.leftmin;c<=a.length-d.rightmin;c++)if(g[c]&1){b.splice(c+e+1,0,q);e++}c=b.slice(1,-1).join("");if(r)d.cache[a]=c;return c}function X(b){return b.replace(/([:\/\.\?#&_,;!@]+)/gi,"$&"+T)}function ia(b){var a=C.getDataForElem(b),d=a.language,c,e,f;if(Hyphenator.languages.hasOwnProperty(d)){c=function(g){return P.test(g)?
X(g):F(d,g)};for(f=0;e=b.childNodes[f++];)if(e.nodeType===3&&e.data.length>=t)e.data=e.data.replace(Hyphenator.languages[d].genRegExp,c)}if(a.isHidden&&B==="hidden"){b.style.visibility="visible";if(a.hasOwnStyle)if(b.style.removeProperty)b.style.removeProperty("visibility");else b.style.removeAttribute&&b.style.removeAttribute("visibility");else{b.setAttribute("style","");b.removeAttribute("style")}}if(a.isLast){m=3;R()}}function Y(b){var a,d=0,c;switch(q){case "|":a="\\|";break;case "+":a="\\+";
break;case "*":a="\\*";break;default:a=q}for(;c=b.childNodes[d++];)if(c.nodeType===3){c.data=c.data.replace(new RegExp(a,"g"),"");c.data=c.data.replace(new RegExp(Q,"g"),"")}else c.nodeType===1&&Y(c)}function Z(){function b(c,e){return function(){return c(e)}}for(var a=0,d;d=p[a++];)window.setTimeout(b(ia,d),0)}function ja(){for(var b=0,a;a=p[b++];)Y(a);m=4}return{version:"2.4.0",languages:{},config:function(b){function a(c,e){if(typeof b[c]===e)return true;else{n(new Error("Config onError: "+c+" must be of type "+
e));return false}}var d;for(d in b)if(b.hasOwnProperty(d))switch(d){case "classname":if(a("classname","string"))A=b.classname;break;case "donthyphenateclassname":if(a("donthyphenateclassname","string"))s=b.donthyphenateclassname;break;case "minwordlength":if(a("minwordlength","number"))t=b.minwordlength;break;case "hyphenchar":if(a("hyphenchar","string")){if(b.hyphenchar==="&shy;")b.hyphenchar=String.fromCharCode(173);q=b.hyphenchar}break;case "urlhyphenchar":if(b.hasOwnProperty("urlhyphenchar"))if(a("urlhyphenchar",
"string"))T=b.urlhyphenchar;break;case "togglebox":if(a("togglebox","function"))u=b.togglebox;break;case "displaytogglebox":if(a("displaytogglebox","boolean"))L=b.displaytogglebox;break;case "remoteloading":if(a("remoteloading","boolean"))K=b.remoteloading;break;case "enablecache":if(a("enablecache","boolean"))r=b.enablecache;break;case "onhyphenationdonecallback":if(a("onhyphenationdonecallback","function"))R=b.onhyphenationdonecallback;break;case "onerrorhandler":if(a("onerrorhandler","function"))n=
b.onerrorhandler;break;case "intermediatestate":if(a("intermediatestate","string"))B=b.intermediatestate;break;case "selectorfunction":if(a("selectorfunction","function"))S=b.selectorfunction;break;default:n(new Error("Hyphenator.config: property "+d+" not known."))}},run:function(){function b(){try{ca();da();ha(Z);L&&u(true)}catch(a){n(a)}}o||ba(window,b);if(Hyphenator.isBookmarklet()||o)b()},addExceptions:function(b,a){if(b==="")b="global";if(i.hasOwnProperty[b])i[b]+=", "+a;else i[b]=a},hyphenate:function(b,
a){var d,c,e;if(Hyphenator.languages.hasOwnProperty(a)){Hyphenator.languages[a].prepared||E(a);d=function(f){return P.test(f)?X(f):F(a,f)};if(typeof b==="string"||b.constructor===String)return b.replace(Hyphenator.languages[a].genRegExp,d);else if(typeof b==="object")for(e=0;c=b.childNodes[e++];)if(c.nodeType===3&&c.data.length>=t)c.data=c.data.replace(Hyphenator.languages[a].genRegExp,d);else if(c.nodeType===1){if(c.lang!=="")a=c.lang;Hyphenator.hyphenate(c,a)}}else n(new Error('Language "'+a+'" is not loaded.'))},
isBookmarklet:function(){return M},toggleHyphenation:function(){switch(m){case 3:ja();u(false);break;case 4:Z();u(true);break}}}}();if(Hyphenator.isBookmarklet()){Hyphenator.config({displaytogglebox:true,intermediatestate:"visible"});Hyphenator.run()};/*-------------------------------------------------------------------- 
 * jQuery Plugin: "Cookie"
--------------------------------------------------------------------*/

jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options=$.extend({},options);options.expires=-1;}
var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
expires='; expires='+date.toUTCString();}
var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
return cookieValue;}};

/*-------------------------------------------------------------------- 
 * jQuery Plugin: "HoverIntent"
--------------------------------------------------------------------*/

(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/*-------------------------------------------------------------------- 
 * jQuery Plugin: "ScrollTo"
--------------------------------------------------------------------*/

(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/*-------------------------------------------------------------------- 
 * jQuery Plugin: "Tablesorter 2.0"
--------------------------------------------------------------------*/

(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);

/*-------------------------------------------------------------------- 
 * jQuery Plugin: "Cycle lite"
--------------------------------------------------------------------*/

(function(a){function d(a,b,d){var e=a[0].parentNode,f=e.cycleTimeout;if(f){clearTimeout(f);e.cycleTimeout=0}b.nextSlide=b.currSlide+d;if(b.nextSlide<0){b.nextSlide=a.length-1}else if(b.nextSlide>=a.length){b.nextSlide=0}c(a,b,1,d>=0);return false}function c(b,d,e,f){function l(){if(d.timeout)g.cycleTimeout=setTimeout(function(){c(b,d,0,!d.rev)},d.timeout)}if(d.busy)return;var g=b[0].parentNode,h=b[d.currSlide],i=b[d.nextSlide];if(g.cycleTimeout===0&&!e)return;if(e||!g.cyclePause){if(d.before.length)a.each(d.before,function(a,b){b.apply(i,[h,i,d,f])});var j=function(){if(a.browser.msie)this.style.removeAttribute("filter");a.each(d.after,function(a,b){b.apply(i,[h,i,d,f])});l()};if(d.nextSlide!=d.currSlide){d.busy=1;a.fn.cycle.custom(h,i,d,j)}var k=d.nextSlide+1==b.length;d.nextSlide=k?0:d.nextSlide+1;d.currSlide=k?b.length-1:d.nextSlide-1}}var b="Lite-1.3";a.fn.cycle=function(b){return this.each(function(){b=b||{};if(this.cycleTimeout)clearTimeout(this.cycleTimeout);this.cycleTimeout=0;this.cyclePause=0;var e=a(this);var f=b.slideExpr?a(b.slideExpr,this):e.children();var g=f.get();if(g.length<2){window.console&&console.log("terminating; too few slides: "+g.length);return}var h=a.extend({},a.fn.cycle.defaults,b||{},a.metadata?e.metadata():a.meta?e.data():{});var i=a.isFunction(e.data)?e.data(h.metaAttr):null;if(i)h=a.extend(h,i);h.before=h.before?[h.before]:[];h.after=h.after?[h.after]:[];h.after.unshift(function(){h.busy=0});var j=this.className;h.width=parseInt((j.match(/w:(\d+)/)||[])[1])||h.width;h.height=parseInt((j.match(/h:(\d+)/)||[])[1])||h.height;h.timeout=parseInt((j.match(/t:(\d+)/)||[])[1])||h.timeout;if(e.css("position")=="static")e.css("position","relative");if(h.width)e.width(h.width);if(h.height&&h.height!="auto")e.height(h.height);var k=0;f.css({position:"absolute",top:0,left:0}).each(function(b){a(this).css("z-index",g.length-b)});a(g[k]).css("opacity",1).show();if(a.browser.msie)g[k].style.removeAttribute("filter");if(h.fit&&h.width)f.width(h.width);if(h.fit&&h.height&&h.height!="auto")f.height(h.height);if(h.pause)e.hover(function(){this.cyclePause=1},function(){this.cyclePause=0});var l=a.fn.cycle.transitions[h.fx];l&&l(e,f,h);f.each(function(){var b=a(this);this.cycleH=h.fit&&h.height?h.height:b.height();this.cycleW=h.fit&&h.width?h.width:b.width()});if(h.cssFirst)a(f[k]).css(h.cssFirst);if(h.timeout){if(h.speed.constructor==String)h.speed={slow:600,fast:200}[h.speed]||400;if(!h.sync)h.speed=h.speed/2;while(h.timeout-h.speed<250)h.timeout+=h.speed}h.speedIn=h.speed;h.speedOut=h.speed;h.slideCount=g.length;h.currSlide=k;h.nextSlide=1;var m=f[k];if(h.before.length)h.before[0].apply(m,[m,m,h,true]);if(h.after.length>1)h.after[1].apply(m,[m,m,h,true]);if(h.click&&!h.next)h.next=h.click;if(h.next)a(h.next).bind("click",function(){return d(g,h,h.rev?-1:1)});if(h.prev)a(h.prev).bind("click",function(){return d(g,h,h.rev?1:-1)});if(h.timeout)this.cycleTimeout=setTimeout(function(){c(g,h,0,!h.rev)},h.timeout+(h.delay||0))})};a.fn.cycle.custom=function(b,c,d,e){var f=a(b),g=a(c);g.css(d.cssBefore);var h=function(){g.animate(d.animIn,d.speedIn,d.easeIn,e)};f.animate(d.animOut,d.speedOut,d.easeOut,function(){f.css(d.cssAfter);if(!d.sync)h()});if(d.sync)h()};a.fn.cycle.transitions={fade:function(a,b,c){b.not(":eq(0)").hide();c.cssBefore={opacity:0,display:"block"};c.cssAfter={display:"none"};c.animOut={opacity:0};c.animIn={opacity:1}},fadeout:function(b,c,d){d.before.push(function(b,c,d,e){a(b).css("zIndex",d.slideCount+(e===true?1:0));a(c).css("zIndex",d.slideCount+(e===true?0:1))});c.not(":eq(0)").hide();d.cssBefore={opacity:1,display:"block",zIndex:1};d.cssAfter={display:"none",zIndex:0};d.animOut={opacity:0}}};a.fn.cycle.ver=function(){return b};a.fn.cycle.defaults={animIn:{},animOut:{},fx:"fade",after:null,before:null,cssBefore:{},cssAfter:{},delay:0,fit:0,height:"auto",metaAttr:"cycle",next:null,pause:0,prev:null,speed:1e3,slideExpr:null,sync:1,timeout:4e3}})(jQuery)

/*-------------------------------------------------------------------- 
 * jQuery Plugin: "ImageLoader"
--------------------------------------------------------------------*/

jQuery.fn.imageLoader=function(k,c){var b=$.extend({},$.fn.imageLoader.defaults,k);var d=1;var a=this;var j=[];var e=(typeof b.images[0]=="object")?true:false;g();for(var f=0;f<b.images.length;f++){j["img"+f]=new Image();$(a).append(function(l,m){var i=$(j["img"+f]).load(function(){h()});if(b.hideImages){$(i).hide()}i.attr((e?b.images[f]:{src:b.images[f]}));return i})}return $(this);function h(){d++;if((b.images.length+1)==d){if(b.endableSplashScreen){$("#imageLoaderSplashArea").remove()}if(typeof c=="function"){c.call()}}else{if(b.endableSplashScreen&&b.enableSplashScreenText){$("#imageLoaderSplashArea p.loadingText").html("Ladataan kuvia: "+d+"/"+b.images.length)}}}function g(){if(b.endableSplashScreen){var i='<div id="imageLoaderSplashArea">'+((b.enableSplashScreenImage)?'<img src="'+b.splashScreenImage+'" class="splashScreenImage" />':"")+((b.enableSplashScreenText)?'<p class="loadingText">Ladataan kuvia: '+d+"/"+b.images.length+"</p>":"")+"</div>";$(a).append(i)}}};jQuery.fn.imageLoader.defaults={images:[],splashScreenImage:"images/splashScreenImage.gif",enableSplashScreenImage:1,enableSplashScreenText:1,endableSplashScreen:1,hideImages:1};

/*-------------------------------------------------------------------- 
 * jQuery Script: "IE Z-index Fix"
--------------------------------------------------------------------*/

$(function() {
if ( $("nav#mainnav").length > 0 && $.browser.msie ) {
	var zIndexNumber = 0;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber += 10;
	});
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "IE Megamenu Border-right Fix"
--------------------------------------------------------------------*/

$(function() {
if ( $("nav#mainnav").length > 0 ) {
$('nav#mainnav div>div:last-child').css('border-right', '0');
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Hyphenator"
--------------------------------------------------------------------*/

$(function() {
if ( $("section p").length > 0 ) {
Hyphenator.run();
$("section p").addClass("hyphenate");
$("section li").addClass("hyphenate");
$("section td").addClass("hyphenate");
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Megamenu"
--------------------------------------------------------------------*/

$(function() {
if ( $("nav#mainnav").length > 0 ) {
function addMega(){ $(this).addClass("hovering"); }

function removeMega(){ $(this).removeClass("hovering"); }

var megaConfig = {
	sensitivity: 3,
	interval: 50,
	over: addMega,
	timeout: 250,
	out: removeMega
};

$("nav#mainnav li.first").hoverIntent(megaConfig)
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Tabs"
--------------------------------------------------------------------*/

$(function () {
if ( $("#tabs").length > 0 ) {

var tabContainers = $('div#tabs > div');

if(location.hash.length > 0) {
	var str = location.hash;
	str = str.replace("#", "");
	$('div#tabs ul li.list' + str + ' a').addClass('selected');
	tabContainers.hide();
	$(location.hash).show();	
	$.scrollTo("div#tabs ul");
}
else {
	$('div#tabs ul li.listceylon a').addClass('selected');	
	tabContainers.hide();
	$("#ceylon").show();
}

$("div#tabs ul a").click(function () {
	location.hash = $(this).attr('href')
	tabContainers.hide().filter(this.hash).show();
	$('div#tabs ul a').removeClass('selected');
	$(this).addClass('selected');
	return false;
});

tabContainers.each(function(intIndex) {
if (intIndex != 9) {
	var tama = $(this).attr('id');
	var seur = $(this).next().attr('id');
	var seurpitka = $(this).next().children("h2").text();

	$("<h3>").attr("class", tama + " oikea").appendTo("#" + tama);
	$("<a>").attr("href","#" + seur).click(function () {
		location.hash = $(this).attr('href');
		$.scrollTo("div#tabs ul");
		tabContainers.hide().filter(this.hash).show();
		$('div#tabs ul li.list' + tama + ' a').removeClass('selected');
		$('div#tabs ul li.list' + seur + ' a').addClass('selected');
		return false;
	}).text(seurpitka + " »").appendTo('.' + tama);
}
});

}
});
/*-------------------------------------------------------------------- 
 * jQuery Script: "Nostopienennys"
--------------------------------------------------------------------*/

$(function() {
if ( $("#nostot").length > 0 ) {
$("<a>").attr("id","toggleNosto").attr("title","Piilota nostot").text("▲").click(function () 
{
	$("#nostot .nosto").slideToggle("fast");
}
).insertBefore('#nostot h3');
$('#toggleNosto').toggle(
function () {
	$(this).text("▼").attr("title","Näytä nostot");
	$.cookie('naytaNosto', 'collapsed', {expires: 14});
},
function () {
	$(this).text("▲").attr("title","Piilota nostot");
	$.cookie('naytaNosto', 'expanded', {expires: 14});
}
);
// COOKIES
var naytaNosto = $.cookie('naytaNosto');

if (naytaNosto == 'collapsed') {
	$("#nostot .nosto").hide();
	$('#toggleNosto').text("?").attr("title","Näytä nostot");
	
$('#toggleNosto').toggle(
function () {
	$(this).text("▲").attr("title","Piilota nostot");
	$.cookie('naytaNosto', 'expanded', {expires: 14});
},
function () {
	$(this).text("▼").attr("title","Näytä nostot");
	$.cookie('naytaNosto', 'collapsed', {expires: 14});
}
);
};
if (naytaNosto == 'expanded') {
	$('#toggleNosto').text("▲").attr("title","Piilota nostot");
};
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Hakutyhjennys"
--------------------------------------------------------------------*/

$(function() {
if ( $("#haku").length > 0 ) {
$('#haku input[type="text"]').click( function() { if (this.value == this.defaultValue) { this.value = ''; } } );
$('#haku input[type="text"]').blur(function() { if (this.value == '') { this.value = this.defaultValue; } } );
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Takaisinlinkki"
--------------------------------------------------------------------*/

$(function() {
if ( $("body.naytajokin").length > 0 ) {
$("<a>").attr("href","javascript:history.go(-1)").attr("id","takaisin").appendTo('body.naytajokin header');
$("<img>").attr("src","/kuvat/leiska/takaisin.png").attr("title","Takaisin edelliselle sivulle").attr("alt","takaisin").appendTo('#takaisin');
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Kuvan pienennys"
--------------------------------------------------------------------*/

$(function() {
if ( $("body.naytajokin #kuva").length > 0 ) {
$("<p>").text("Kuvaa pienennetty, klikkaa sitä nähdäksesi täysikokoisen version.").prependTo('#kuva').wrapInner("<strong></strong>");

if (document.body.clientWidth > $("#kuva div img").width()) { $("#kuva div").width($("#kuva div img").width()); }
else {	$("#kuva div").toggleClass("pienennys");
	$("#kuva p").toggleClass("nakyy");
	
	$("#kuva div").click(function () { 
		$("#kuva div").toggleClass("pienennys");
		$("#kuva p").toggleClass("nakyy"); 
		});
     }
}
});

/*-------------------------------------------------------------------- 
 * jQuery Script: "Kuvien AJAX-selaus"
--------------------------------------------------------------------*/

$(function() {
if ( $("body.naytajokin #kuva_ylapalkki").length > 0 ) {
	$("a.seuraava, img.seuraava, #kuva_galleria, a.edellinen, img.edellinen").click(function() { return false; });
	var img = $("#kuva_galleria").attr('src').split('/').pop().replace('kuva','');
	var imgNumber = parseInt(img.split('.').shift());
	var imgType = img.split('.').pop();
	var origImgSrc = $("#kuva_galleria").attr('src').replace(img, '');
	
	var origSrc = window.location.pathname.replace(imgNumber, '');
	
	var nextImg = parseInt(imgNumber+1);
	var prevImg = parseInt(imgNumber-1);
	
	var kuvamaara = parseInt($(".kuvamaara").text());
		
	$("#kuva_galleria, a.seuraava, img.seuraava").click(function () {
		$("<div>").attr('id', 'loader').insertAfter("#kuva_ylapalkki").css('width', $("#kuva_galleria").width()).css('height', $("#kuva_galleria").height());
		$("#kuva_galleria").hide();
		$("#kuva_galleria").attr('src', origImgSrc + nextImg + '.' + imgType);
			  
		$("#kuva_galleria").load(function () {
			$("#loader").remove();
			$(this).fadeIn();
			$.scrollTo("#kuva_ylapalkki");
		}).parent().attr('href', origSrc + nextImg+1).css('outline', 'none');
		
		if (nextImg >= kuvamaara) { nextImg = parseInt(0); imgNumber = parseInt(-1); prevImg = parseInt(kuvamaara); }	
		
		$("a.edellinen").attr('href', origSrc + prevImg);
		$("img.edellinen").parent().attr('href', origSrc + prevImg);
		$(".kuvanro").text(nextImg+1);
		$("a.seuraava").attr('href', origSrc + nextImg);
		$("img.seuraava").parent().attr('href', origSrc + nextImg);
		
		var title = document.title;
		newTitle = document.title.replace(nextImg, nextImg+1);
		document.title = newTitle;		
		
		imgNumber++;
		nextImg++;
		prevImg++;
		if (prevImg > kuvamaara) { prevImg = kuvamaara-1; }
		if (prevImg == kuvamaara && imgNumber == 1) { prevImg = 0; }
		if (imgNumber == kuvamaara) { imgNumber = 0; }
		if (imgNumber == kuvamaara-1 && nextImg == kuvamaara) { nextImg = 0; }
	});
	
	$("a.edellinen, img.edellinen").click(function () {
		$("<div>").attr('id', 'loader').insertAfter("#kuva_ylapalkki").css('width', $("#kuva_galleria").width()).css('height', $("#kuva_galleria").height());
		$("#kuva_galleria").hide();
		$("#kuva_galleria").attr('src', origImgSrc + prevImg + '.' + imgType);
				  
		$("#kuva_galleria").load(function () {
			$("#loader").remove();
			$(this).fadeIn();
		}).parent().attr('href', origSrc + nextImg).css('outline', 'none');
		
		if (imgNumber <= 0) { prevImg = parseInt(kuvamaara-1); imgNumber = parseInt(kuvamaara); nextImg = parseInt(0); }
				
		$("a.edellinen").attr('href', origSrc + prevImg);
		$("img.edellinen").parent().attr('href', origSrc + prevImg);
		$(".kuvanro").text(imgNumber);
		$("a.seuraava").attr('href', origSrc + nextImg);
		$("img.seuraava").parent().attr('href', origSrc + nextImg);
		
		var title = document.title;
		newTitle = document.title.replace(imgNumber, prevImg);
		document.title = newTitle;
		
		imgNumber--;
		nextImg--;
		prevImg--;
		if (prevImg == kuvamaara) { prevImg = 0; }
		if (prevImg < 0) { prevImg = kuvamaara-1; }
		if (imgNumber == kuvamaara-1 && nextImg < 0) { nextImg = 0; }
		if (imgNumber == kuvamaara-2 && nextImg < 0) { nextImg = kuvamaara-1; }
		if (imgNumber == kuvamaara && prevImg == kuvamaara-1) { imgNumber = 0; prevImg = kuvamaara-1; }
	});
}
});

/*------------------------------------------------------------------- 
 * jQuery Script: "Shadowbox"
--------------------------------------------------------------------*/
/*
 * Shadowbox.js, version 3.0.3
 * http://shadowbox-js.com/
 *
 * Copyright 2007-2010, Michael J. I. Jackson
 * Date: 2010-08-27 18:01:43 +0000
 */
(function(au,k){var Q={version:"3.0.3"};var J=navigator.userAgent.toLowerCase();if(J.indexOf("windows")>-1||J.indexOf("win32")>-1){Q.isWindows=true}else{if(J.indexOf("macintosh")>-1||J.indexOf("mac os x")>-1){Q.isMac=true}else{if(J.indexOf("linux")>-1){Q.isLinux=true}}}Q.isIE=J.indexOf("msie")>-1;Q.isIE6=J.indexOf("msie 6")>-1;Q.isIE7=J.indexOf("msie 7")>-1;Q.isGecko=J.indexOf("gecko")>-1&&J.indexOf("safari")==-1;Q.isWebKit=J.indexOf("applewebkit/")>-1;var ab=/#(.+)$/,af=/^(light|shadow)box\[(.*?)\]/i,az=/\s*([a-z_]*?)\s*=\s*(.+)\s*/,f=/[0-9a-z]+$/i,aD=/(.+\/)shadowbox\.js/i;var A=false,a=false,l={},z=0,R,ap;Q.current=-1;Q.dimensions=null;Q.ease=function(K){return 1+Math.pow(K-1,3)};Q.errorInfo={fla:{name:"Flash",url:"http://www.adobe.com/products/flashplayer/"},qt:{name:"QuickTime",url:"http://www.apple.com/quicktime/download/"},wmp:{name:"Windows Media Player",url:"http://www.microsoft.com/windows/windowsmedia/"},f4m:{name:"Flip4Mac",url:"http://www.flip4mac.com/wmv_download.htm"}};Q.gallery=[];Q.onReady=aj;Q.path=null;Q.player=null;Q.playerId="sb-player";Q.options={animate:true,animateFade:true,autoplayMovies:true,continuous:false,enableKeys:true,flashParams:{bgcolor:"#000000",allowfullscreen:true},flashVars:{},flashVersion:"9.0.115",handleOversize:"resize",handleUnsupported:"link",onChange:aj,onClose:aj,onFinish:aj,onOpen:aj,showMovieControls:true,skipSetup:false,slideshowDelay:0,viewportPadding:20};Q.getCurrent=function(){return Q.current>-1?Q.gallery[Q.current]:null};Q.hasNext=function(){return Q.gallery.length>1&&(Q.current!=Q.gallery.length-1||Q.options.continuous)};Q.isOpen=function(){return A};Q.isPaused=function(){return ap=="pause"};Q.applyOptions=function(K){l=aC({},Q.options);aC(Q.options,K)};Q.revertOptions=function(){aC(Q.options,l)};Q.init=function(aG,aJ){if(a){return}a=true;if(Q.skin.options){aC(Q.options,Q.skin.options)}if(aG){aC(Q.options,aG)}if(!Q.path){var aI,S=document.getElementsByTagName("script");for(var aH=0,K=S.length;aH<K;++aH){aI=aD.exec(S[aH].src);if(aI){Q.path=aI[1];break}}}if(aJ){Q.onReady=aJ}P()};Q.open=function(S){if(A){return}var K=Q.makeGallery(S);Q.gallery=K[0];Q.current=K[1];S=Q.getCurrent();if(S==null){return}Q.applyOptions(S.options||{});G();if(Q.gallery.length){S=Q.getCurrent();if(Q.options.onOpen(S)===false){return}A=true;Q.skin.onOpen(S,c)}};Q.close=function(){if(!A){return}A=false;if(Q.player){Q.player.remove();Q.player=null}if(typeof ap=="number"){clearTimeout(ap);ap=null}z=0;aq(false);Q.options.onClose(Q.getCurrent());Q.skin.onClose();Q.revertOptions()};Q.play=function(){if(!Q.hasNext()){return}if(!z){z=Q.options.slideshowDelay*1000}if(z){R=aw();ap=setTimeout(function(){z=R=0;Q.next()},z);if(Q.skin.onPlay){Q.skin.onPlay()}}};Q.pause=function(){if(typeof ap!="number"){return}z=Math.max(0,z-(aw()-R));if(z){clearTimeout(ap);ap="pause";if(Q.skin.onPause){Q.skin.onPause()}}};Q.change=function(K){if(!(K in Q.gallery)){if(Q.options.continuous){K=(K<0?Q.gallery.length+K:0);if(!(K in Q.gallery)){return}}else{return}}Q.current=K;if(typeof ap=="number"){clearTimeout(ap);ap=null;z=R=0}Q.options.onChange(Q.getCurrent());c(true)};Q.next=function(){Q.change(Q.current+1)};Q.previous=function(){Q.change(Q.current-1)};Q.setDimensions=function(aS,aJ,aQ,aR,aI,K,aO,aL){var aN=aS,aH=aJ;var aM=2*aO+aI;if(aS+aM>aQ){aS=aQ-aM}var aG=2*aO+K;if(aJ+aG>aR){aJ=aR-aG}var S=(aN-aS)/aN,aP=(aH-aJ)/aH,aK=(S>0||aP>0);if(aL&&aK){if(S>aP){aJ=Math.round((aH/aN)*aS)}else{if(aP>S){aS=Math.round((aN/aH)*aJ)}}}Q.dimensions={height:aS+aI,width:aJ+K,innerHeight:aS,innerWidth:aJ,top:Math.floor((aQ-(aS+aM))/2+aO),left:Math.floor((aR-(aJ+aG))/2+aO),oversized:aK};return Q.dimensions};Q.makeGallery=function(aI){var K=[],aH=-1;if(typeof aI=="string"){aI=[aI]}if(typeof aI.length=="number"){aF(aI,function(aK,aL){if(aL.content){K[aK]=aL}else{K[aK]={content:aL}}});aH=0}else{if(aI.tagName){var S=Q.getCache(aI);aI=S?S:Q.makeObject(aI)}if(aI.gallery){K=[];var aJ;for(var aG in Q.cache){aJ=Q.cache[aG];if(aJ.gallery&&aJ.gallery==aI.gallery){if(aH==-1&&aJ.content==aI.content){aH=K.length}K.push(aJ)}}if(aH==-1){K.unshift(aI);aH=0}}else{K=[aI];aH=0}}aF(K,function(aK,aL){K[aK]=aC({},aL)});return[K,aH]};Q.makeObject=function(aH,aG){var aI={content:aH.href,title:aH.getAttribute("title")||"",link:aH};if(aG){aG=aC({},aG);aF(["player","title","height","width","gallery"],function(aJ,aK){if(typeof aG[aK]!="undefined"){aI[aK]=aG[aK];delete aG[aK]}});aI.options=aG}else{aI.options={}}if(!aI.player){aI.player=Q.getPlayer(aI.content)}var K=aH.getAttribute("rel");if(K){var S=K.match(af);if(S){aI.gallery=escape(S[2])}aF(K.split(";"),function(aJ,aK){S=aK.match(az);if(S){aI[S[1]]=S[2]}})}return aI};Q.getPlayer=function(aG){if(aG.indexOf("#")>-1&&aG.indexOf(document.location.href)==0){return"inline"}var aH=aG.indexOf("?");if(aH>-1){aG=aG.substring(0,aH)}var S,K=aG.match(f);if(K){S=K[0].toLowerCase()}if(S){if(Q.img&&Q.img.ext.indexOf(S)>-1){return"img"}if(Q.swf&&Q.swf.ext.indexOf(S)>-1){return"swf"}if(Q.flv&&Q.flv.ext.indexOf(S)>-1){return"flv"}if(Q.qt&&Q.qt.ext.indexOf(S)>-1){if(Q.wmp&&Q.wmp.ext.indexOf(S)>-1){return"qtwmp"}else{return"qt"}}if(Q.wmp&&Q.wmp.ext.indexOf(S)>-1){return"wmp"}}return"iframe"};function G(){var aH=Q.errorInfo,aI=Q.plugins,aK,aL,aO,aG,aN,S,aM,K;for(var aJ=0;aJ<Q.gallery.length;++aJ){aK=Q.gallery[aJ];aL=false;aO=null;switch(aK.player){case"flv":case"swf":if(!aI.fla){aO="fla"}break;case"qt":if(!aI.qt){aO="qt"}break;case"wmp":if(Q.isMac){if(aI.qt&&aI.f4m){aK.player="qt"}else{aO="qtf4m"}}else{if(!aI.wmp){aO="wmp"}}break;case"qtwmp":if(aI.qt){aK.player="qt"}else{if(aI.wmp){aK.player="wmp"}else{aO="qtwmp"}}break}if(aO){if(Q.options.handleUnsupported=="link"){switch(aO){case"qtf4m":aN="shared";S=[aH.qt.url,aH.qt.name,aH.f4m.url,aH.f4m.name];break;case"qtwmp":aN="either";S=[aH.qt.url,aH.qt.name,aH.wmp.url,aH.wmp.name];break;default:aN="single";S=[aH[aO].url,aH[aO].name]}aK.player="html";aK.content='<div class="sb-message">'+s(Q.lang.errors[aN],S)+"</div>"}else{aL=true}}else{if(aK.player=="inline"){aG=ab.exec(aK.content);if(aG){aM=ad(aG[1]);if(aM){aK.content=aM.innerHTML}else{aL=true}}else{aL=true}}else{if(aK.player=="swf"||aK.player=="flv"){K=(aK.options&&aK.options.flashVersion)||Q.options.flashVersion;if(Q.flash&&!Q.flash.hasFlashPlayerVersion(K)){aK.width=310;aK.height=177}}}}if(aL){Q.gallery.splice(aJ,1);if(aJ<Q.current){--Q.current}else{if(aJ==Q.current){Q.current=aJ>0?aJ-1:aJ}}--aJ}}}function aq(K){if(!Q.options.enableKeys){return}(K?F:M)(document,"keydown",an)}function an(aG){if(aG.metaKey||aG.shiftKey||aG.altKey||aG.ctrlKey){return}var S=v(aG),K;switch(S){case 81:case 88:case 27:K=Q.close;break;case 37:K=Q.previous;break;case 39:K=Q.next;break;case 32:K=typeof ap=="number"?Q.pause:Q.play;break}if(K){n(aG);K()}}function c(aK){aq(false);var aJ=Q.getCurrent();var aG=(aJ.player=="inline"?"html":aJ.player);if(typeof Q[aG]!="function"){throw"unknown player "+aG}if(aK){Q.player.remove();Q.revertOptions();Q.applyOptions(aJ.options||{})}Q.player=new Q[aG](aJ,Q.playerId);if(Q.gallery.length>1){var aH=Q.gallery[Q.current+1]||Q.gallery[0];if(aH.player=="img"){var S=new Image();S.src=aH.content}var aI=Q.gallery[Q.current-1]||Q.gallery[Q.gallery.length-1];if(aI.player=="img"){var K=new Image();K.src=aI.content}}Q.skin.onLoad(aK,W)}function W(){if(!A){return}if(typeof Q.player.ready!="undefined"){var K=setInterval(function(){if(A){if(Q.player.ready){clearInterval(K);K=null;Q.skin.onReady(e)}}else{clearInterval(K);K=null}},10)}else{Q.skin.onReady(e)}}function e(){if(!A){return}Q.player.append(Q.skin.body,Q.dimensions);Q.skin.onShow(I)}function I(){if(!A){return}if(Q.player.onLoad){Q.player.onLoad()}Q.options.onFinish(Q.getCurrent());if(!Q.isPaused()){Q.play()}aq(true)}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(S,aG){var K=this.length>>>0;aG=aG||0;if(aG<0){aG+=K}for(;aG<K;++aG){if(aG in this&&this[aG]===S){return aG}}return -1}}function aw(){return(new Date).getTime()}function aC(K,aG){for(var S in aG){K[S]=aG[S]}return K}function aF(aH,aI){var S=0,K=aH.length;for(var aG=aH[0];S<K&&aI.call(aG,S,aG)!==false;aG=aH[++S]){}}function s(S,K){return S.replace(/\{(\w+?)\}/g,function(aG,aH){return K[aH]})}function aj(){}function ad(K){return document.getElementById(K)}function C(K){K.parentNode.removeChild(K)}var h=true,x=true;function d(){var K=document.body,S=document.createElement("div");h=typeof S.style.opacity==="string";S.style.position="fixed";S.style.margin=0;S.style.top="20px";K.appendChild(S,K.firstChild);x=S.offsetTop==20;K.removeChild(S)}Q.getStyle=(function(){var K=/opacity=([^)]*)/,S=document.defaultView&&document.defaultView.getComputedStyle;return function(aJ,aI){var aH;if(!h&&aI=="opacity"&&aJ.currentStyle){aH=K.test(aJ.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return aH===""?"1":aH}if(S){var aG=S(aJ,null);if(aG){aH=aG[aI]}if(aI=="opacity"&&aH==""){aH="1"}}else{aH=aJ.currentStyle[aI]}return aH}})();Q.appendHTML=function(aG,S){if(aG.insertAdjacentHTML){aG.insertAdjacentHTML("BeforeEnd",S)}else{if(aG.lastChild){var K=aG.ownerDocument.createRange();K.setStartAfter(aG.lastChild);var aH=K.createContextualFragment(S);aG.appendChild(aH)}else{aG.innerHTML=S}}};Q.getWindowSize=function(K){if(document.compatMode==="CSS1Compat"){return document.documentElement["client"+K]}return document.body["client"+K]};Q.setOpacity=function(aG,K){var S=aG.style;if(h){S.opacity=(K==1?"":K)}else{S.zoom=1;if(K==1){if(typeof S.filter=="string"&&(/alpha/i).test(S.filter)){S.filter=S.filter.replace(/\s*[\w\.]*alpha\([^\)]*\);?/gi,"")}}else{S.filter=(S.filter||"").replace(/\s*[\w\.]*alpha\([^\)]*\)/gi,"")+" alpha(opacity="+(K*100)+")"}}};Q.clearOpacity=function(K){Q.setOpacity(K,1)};function o(K){return K.target}function V(K){return[K.pageX,K.pageY]}function n(K){K.preventDefault()}function v(K){return K.keyCode}function F(aG,S,K){jQuery(aG).bind(S,K)}function M(aG,S,K){jQuery(aG).unbind(S,K)}jQuery.fn.shadowbox=function(K){return this.each(function(){var aG=jQuery(this);var aH=jQuery.extend({},K||{},jQuery.metadata?aG.metadata():jQuery.meta?aG.data():{});var S=this.className||"";aH.width=parseInt((S.match(/w:(\d+)/)||[])[1])||aH.width;aH.height=parseInt((S.match(/h:(\d+)/)||[])[1])||aH.height;Shadowbox.setup(aG,aH)})};var y=false,al;if(document.addEventListener){al=function(){document.removeEventListener("DOMContentLoaded",al,false);Q.load()}}else{if(document.attachEvent){al=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",al);Q.load()}}}}function g(){if(y){return}try{document.documentElement.doScroll("left")}catch(K){setTimeout(g,1);return}Q.load()}function P(){if(document.readyState==="complete"){return Q.load()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",al,false);au.addEventListener("load",Q.load,false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",al);au.attachEvent("onload",Q.load);var K=false;try{K=au.frameElement===null}catch(S){}if(document.documentElement.doScroll&&K){g()}}}}Q.load=function(){if(y){return}if(!document.body){return setTimeout(Q.load,13)}y=true;d();Q.onReady();if(!Q.options.skipSetup){Q.setup()}Q.skin.init()};Q.plugins={};if(navigator.plugins&&navigator.plugins.length){var w=[];aF(navigator.plugins,function(K,S){w.push(S.name)});w=w.join(",");var ai=w.indexOf("Flip4Mac")>-1;Q.plugins={fla:w.indexOf("Shockwave Flash")>-1,qt:w.indexOf("QuickTime")>-1,wmp:!ai&&w.indexOf("Windows Media")>-1,f4m:ai}}else{var p=function(K){var S;try{S=new ActiveXObject(K)}catch(aG){}return !!S};Q.plugins={fla:p("ShockwaveFlash.ShockwaveFlash"),qt:p("QuickTime.QuickTime"),wmp:p("wmplayer.ocx"),f4m:false}}var X=/^(light|shadow)box/i,am="shadowboxCacheKey",b=1;Q.cache={};Q.select=function(S){var aG=[];if(!S){var K;aF(document.getElementsByTagName("a"),function(aJ,aK){K=aK.getAttribute("rel");if(K&&X.test(K)){aG.push(aK)}})}else{var aI=S.length;if(aI){if(typeof S=="string"){if(Q.find){aG=Q.find(S)}}else{if(aI==2&&typeof S[0]=="string"&&S[1].nodeType){if(Q.find){aG=Q.find(S[0],S[1])}}else{for(var aH=0;aH<aI;++aH){aG[aH]=S[aH]}}}}else{aG.push(S)}}return aG};Q.setup=function(K,S){aF(Q.select(K),function(aG,aH){Q.addCache(aH,S)})};Q.teardown=function(K){aF(Q.select(K),function(S,aG){Q.removeCache(aG)})};Q.addCache=function(aG,K){var S=aG[am];if(S==k){S=b++;aG[am]=S;F(aG,"click",u)}Q.cache[S]=Q.makeObject(aG,K)};Q.removeCache=function(K){M(K,"click",u);delete Q.cache[K[am]];K[am]=null};Q.getCache=function(S){var K=S[am];return(K in Q.cache&&Q.cache[K])};Q.clearCache=function(){for(var K in Q.cache){Q.removeCache(Q.cache[K].link)}Q.cache={}};function u(K){Q.open(this);if(Q.gallery.length){n(K)}}
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 *
 * Modified for inclusion in Shadowbox.js
 */
Q.find=(function(){var aP=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,aQ=0,aS=Object.prototype.toString,aK=false,aJ=true;[0,0].sort(function(){aJ=false;return 0});var aG=function(a1,aW,a4,a5){a4=a4||[];var a7=aW=aW||document;if(aW.nodeType!==1&&aW.nodeType!==9){return[]}if(!a1||typeof a1!=="string"){return a4}var a2=[],aY,a9,bc,aX,a0=true,aZ=aH(aW),a6=a1;while((aP.exec(""),aY=aP.exec(a6))!==null){a6=aY[3];a2.push(aY[1]);if(aY[2]){aX=aY[3];break}}if(a2.length>1&&aL.exec(a1)){if(a2.length===2&&aM.relative[a2[0]]){a9=aT(a2[0]+a2[1],aW)}else{a9=aM.relative[a2[0]]?[aW]:aG(a2.shift(),aW);while(a2.length){a1=a2.shift();if(aM.relative[a1]){a1+=a2.shift()}a9=aT(a1,a9)}}}else{if(!a5&&a2.length>1&&aW.nodeType===9&&!aZ&&aM.match.ID.test(a2[0])&&!aM.match.ID.test(a2[a2.length-1])){var a8=aG.find(a2.shift(),aW,aZ);aW=a8.expr?aG.filter(a8.expr,a8.set)[0]:a8.set[0]}if(aW){var a8=a5?{expr:a2.pop(),set:aO(a5)}:aG.find(a2.pop(),a2.length===1&&(a2[0]==="~"||a2[0]==="+")&&aW.parentNode?aW.parentNode:aW,aZ);a9=a8.expr?aG.filter(a8.expr,a8.set):a8.set;if(a2.length>0){bc=aO(a9)}else{a0=false}while(a2.length){var bb=a2.pop(),ba=bb;if(!aM.relative[bb]){bb=""}else{ba=a2.pop()}if(ba==null){ba=aW}aM.relative[bb](bc,ba,aZ)}}else{bc=a2=[]}}if(!bc){bc=a9}if(!bc){throw"Syntax error, unrecognized expression: "+(bb||a1)}if(aS.call(bc)==="[object Array]"){if(!a0){a4.push.apply(a4,bc)}else{if(aW&&aW.nodeType===1){for(var a3=0;bc[a3]!=null;a3++){if(bc[a3]&&(bc[a3]===true||bc[a3].nodeType===1&&aN(aW,bc[a3]))){a4.push(a9[a3])}}}else{for(var a3=0;bc[a3]!=null;a3++){if(bc[a3]&&bc[a3].nodeType===1){a4.push(a9[a3])}}}}}else{aO(bc,a4)}if(aX){aG(aX,a7,a4,a5);aG.uniqueSort(a4)}return a4};aG.uniqueSort=function(aX){if(aR){aK=aJ;aX.sort(aR);if(aK){for(var aW=1;aW<aX.length;aW++){if(aX[aW]===aX[aW-1]){aX.splice(aW--,1)}}}}return aX};aG.matches=function(aW,aX){return aG(aW,null,null,aX)};aG.find=function(a3,aW,a4){var a2,a0;if(!a3){return[]}for(var aZ=0,aY=aM.order.length;aZ<aY;aZ++){var a1=aM.order[aZ],a0;if((a0=aM.leftMatch[a1].exec(a3))){var aX=a0[1];a0.splice(1,1);if(aX.substr(aX.length-1)!=="\\"){a0[1]=(a0[1]||"").replace(/\\/g,"");a2=aM.find[a1](a0,aW,a4);if(a2!=null){a3=a3.replace(aM.match[a1],"");break}}}}if(!a2){a2=aW.getElementsByTagName("*")}return{set:a2,expr:a3}};aG.filter=function(a6,a5,a9,aZ){var aY=a6,bb=[],a3=a5,a1,aW,a2=a5&&a5[0]&&aH(a5[0]);while(a6&&a5.length){for(var a4 in aM.filter){if((a1=aM.match[a4].exec(a6))!=null){var aX=aM.filter[a4],ba,a8;aW=false;if(a3===bb){bb=[]}if(aM.preFilter[a4]){a1=aM.preFilter[a4](a1,a3,a9,bb,aZ,a2);if(!a1){aW=ba=true}else{if(a1===true){continue}}}if(a1){for(var a0=0;(a8=a3[a0])!=null;a0++){if(a8){ba=aX(a8,a1,a0,a3);var a7=aZ^!!ba;if(a9&&ba!=null){if(a7){aW=true}else{a3[a0]=false}}else{if(a7){bb.push(a8);aW=true}}}}}if(ba!==k){if(!a9){a3=bb}a6=a6.replace(aM.match[a4],"");if(!aW){return[]}break}}}if(a6===aY){if(aW==null){throw"Syntax error, unrecognized expression: "+a6}else{break}}aY=a6}return a3};var aM=aG.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(aW){return aW.getAttribute("href")}},relative:{"+":function(a2,aX){var aZ=typeof aX==="string",a1=aZ&&!/\W/.test(aX),a3=aZ&&!a1;if(a1){aX=aX.toLowerCase()}for(var aY=0,aW=a2.length,a0;aY<aW;aY++){if((a0=a2[aY])){while((a0=a0.previousSibling)&&a0.nodeType!==1){}a2[aY]=a3||a0&&a0.nodeName.toLowerCase()===aX?a0||false:a0===aX}}if(a3){aG.filter(aX,a2,true)}},">":function(a2,aX){var a0=typeof aX==="string";if(a0&&!/\W/.test(aX)){aX=aX.toLowerCase();for(var aY=0,aW=a2.length;aY<aW;aY++){var a1=a2[aY];if(a1){var aZ=a1.parentNode;a2[aY]=aZ.nodeName.toLowerCase()===aX?aZ:false}}}else{for(var aY=0,aW=a2.length;aY<aW;aY++){var a1=a2[aY];if(a1){a2[aY]=a0?a1.parentNode:a1.parentNode===aX}}if(a0){aG.filter(aX,a2,true)}}},"":function(aZ,aX,a1){var aY=aQ++,aW=aU;if(typeof aX==="string"&&!/\W/.test(aX)){var a0=aX=aX.toLowerCase();aW=K}aW("parentNode",aX,aY,aZ,a0,a1)},"~":function(aZ,aX,a1){var aY=aQ++,aW=aU;if(typeof aX==="string"&&!/\W/.test(aX)){var a0=aX=aX.toLowerCase();aW=K}aW("previousSibling",aX,aY,aZ,a0,a1)}},find:{ID:function(aX,aY,aZ){if(typeof aY.getElementById!=="undefined"&&!aZ){var aW=aY.getElementById(aX[1]);return aW?[aW]:[]}},NAME:function(aY,a1){if(typeof a1.getElementsByName!=="undefined"){var aX=[],a0=a1.getElementsByName(aY[1]);for(var aZ=0,aW=a0.length;aZ<aW;aZ++){if(a0[aZ].getAttribute("name")===aY[1]){aX.push(a0[aZ])}}return aX.length===0?null:aX}},TAG:function(aW,aX){return aX.getElementsByTagName(aW[1])}},preFilter:{CLASS:function(aZ,aX,aY,aW,a2,a3){aZ=" "+aZ[1].replace(/\\/g,"")+" ";if(a3){return aZ}for(var a0=0,a1;(a1=aX[a0])!=null;a0++){if(a1){if(a2^(a1.className&&(" "+a1.className+" ").replace(/[\t\n]/g," ").indexOf(aZ)>=0)){if(!aY){aW.push(a1)}}else{if(aY){aX[a0]=false}}}}return false},ID:function(aW){return aW[1].replace(/\\/g,"")},TAG:function(aX,aW){return aX[1].toLowerCase()},CHILD:function(aW){if(aW[1]==="nth"){var aX=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(aW[2]==="even"&&"2n"||aW[2]==="odd"&&"2n+1"||!/\D/.test(aW[2])&&"0n+"+aW[2]||aW[2]);aW[2]=(aX[1]+(aX[2]||1))-0;aW[3]=aX[3]-0}aW[0]=aQ++;return aW},ATTR:function(a0,aX,aY,aW,a1,a2){var aZ=a0[1].replace(/\\/g,"");if(!a2&&aM.attrMap[aZ]){a0[1]=aM.attrMap[aZ]}if(a0[2]==="~="){a0[4]=" "+a0[4]+" "}return a0},PSEUDO:function(a0,aX,aY,aW,a1){if(a0[1]==="not"){if((aP.exec(a0[3])||"").length>1||/^\w/.test(a0[3])){a0[3]=aG(a0[3],null,null,aX)}else{var aZ=aG.filter(a0[3],aX,aY,true^a1);if(!aY){aW.push.apply(aW,aZ)}return false}}else{if(aM.match.POS.test(a0[0])||aM.match.CHILD.test(a0[0])){return true}}return a0},POS:function(aW){aW.unshift(true);return aW}},filters:{enabled:function(aW){return aW.disabled===false&&aW.type!=="hidden"},disabled:function(aW){return aW.disabled===true},checked:function(aW){return aW.checked===true},selected:function(aW){aW.parentNode.selectedIndex;return aW.selected===true},parent:function(aW){return !!aW.firstChild},empty:function(aW){return !aW.firstChild},has:function(aY,aX,aW){return !!aG(aW[3],aY).length},header:function(aW){return/h\d/i.test(aW.nodeName)},text:function(aW){return"text"===aW.type},radio:function(aW){return"radio"===aW.type},checkbox:function(aW){return"checkbox"===aW.type},file:function(aW){return"file"===aW.type},password:function(aW){return"password"===aW.type},submit:function(aW){return"submit"===aW.type},image:function(aW){return"image"===aW.type},reset:function(aW){return"reset"===aW.type},button:function(aW){return"button"===aW.type||aW.nodeName.toLowerCase()==="button"},input:function(aW){return/input|select|textarea|button/i.test(aW.nodeName)}},setFilters:{first:function(aX,aW){return aW===0},last:function(aY,aX,aW,aZ){return aX===aZ.length-1},even:function(aX,aW){return aW%2===0},odd:function(aX,aW){return aW%2===1},lt:function(aY,aX,aW){return aX<aW[3]-0},gt:function(aY,aX,aW){return aX>aW[3]-0},nth:function(aY,aX,aW){return aW[3]-0===aX},eq:function(aY,aX,aW){return aW[3]-0===aX}},filter:{PSEUDO:function(a2,aY,aZ,a3){var aX=aY[1],a0=aM.filters[aX];if(a0){return a0(a2,aZ,aY,a3)}else{if(aX==="contains"){return(a2.textContent||a2.innerText||S([a2])||"").indexOf(aY[3])>=0}else{if(aX==="not"){var a1=aY[3];for(var aZ=0,aW=a1.length;aZ<aW;aZ++){if(a1[aZ]===a2){return false}}return true}else{throw"Syntax error, unrecognized expression: "+aX}}}},CHILD:function(aW,aZ){var a2=aZ[1],aX=aW;switch(a2){case"only":case"first":while((aX=aX.previousSibling)){if(aX.nodeType===1){return false}}if(a2==="first"){return true}aX=aW;case"last":while((aX=aX.nextSibling)){if(aX.nodeType===1){return false}}return true;case"nth":var aY=aZ[2],a5=aZ[3];if(aY===1&&a5===0){return true}var a1=aZ[0],a4=aW.parentNode;if(a4&&(a4.sizcache!==a1||!aW.nodeIndex)){var a0=0;for(aX=a4.firstChild;aX;aX=aX.nextSibling){if(aX.nodeType===1){aX.nodeIndex=++a0}}a4.sizcache=a1}var a3=aW.nodeIndex-a5;if(aY===0){return a3===0}else{return(a3%aY===0&&a3/aY>=0)}}},ID:function(aX,aW){return aX.nodeType===1&&aX.getAttribute("id")===aW},TAG:function(aX,aW){return(aW==="*"&&aX.nodeType===1)||aX.nodeName.toLowerCase()===aW},CLASS:function(aX,aW){return(" "+(aX.className||aX.getAttribute("class"))+" ").indexOf(aW)>-1},ATTR:function(a1,aZ){var aY=aZ[1],aW=aM.attrHandle[aY]?aM.attrHandle[aY](a1):a1[aY]!=null?a1[aY]:a1.getAttribute(aY),a2=aW+"",a0=aZ[2],aX=aZ[4];return aW==null?a0==="!=":a0==="="?a2===aX:a0==="*="?a2.indexOf(aX)>=0:a0==="~="?(" "+a2+" ").indexOf(aX)>=0:!aX?a2&&aW!==false:a0==="!="?a2!==aX:a0==="^="?a2.indexOf(aX)===0:a0==="$="?a2.substr(a2.length-aX.length)===aX:a0==="|="?a2===aX||a2.substr(0,aX.length+1)===aX+"-":false},POS:function(a0,aX,aY,a1){var aW=aX[2],aZ=aM.setFilters[aW];if(aZ){return aZ(a0,aY,aX,a1)}}}};var aL=aM.match.POS;for(var aI in aM.match){aM.match[aI]=new RegExp(aM.match[aI].source+/(?![^\[]*\])(?![^\(]*\))/.source);aM.leftMatch[aI]=new RegExp(/(^(?:.|\r|\n)*?)/.source+aM.match[aI].source)}var aO=function(aX,aW){aX=Array.prototype.slice.call(aX,0);if(aW){aW.push.apply(aW,aX);return aW}return aX};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(aV){aO=function(a0,aZ){var aX=aZ||[];if(aS.call(a0)==="[object Array]"){Array.prototype.push.apply(aX,a0)}else{if(typeof a0.length==="number"){for(var aY=0,aW=a0.length;aY<aW;aY++){aX.push(a0[aY])}}else{for(var aY=0;a0[aY];aY++){aX.push(a0[aY])}}}return aX}}var aR;if(document.documentElement.compareDocumentPosition){aR=function(aX,aW){if(!aX.compareDocumentPosition||!aW.compareDocumentPosition){if(aX==aW){aK=true}return aX.compareDocumentPosition?-1:1}var aY=aX.compareDocumentPosition(aW)&4?-1:aX===aW?0:1;if(aY===0){aK=true}return aY}}else{if("sourceIndex" in document.documentElement){aR=function(aX,aW){if(!aX.sourceIndex||!aW.sourceIndex){if(aX==aW){aK=true}return aX.sourceIndex?-1:1}var aY=aX.sourceIndex-aW.sourceIndex;if(aY===0){aK=true}return aY}}else{if(document.createRange){aR=function(aZ,aX){if(!aZ.ownerDocument||!aX.ownerDocument){if(aZ==aX){aK=true}return aZ.ownerDocument?-1:1}var aY=aZ.ownerDocument.createRange(),aW=aX.ownerDocument.createRange();aY.setStart(aZ,0);aY.setEnd(aZ,0);aW.setStart(aX,0);aW.setEnd(aX,0);var a0=aY.compareBoundaryPoints(Range.START_TO_END,aW);if(a0===0){aK=true}return a0}}}}function S(aW){var aX="",aZ;for(var aY=0;aW[aY];aY++){aZ=aW[aY];if(aZ.nodeType===3||aZ.nodeType===4){aX+=aZ.nodeValue}else{if(aZ.nodeType!==8){aX+=S(aZ.childNodes)}}}return aX}(function(){var aX=document.createElement("div"),aY="script"+(new Date).getTime();aX.innerHTML="<a name='"+aY+"'/>";var aW=document.documentElement;aW.insertBefore(aX,aW.firstChild);if(document.getElementById(aY)){aM.find.ID=function(a0,a1,a2){if(typeof a1.getElementById!=="undefined"&&!a2){var aZ=a1.getElementById(a0[1]);return aZ?aZ.id===a0[1]||typeof aZ.getAttributeNode!=="undefined"&&aZ.getAttributeNode("id").nodeValue===a0[1]?[aZ]:k:[]}};aM.filter.ID=function(a1,aZ){var a0=typeof a1.getAttributeNode!=="undefined"&&a1.getAttributeNode("id");return a1.nodeType===1&&a0&&a0.nodeValue===aZ}}aW.removeChild(aX);aW=aX=null})();(function(){var aW=document.createElement("div");aW.appendChild(document.createComment(""));if(aW.getElementsByTagName("*").length>0){aM.find.TAG=function(aX,a1){var a0=a1.getElementsByTagName(aX[1]);if(aX[1]==="*"){var aZ=[];for(var aY=0;a0[aY];aY++){if(a0[aY].nodeType===1){aZ.push(a0[aY])}}a0=aZ}return a0}}aW.innerHTML="<a href='#'></a>";if(aW.firstChild&&typeof aW.firstChild.getAttribute!=="undefined"&&aW.firstChild.getAttribute("href")!=="#"){aM.attrHandle.href=function(aX){return aX.getAttribute("href",2)}}aW=null})();if(document.querySelectorAll){(function(){var aW=aG,aY=document.createElement("div");aY.innerHTML="<p class='TEST'></p>";if(aY.querySelectorAll&&aY.querySelectorAll(".TEST").length===0){return}aG=function(a2,a1,aZ,a0){a1=a1||document;if(!a0&&a1.nodeType===9&&!aH(a1)){try{return aO(a1.querySelectorAll(a2),aZ)}catch(a3){}}return aW(a2,a1,aZ,a0)};for(var aX in aW){aG[aX]=aW[aX]}aY=null})()}(function(){var aW=document.createElement("div");aW.innerHTML="<div class='test e'></div><div class='test'></div>";if(!aW.getElementsByClassName||aW.getElementsByClassName("e").length===0){return}aW.lastChild.className="e";if(aW.getElementsByClassName("e").length===1){return}aM.order.splice(1,0,"CLASS");aM.find.CLASS=function(aX,aY,aZ){if(typeof aY.getElementsByClassName!=="undefined"&&!aZ){return aY.getElementsByClassName(aX[1])}};aW=null})();function K(aX,a2,a1,a5,a3,a4){for(var aZ=0,aY=a5.length;aZ<aY;aZ++){var aW=a5[aZ];if(aW){aW=aW[aX];var a0=false;while(aW){if(aW.sizcache===a1){a0=a5[aW.sizset];break}if(aW.nodeType===1&&!a4){aW.sizcache=a1;aW.sizset=aZ}if(aW.nodeName.toLowerCase()===a2){a0=aW;break}aW=aW[aX]}a5[aZ]=a0}}}function aU(aX,a2,a1,a5,a3,a4){for(var aZ=0,aY=a5.length;aZ<aY;aZ++){var aW=a5[aZ];if(aW){aW=aW[aX];var a0=false;while(aW){if(aW.sizcache===a1){a0=a5[aW.sizset];break}if(aW.nodeType===1){if(!a4){aW.sizcache=a1;aW.sizset=aZ}if(typeof a2!=="string"){if(aW===a2){a0=true;break}}else{if(aG.filter(a2,[aW]).length>0){a0=aW;break}}}aW=aW[aX]}a5[aZ]=a0}}}var aN=document.compareDocumentPosition?function(aX,aW){return aX.compareDocumentPosition(aW)&16}:function(aX,aW){return aX!==aW&&(aX.contains?aX.contains(aW):true)};var aH=function(aW){var aX=(aW?aW.ownerDocument||aW:0).documentElement;return aX?aX.nodeName!=="HTML":false};var aT=function(aW,a3){var aZ=[],a0="",a1,aY=a3.nodeType?[a3]:a3;while((a1=aM.match.PSEUDO.exec(aW))){a0+=a1[0];aW=aW.replace(aM.match.PSEUDO,"")}aW=aM.relative[aW]?aW+"*":aW;for(var a2=0,aX=aY.length;a2<aX;a2++){aG(aW,aY[a2],aZ)}return aG.filter(a0,aZ)};return aG})();Q.lang={code:"fi",of:"/",loading:"ladataan…",cancel:"Peruuta",next:"Seuraava",previous:"Edellinen",play:"Toista",pause:"Pysäytä",close:"Sulje",expand:"Suurenna",errors:{single:'Sinun on asennettava <a href="{0}">{1}</a> nähdäksesi sisällön.',shared:'Sinun on asennettava <a href="{0}">{1}</a> - ja <a href="{2}">{3}</a> selainlaajennukset nähdäksesi sisällön.',either:'Sinun on asennetteva joko <a href="{0}">{1}</a> tai <a href="{2}">{3}</a> selainlaajennus nähdäksesi sisällön.'}};var D,at="sb-drag-proxy",E,j,ag;function ax(){E={x:0,y:0,startX:null,startY:null}}function aA(){var K=Q.dimensions;aC(j.style,{height:K.innerHeight+"px",width:K.innerWidth+"px"})}function O(){ax();var K=["position:absolute","cursor:"+(Q.isGecko?"-moz-grab":"move"),"background-color:"+(Q.isIE?"#fff;filter:alpha(opacity=0)":"transparent")].join(";");Q.appendHTML(Q.skin.body,'<div id="'+at+'" style="'+K+'"></div>');j=ad(at);aA();F(j,"mousedown",L)}function B(){if(j){M(j,"mousedown",L);C(j);j=null}ag=null}function L(S){n(S);var K=V(S);E.startX=K[0];E.startY=K[1];ag=ad(Q.player.id);F(document,"mousemove",H);F(document,"mouseup",i);if(Q.isGecko){j.style.cursor="-moz-grabbing"}}function H(aI){var K=Q.player,aJ=Q.dimensions,aH=V(aI);var aG=aH[0]-E.startX;E.startX+=aG;E.x=Math.max(Math.min(0,E.x+aG),aJ.innerWidth-K.width);var S=aH[1]-E.startY;E.startY+=S;E.y=Math.max(Math.min(0,E.y+S),aJ.innerHeight-K.height);aC(ag.style,{left:E.x+"px",top:E.y+"px"})}function i(){M(document,"mousemove",H);M(document,"mouseup",i);if(Q.isGecko){j.style.cursor="-moz-grab"}}Q.img=function(S,aG){this.obj=S;this.id=aG;this.ready=false;var K=this;D=new Image();D.onload=function(){K.height=S.height?parseInt(S.height,10):D.height;K.width=S.width?parseInt(S.width,10):D.width;K.ready=true;D.onload=null;D=null};D.src=S.content};Q.img.ext=["bmp","gif","jpg","jpeg","png"];Q.img.prototype={append:function(S,aI){var aG=document.createElement("img");aG.id=this.id;aG.src=this.obj.content;aG.style.position="absolute";var K,aH;if(aI.oversized&&Q.options.handleOversize=="resize"){K=aI.innerHeight;aH=aI.innerWidth}else{K=this.height;aH=this.width}aG.setAttribute("height",K);aG.setAttribute("width",aH);S.appendChild(aG)},remove:function(){var K=ad(this.id);if(K){C(K)}B();if(D){D.onload=null;D=null}},onLoad:function(){var K=Q.dimensions;if(K.oversized&&Q.options.handleOversize=="drag"){O()}},onWindowResize:function(){var aH=Q.dimensions;switch(Q.options.handleOversize){case"resize":var K=ad(this.id);K.height=aH.innerHeight;K.width=aH.innerWidth;break;case"drag":if(ag){var aG=parseInt(Q.getStyle(ag,"top")),S=parseInt(Q.getStyle(ag,"left"));if(aG+this.height<aH.innerHeight){ag.style.top=aH.innerHeight-this.height+"px"}if(S+this.width<aH.innerWidth){ag.style.left=aH.innerWidth-this.width+"px"}aA()}break}}};Q.iframe=function(S,aG){this.obj=S;this.id=aG;var K=ad("sb-overlay");this.height=S.height?parseInt(S.height,10):K.offsetHeight;this.width=S.width?parseInt(S.width,10):K.offsetWidth};Q.iframe.prototype={append:function(K,aG){var S='<iframe id="'+this.id+'" name="'+this.id+'" height="100%" width="100%" frameborder="0" marginwidth="0" marginheight="0" style="visibility:hidden" onload="this.style.visibility=\'visible\'" scrolling="auto"';if(Q.isIE){S+=' allowtransparency="true"';if(Q.isIE6){S+=" src=\"javascript:false;document.write('');\""}}S+="></iframe>";K.innerHTML=S},remove:function(){var K=ad(this.id);if(K){C(K);if(Q.isGecko){delete au.frames[this.id]}}},onLoad:function(){var K=Q.isIE?ad(this.id).contentWindow:au.frames[this.id];K.location.href=this.obj.content}};Q.html=function(K,S){this.obj=K;this.id=S;this.height=K.height?parseInt(K.height,10):300;this.width=K.width?parseInt(K.width,10):500};Q.html.prototype={append:function(K,S){var aG=document.createElement("div");aG.id=this.id;aG.className="html";aG.innerHTML=this.obj.content;K.appendChild(aG)},remove:function(){var K=ad(this.id);if(K){C(K)}}};var ao=false,Y=[],q=["sb-nav-close","sb-nav-next","sb-nav-play","sb-nav-pause","sb-nav-previous"],aa,ae,Z,m=true;function N(aG,aQ,aN,aL,aR){var K=(aQ=="opacity"),aM=K?Q.setOpacity:function(aS,aT){aS.style[aQ]=""+aT+"px"};if(aL==0||(!K&&!Q.options.animate)||(K&&!Q.options.animateFade)){aM(aG,aN);if(aR){aR()}return}var aO=parseFloat(Q.getStyle(aG,aQ))||0;var aP=aN-aO;if(aP==0){if(aR){aR()}return}aL*=1000;var aH=aw(),aK=Q.ease,aJ=aH+aL,aI;var S=setInterval(function(){aI=aw();if(aI>=aJ){clearInterval(S);S=null;aM(aG,aN);if(aR){aR()}}else{aM(aG,aO+aK((aI-aH)/aL)*aP)}},10)}function aB(){aa.style.height=Q.getWindowSize("Height")+"px";aa.style.width=Q.getWindowSize("Width")+"px"}function aE(){aa.style.top=document.documentElement.scrollTop+"px";aa.style.left=document.documentElement.scrollLeft+"px"}function ay(K){if(K){aF(Y,function(S,aG){aG[0].style.visibility=aG[1]||""})}else{Y=[];aF(Q.options.troubleElements,function(aG,S){aF(document.getElementsByTagName(S),function(aH,aI){Y.push([aI,aI.style.visibility]);aI.style.visibility="hidden"})})}}function r(aG,K){var S=ad("sb-nav-"+aG);if(S){S.style.display=K?"":"none"}}function ah(K,aJ){var aI=ad("sb-loading"),aG=Q.getCurrent().player,aH=(aG=="img"||aG=="html");if(K){Q.setOpacity(aI,0);aI.style.display="block";var S=function(){Q.clearOpacity(aI);if(aJ){aJ()}};if(aH){N(aI,"opacity",1,Q.options.fadeDuration,S)}else{S()}}else{var S=function(){aI.style.display="none";Q.clearOpacity(aI);if(aJ){aJ()}};if(aH){N(aI,"opacity",0,Q.options.fadeDuration,S)}else{S()}}}function t(aO){var aJ=Q.getCurrent();ad("sb-title-inner").innerHTML=aJ.title||"";var aP,aL,S,aQ,aM;if(Q.options.displayNav){aP=true;var aN=Q.gallery.length;if(aN>1){if(Q.options.continuous){aL=aM=true}else{aL=(aN-1)>Q.current;aM=Q.current>0}}if(Q.options.slideshowDelay>0&&Q.hasNext()){aQ=!Q.isPaused();S=!aQ}}else{aP=aL=S=aQ=aM=false}r("close",aP);r("next",aL);r("play",S);r("pause",aQ);r("previous",aM);var K="";if(Q.options.displayCounter&&Q.gallery.length>1){var aN=Q.gallery.length;if(Q.options.counterType=="skip"){var aI=0,aH=aN,aG=parseInt(Q.options.counterLimit)||0;if(aG<aN&&aG>2){var aK=Math.floor(aG/2);aI=Q.current-aK;if(aI<0){aI+=aN}aH=Q.current+(aG-aK);if(aH>aN){aH-=aN}}while(aI!=aH){if(aI==aN){aI=0}K+='<a onclick="Shadowbox.change('+aI+');"';if(aI==Q.current){K+=' class="sb-counter-current"'}K+=">"+(++aI)+"</a>"}}else{K=[Q.current+1,Q.lang.of,aN].join(" ")}}ad("sb-counter").innerHTML=K;aO()}function U(aH){var K=ad("sb-title-inner"),aG=ad("sb-info-inner"),S=0.35;K.style.visibility=aG.style.visibility="";if(K.innerHTML!=""){N(K,"marginTop",0,S)}N(aG,"marginTop",0,S,aH)}function av(aG,aM){var aK=ad("sb-title"),K=ad("sb-info"),aH=aK.offsetHeight,aI=K.offsetHeight,aJ=ad("sb-title-inner"),aL=ad("sb-info-inner"),S=(aG?0.35:0);N(aJ,"marginTop",aH,S);N(aL,"marginTop",aI*-1,S,function(){aJ.style.visibility=aL.style.visibility="hidden";aM()})}function ac(K,aH,S,aJ){var aI=ad("sb-wrapper-inner"),aG=(S?Q.options.resizeDuration:0);N(Z,"top",aH,aG);N(aI,"height",K,aG,aJ)}function ar(K,aH,S,aI){var aG=(S?Q.options.resizeDuration:0);N(Z,"left",aH,aG);N(Z,"width",K,aG,aI)}function ak(aM,aG){var aI=ad("sb-body-inner"),aM=parseInt(aM),aG=parseInt(aG),S=Z.offsetHeight-aI.offsetHeight,K=Z.offsetWidth-aI.offsetWidth,aK=ae.offsetHeight,aL=ae.offsetWidth,aJ=parseInt(Q.options.viewportPadding)||20,aH=(Q.player&&Q.options.handleOversize!="drag");return Q.setDimensions(aM,aG,aK,aL,S,K,aJ,aH)}var T={};T.markup='<div id="sb-container"><div id="sb-overlay"></div><div id="sb-wrapper"><div id="sb-title"><div id="sb-title-inner"></div></div><div id="sb-wrapper-inner"><div id="sb-body"><div id="sb-body-inner"></div><div id="sb-loading"><div id="sb-loading-inner"><span>{loading}</span></div></div></div></div><div id="sb-info"><div id="sb-info-inner"><div id="sb-counter"></div><div id="sb-nav"><a id="sb-nav-close" title="{close}" onclick="Shadowbox.close()"></a><a id="sb-nav-next" title="{next}" onclick="Shadowbox.next()"></a><a id="sb-nav-play" title="{play}" onclick="Shadowbox.play()"></a><a id="sb-nav-pause" title="{pause}" onclick="Shadowbox.pause()"></a><a id="sb-nav-previous" title="{previous}" onclick="Shadowbox.previous()"></a><a id="sb-nav-expand" title="{expand}" onclick="sb_expand()"></a></div></div></div></div></div>';T.options={animSequence:"sync",counterLimit:10,counterType:"default",displayCounter:true,displayNav:true,fadeDuration:0.35,initialHeight:160,initialWidth:320,modal:false,overlayColor:"#000",overlayOpacity:0.85,resizeDuration:0.35,showOverlay:true,troubleElements:["select","object","embed","canvas"]};T.init=function(){Q.appendHTML(document.body,s(T.markup,Q.lang));T.body=ad("sb-body-inner");aa=ad("sb-container");ae=ad("sb-overlay");Z=ad("sb-wrapper");if(!x){aa.style.position="absolute"}if(!h){var aG,K,S=/url\("(.*\.png)"\)/;aF(q,function(aI,aJ){aG=ad(aJ);if(aG){K=Q.getStyle(aG,"backgroundImage").match(S);if(K){aG.style.backgroundImage="none";aG.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src="+K[1]+",sizingMethod=scale);"}}})}var aH;F(au,"resize",function(){if(aH){clearTimeout(aH);aH=null}if(A){aH=setTimeout(T.onWindowResize,10)}})};T.onOpen=function(K,aG){m=false;aa.style.display="block";aB();var S=ak(Q.options.initialHeight,Q.options.initialWidth);ac(S.innerHeight,S.top);ar(S.width,S.left);if(Q.options.showOverlay){ae.style.backgroundColor=Q.options.overlayColor;Q.setOpacity(ae,0);if(!Q.options.modal){F(ae,"click",Q.close)}ao=true}if(!x){aE();F(au,"scroll",aE)}ay();aa.style.visibility="visible";if(ao){N(ae,"opacity",Q.options.overlayOpacity,Q.options.fadeDuration,aG)}else{aG()}};T.onLoad=function(S,K){ah(true);while(T.body.firstChild){C(T.body.firstChild)}av(S,function(){if(!A){return}if(!S){Z.style.visibility="visible"}t(K)})};T.onReady=function(aH){if(!A){return}var S=Q.player,aG=ak(S.height,S.width);var K=function(){U(aH)};switch(Q.options.animSequence){case"hw":ac(aG.innerHeight,aG.top,true,function(){ar(aG.width,aG.left,true,K)});break;case"wh":ar(aG.width,aG.left,true,function(){ac(aG.innerHeight,aG.top,true,K)});break;default:ar(aG.width,aG.left,true);ac(aG.innerHeight,aG.top,true,K)}};T.onShow=function(K){ah(false,K);m=true};T.onClose=function(){if(!x){M(au,"scroll",aE)}M(ae,"click",Q.close);Z.style.visibility="hidden";var K=function(){aa.style.visibility="hidden";aa.style.display="none";ay(true)};if(ao){N(ae,"opacity",0,Q.options.fadeDuration,K)}else{K()}};T.onPlay=function(){r("play",false);r("pause",true)};T.onPause=function(){r("pause",false);r("play",true)};T.onWindowResize=function(){if(!m){return}aB();var K=Q.player,S=ak(K.height,K.width);ar(S.width,S.left);ac(S.innerHeight,S.top);if(K.onWindowResize){K.onWindowResize()}};Q.skin=T;au.Shadowbox=Q})(window);


/*
 * SB Expand - ShadowBox modification by pandaking (slideshow support by migf1)
 * Allow's the expansion of large images to their original size.
 */

var sbe_isDrag = true;		// global flag

// Changes all images back to resize if they were already on drag.
var sbe_cleanup = function(){
	if (sbe_isDrag){
		var sbe = Shadowbox.getCurrent();
		sbe.options["handleOversize"] = "resize";
		Shadowbox.setup(sbe.link, sbe.options);
		remove_mag(sbe);
		sbe_isDrag = false;
	}
	sbe_isDrag = true;	// migf1: dunno why this is needed (it somehow resets image to "resize")
}

// Removes magnifying glass if anything other than an image is opened.
var remove_mag = function(sbe){
	sbe.options["handleOversize"]="resize";
	if ( sbe["player"] !== "img" ) {
		var el = document.getElementById('sb-nav-expand');
		el.style.display = 'none';
	}
	else {
		var el = document.getElementById('sb-nav-expand');
		el.style.display = 'block';
	}
	Shadowbox.setup(sbe.link, sbe.options); 
}

// Forces the currently displayed image to "resize" mode and Closes Shadowbox		
var sbe_close = function() {
	var sbe = Shadowbox.getCurrent();
	sbe.options["handleOversize"] = "resize";
	Shadowbox.close();
}

// Function to switch between the full and the auto-shrunk dimensions of an image
// (it is done by switcing the handleOversize option of the image between "drag" and "resize")
function sb_expand() {
	sbe_isDrag = false;

	var sbe = Shadowbox.getCurrent();
	if ( sbe.options["handleOversize"] === "drag" ) {
		sbe.options["handleOversize"] = "resize";
		// Shadowbox.play();	// uncomment for resuming slideshow when icon is press for 2nd time 
	}
	else {
		Shadowbox.pause();		// in case of a slidshow going on, pause it before expanding image
		sbe.options["handleOversize"] = "drag";
	}
	Shadowbox.change(Shadowbox.current);
}

/*
 * SB Expand - ShadowBox modification by pandaking (slideshow support by migf1)
 * Allow's the expansion of large images to their original size.
*/

/*-------------------------------------------------------------------- 
 * jQuery Script: "Muokkaa shadowbox-linkit"
--------------------------------------------------------------------*/

$(function() {
jQuery.each(jQuery.browser, function(i, val) { if(i!="msie" && jQuery.browser.version.substr(0,3)!="6.0") {
if ( $("#nayttelijat").length > 0 && $("div.kuvat.kv_dvd").length == 0 ) {
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[dvd]').attr('href', $(this).attr('href').replace('kuvat/','/kuvat/dvd/kuva'));
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg'); 
});
}
if ( $("#bonus").length > 0 ) {
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[dvd]').attr('href', $(this).attr('href').replace('kuvat/','/kuvat/dvd/kuva'));
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg'); 
});
$("a[href^='bonus/kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[bonus]').attr('href', $(this).attr('href').replace('bonus/kuvat/','/kuvat/dvd/bonus/kuva'));
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg'); 
});
}
if ( $("div.kuvat.kv_dvd").length > 0 ) {
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[dvd]').attr('href', $(this).attr('href').replace('kuvat/','/kuvat/kv/dvd/kuva'));
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg'); 
});
}

if ( $("div.kuvat.peril").length > 0 ) {
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[peril]').attr('href', $(this).attr('href').replace('kuvat/','/kuvat/huvitukset/temple_peril/peten_kuvat/kuva'));
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg'); 
});
}
if ( $("div.kuvat.shadowbox_png").length > 0 ) {
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[peli]');
	var pathArray = window.location.pathname.split('/');
	var vika = pathArray[pathArray.length-2];
	var tokavika = pathArray[pathArray.length-3];
	
	if ( (tokavika == '1980s' && vika != 'lc') || tokavika == 'kannykkapelit' && vika != 'foa' ) {
	$(this).attr('href', $(this).attr('href').replace('kuvat/','/kuvat/' + vika + '/kuva'));
	$(this).attr('href', $(this).attr('href').replace('tod','tod_atari'));
	
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.png');
	}
	
	else if ( vika == 'foa' ) {
	$(this).attr('href', $(this).attr('href').replace('kuvat/','/kuvat/atlantis/atlantis_'));
	
	var newSrc = $(this).attr('href').split('_');
	var newSrc = parseInt(newSrc[1])+1;
	$(this).attr('href', '/kuvat/atlantis/atlantis_' + newSrc + '.png');	
	}
	
	else if ( vika == 'lc' ) {
	$(this).attr('href', $(this).attr('href').replace('kuvat/','/kuvat/crusade/crusade_'));
	
	var newSrc = $(this).attr('href').split('_');
	var newSrc = parseInt(newSrc[1])+1;
	$(this).attr('href', '/kuvat/crusade/crusade_' + newSrc + '.png');	
	}
	
	else {
	$(this).attr('href', $(this).attr('href').replace('kuvat/','/kuvat/' + vika + '/kuva'));
	
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.png');
	}
	
});
}

if ( $("div.kuvat.shadowbox_jpg").length > 0 ) {
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[peli]');
	var pathArray = window.location.pathname.split('/');	
	var vika = pathArray[pathArray.length-2];
	var tokavika = pathArray[pathArray.length-3];
	
	$(this).attr('href', $(this).attr('href').replace('kuvat/','/kuvat/' + vika + '/kuva'));
	$(this).attr('href', $(this).attr('href').replace('im','infernal'));
	$(this).attr('href', $(this).attr('href').replace('kuvakaappaukset_et/kuva','emperor/omat/'));
	$(this).attr('href', $(this).attr('href').replace('et','emperor'));
	
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg');
});
}

if ( $("#lego").length > 0 ) {
$("a[href*='kansi']").each(function () {
	$(this).attr('rel', 'shadowbox[lego]').attr('href', $(this).attr('href').replace('/kuva//kuvat/','/kuvat/'));
});
}

if ( $(".kuvakaappaukset").length > 0 && $(".kuvakaappaukset_et").length == 0) {	
	var pathArray = window.location.pathname.split('/');
	var tokavika = pathArray[pathArray.length-3];
$("a[href^='kuvat/']").each(function () {
	$(this).attr('rel', 'shadowbox[hd]').attr('href', $(this).attr('href').replace('kuvat/','/kuvat/hd/' + tokavika + '/'));
	var originalSrc = $(this).attr('href');
	$(this).attr('href', originalSrc + '.jpg');
});
}

if ( $(".tekija").length > 0 ) {	
$("a[href*='hylly']").each(function () {
	$(this).attr('rel', 'shadowbox[hylly]').attr('href', $(this).attr('href').replace('/kuva/',''));
});
}

$("a[href*='/kuva//']").each(function () {
	$(this).attr('rel', 'shadowbox').attr('href', $(this).attr('href').replace('/kuva/','') ); 
});
$("a[href*='/video/']").each(function () {
	$(this).attr('rel', 'shadowbox').attr('href', $(this).attr('href').replace('/video/','/video.php?url=') ).attr('href', $(this).attr('href').replace('_lev','&leveys=') ).attr('href', $(this).attr('href').replace('_kor','&korkeus=') );
});
$("a[class='external']").each(function () {
	$(this).removeAttr('rel').attr('href', $(this).attr('href').replace('/video.php?url=','/video/') ).attr('href', $(this).attr('href').replace('&leveys=','_lev') ).attr('href', $(this).attr('href').replace('&korkeus=','_kor') );
});
}
});  
});  

/*-------------------------------------------------------------------- 
 * jQuery Script: "IE <7 PNG Fix"
--------------------------------------------------------------------*/

(function($){$.fn.pngfix=function(options){var elements=this;var settings=$.extend({imageFixSrc:false,sizingMethod:false},options);if(!$.browser.msie||($.browser.msie&&$.browser.version>=7)){return(elements);}
function setFilter(el,path,mode){var fs=el.attr("filters");var alpha="DXImageTransform.Microsoft.AlphaImageLoader";if(fs[alpha]){fs[alpha].enabled=true;fs[alpha].src=path;fs[alpha].sizingMethod=mode;}else{el.css("filter",'progid:'+alpha+'(enabled="true", sizingMethod="'+mode+'", src="'+path+'")');}}
function setDOMElementWidth(el){if(el.css("width")=="auto"&el.css("height")=="auto"){el.css("width",el.attr("offsetWidth")+"px");}}
return(elements.each(function(){var el=$(this);if(el.attr("tagName").toUpperCase()=="IMG"&&(/\.png/i).test(el.attr("src"))){if(!settings.imageFixSrc){el.wrap("<span></span>");var par=el.parent();par.css({height:el.height(),width:el.width(),display:"inline-block"});setFilter(par,el.attr("src"),"scale");el.remove();}else if((/\.gif/i).test(settings.imageFixSrc)){setDOMElementWidth(el);setFilter(el,el.attr("src"),"image");el.attr("src",settings.imageFixSrc);}}else{var bg=new String(el.css("backgroundImage"));var matches=bg.match(/^url\("(.*)"\)$/);if(matches&&matches.length){setDOMElementWidth(el);el.css("backgroundImage","none");var sc="crop";if(settings.sizingMethod){sc=settings.sizingMethod;}
setFilter(el,matches[1],sc);el.find("a").each(function(){$(this).css("position","relative");});}}}));}})(jQuery)

jQuery(function($) { $("header h1 img[src$='.png'], section h1 img[src$='.png'], blockquote, #takaisin img, .edellinen_seuraava").pngfix(); });

/*-------------------------------------------------------------------- 
 * jQuery Script: "Sort soundtrack tables"
--------------------------------------------------------------------*/

$(function() {
if ( $("table.soundtrack").length > 0 || $("body.tekijat").length > 0 ) {
$("table.soundtrack, body.tekijat table").tablesorter({widgets: ['zebra']});
}
});

$(function() {
if ( $("#slideshow").length > 0 ) {
$("#slideshow").hover(
function () {
	$(this).animate({ height: '382px'});
	$("#slideshow img").animate({ marginTop: 0 });
}, 
function () {
	$(this).animate({ height: '200px'});
	$("#slideshow img").animate({ marginTop: '-75px' });
});
}
});/**
 * Flash (http://jquery.lukelutman.com/plugins/flash)
 * A jQuery plugin for embedding Flash movies.
 * 
 * Version 1.0
 * November 9th, 2006
 *
 * Copyright (c) 2006 Luke Lutman (http://www.lukelutman.com)
 * Dual licensed under the MIT and GPL licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/gpl-license.php
 * 
 * Inspired by:
 * SWFObject (http://blog.deconcept.com/swfobject/)
 * UFO (http://www.bobbyvandersluis.com/ufo/)
 * sIFR (http://www.mikeindustries.com/sifr/)
 * 
 * IMPORTANT: 
 * The packed version of jQuery breaks ActiveX control
 * activation in Internet Explorer. Use JSMin to minifiy
 * jQuery (see: http://jquery.lukelutman.com/plugins/flash#activex).
 *
 **/ 
;(function(){
	
var $$;

/**
 * 
 * @desc Replace matching elements with a flash movie.
 * @author Luke Lutman
 * @version 1.0.1
 *
 * @name flash
 * @param Hash htmlOptions Options for the embed/object tag.
 * @param Hash pluginOptions Options for detecting/updating the Flash plugin (optional).
 * @param Function replace Custom block called for each matched element if flash is installed (optional).
 * @param Function update Custom block called for each matched if flash isn't installed (optional).
 * @type jQuery
 *
 * @cat plugins/flash
 * 
 * @example $('#hello').flash({ src: 'hello.swf' });
 * @desc Embed a Flash movie.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { version: 8 });
 * @desc Embed a Flash 8 movie.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { expressInstall: true });
 * @desc Embed a Flash movie using Express Install if flash isn't installed.
 *
 * @example $('#hello').flash({ src: 'hello.swf' }, { update: false });
 * @desc Embed a Flash movie, don't show an update message if Flash isn't installed.
 *
**/
$$ = jQuery.fn.flash = function(htmlOptions, pluginOptions, replace, update) {
	
	// Set the default block.
	var block = replace || $$.replace;
	
	// Merge the default and passed plugin options.
	pluginOptions = $$.copy($$.pluginOptions, pluginOptions);
	
	// Detect Flash.
	if(!$$.hasFlash(pluginOptions.version)) {
		// Use Express Install (if specified and Flash plugin 6,0,65 or higher is installed).
		if(pluginOptions.expressInstall && $$.hasFlash(6,0,65)) {
			// Add the necessary flashvars (merged later).
			var expressInstallOptions = {
				flashvars: {  	
					MMredirectURL: location,
					MMplayerType: 'PlugIn',
					MMdoctitle: jQuery('title').text() 
				}					
			};
		// Ask the user to update (if specified).
		} else if (pluginOptions.update) {
			// Change the block to insert the update message instead of the flash movie.
			block = update || $$.update;
		// Fail
		} else {
			// The required version of flash isn't installed.
			// Express Install is turned off, or flash 6,0,65 isn't installed.
			// Update is turned off.
			// Return without doing anything.
			return this;
		}
	}
	
	// Merge the default, express install and passed html options.
	htmlOptions = $$.copy($$.htmlOptions, expressInstallOptions, htmlOptions);
	
	// Invoke $block (with a copy of the merged html options) for each element.
	return this.each(function(){
		block.call(this, $$.copy(htmlOptions));
	});
	
};
/**
 *
 * @name flash.copy
 * @desc Copy an arbitrary number of objects into a new object.
 * @type Object
 * 
 * @example $$.copy({ foo: 1 }, { bar: 2 });
 * @result { foo: 1, bar: 2 };
 *
**/
$$.copy = function() {
	var options = {}, flashvars = {};
	for(var i = 0; i < arguments.length; i++) {
		var arg = arguments[i];
		if(arg == undefined) continue;
		jQuery.extend(options, arg);
		// don't clobber one flash vars object with another
		// merge them instead
		if(arg.flashvars == undefined) continue;
		jQuery.extend(flashvars, arg.flashvars);
	}
	options.flashvars = flashvars;
	return options;
};
/*
 * @name flash.hasFlash
 * @desc Check if a specific version of the Flash plugin is installed
 * @type Boolean
 *
**/
$$.hasFlash = function() {
	// look for a flag in the query string to bypass flash detection
	if(/hasFlash\=true/.test(location)) return true;
	if(/hasFlash\=false/.test(location)) return false;
	var pv = $$.hasFlash.playerVersion().match(/\d+/g);
	var rv = String([arguments[0], arguments[1], arguments[2]]).match(/\d+/g) || String($$.pluginOptions.version).match(/\d+/g);
	for(var i = 0; i < 3; i++) {
		pv[i] = parseInt(pv[i] || 0);
		rv[i] = parseInt(rv[i] || 0);
		// player is less than required
		if(pv[i] < rv[i]) return false;
		// player is greater than required
		if(pv[i] > rv[i]) return true;
	}
	// major version, minor version and revision match exactly
	return true;
};
/**
 *
 * @name flash.hasFlash.playerVersion
 * @desc Get the version of the installed Flash plugin.
 * @type String
 *
**/
$$.hasFlash.playerVersion = function() {
	// ie
	try {
		try {
			// avoid fp6 minor version lookup issues
			// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
			var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
			try { axo.AllowScriptAccess = 'always';	} 
			catch(e) { return '6,0,0'; }				
		} catch(e) {}
		return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
	// other browsers
	} catch(e) {
		try {
			if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
				return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
			}
		} catch(e) {}		
	}
	return '0,0,0';
};
/**
 *
 * @name flash.htmlOptions
 * @desc The default set of options for the object or embed tag.
 *
**/
$$.htmlOptions = {
	height: 240,
	flashvars: {},
	pluginspage: 'http://www.adobe.com/go/getflashplayer',
	src: '#',
	type: 'application/x-shockwave-flash',
	width: 320		
};
/**
 *
 * @name flash.pluginOptions
 * @desc The default set of options for checking/updating the flash Plugin.
 *
**/
$$.pluginOptions = {
	expressInstall: false,
	update: true,
	version: '6.0.65'
};
/**
 *
 * @name flash.replace
 * @desc The default method for replacing an element with a Flash movie.
 *
**/
$$.replace = function(htmlOptions) {
	this.innerHTML = '<div class="alt">'+this.innerHTML+'</div>';
	jQuery(this)
		.addClass('flash-replaced')
		.prepend($$.transform(htmlOptions));
};
/**
 *
 * @name flash.update
 * @desc The default method for replacing an element with an update message.
 *
**/
$$.update = function(htmlOptions) {
	var url = String(location).split('?');
	url.splice(1,0,'?hasFlash=true&');
	url = url.join('');
	var msg = '<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';
	this.innerHTML = '<span class="alt">'+this.innerHTML+'</span>';
	jQuery(this)
		.addClass('flash-update')
		.prepend(msg);
};
/**
 *
 * @desc Convert a hash of html options to a string of attributes, using Function.apply(). 
 * @example toAttributeString.apply(htmlOptions)
 * @result foo="bar" foo="bar"
 *
**/
function toAttributeString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'="'+this[key]+'" ';
	return s;		
};
/**
 *
 * @desc Convert a hash of flashvars to a url-encoded string, using Function.apply(). 
 * @example toFlashvarsString.apply(flashvarsObject)
 * @result foo=bar&foo=bar
 *
**/
function toFlashvarsString() {
	var s = '';
	for(var key in this)
		if(typeof this[key] != 'function')
			s += key+'='+encodeURIComponent(this[key])+'&';
	return s.replace(/&$/, '');		
};
/**
 *
 * @name flash.transform
 * @desc Transform a set of html options into an embed tag.
 * @type String 
 *
 * @example $$.transform(htmlOptions)
 * @result <embed src="foo.swf" ... />
 *
 * Note: The embed tag is NOT standards-compliant, but it 
 * works in all current browsers. flash.transform can be
 * overwritten with a custom function to generate more 
 * standards-compliant markup.
 *
**/
$$.transform = function(htmlOptions) {
	htmlOptions.toString = toAttributeString;
	if(htmlOptions.flashvars) htmlOptions.flashvars.toString = toFlashvarsString;
	return '<embed ' + String(htmlOptions) + '/>';		
};

/**
 *
 * Flash Player 9 Fix (http://blog.deconcept.com/2006/07/28/swfobject-143-released/)
 *
**/
if (window.attachEvent) {
	window.attachEvent("onbeforeunload", function(){
		__flash_unloadHandler = function() {};
		__flash_savedUnloadHandler = function() {};
	});
}
	
})();
