var products_navigation=null;var product_sections=null;var visible_product=null;var products=["events_container","strategy_container","reviews_container","cop_container","shareflect_container","dcp_container","training_container"];var visible_reference=null;var references=["nomadskolan","rte","vod","digibusiness","tivit","hrcommunity","gtf","tekes","bantora"];var visible_person="teemu";var people=["teemu","ville","sam","jyrki","mikko","antti","esko","petra","veikko"];var contact_in_flight=0;dojo.addOnLoad(function(){if(dojo.byId("products")){products_navigation=dojo.byId("products_navigation");product_sections=dojo.byId("product_sections");var d=location.hash.substr(1)+"_container";if(d&&dojo.indexOf(products,d)!=-1){show_product(d)}dojo.connect(dojo.byId("products_home"),"onclick",null,dojo.partial(show_product,null));dojo.connect(dojo.byId("products_previous"),"onclick",null,previous_product);dojo.connect(dojo.byId("products_next"),"onclick",null,next_product);dojo.query(".product_link").forEach(function(f){dojo.connect(f,"onclick",null,function(g){show_product(f.href.split("#")[1]+"_container")})})}else{if(dojo.byId("references")){var a=location.hash.substr(1);if(a&&dojo.indexOf(references,a)!=-1){show_reference(a)}dojo.connect(dojo.byId("lightbox_close"),"onclick",null,hide_lightbox);dojo.connect(dojo.byId("lightbox_previous"),"onclick",null,previous_reference);dojo.connect(dojo.byId("lightbox_next"),"onclick",null,next_reference);dojo.query(".reference_link").forEach(function(f){dojo.connect(f,"onclick",null,function(g){show_reference(f.href.split("#")[1])})})}else{if(dojo.byId("people")){var c=location.hash.substr(1);if(c&&dojo.indexOf(people,c)!=-1){show_person(c)}else{show_person(visible_person)}dojo.query(".person_link").forEach(function(f){dojo.connect(f,"onclick",null,function(g){show_person(f.href.split("#")[1])})})}else{if(dojo.byId("radar")){var b=dojo.query(".timestamp");setTimeout(function(){b.forEach(function(f){f.innerHTML=time_ago(Number(dojo.attr(f,"title")))});setTimeout(arguments.callee,1000)},1000)}}}}var e=window.location.pathname.split("/")[1]=="fi"?"fi":"en";dojo.query(".language_link").forEach(function(f){dojo.connect(f,"onclick",null,function(g){dojo.stopEvent(g);if(f.id!=e){if(f.id=="en"){window.location=window.location.pathname.substr(3)+window.location.hash}else{window.location="/"+f.id+window.location.pathname+window.location.hash}}})});dojo.query(".tip_field").forEach(function(f){dojo.connect(f,"onfocus",null,function(g){dojo.stopEvent(g);if(dojo.trim(f.value)==f.defaultValue){f.value=""}});dojo.connect(f,"onblur",null,function(g){dojo.stopEvent(g);if(!dojo.trim(f.value).length){f.value=f.defaultValue}})});dojo.query(".message").forEach(function(k){var f=dojo.query(".contact_form_container",k)[0];var l=dojo.query(".contact_form_success",k)[0];var j=dojo.query(".contact_form",f)[0];var h=dojo.query(".contact_name",j)[0];var g=dojo.query(".contact_email",j)[0];var i=dojo.query(".contact_content",j)[0];dojo.connect(j,"onsubmit",null,function(n){dojo.stopEvent(n);var m=new Date();m=m.getTime()/1000;if(m<contact_in_flight+5){return}if(!h.value.length||!g.value.length||!i.value.length){alert("Please fill all the fields.")}contact_in_flight=m;dojo.xhrPost({url:"/static/mail_us.pl",handleAs:"json",content:{name:h.value,email:g.value,content:i.value},load:function(o){dojo.style(f,"display","none");dojo.style(l,"display","block")},error:function(o){alert("Unexpected error. Please try again.")}})})})});function show_product(a){if(a){if(visible_product){dojo.style(visible_product,"display","none")}visible_product=a;dojo.style(visible_product,"display","block");dojo.style(products_navigation,"display","block");dojo.style(product_sections,"display","none");location.hash="#"+a.split("_")[0]}else{dojo.style(visible_product,"display","none");visible_product=null;dojo.style(products_navigation,"display","none");dojo.style(product_sections,"display","block");location.hash=""}}function previous_product(b){dojo.stopEvent(b);var a=dojo.indexOf(products,visible_product)-1;if(a==-1){show_product(products[products.length-1])}else{show_product(products[a])}}function next_product(b){dojo.stopEvent(b);var a=dojo.indexOf(products,visible_product)+1;if(a==products.length){show_product(products[0])}else{show_product(products[a])}}function show_person(a){dojo.removeClass(visible_person+"_link","active");dojo.style(visible_person,"display","none");dojo.addClass(a+"_link","active");dojo.style(a,"display","block");visible_person=a}function show_lightbox(){dojo.style("lightbox_overlay","display","block")}function hide_lightbox(a){dojo.stopEvent(a);dojo.style("lightbox_overlay","display","none")}function show_reference(a){if(visible_reference){dojo.style("lightbox_"+visible_reference,"display","none")}show_lightbox();visible_reference=a;dojo.style("lightbox_"+a,"display","block");location.hash="#"+visible_reference}function previous_reference(b){dojo.stopEvent(b);var a=dojo.indexOf(references,visible_reference)-1;if(a==-1){show_reference(references[references.length-1])}else{show_reference(references[a])}}function next_reference(b){dojo.stopEvent(b);var a=dojo.indexOf(references,visible_reference)+1;if(a==references.length){show_reference(references[0])}else{show_reference(references[a])}}function time_ago(c){var a=Math.floor(new Date().getTime()/1000);var d=a-c;var b=0;if(b=Math.floor(d/(60*60*24*365))){return b+"Y"}else{if(b=Math.floor(d/(60*60*24*30))){return b+"M"}else{if(b=Math.floor(d/(60*60*24))){return b+"d"}else{if(b=Math.floor(d/(60*60))){return b+"h"}else{if(b=Math.floor(d/60)){return b+"m"}else{return Math.floor(d)+"s"}}}}}};