
	var btyp = "gif";
	var active = "";
	
    var blkTargetName = new Array();
	var blkTargetLink = new Array();
	
	var redTargetName = new Array();
	var redTargetLink = new Array();
	
	/* 
	 * Prepares the navigation variables.
	 *
	 * @param lang				the language code (eg. "de", "en", ..)
	 * @param numNavItems	the number of main and footer navigation items
	 * @param blkArrows		the number of black arrows (Submenu-Items)
	 * @param redArrows		the number of red arrows (SubSubmenu-Items)
	 */
	function prepare(lang, imgPath, blkArrows, redArrows) {
		
		fEmpty = imgPath + "spacer.gif";
		fRedArrow = imgPath + "p_red.gif";
		fBlkArrow = imgPath + "p_black.gif";
		fBlkArrowDown = imgPath + "p_black_down.gif";
		
		var blkArrowName = "blkarrow";
		var redArrowName = "redarrow";
				
		for (i=1; i<=blkArrows; i++) {
			blkTargetName[i] = blkArrowName + i;
		}
				
		for (i=1; i<=blkArrows; i++) {
			blkTargetLink[i] = false;
		}
		
		for (i=1; i<=redArrows; i++) {
			redTargetName[i] = redArrowName + i;
		}
		
		for (i=1; i<=redArrows; i++) {
			redTargetLink[i] = false;
		}
	}
	
	/*
	 * showBlackArrow
	 *
	 * @param: int	the number of the arrow to show
	 */
	function showBlackArrow(nr) {
		if (checkBrowser()) {
			
			alert("showBlackArrow " + nr);
			
			for (i=1; i<=blkTargetName.length - 1; i++) {
				blkTargetLink[i] = false;
				ziel = blkTargetName[i];

				if (document.images[ziel].name != active) {
					document.images[ziel].src = fEmpty;
				}
			}
			
			ziel = blkTargetName[nr];
			document.images[ziel].src = fBlkArrow;
			alert(document.images[ziel].src);
		}
	}

	/*
	 * hideBlackArrow
	 *
	 * @param: int	the number of the arrow to hide
	 */	
	function hideBlackArrow(nr) {
		if (checkBrowser()) {	
			
			alert("hideBlackArrow " + nr);
					
			for (i=1; i<=blkTargetName.length - 1; i++) {
				blkTargetLink[i] = false;
				ziel = blkTargetName[i];
				
				if (document.images[ziel].name != active) {
					document.images[ziel].src = fEmpty;
				}
			}
		}
	}

	/*
	 * clickBlack
	 * 
	 * @param: String	black
	 * @param: boolean submenu
	 */
	function clickBlack(black, submenu) {
		if (checkBrowser()) {
			for (i=1; i<=blkTargetName.length - 1; i++) {
				blkTargetLink[i] = false;
				ziel = blkTargetName[i];
				document.images[ziel].src = fEmpty;
			}
			
			for (j=1; j<=redTargetName.length; j++) {
				redTargetLink[j] = false;
				ziel = redTargetName[j];
				document.images[ziel].src = fEmpty;
			}
			
			if (submenu) {
				document.images[black].src = fBlkArrowDown;
			} else { 
				document.images[black].src = fBlkArrow;
			}
			
			active = "";
		}
	}

	/*
	 * showRedArrow
	 *
	 * @param: int	the number of the arrow to show
	 */
	function showRedArrow(nr) {
		if (checkBrowser()) {
			for (i=1; i<=redTargetName.length - 1; i++) {
				redTargetLink[i] = false;
				ziel = redTargetName[i];
				
				if ((document.images[ziel].name != "pfeils") && (document.images[ziel].name != active)) {
					document.images[ziel].src = fEmpty;
				}
			}
			
			ziel = redTargetName[nr];
			document.images[ziel].src = fRedArrow;
			document.pfeils.src = fBlkArrowDown;
		}
	}

	/*
	 * hideRedArrow
	 *
	 * @param: int	the number of the arrow to hide
	 */	
	function hideRedArrow(nr) {
		if (checkBrowser()) {
			for (i=1; i<=redTargetName.length - 1; i++) {
				redTargetLink[i] = false;
				ziel = redTargetName[i];
				
				if (document.images[ziel].name != "pfeils" && document.images[ziel].name != active) {
					document.images[ziel].src = fEmpty;
				}
			}
		}
	}

	/*
	 * clickRed
	 *
	 * @param: int	the number of the arrow which has been activated
	 */
	function clickRed(nr) {
		if (checkBrowser()) {
			for (i=1; i<=redTargetName.length - 1; i++) {
				redTargetLink[i] = false;
				ziel = redTargetName[i];
	
				if (document.images[ziel].name != "pfeils") {
					document.images[ziel].src = fEmpty;
				}
			}
			
			ziel = redTargetName[nr];
			document.images[ziel].src = fRedArrow;
			
			active = ziel;
		}
	}
		
	/*
	 * Checks if browser is supported
	 * 
	 * @return true, if supported
	 */
	function checkBrowser() {
		if ( (navigator.appName == 'Microsoft Internet Explorer' && navigator.appVersion.substring(0,1) > '3')
      || (navigator.appName == 'Netscape' && navigator.appVersion.substring(0,1) >= '3')) {
			return true;
		} else {
			return false;
		}
	}
		
	/*
	 * Checks if a flash player is installed.
	 */
	function checkFlash() {
		var hasFlash = false;
		
		if (checkBrowser()) {
			if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]
				&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
				&& navigator.plugins && navigator.plugins["Shockwave Flash"])
			{
				hasFlash = true;
			} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") != -1 && (navigator.userAgent.indexOf('Win') != -1)) {
				try {
					// version will be set for 4.X or 5.X player
					var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
					var version = axo.GetVariable("$version");
					if (version != -1 ) {
						hasFlash = true;
					}
				} catch (e) {
				}
			}
		}
		
		return hasFlash;
	}
	
	/*
	 * Checks for flash plugin and depending on this returns the content.
	 *
	 * @param path		the relative path to the flash content
	 * @param alt			the relative path to the alternative content
	 * @param clip		the name of the clip
	 * @return the (animation or alternative) content.
	 */
	function getAnimation(clip, alt, height) {
		if (checkFlash()) {
			content  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"';
			content += ' width="550" height="200" id="' + clip + '">';
			//content += ' width="550" id="' + clip + '">';
			content += '<param name="movie" value="' + clip + '">';
			content += '<param name="quality" value="high">';
			content += '<param name="bgcolor" value="#ffffff">';
			content += '<embed src="' + clip + '" quality="high" bgcolor="#ffffff" swLiveConnect="false"';
			content += ' width="550" height="' + height + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
			//content += ' width="550" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
			content += '</embed>';
			content += '</object>';
		} else {
			content  = '<img src="' + alt +  '" width="550" height="' + height + '" border="0" alt="">';
		}

		return content;
	}
	
	function getFlashAnimation(clip, alt, width, height) {
		if (checkFlash()) {
			content  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"';
			content += ' width="550" height="200" id="' + clip + '">';
			//content += ' width="550" id="' + clip + '">';
			content += '<param name="movie" value="' + clip + '">';
			content += '<param name="quality" value="high">';
			content += '<param name="bgcolor" value="#ffffff">';
			content += '<embed src="' + clip + '" quality="high" bgcolor="#ffffff" swLiveConnect="false"';
			content += ' width="' + width + '" height="' + height + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
			//content += ' width="550" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
			content += '</embed>';
			content += '</object>';
		} else {
			content  = '<img src="' + alt +  '" width="' + width + '" height="' + height + '" border="0" alt="">';
		}

		return content;
	}
	
	
function openEngineWindow(lang) {
	var url = "/live_deutz_products/html/display:init?intro=1&all=1&dep=com&lang=" + lang;
	var width = 1000;
	var height = 620;
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;

    var popUp = window.open(url, 'DEUTZ', 'width=' + width + ', height=' + height + ', left=' + left + ',top=' + top + ', '
																			+ 'resizable=no, scrollbars=no, toolbar=no, status=no, menubar=no, location=no');

    popUp.focus();
}

function openEngine(args) {
	var url = "/live_deutz_products/html/display:init?" + args;
	var width = 1000;
	var height = 620;
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;

    var popUp = window.open(url, 'DEUTZ', 'width=' + width + ', height=' + height + ', left=' + left + ',top=' + top + ', '
																			+ 'resizable=no, scrollbars=no, toolbar=no, status=no, menubar=no, location=no');

    popUp.focus();
}

function openKonfiguratorWindow(lang) {
	
	var width = 1000;
	var height = 620;
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	//var url = "/live_dcs_genset/html/layouts:konfigurator?intro=1&lang=" + lang
	// add changelang Attribute to change content to the right language //
	var url = "/live_dcs_genset/html/layouts:konfigurator/~changelanguage:"+lang+"?intro=1&lang=" + lang
  var konfigWin = window.open(url, 'DCS', 'width=' + width + ', height=' + height + ', left=' + left + ',top=' + top + ', ' + 'resizable=no, scrollbars=no, toolbar=no, status=no, menubar=no, location=no');

  konfigWin.focus();
}