/* $Id: inline-windows.js 5489 2009-08-03 09:36:24Z bhillebrand $ */
"use strict";function drawWindowOverlay(c,e){var d=c.getElementsByTagName("img"),a=new Image(),f=new Image(),b;a.src=d[0].src;f.src=d[1].src;if(e==="show"){b="visible";d[0].src=f.src;d[1].src=a.src;}else{b="hidden";d[0].src=f.src;d[1].src=a.src;}$("div:eq(0)",c).css("visibility",b);}function activateInlineWindow(b){var d,h,a=0,e,g,f=document.body.offsetWidth-800,c=f/2;if(c<=0){c=0;}if(document.documentElement.clientHeight){a=document.documentElement.clientHeight;}else{if(document.body.offsetHeight){a=document.body.offsetHeight;}}e=a-$(document.getElementById(b)).height();g=e/2;if(g<=0){g=0;}if(window.pageYOffset){g+=window.pageYOffset;}else{if(document.body.scrollTop){g+=document.body.scrollTop;}else{if(document.documentElement.scrollTop){g+=document.documentElement.scrollTop;}}}c+="px";g+="px";if(!document.getElementById("inlinewindowOverlay")){$(document.body).append("<div id='inlinewindowOverlay'></div>");}d=window.innerHeight;if(window.scrollMaxY){d+=window.scrollMaxY;}if(!d){d=document.body.clientHeight;}$(document.getElementById("inlinewindowOverlay")).show();if(document.getElementsByTagName("body")[0].scrollHeight<d){h=d;}else{h=document.getElementsByTagName("body")[0].scrollHeight;}document.getElementById("inlinewindowOverlay").style.height=h+"px";$("#"+b).show().css({top:g,left:c,"z-index":"1000"});}function deactivateInlineWindow(a){$("#inlinewindowOverlay").remove();$(document.getElementById(a)).hide();$(document.getElementById(a)).attr({style:"top:128px;left:119px;"});}function iwLoadElementsFromFile(c,e,d,a){var b=$.ajax({url:c,beforeSend:function(){if(a){if(a.preloader&&a.preloaderElement){var f="<img src='"+a.preloader+"' />";$("#"+e+" "+a.preloaderElement).html(f);}}},success:function(g){var f;for(f in d){if(d.hasOwnProperty(f)){$("#"+e+" ."+f).html($(b.responseText).find(d[f]).html());activateInlineWindow(e);}}if(a){if(a.iwTitle){$("#"+e+" .titleHeadline").text(a.iwTitle);}}},error:function(f){if(a){if(a.preloaderElement){$(a.preloaderElement).text(b.status);}}}});}$(document).ready(function(){var a;$(".activateInlineWindow").click(function(){var b="inlineWindow_"+$(this).attr("id"),c;activateInlineWindow(b);if($(this).hasClass("iwTitle")){c=$(this).attr("title");}if($(this).hasClass("iwLoader")){a=$(this).attr("href");iwLoadElementsFromFile(a,b,{titleHeadline:"#iwPageHeadline",contentText:"#iwPageCopy"},{preloader:"/assets/images/global/ajax-loader.gif",preloaderElement:".contentText",iwTitle:c});}return false;});$(".deactivateInlineWindow").click(function(){deactivateInlineWindow("inlineWindow_"+($(this).attr("id").replace(/(\w[^\n\r$]+)_/,"")));});$(".activateInlineWindow,.generateMousePointer").attr({style:"cursor:pointer"});});function browseContinents(a){var b=$(a).attr("id").replace("activate","");$(a).parent().siblings().children().removeClass("continentActive");$(a).addClass("continentActive");$(document.getElementById("iwWorldWide"+b)).siblings().hide();$(document.getElementById("iwWorldWide"+b)).show();}