/*
 * Neuvosto Oy website 1.0
 *
 * Copyright (c) 2008 Neuvosto (Neuvosto Oy)
 * All rights reserved.
 *
 */
(function(A){A.neuvosto={config:{parts_url_prefix:"/page_parts/__LANG__/",parts_url_suffix:"/",languages:{fi:"Suomeksi",en:"In English"}},active_lang:"fi",active_page:null,active_section:"left",active_lc:"kimmocollander",fetched_pages:null,arrow_holder:null,lang_selector:null,dc_holders:{left:null,middle:null,right:null},arrow_positions:null,untranslated_blocks:{en:["#top-content-blocks .content_block_left","#top-content-blocks .content_block_middle","#top-content-blocks .content_block_left","#bottom-content-blocks .dynamic_block_middle","#bottom-content-blocks .dynamic_block_right"]}};
A.extend(A.neuvosto,{init:function(B,C){A(document).pngFix();A.neuvosto.lang_selector=A(".language_selector");
A.each(A("a",A.neuvosto.lang_selector),function(){A(this).bind("click",function(D){var E=A(this).attr("class").split("_")[1];
A.neuvosto.set_active_lang(E);});});if(typeof C!=="undefined"){A.neuvosto.set_active_lang(C);
}A.neuvosto.active_section=B;A.neuvosto.fetched_pages={};A.neuvosto.fetched_pages[A.neuvosto.active_lang]={};
A.neuvosto.arrow_holder=A(".horizontal_arrow_holder");A.neuvosto.dc_holders={left:A("#bottom-content-blocks .dynamic_block_left"),middle:A("#bottom-content-blocks .dynamic_block_middle"),right:A("#bottom-content-blocks .dynamic_block_right")};
A.neuvosto.arrow_positions={kimmocollander:50,kaikeskikorhonen:150,waterfronteurope:98,globaleurope:114,visanoronen:126,hannalauren:140,tommilappalainen:154,klaustyrkko:182, susannamonni:192};
A.neuvosto.init_nav();A.neuvosto.init_events();},update_arrow:function(D){var C=A(".arrow_line_middle",A.neuvosto.arrow_holder);
var B=A.neuvosto.arrow_positions[D];if(A.browser.msie&&D!="kimmocollander"){B+=7;}C.css({height:B+"px"});
},init_nav:function(){var B=null;var C=null;var D=null;A("#bottom-content-blocks a.kimmocollander").bind("click",function(E){A.neuvosto.set_active_section("left");
if(A.neuvosto.active_lc=="kimmocollander"){return false;}A.neuvosto.update_arrow("kimmocollander");
A.neuvosto.set_active_left_content("kimmocollander","Kimmo Collander");return false;});
A("#bottom-content-blocks .dynamic_block_middle h3 a").bind("click",function(E){return A.neuvosto.show_block("middle");
});A("#bottom-content-blocks .dynamic_block_right h3 a").bind("click",function(E){return A.neuvosto.show_block("right");
});A.each(A("ul.partner_links li a"),function(){A(this).bind("click",function(F){var E=A(F.target);
if(E.attr("target")){return true;}C=E.attr("class");D=E.html();A.neuvosto.update_arrow(C);
A.neuvosto.set_active_section("left");if(A.neuvosto.active_lc==C){return false;}A.neuvosto.set_active_left_content(C,D);
return false;});});},show_block:function(B){switch(B){case"left":if(A.neuvosto.active_section=="left"){return false;
}A.neuvosto.set_active_section("left");return false;break;case"middle":if(A.neuvosto.active_section=="middle"){return false;
}A.neuvosto.set_active_section("middle");return false;break;case"right":if(A.neuvosto.active_section=="right"){return false;
}A.neuvosto.set_active_section("right");return false;break;}return false;},init_events:function(){var C=A("#bottom-content-blocks .dynamic_block_middle");
var B=A(".event_listing",C);A.each(A("a.back_to_events"),function(){A(this).bind("click",function(){A(".block_content_helper",C).hide();
B.show();return false;});});function E(G){var F=G.target;if(F){if(F.tagName=="UL"){F=A(F).find("li").eq(0);
return F;}while(F.tagName!="LI"){F=F.parentNode;}}return A(F);}var D=null;A.each(A("ul.past li a.details_link",C),function(){A(this).bind("click",function(F){D=E(F);
var G=A("."+D.attr("id")+"_details",C);if(G.length>0){B.hide();G.show();}return false;
});});},set_active_left_content:function(E,F){A("span.ac_title").html(F);var C=("_OLD_"+A.neuvosto.active_lc).replace("_OLD_","");
var D=A(".dbc_left_"+A.neuvosto.active_lc,A.neuvosto.dc_holders.left);D.hide();var B=A(".dbc_left_"+E,A.neuvosto.dc_holders.left);
B.show();A.neuvosto.active_lc=E;},set_active_section:function(C){if(A.neuvosto.dc_holders[C].hasClass("dynamic_block_closed")){A.neuvosto.dc_holders[C].removeClass("dynamic_block_closed");
A.neuvosto.dc_holders[C].addClass("dynamic_block_open");var B=("_OLD_"+A.neuvosto.active_section).replace("_OLD_","");
A.neuvosto.dc_holders[B].removeClass("dynamic_block_open");A.neuvosto.dc_holders[B].addClass("dynamic_block_closed");
A.neuvosto.active_section=C;}},set_active_lang:function(D,B){if(A.neuvosto.active_lang==D){return false;
}if(typeof B==="undefined"){B=false;}var C=("_OLD_"+A.neuvosto.active_lang).replace("_OLD_","");
A.neuvosto.active_lang=D;A("#layout.language_"+C).removeClass("language_"+C).addClass("language_"+D);
A.each(A(".content_block_"+C),function(){A(this).hide();});A.each(A(".content_block_"+D),function(){A(this).show();
});A.each(A.neuvosto.untranslated_blocks.en,function(E,F){if(C=="fi"){A(F).addClass("content_block_disabled");
}else{A(F).removeClass("content_block_disabled");}});A("#bottom-content-blocks a.kimmocollander").trigger("click");
return true;}});})(jQuery);
