function showJumpNavigation(iso){
	var myElement = document.getElementById('searchjump-' + iso);
	myElement.style.display = "block";
}
function hideJumpNavigation(iso){
	var myElement = document.getElementById('searchjump-' + iso);
	if(myElement){
		myElement.style.display = "none";
	}
}


function nw(url) {
	window.open(url, "popup", "width=1280,height=600,left=20,top=20, resizable=yes, scrollbars=yes");
}
function deleteBackground() {
	var myElement = document.getElementById("search");
	myElement.style.background = "transparent";
}
function showBackground() {
	var myElement = document.getElementById("search");
	myElement.style.background = "transparent";
}
function nv(url) {
	window.open(url, "popup", "width=600,height=400,left=20,top=20, resizable=yes, scrollbars=yes");
}
function popup(url) {
	window.open(url, "popup", "width=980,height=525,left=20,top=20, resizable=yes, scrollbars=yes");
}
function sb(box){
	var theBox = document.getElementById("specialbox" + box);
	if(theBox){
		theBox.style.display = "block";	
	}
}
function hb(box){
	var theBox = document.getElementById("specialbox" + box);
	if(theBox){
		theBox.style.display = "none";	
	}
}


function showPic(thePic){
	if(thePic == "pic1"){
		document.getElementById("pic4").style.display = "none";
		document.getElementById("pic3").style.display = "none";
		document.getElementById("pic2").style.display = "none";
		document.getElementById("pic1").style.display = "block";	
	}
	if(thePic == "pic2"){
		document.getElementById("pic4").style.display = "none";
		document.getElementById("pic3").style.display = "none";
		document.getElementById("pic1").style.display = "none";
		document.getElementById("pic2").style.display = "block";	
	}
	if(thePic == "pic3"){
		document.getElementById("pic1").style.display = "none";
		document.getElementById("pic2").style.display = "none";
		document.getElementById("pic4").style.display = "none";
		document.getElementById("pic3").style.display = "block";	
	}
	if(thePic == "pic4"){
		document.getElementById("pic1").style.display = "none";
		document.getElementById("pic3").style.display = "none";
		document.getElementById("pic2").style.display = "none";
		document.getElementById("pic4").style.display = "block";	
	}
}
function rzCC(s){
   for(var exp=/-([a-z])/; 
       exp.test(s); 
       s=s.replace(exp,RegExp.$1.toUpperCase()));
   return s;
 }

 function _setStyle(element, declaration) {
   if (declaration.charAt(declaration.length-1)==';')
     declaration = declaration.slice(0, -1);
   var k, v;
   var splitted = declaration.split(';');
   for (var i=0, len=splitted.length; i<len; i++) {
      k = rzCC(splitted[i].split(':')[0]);
      v = splitted[i].split(':')[1];
      eval("element.style."+k+"='"+v+"'");
   }
 }

function isIE6(){
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ 
 		var ieversion=new Number(RegExp.$1) 
		if (ieversion<=6){
			return true;
		}
	}
}

// Print with/without images
/*
 * window.addEvent("domready", function () { if($("printImages") != null){
 * $("printImages").addEvents({"click":function () {
 * 
 * if(this.checked){ $$("#popup img").each(function(el) { if(el !=
 * $("printIcon")){ el.setStyle('display', 'none'); } }); }else{ $$("#popup
 * img").each(function(el) { el.setStyle('display', 'block'); });
 * $("printIcon").setStyle('float', 'right'); } } }); } });
 */

// Print with/without images
window.addEvent("domready", function () {
	if($("printNoImages") != null){
		$("printNoImages").addEvents({"click":function () {
			$$("#popup img").each(function(el) { 
				if(el != $("printIcon")){
					if(el != $("printIcon2")){
						el.setStyle('display', 'none');
					}
				}			 
			});
			window.print();
		} 
		});
	}
	if($("printAllImages") != null){
		$("printAllImages").addEvents({"click":function () {
			$$("#popup img").each(function(el) { 
				if(el != $("printIcon")){
					if(el != $("printIcon2")){
						el.setStyle('display', 'block');
					}
				}			 
			});
			window.print();
		} 
		});
	}
});

// here are our functions to change the styles
var showFunction = function() {
	$$('.hidden').setStyle('display', 'none'); 
	this.setStyle('display', 'block');
}
 
var hideFunction = function() {
	this.setStyle('display', 'none');
}

window.addEvent('domready', function() {
	if($("contentpdf") != null){
		$('contentpdf').setStyle('display', 'block');
		// $('pdf').setAttribute('class', 'current');
		$('pdf').addClass('current'); 
		$('pdf').addEvent('click', showFunction.bind($('contentpdf')));
		$('xls').addEvent('click', showFunction.bind($('contentxls')));
	}
});
window.addEvent("domready", function () {
	if($("contentpdf") != null){
	$("pdf").addEvents({"click":function () {
		// this.setAttribute("class","current");
		this.addClass('current'); 
		$('xls').removeClass('current'); 
		// $("xls").setAttribute("class","normal");
	} 
	});
	$("xls").addEvents({"click":function () {
		// this.setAttribute("class","current");
		// $("pdf").setAttribute("class","normal");
		this.addClass('current'); 
		$('pdf').removeClass('current'); 
	} 
	});
	}

	// Serach & Jump
	if($("search-de")){
		$("search-de").addEvents({
			"mouseover":function () {
				showJumpNavigation('de'); 
			},
			"keydown":function () {
				hideJumpNavigation('de'); 
			} 
		});
	}
	if($("search-en")){
		$("search-en").addEvents({
			"mouseover":function () {
				showJumpNavigation('en'); 
			},
			"keydown":function () {
				hideJumpNavigation('en'); 
			} 
		});
	}
	
	var filename = GetFilename(document.URL);
	var relfix = '';
	if('index' != filename){
		relfix = '../../';
	}else{
		relfix = '../';
	}
	
	// Hover-Effekte bei Schrift-Icons
	if($("fontMinus")){
		$("fontMinus").addEvents({
			"mouseover":function () {
				this.setProperty('src', relfix + 'files/images/page_service/layout_icon_minus_hover.gif');
			},
			"mouseout":function () {
				this.setProperty('src', relfix + 'files/images/page_service/layout_icon_minus.gif');
			} 
		});
	}
	if($("fontReset")){
		$("fontReset").addEvents({
			"mouseover":function () {
				this.setProperty('src', relfix + 'files/images/page_service/layout_icon_reset_hover.gif');
			},
			"mouseout":function () {
				this.setProperty('src', relfix + 'files/images/page_service/layout_icon_reset.gif');
			} 
		});
	}
	if($("fontPlus")){
		$("fontPlus").addEvents({
			"mouseover":function () {
				this.setProperty('src', relfix + 'files/images/page_service/layout_icon_plus_hover.gif');
			},
			"mouseout":function () {
				this.setProperty('src', relfix + 'files/images/page_service/layout_icon_plus.gif');
			} 
		});
	}
	// Enable javascript links
	if($("personal_report")){
		$("personal_report").setStyle('display', 'block');
	}
	if($("key_figures")){
		$("key_figures").setStyle('display', 'block');
	}
	if($("fontsizer_minus")){
		$("fontsizer_minus").setStyle('display', 'block');
	}
	if($("fontsizer_reset")){
		$("fontsizer_reset").setStyle('display', 'block');
	}
	if($("fontsizer_plus")){
		$("fontsizer_plus").setStyle('display', 'block');
	}
	if($("search-form")){
		$("search-form").setStyle('display', 'block');
	}
	if($("add_site")){
		$("add_site").setStyle('display', 'block');
	}
	if($("recommend_page")){
		$("recommend_page").setStyle('display', 'block');
	}
	// Shadowbox.init();
});

function GetFilename(url)
{
   if (url)
   {
      var m = url.toString().match(/.*\/(.+?)\./);
      if (m && m.length > 1)
      {
         return m[1];
      }
   }
   return "";
}

