function middleStr(sAll, sStart, sEnd){    	var sPart = "";    	var posStart = sAll.indexOf(sStart);	var posEnd = sAll.indexOf(sEnd, posStart + sStart.length + 1); 	if (posStart >= 0 && posEnd >= 0 && posEnd > posStart) {     	sPart = sAll.substring(posStart + sStart.length, posEnd);    	}    	return sPart;}function rightStr(sAll, sStart){    	var sPart = "";    	var posStart = sAll.indexOf(sStart);	if (posStart >= 0) {     	sPart = sAll.substring(posStart + sStart.length, sAll.length);    	}    	return sPart;}function gotoUrlNewWinSizeCenteredScrollbar(s, iWidth, iHeight){    iWidth += 20;    iHeight += 25;	    iLeft = Math.round((screen.width - iWidth) / 2);    iTop = Math.round((screen.height - iHeight) / 2);    newWin = window.open(s, "newWin" + getRandomInt(10000), "width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop + ",dependent=yes,location=no,resizable=no,scrollbars=yes,status=no");}function gotoUrlNewWinSizeCenteredResizable(s, iWidth, iHeight){    iWidth += 20;    iHeight += 25;	    iLeft = 20;    iTop = 20;    newWin = window.open(s, "sportWin", "width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop + ",dependent=yes,location=no,resizable=no,scrollbars=yes,status=no");}var g_openFlipFlopImage = 0;function clickFlipFlopImage(id, imgWidth, imgHeight){    if (g_openFlipFlopImage != 0) closeFlipFlopImage();     var pageWidth = 615;     var shadeborder = 8;     var elmShade = document.getElementById("flipFlopImageShade");     var elmImage = document.getElementById("flipFlopImage" + id);     var elmCloseButton = document.getElementById("closeButton" + id);     var imgX = pageWidth / 2 - imgWidth / 2;     var imgY = Math.round( (viewportGetHeight() - imgHeight)/2 ) + viewportGetScrollY();     if (imgY < 0) { imgY = 0; }     if (imgX < 0) { imgX = 0; }     elmShade.style.left = (imgX - shadeborder) + "px";     elmShade.style.width = (imgWidth + shadeborder * 2) + "px";     elmShade.style.top = (imgY - shadeborder) + "px";     elmShade.style.height = (imgHeight + shadeborder * 2) + "px";     elmImage.style.left = imgX + "px";     elmImage.style.top = imgY + "px";     if (elmCloseButton) {         elmCloseButton.style.left = (imgWidth - 19) + "px";     }     elmImage.style.display = "block";     elmShade.style.display = "block";     g_openFlipFlopImage = id;    }function closeFlipFlopImage(){    hideLr("flipFlopImageShade");    hideLr("flipFlopImage" + g_openFlipFlopImage);    g_openFlipFlopImage = 0;}function gotoUrlNewWinSizeCenteredScrollbar(s, iWidth, iHeight){    iWidth += 20;    iHeight += 25;	    iLeft = Math.round((screen.width - iWidth) / 2);    iTop = Math.round((screen.height - iHeight) / 2);    newWin = window.open(s, "newWin" + getRandomInt(10000), "width=" + iWidth + ",height=" + iHeight + ",left=" + iLeft + ",top=" + iTop + ",dependent=yes,location=no,resizable=yes,scrollbars=yes,status=no");    }function showResultList() {	if(document.forms['contentsearch'].cat.selectedIndex != 0) {		var selCat = document.forms['contentsearch'].cat.value;		var cat = "&key1=" + encodeURI(selCat);		document.getElementById("contentSearchIFrame").src = resultListBegin + cat;		document.getElementById("contentSearchResultDisplay").style.visibility = "visible";	}}function showResultList12() {	if(document.forms['contentsearch'].cat2.selectedIndex != 0) {		var selCat1 = document.forms['contentsearch'].cat1.value;		var selCat2 = document.forms['contentsearch'].cat2.value;		var cats = "&key1=" + encodeURI(selCat1) + "&key2=" + encodeURI(selCat2);		document.getElementById("contentSearchIFrame").src = resultListBegin + cats		document.getElementById("contentSearchResultDisplay").style.visibility = "visible";	}}function selectCat12() {		var cat2s = document.forms['contentsearch'].cat2.options; 	cat2s.length = 1;		if(document.forms['contentsearch'].cat1.selectedIndex != 0) {		var selCat1 = document.forms['contentsearch'].cat1.value;		var j = 1;		var newOption;		for(i = 0; i < allArray.length; i++) {			allValue = allArray[i];			all = allValue.split("###");		 		 			 cat1 = all[0];			 cat2 = all[1];	 		 			 if(selCat1 == cat1) { 				newOption = new Option(cat2, cat2, false, false);				cat2s[j++] = newOption;		 		 		 		 		 	 			 }		}			}}function selectCat1() {		var cat2s = document.forms['contentsearch'].cat2.options; 	cat2s.length = 1;		if(document.forms['contentsearch'].cat1.selectedIndex != 0) {		var selCat1 = document.forms['contentsearch'].cat1.value;		var j = 1;		var newOption;		for(i = 0; i < allArray.length; i++) {			allValue = allArray[i];			all = allValue.split("###");		 		 			 cat1 = all[0];			 cat2 = all[1];			  viewKey = all[2];	 		 			 if(selCat1 == cat1) { 				newOption = new Option(cat2, viewKey, false, false);				cat2s[j++] = newOption;		 		 		 		 		 	 			 }		}			}}function selectCat() {		if(document.forms['contentsearch'].cat.selectedIndex != 0) {		var selCat = document.forms['contentsearch'].cat.value;		if(openNewWindow) {			gotoUrlNewWinSizeCenteredScrollbar(selCat + "?OpenDocument&popup", windowWidth, windowHeight);		}		else {			document.location.href = selCat;		}			}}function selectCat2() {	if(document.forms['contentsearch'].cat2.selectedIndex != 0) {		var selCat2 = document.forms['contentsearch'].cat2.value;				if(openNewWindow) {			gotoUrlNewWinSizeCenteredScrollbar(selCat2 + "?OpenDocument&popup", windowWidth, windowHeight);		}		else {			document.location.href = selCat2;		}	}}function showMultimediaGalleryWallpaper(img){     gotoUrlNewWin(img);}var g_activeRolloverImage;function hiliteRolloverImage(nr) {   /*if (g_activeRolloverImage) document.getElementById('button' + g_activeRolloverImage).src = eval('button' + g_activeRolloverImage + 'Out').src;   document.getElementById('button' + nr).src = eval('button' + nr + 'Over').src;*/   document.getElementById('introChangeImage').src = eval('changeImg' + nr).src;   if (g_activeRolloverImage) document.getElementById('imageSwitcher' + g_activeRolloverImage).className = '';   document.getElementById('imageSwitcher' + nr).className = 'imageSwitchSelected';   g_activeRolloverImage = nr;      if (g_lastMiniGalleryNumber != 0) {	var lastElm = document.getElementById("miniGalleryThumbnail" + g_lastMiniGalleryNumber);	lastElm.className = "miniGalleryThumb";	g_lastMiniGalleryNumber = 0;   }  	    }function clearRolloverImage() {   if (g_activeRolloverImage) {      /*document.getElementById('button' + g_activeRolloverImage).src = eval('button' + g_activeRolloverImage + 'Out').src;*/      document.getElementById('introChangeImage').src = g_InitialRolloverImageSrc;      document.getElementById('imageSwitcher' + g_activeRolloverImage).className = '';      g_activeRolloverImage = null;   }}function setInitialRolloverImage() {	if (g_activeRolloverImage) {		/*document.images['button' + g_activeRolloverImage].src = eval('button' + g_activeRolloverImage + 'Out').src;*/		document.getElementById('imageSwitcher' + g_activeRolloverImage).className = '';		hiliteRolloverImage(g_initialRolloverImage);		g_activeRolloverImage = g_initialRolloverImage;	 }}/* Page Layer */var g_openPageLayer = 0;function openPageLayer(sUrl, iWidth, iHeight){    if (g_openPageLayer == 0)    {        var pageWidth = 615;        var shadeborder = 8;     //   imgWidth = 646;      //  imgHeight = 535;        var elmShade = document.getElementById("pageLayerShade");        var elmKB = document.getElementById("pageLayer");        var imgX = pageWidth / 2 - iWidth / 2;        var imgY = Math.round( (viewportGetHeight() - iHeight)/2 ) + viewportGetScrollY();        if (imgY < 0) { imgY = 0; }        if (imgX < 0) { imgX = 0; }        elmShade.style.left = (imgX - shadeborder) + "px";        elmShade.style.top = (imgY - shadeborder) + "px";        elmKB.style.left = imgX + "px";        elmKB.style.top = imgY + "px";        var elmCloseButton = document.getElementById("closeButtonPageLayer");        if (elmCloseButton) {            elmCloseButton.style.left = (iWidth - 19) + "px";        }      //  elmKB.style.display = "block";       // elmShade.style.display = "block";        g_openPageLayer = sUrl;        prepareFillPageLayer(sUrl);    }}function closePageLayer(){  /*  hideLr("pageLayerBaseShade");    hideLr("pageLayer");    g_openPageLayer = 0;*/         var elm = document.getElementById("pageLayer");    elm.innerHTML = "<p>&nbsp;</p>";    elm.style.display = "none";    hideLr("pageLayerShade");    g_openPageLayer = 0;        if (g_is_safari) {        var introElm = document.getElementById("introImage");        if (introElm) {            introElm.style.visibility = "visible";        }    }    }function getCachePrevent(){    return "?OpenDocument&rand=" + escape( Math.round( Math.random() * 10000 ) );}function prepareFillPageLayer(sUrl){    sUrl += getCachePrevent();    if (window.XMLHttpRequest) {        g_req = new XMLHttpRequest();    }    else if (window.ActiveXObject) {        g_req = new ActiveXObject("Microsoft.XMLHTTP");    }    g_req.onreadystatechange = fillPageLayer;    g_req.open("GET", sUrl, true);    g_req.send(null);}function fillPageLayer(){    if (g_req.readyState == 4)    {        if (g_req.status == 200)        {                	if (g_is_safari) {                var introElm = document.getElementById("introImage");                if (introElm) {                    introElm.style.visibility = "hidden";                }            }                            var s = "";                    var elmKB = document.getElementById("pageLayer");          s += "";          alert(g_req.responseText);            s += "<div class=\"closeButton\" id=\"closeButtonPageLayer\" onclick=\"closePageLayer()\"><img src=\"../../../admin.nsf/close-button.gif\" alt=\"[X]\" title=\"Close\" /></div>";          		  s += g_req.responseText;            s = replStr(s, "<content>", "");            s = replStr(s, "</content>", "");		var sRun = getTextBetween(s, "// <![CDATA[", "// ]]>");            sRun = replStr(sRun, ",wmode=opaque", ",");            elmKB.innerHTML = s;                        var elmShade = document.getElementById("pageLayerShade");            var elmKB = document.getElementById("pageLayer");            elmKB.style.display = "block";            elmShade.style.display = "block";                          if (sRun != "") { eval(sRun); }             alert(sRun);            alert(s);        }        else        {            alert("Can't retrieve XML: " + g_req.statusText);        }    }}var g_lastMiniGalleryNumber = 0;function setMiniGalleryImage(elm, n){    if (g_lastMiniGalleryNumber != n)    {    			 		if (g_lastMiniGalleryNumber != 0) {		    var lastElm = document.getElementById("miniGalleryThumbnail" + g_lastMiniGalleryNumber);	        lastElm.className = "miniGalleryThumb";   		}  	            var thisElm = document.getElementById("miniGalleryThumbnail" + n);        thisElm.className = "miniGalleryThumbSelected";        g_lastMiniGalleryNumber = n;        sHref = elm.href;        document.getElementById("introChangeImage").src = sHref;         if (g_activeRolloverImage) document.getElementById('imageSwitcher' + g_activeRolloverImage).className = '';         g_activeRolloverImage = null;    }    return false;}/* Multimedia gallery *//* film */var isVideoRunning;function galleryPlayVideo(nr, url, width, height) {		var htmlStr = '';				if(url.indexOf('.wmv') > -1 || url.indexOf('.asx') > -1 || url.indexOf('.asf') > -1) {		height += 75;			htmlStr += '<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" width="' + width + '" height="' + height + '">';		htmlStr += '<param name="fileName" value="' + url + '">';		htmlStr += '<param name="ShowControls" VALUE="true">';		htmlStr += '<param name="ShowDisplay" VALUE="false">';		htmlStr += '<param name="ShowStatusBar" VALUE="true">';		htmlStr += '<embed type="application/x-mplayer2" src="' + url + '" width="' + width + '" height="' + height + '" ShowControls="true" ShowDisplay="true" ShowStatusBar="true"></embed>';		htmlStr += '</object>';			}	else if(url.indexOf('.mov') > -1 || url.indexOf('.qt') > -1) {		height += 14;				htmlStr += '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="' + width + '" HEIGHT="' + height + '" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">';		htmlStr += '<PARAM NAME="src" VALUE="' + url + '">';		htmlStr += '<PARAM NAME="controller" VALUE="true">';		htmlStr += '<PARAM NAME="target" VALUE="myself">';		htmlStr += '<PARAM NAME="href" VALUE="url">';		htmlStr += '<PARAM NAME="autoplay" VALUE="true">';				htmlStr += '<PARAM NAME="pluginspage" VALUE="http://www.apple.com/quicktime/download/indext.html">';		htmlStr += '<EMBED WIDTH="' + width + '" HEIGHT="' + height + '" CONTROLLER="true" TARGET="myself" HREF="' + url + '" SRC="' + url + '" BGCOLOR="FFFFFF" BORDER="0" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></EMBED>';		htmlStr += '</OBJECT>';	}		if (document.getElementById('galleryImage')) document.getElementById('galleryImage').style.visibility = 'hidden';	switchLabel(nr);//	document.getElementById('video_display').style.display = 'block';	//document.getElementById('galleryStage').style.backgroundColor = '#CCCCCC';	//document.getElementById('galleryStage').innerHTML = htmlStr;	document.getElementById('galleryStage').innerHTML = '<table border="0" cellspacing="0" cellpadding="0"><tr><td style="width:595px;height:317px;background-color:#CCCCCC;text-align:center;vertical-align:middle">' + htmlStr + '</td></tr></table>';	isVideoRunning = true;	}function switchLabel(nr) {	if(g_lastNumber) document.getElementById("galleryLabel" + g_lastNumber).style.visibility = 'hidden';    g_lastNumber = nr;	            document.getElementById("galleryLabel" + g_lastNumber).style.visibility = 'visible'}/* Inline videos */function videoWin(market, videoURL, videoWidth, videoHeight, docUNID, multimediaNr) {	var  url = '../Video?OpenNavigator&market=' + market + '&url=' + videoURL + '&width=' + String(videoWidth) + '&height=' + String(videoHeight) + '&unid=' + docUNID + '&nr=' + multimediaNr;	var windowWidth = videoWidth + 52;	var windowHeight;	if(videoURL.indexOf('.mov') > -1) windowHeight = videoHeight + 107;	else windowHeight = videoHeight + 137;    var windowLeft = Math.round((screen.width - windowWidth) / 2);    var windowTop = Math.round((screen.height - windowHeight) / 2);    newWin = window.open(url, "newWin" + getRandomInt(10000), "width=" + windowWidth + ",height=" + windowHeight + ",left=" + windowLeft + ",top=" + windowTop + ",dependent=yes,location=no,resizable=no,scrollbars=no,status=no");}// Browser Checkfunction browserCheck() {	var agt = navigator.userAgent.toLowerCase();	this.ie4 = (document.all) ? true : false;	this.ns4 = (document.layers) ? true : false;	this.dom2 = (document.getElementById) ? true : false;	this.ie5 = (this.ie4 && this.dom2) ? true : false;	this.ns6 = (!this.ie4 && this.dom2) ? true : false;	this.win = (agt.indexOf('win') != -1) ? true : false;	this.mac = (agt.indexOf('mac') != -1) ? true : false;		if (this.ie4 && this.win) {		with (document) {			write('<script language="VBScript" type="text/vbscript">\n');			write('Function flashActX(flashVer)\n');			write('\tOn Error Resume Next\n');			write('\t\n');			write('\tDim FlashObj\n');			write('\tFlashObj = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashVer))\n');			write('\tflashActX = FlashObj\n');			write('End Function\n');			write('</script>\n');		}		this.flashEnabled = (typeof(flashActX(4)) != 'undefined') ? true : false;		this.flash5Enabled = (typeof(flashActX(5)) != 'undefined') ? true : false;		this.flash6Enabled = (typeof(flashActX(6)) != 'undefined') ? true : false;	} else {		if (navigator.plugins && navigator.plugins['Shockwave Flash']) {			var flashPlugIn = 0;			var str = navigator.plugins['Shockwave Flash'].description.split(' ');			for (var i = 0; i < str.length; i++) {				if (!isNaN(parseInt(str[i]))) {					flashPlugIn = parseInt(str[i]);					break;				}			}			this.flashEnabled = (flashPlugIn >= 4) ? true : false;			this.flash5Enabled = (flashPlugIn >= 5) ? true : false;			this.flash6Enabled = (flashPlugIn >= 6) ? true : false;		} else {			this.flashEnabled = false;		}	}}var is = new browserCheck();function changeFlashVideo(videoLoader, video, format) {	var flashVideoSpanTag = document.getElementById("flashvideospan");	var htmlStr = '';		if(is.flash6Enabled) {	 		var flashVars = 'swf=' + video + '&format=' + format + "&width=429&height=262";			htmlStr += '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="429" HEIGHT="262" id="video-loader" ALIGN="">';		htmlStr += '<PARAM NAME=movie VALUE="' + videoLoader + '">';		htmlStr += '<PARAM NAME=FlashVars VALUE="' + flashVars + '">';  		htmlStr += '<PARAM NAME=quality VALUE=high>';  		htmlStr += '<PARAM NAME=bgcolor VALUE=#E0E0E0>';  		htmlStr += '<EMBED src="' + videoLoader + '" FlashVars="' + flashVars + '" quality=high bgcolor=#E0E0E0  WIDTH="429" HEIGHT="262" NAME="video-loader" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';		htmlStr += '</OBJECT>';	}	else {		htmlStr += 'You will need the current version of the Flash player to view this film.<br>';		htmlStr += 'You can download this plug-in for free at Macromedia.<br>';		htmlStr += 'Please <a href="http://www.macromedia.com/go/getflashplayer">click here.</a>';		}		flashVideoSpanTag.innerHTML = htmlStr;}/*function openFlashVideo(videoLoader, video, format, flashWidth, flashHeight) {	var closeWindowMsg = new Array();	closeWindowMsg[0] = "Fenster schliessen";	closeWindowMsg[1] = "Close window";	closeWindowMsg[2] = "Fermer la fen&ecirc;tre";	closeWindowMsg[3] = "Chiudi la finestra";	closeWindowMsg[4] = "Cerrar ventana";	closeWindowMsg[5] = "Close window";	closeWindowMsg[6] = "Close window";		closeWindowMsg[7] = "Close window";			var flashVars = 'swf=' + video + '&format=' + format + "&width=" + flashWidth + "&height=" + flashHeight;		var winWidth = flashWidth;	var winHeight = flashHeight + 50;		var resWidth = flashWidth + 10;	var resHeight = flashHeight + 95;		var objectStr = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + flashWidth + '" HEIGHT="' + flashHeight + '" id="video-loader" ALIGN="">';	objectStr += '<PARAM NAME=movie VALUE="' + videoLoader + '">';	objectStr += '<PARAM NAME=FlashVars VALUE="' + flashVars + '">';  	objectStr += '<PARAM NAME=quality VALUE=high>';  	objectStr += '<PARAM NAME=bgcolor VALUE=#E0E0E0>';  	objectStr += '<EMBED src="' + videoLoader + '" FlashVars="' + flashVars + '" quality=high bgcolor=#E0E0E0  WIDTH="' + flashWidth + '" HEIGHT="' + flashHeight + '" NAME="video-loader" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';	objectStr += '</OBJECT>';	var htmlStr = '<html><head><title>Porsche Video</title></head><body onLoad=\"window.resizeTo(' + resWidth + ',' + resHeight + ')\" bgcolor="white" leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">';	htmlStr += objectStr;		htmlStr += '<p style="text-align:center"><a href="javascript:self.close()"><img src="../../../admin.nsf/flashvideo_close_window_' + marketLanguage + '.gif" alt="" border="0"></a><p>';			htmlStr += '<body></html>';		winX = (screen.width - winWidth) / 2;	winY = (screen.height - winHeight) / 2;	var videoWin = window.open('','videoWin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=' + winX + ',top=' + winY + ',width=' + winWidth + ',height='+ winHeight);	with (videoWin.document) {		open();		write(htmlStr);		close();		}	videoWin.focus();		}*/function startSearch() {			var term = encodeURIComponent(document.forms["searchform"].query.value);	var action = "searchresult?OpenDocument&search=" + term; 	document.location.href = action;	}function changedMarket(elmThis){    if (document.getElementById)    {        var sUrl = elmThis.value;        if (sUrl != "")        {            document.location.href = sUrl;        }    }}