function AktivNav(p,i,status,allhide)
{
		
		if (status=='over'){
			for  (k=1;k<=5;k++)
			{
				ts= "ts"+k+p+i;
				//document.getElementById(ts).style.backgroundColor='#FFFFFF';	
				//document.getElementById(ts).style.color='#778087';
				//alert(ts);
			}
		}
		if (status=='out'  ){
			for  (k=1;k<=5;k++)
			{
				ts = "ts"+k+p+i;
				//document.getElementById(ts).style.backgroundColor='#778087';	
				//document.getElementById(ts).style.color='#FFFFFF';
				//alert(ts);
			}
		}
		if (status=='click'){
			
			for ( j=0; j<allhide;j++)
			{
				for  (k=1;k<=5;k++)
				{
					clicked = true;
					ts = "ts"+k+p+j;
					document.getElementById(ts).style.backgroundColor='#778087';	
					document.getElementById(ts).style.color='#FFFFFF';
				//alert(ts);
				}
				
			}
	
			for  (k=1;k<=5;k++)
			{
				clicked = true;
				ts = "ts"+k+p+i;
				document.getElementById(ts).style.backgroundColor='#FFFFFF';	
				document.getElementById(ts).style.color='#778087';
			//alert(ts);
			}
		}
}


function showKShopLayer(toshow,p,ii,allhide)
{

for (var i=0; i < allhide; i++) 
	{
	tohide = "p"+p+"i"+i;	
	document.getElementById(tohide).style.visibility = 'hidden';	
	}
	//Layer
	toshow="p"+p+"i"+ii;
	document.getElementById(toshow).style.visibility = 'visible';
}


function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
return  tempY;
}

var IE = document.all?true:false;
var tempX = 0;
var tempY = 0;

function TESTshowBigImage(status,prodcount)
{
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousedown = getMouseXY;
if (status=='show')
	{
	document.getElementById('bigimage').style.top =  tempY-320+ "px";
	document.getElementById('bigimage').style.visibility = 'visible';
	}
if (status=='hide')
	{
	document.getElementById('bigimage').style.visibility = 'hidden';	
	}
}












function rollover(bild_org,bild_change)
{
    document.getElementById(bild_org).src =bild_change;        
}

/*function rollover(bild_org,bild_change)
{
     imgChange    = new Image();
     imgChange.src = bild_change;
     if(navigator.appName == "Netscape")
     {
         document.linie.document.images[bild_org].src = imgChange.src;
     }
     else
     {
       window.document.images[bild_org].src = imgChange.src;
     }
}*/

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function Go(x)
{
 if(x == "nothing")
 {
   document.forms[0].reset();
   document.forms[0].elements[0].blur();
   focus();
   return;
 }
  else
  {
   location.href = x;
   document.forms[0].reset();
   document.forms[0].elements[0].blur();
   focus();
  }
}
function popup(PopURL,FName,x,y,posx,posy)
{
try
{
	
	if (!(posx)) posx=20;
	if (!(posy)) posy=20;
	ie=(document.all)?true:false;
	ie4 = navigator.appVersion.indexOf("MSIE 4");
	if (! window.cc_child) 
	{
		cc_child = window.open(PopURL, FName,'location=no,menubar=no,resizable=no,status=no,scrollbars=yes,width='+x+',height='+y);
		if (posx) cc_child.moveTo(posx,posy);
		window.cc_child.focus();
		return;
	}
	
	if (ie && ie4 < 0)
	{	
		if (window.cc_child.closed)
		{	
			cc_child = window.open(PopURL, FName,'location=no,menubar=no,resizable=no,status=no,scrollbars=yes,width='+x+',height='+y);
			if (posx) cc_child.moveTo(posx,posy);
			window.cc_child.focus();
			return;
		}
	}
	
	if (window.cc_child) 
	{
		if (ie && ie4 < 0)
			{  window.cc_child.close(); }
		cc_child = window.open(PopURL, FName,'location=no,menubar=no,resizable=no,status=no,scrollbars=yes,width='+x+',height='+y);
		if (posx) cc_child.moveTo(posx,posy);
		window.cc_child.focus();
	}
}
catch(e)
{}
}
function popupPrint(PopURL,FName,x,y,posx,posy)
{
        if (!(posx)) posx=20;
        if (!(posy)) posy=20;
        ie=(document.all)?true:false;
        ie4 = navigator.appVersion.indexOf("MSIE 4");
        if (! window.cc_child)
        	{
                cc_child = window.open(PopURL, FName,'location=no,menubar=yes,resizable=no,status=no,scrollbars=yes,width='+x+',height='+y+', top='+posy+', left='+posx);
                //if (posx) cc_child.moveTo(posx,posy);
                window.cc_child.focus();
                return;
        	}

        if (ie && ie4 < 0)
        {
                if (window.cc_child.closed)
                {
                        cc_child = window.open(PopURL, FName,'location=no,menubar=yes,resizable=no,status=no,scrollbars=yes,width='+x+',height='+y+', top='+posy+', left='+posx);
                		//if (posx) cc_child.moveTo(posx,posy);
                        window.cc_child.focus();
                        return;
                }
        }

        if (window.cc_child)
        	{
                if (ie && ie4 < 0)
                        {  window.cc_child.close(); }
               cc_child = window.open(PopURL, FName,'location=no,menubar=yes,resizable=no,status=no,scrollbars=yes,width='+x+',height='+y+', top='+posy+', left='+posx);
                //if (posx) cc_child.moveTo(posx,posy);
                window.cc_child.focus();
        	}
}


var start = true;
var lastId = 0;

/**** 
 * Aktivieren und Deaktivieren der Icons, sowie Ein- und Ausblenden der zugehörigen Texte, 
 * sowie Laden des entsprechenden Prduktbildes auf "Ar03_Product_Main.jsp" 
 ****/
function toggleIcons(id, language, organisation, event)
{
	//Den ersten Klick registrieren
	if(event == "click" && start == true)
	{
		start = false;
	}	
	
	if(id != lastId)
	{
		//Funktion soll nur bis zum ersten Klick "onmouseover" aufgerufen werden
		if((start == true && event == "mouseover") || (start == false && event == "click"))
		{	
			$('div.iconInactive').show();
			$('#icon' + id).hide();
			
			$('div.icontext').hide();
			$('#icontext' + id).show();
			
			//Preloader einblenden
			$("#preloader").ajaxStart(
				function()
				{
					$('#ft').hide();
					$(this).show();
				}
			);
			//Wenn das Produktbild auch ausgetauscht werden soll, AJAX-Request absenden
			//Variable "changeProductPic" wird in "toggleViewProduct()" geändert und im
			//Template global deklariert
			if(changeProductPic == 'true')
			{
				$.post
				(	"../../lib/jsp/product_main_ajax.jsp" ,
					{conSeq:id , language:language , organisation:organisation} ,
					function(data)
					{
						$('#ft').html(data);
						$('#preloader').hide();
						$('#ft').show();
					}
				);
			}
			lastId = id;
		}
	}
}


/**** Auf Produkt-Hauptseite zwischen Standard- und 3D-Ansicht umschalten ****/
function toggleViewProduct(view)
{
	//Variable "changeProductPic" wird in "toggleViewProduct()" ausgewertet und im
	//Template global deklariert
	
	if(view == '3D')
	{
		//Hauptbild(er) ein-/ausblenden
		switchContent('viewFlashOrPicture', 'view3D');
		
		//Links umformatieren
		changeProductPic = 'false';
		$('#linkView3D').css('color', '#d5011a');
		$('#linkViewStandard').css('color', '#666666');
		$('#icons3DWrap').css('visibility', 'visible');
	}
	else if(view == 'standard')
	{
		switchContent('view3D', 'viewFlashOrPicture');
		changeProductPic = 'true';
		$('#linkViewStandard').css('color', '#d5011a');
		$('#linkView3D').css('color', '#666666');
		$('#icons3DWrap').css('visibility', 'hidden');
	}
}

/**** zwischen 3D- und Ober-/Unteransicht des Produkbildes wechseln ****/
function toggle3D(view)
{
	//"urlsTopBottom" wird in "renderContent2009.jsp" ausgegeben
	
	var pathRoot = "../../images/imgTemplates/";
	
	if(view == "top")
	{	
		//Buttonbilder austauschen
		$('#imgIcon3D').attr('src', pathRoot + '3D_inactive.png');
		$('#imgIconTop').attr('src', pathRoot + '3D_top_active.png');
		$('#imgIconBottom').attr('src', pathRoot + '3D_bottom_inactive.png');
		
		//Hauptbild austauschen, sowie Container ein- und ausblenden
		$('#view3DInner3D').hide();
		$('#view3DInnerTopBottom').show();
		$('#imgTopBottom').attr('src', imageTopBottom0.src);
	}
	else if(view == "bottom")
	{
		$('#imgIcon3D').attr('src', pathRoot + '3D_inactive.png');
		$('#imgIconTop').attr('src', pathRoot + '3D_top_inactive.png');
		$('#imgIconBottom').attr('src', pathRoot + '3D_bottom_active.png');
		
		$('#view3DInner3D').hide();
		$('#view3DInnerTopBottom').show();
		$('#imgTopBottom').attr('src', imageTopBottom1.src);
	}
	else if(view == "3D")
	{
		$('#imgIcon3D').attr('src', pathRoot + '3D_active.png');
		$('#imgIconTop').attr('src', pathRoot + '3D_top_inactive.png');
		$('#imgIconBottom').attr('src', pathRoot + '3D_bottom_inactive.png');
		
		$('#view3DInner3D').show();
		$('#view3DInnerTopBottom').hide();
	}
}


/**** Aufklappmenues ein- und ausblenden (mit jquery) ****/

/*function sublinks(mode,target){
	if(mode == 'show'){
		//alert($('#Left'+target).attr('offsetLeft'));
		var pos = $('#Left'+target).attr('offsetLeft');
		$('Sublinks'+target).css('left',pos + 'px');
		
		$('#Sublinks'+target).css('visibility','visible');
		//$('#Sublinks'+target).show();
		
		//$('#Left'+target).css('visibility','visible');
		//$('#Middle'+target).css('visibility','visible');
		$('#Background'+target).css('backgroundColor','#560000');
	}
	else{
		$('#Sublinks'+target).css('visibility','hidden');
		//$('#Sublinks'+target).hide();
		
		//$('#Left'+target).css('visibility','hidden');
		//$('#Middle'+target).css('visibility','hidden');
		$('#Background'+target).css('backgroundColor','#3e0100');
	}
}*/

/*function showSublinks(){

	$(this).find('div').css('visibility', 'visible');
}

function hideSublinks(){
	$(this).find('div').css('visibility', 'hidden');
}*/


var closeTimer = 0;
var currentItem = null;
var currentImage = "";
var currentSource = "";
var currentNavActive = "";

/**** Aufklappmenues ein- und ausblenden ****/

function doNav(mode,target,parentnavimageid,imagesource,navisaktive){
	if(mode == 'show')
	{
		if(closeTimer)
		{
			window.clearTimeout(closeTimer);
			closeTimer = null;
		}
		
		if(currentItem != null)
		{
			doNavHide(currentItem,currentImage,currentSource,currentNavActive);
		}
		
		//alert("1"+imagesource);
		var pos = document.getElementById('Left'+target).offsetLeft;
		document.getElementById('Sublinks'+target).style.left = pos + "px";
		document.getElementById('Sublinks'+target).style.visibility = 'visible';
		document.getElementById('Left'+target).style.visibility = 'visible';
		document.getElementById('Middle'+target).style.visibility = 'visible';
		document.getElementById('Background'+target).style.backgroundColor='#560000';
		//headgrafik aktiv machen
		$("#"+parentnavimageid).attr('src','../../images/imgNav/hnao'+imagesource);
		
		currentItem = target;
		currentImage = parentnavimageid;
		currentSource = imagesource;
		currentNavActive = navisaktive;
		
	}
	else if(mode == 'hide')
	{
		closeTimer = setTimeout("doNavHide('" +  target + "','" + parentnavimageid + "','" + imagesource + "','" + navisaktive + "')",250);
	}	
}

function doNavHide(target,parentnavimageid,imagesource,navisaktive)
{
		
	document.getElementById('Sublinks'+target).style.visibility = 'hidden';
	document.getElementById('Left'+target).style.visibility = 'hidden';
	document.getElementById('Middle'+target).style.visibility = 'hidden';
	document.getElementById('Background'+target).style.backgroundColor='#3e0100';
	
	if (navisaktive == "yes")
		{
		$("#"+parentnavimageid).attr('src','../../images/imgNav/hna'+imagesource);
		}
		else
		{
		$("#"+parentnavimageid).attr('src','../../images/imgNav/hn'+imagesource);
		}
}


/**** Inhalt von Box über Links ändern ****/

function toggleBoxes(id,resize)
{
	if(! $('#togglebox' + id).hasClass('togglebox')){
		
		//alle ausblenden
		$('div.togglebox').attr('class','toggleboxInactive');
		//wenn vorhanden zugehörige Bilder ausblenden
		$('div.imageInactive').show();
		
		//das aulösende div einblenden
		$('#togglebox' + id).attr('class','togglebox');
		//wenn vorhanden zugehörige Bilder einblenden
		$('#toggleimage' + id).hide();
		
		//den zugehörigen Text aus- und den neuen einblenden
		$('div.toggletext').hide();
		$('#toggletext' + id).show();
	}
	
	//Wenn nötig Größe von übergeordnetem div anpassen (z.B. bei "Ar03_Teaser.jsp")
	if(resize != 0 && heightStart != "")
	{	
		var heightTextbox = $('#toggletext' + id).outerHeight();

		if(heightStart < heightTextbox)
		{					
			$('#boxes').height(heightTextbox);
		}
		else
		{
			$('#boxes').height(heightStart);
		}
	}
}

//Wenn nötig Größe von div mit der id "boxes" beim Laden der Seite anpassen
function initializeWrappersize()
{
	heightStart = $('#boxes').height();

	var heightTextbox = $('div.toggletext:first').outerHeight();
				
	if(heightStart < heightTextbox)
	{					
		$('#boxes').height(heightTextbox);
	}
}


/**** Box nach unten aufklappen ****/

function openBox(id){

	if($('#slidebox' + id).is(':hidden')){
		$('#slidebox' + id).slideDown('normal');
		$('#iconState' + id).attr('src','../../images/imgTemplates/icon_minus.jpg');
	}
	else{
		$('#slidebox' + id).slideUp('normal');
		$('#iconState' + id).attr('src','../../images/imgTemplates/icon_plus.jpg');
	}
}


/**** Blätterfunktion mit Trennzeichen ****/

var arrayBrowsetext;
var current = 0;

function browse(direction){
	
	//Den Zähler für das aktuelle Element hoch- oder herunterzählen
	if(direction == "next" && current != arrayBrowsetext.length-1){
		current += 1;	
	}
	else if(direction == "prev" && current != 0){
		current -= 1;	
	}
	//Text aktualisieren
	$('#browsetext').html(arrayBrowsetext[current]);
	
	//Farbe von "Zrück-Link" bestimmen (aktiv oder inaktiv)
	if(current > 0){
		$('#prev').css('visibility','visible');
		
		$('#prev').css('cursor','pointer');
	}
	else{
		$('#prev').css('visibility','hidden');
		
		$('#prev').css('cursor','auto');
	}
	
	//Farbe von "Weiter-Link" bestimmen (aktiv oder inaktiv)
	if(current == arrayBrowsetext.length-1){
		$('#next').css('visibility','hidden');
		
		$('#next').css('cursor','auto');
	}
	else if(arrayBrowsetext.length > 1){
		$('#next').css('visibility','visible');
		
		$('#next').css('cursor','pointer');
	}
}


/**** Ausblenden von Selectbox wenn Navi benutzt wird (IE6-Bug) ****/
$(document).ready
(
	function()
	{
		if ($.browser.msie && $.browser.version <7)
		{
			 //$("#navi").hover( function() { $("#selectHide").hide(); }, function() { $("#selectHide").show(); }); 
			 $("#navi").hover( function() { $("#selectHide").css("visibility","hidden"); }, function() { $("#selectHide").css("visibility","visible"); });
		}
	 }
);


/**** Ein und ausblenden der Inhalte auf Porduct Main ****/
function switchContent(content1, content2) {
	
	content1 = "#"+content1;
	content2 = "#"+content2;
	
	$(content1).hide();
	$(content2).show();
	

}

/**** Ein und ausblenden der Awards auf der Seite ****/
function showAward(content) {
	
	$("#awardExtend").html("<div class='imgAward'><img src='"+imgBig[content]+"'></div><div class='textAward'><font class='red'>"+textSubject[content]+"</font><br/>"+textSmall[content]+"<br/>"+textLong[content]+"</div>");
}

/**** Laden der Inhalte im Produktarchiv ****/

function selectContArchive(conSeq,language,organisation){
   
        $.post("../../lib/jsp/archive_prod_ajax.jsp", {conSeq:conSeq , language:language , organisation:organisation} ,function(data){$('#currentProduct').html(data);});
}

/**** Aktivieren und Deaktivieren der Produkte, sowie Ein- und Ausblenden der zugehörigen Texte im Shop ****/
function toggleProducts(id)
{
	//Produktbilder aktivieren/deaktivieren
	$('div.iconInactiveBig').show();
	$('#productCell' + id).find('.iconInactiveBig').hide();
	
	//Farbe der Bildunterschriften ändern
	$('div.productCell').find('span').attr('class','dark');
	$('#productCell' + id).find('span').attr('class','red');
	
	//Zugehörige Texte ein- oder ausblenden
	$('div.columnSmall').hide();
	$('#productdetails' + id).show();
}

function adjustContainer(id)
{
	//alert(id);
	//alert($('#toggletext' + id).height());
}

/**** Laden der Kartendetails nach dem Klick auf ein Land auf der Imagemap von "Ar03_Product_Map.jsp" ****/
function showMapDetails(language, organisation, navSeqSent, codeCountry, version, countryName)
{
	$.post('../../lib/jsp/map_details_ajax.jsp' ,{language:language , organisation:organisation, navSeqSent:navSeqSent, codeCountry:codeCountry, version:version, countryName:countryName} ,function(data){$('#mapDetails').html(data); $('#buyMapLink').show();});
}

/**** Rollover-Effect für "area"-Elemente der Image Map hinzufügen ****/
function initMap()
{
	$('#map').maphilight({fillColor:'d5011a', stroke:false, fillOpacity:1, fade:false, fillOpacity:1});
}

//Wird im "Navteq Mapstore"-Template auf "true" gesetzt
var navteq = false;

/**** Wird im "Navteq Mapstore" - Template eine andere Sprache ausgewählt, Meldung ausgeben ****/
function checkNavteq(message)
{
	var x = false;
	
	if(navteq)
	{
		x = confirm(message);
	}
	if(x || !navteq)
	{
		//Go(this.form.language.options[this.form.language.options.selectedIndex].value);
		Go(document.forms['languagenav'].elements['language'].value);
	}
}

/**** Hintergrundbilder entsprechend der Bildschirmauflösung austauschen ****/
function getDynamicBackgroundImage(pathBackgroundBig, pathImageBig) 
{			
	var widthScreen = window.screen.availWidth;
    var limit = 1650;
	
	if (widthScreen > limit && pathImageBig != "")
    {
		$('#wallpaper').css('backgroundImage','url(' + pathImageBig + ')');
    }
	if (widthScreen > limit && pathBackgroundBig != "")
    {
		$('body').css('backgroundImage','url(' + pathBackgroundBig + ')');
	}
}