function onloadFunction(){

	$("a").each( function(){
		var Wert = $(this).attr("href");
	  	var Ausdruck = /(\w.+)\:(.+)/;
	  	Ausdruck.exec(Wert);
			if (RegExp.$1 == "mailto")
			{
				// Split into Mail + Param
				Ausdruck = /(.+)\?(\w.+)/;
				Ausdruck.exec(trim(RegExp.$2));
			  var site = trim(RegExp.$2);
			  var mail = trim(RegExp.$1);
			  
			  // Always remove Ext-Link-Icon 	
				$(this).children(":first").hide();	 
				if (site == "alternativ") {
				  $(this).attr("href","javascript:;");
			  	$(this).attr("target","_self");
			  	$(this).bind("click", {url:'/_admincontent/dialogcenter.jsp?page=allgemein&emailtoperson='+mail}, zoomImage);
			  }
				if (site == "default") {
				  $(this).attr("href","javascript:;");
			  	$(this).attr("target","_self");
			  	$(this).bind("click", {url:'/_admincontent/dialogcenter.jsp?page=allgemein'}, zoomImage);
			  }
			}
	  	Ausdruck = /(.+)\?(.+)/;
	  	Ausdruck.exec(Wert);
	  	var param = trim(RegExp.$2);
			if (param == "schaden")
			{
			  	$(this).attr("href","javascript:;");
			  	$(this).attr("target","_self");
		  		$(this).bind("click", {url:'/_admincontent/dialogcenter.jsp?page=schaden'}, zoomImage);
			  	$(this).children(":first").hide();
			}
			if (param == "feedback")
			{
			  	$(this).attr("href","javascript:;");
			  	$(this).attr("target","_self");
		  		$(this).bind("click", {url:'/_admincontent/dialogcenter.jsp?page=feedback'}, zoomImage);
			  	$(this).children(":first").hide();
			}
			if (param == "popup")
			{
			  	var site = trim(RegExp.$1);
			  	$(this).attr("href","javascript:;");
			  	$(this).attr("target","_self");
		  		$(this).bind("click", {url:'/system/modules/at.dmc.allianz.at.templates/pages/image.jsp?imageUrl='+site}, zoomImage);
			  	$(this).children(":first").hide();
			}
			
			// Reset RegExp.
		 	Ausdruck.exec("reset reset");
		});
	
	/* sitemap functions */
	if($(".sitemap").length){
		
		$(".sitemap .toggle").attr("href","javascript:;");
		$(".sitemap .toggleAll").attr("href","javascript:;");
		
		$(".sitemap li").removeClass("opened");
		$(".sitemap li").addClass("closed");
		
		$(".sitemap .toggleAll").click( function(){
			if( $(this).hasClass("tAClose") ) {
				$(".sitemap li").removeClass("opened");
				$(".sitemap li").addClass("closed");													 
			} else {
				$(".sitemap li").each( function(){						
					if( $(this).children("ul").length ){
						$(this).removeClass("closed");
						$(this).addClass("opened");
					}	
				});								
			}
			$(this).toggleClass("tAClose");
		});	
							
		$(".sitemap .toggle").click(function(){						
			$(this).parent().parent().toggleClass("opened");
			$(this).parent().parent().toggleClass("closed");
		});					
	}
	
	/* info icon */

	var	boxHtml = "\
		<div id='infobox'>\
			<div class='top'></div>\
			<div class='bg'>\
				<div class='content'>\
					<p class='title'>Info</p>\
					<p class='text'>At carus indissolubilis servitium ora lac Vehemens, ita Silex dis Concateno quo sis cur.</p>\
				</div>\
			</div>\
			<div class='bottom'></div>\
		</div>\
	";
	
	$(".info").hover(
		function(e){
			var infoText = $(this).children("span").text();
			infoText=infoText.slice(1,(infoText.length-1));
			//create box
			$("#plainContent").append(boxHtml);
			$("#infobox .text").text(infoText);			
			
			//set box position
			var boxHeight = $("#infobox").height();
			
			var posY = e.pageY;
			var posX = e.pageX;
			
			if ($("#column_01").css("width") != undefined) {
				posY = parseInt(posY)+10;
				posX = parseInt(posX)+10;
				if (posX > 450)
					posX = 450;
			}
				
			// if box is near to bottom - show it upside the mousepointer
			if (document.getElementById('column_02').offsetHeight < document.getElementById('infobox').offsetHeight + posY + 50)
				posY = posY - (document.getElementById('infobox').offsetHeight + 30)

 			$("#infobox").css("top", posY);	
			$("#infobox").css("left", posX);
			if(navigator.appVersion.indexOf('MSIE 6',navigator.appVersion)>0) {
				$("#infobox .top").css("background-image", "none");
				$("#infobox .bg").css("background-image", "none");
				$("#infobox .bottom").css("background-image", "none");
			}

		},
		function(){			
			$("#infobox").remove();				
		}
	);		

};


function trim(s) {
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
}