if (this.name = '') this.name='shEAMainWnd'; this.focus(); function imagePopUp(urlToOpen) { var x = (screen.width-800)/2, y = (screen.height-800)/2; OpenWin = this.open(urlToOpen, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes, screenX="+x+", screenY="+y+", left="+x+", top="+y); } function printerFriendly(urlToOpen) { var x = (screen.width-800)/2, y = (screen.height-600)/2; OpenWin = this.open(urlToOpen, "CtrlWindow", "width=800,height=600,toolbar=no,menubar=yes,location=no,scrollbars=yes,resizable=no, screenX="+x+", screenY="+y+", left="+x+", top="+y); } function recommend(urlRecommandForThisArticle) { var x = (screen.width-400)/2, y = (screen.height-300)/2; OpenWin = this.open(urlRecommandForThisArticle, "CtrlWindow", "width=400,height=300,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no, screenX="+x+", screenY="+y+", left="+x+", top="+y); } function getElementPosition(elem) { var offsetTrail = elem; var offsetLeft = 0; var offsetTop = 0; while (offsetTrail) { offsetLeft += offsetTrail.offsetLeft; offsetTop += offsetTrail.offsetTop; offsetTrail = offsetTrail.offsetParent; } if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") { offsetLeft += document.body.leftMargin; offsetTop += document.body.topMargin; } return {left:offsetLeft, top:offsetTop}; } function SetJSCookie(cookieName,cookieValue,nDays) { var today = new Date(); var expire = new Date(); if (nDays==null || nDays==0) nDays=1; expire.setTime(today.getTime() + 3600000*24*nDays); document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString(); } function ReadCookie(cookieName) { var theCookie=""+document.cookie; var ind=theCookie.indexOf(cookieName); if (ind==-1 || cookieName=="") return ""; var ind1=theCookie.indexOf(';',ind); if (ind1==-1) ind1=theCookie.length; return unescape(theCookie.substring(ind+cookieName.length+1,ind1)); } document.onload = FixFlash(); function FixFlash(){ objects = document.getElementsByTagName("object"); // alert(objects); for (var i = 0; i < objects.length; i++) objects[i].outerHTML = objects[i].outerHTML; } function closePromo(){ // alert('mmmm'); document.getElementById('promotion').style.top = '-1000px'; } function LeasingLoadOptions(){ var baseHref = document.getElementsByTagName('base')[0].href; var modelEl = document.getElementById('leasingModelID'); var modelID = modelEl.options[modelEl.selectedIndex].value; makePOSTRequest(baseHref+'index.html/showroom|getOptions', '&modelID='+modelID, 'fillOptionSelect'); } function fillOptionSelect(){ if (http_request_di.readyState == 4) { if (http_request_di.status == 200){ var leasingOptionEL = document.getElementById('leasingOptionID'); leasingOptionEL.innerHTML = ""; var strOptions = http_request_di.responseText; firstArray = arrayer(strOptions,"||"); if(firstArray.length > 0) { for(i=0;i < firstArray.length;i++) { secondArray=arrayer(firstArray[i],"|"); var elOptNew = document.createElement('option'); elOptNew.text = secondArray[1]; elOptNew.value = secondArray[0]; try { leasingOptionEL.add(elOptNew, null); // standards compliant; doesn't work in IE } catch(ex) { leasingOptionEL.add(elOptNew); // IE only } } } // alert(leasingOptionEL.innerHTML); // document.getElementById('leasingOptionID').innerHTML = strOptions; LeasingLoadPriceCIP(); } } } function LeasingLoadPriceCIP(){ var baseHref = document.getElementsByTagName('base')[0].href; var modelEl = document.getElementById('leasingModelID'); var modelID = modelEl.options[modelEl.selectedIndex].value; var optionEl = document.getElementById('leasingOptionID'); var optionID = optionEl.options[optionEl.selectedIndex].value; makePOSTRequest(baseHref+'index.html/showroom|getOptions', '&modelID='+modelID+'&optionID='+optionID, 'fillPriceInput'); } function fillPriceInput(){ if (http_request_di.readyState == 4) { if (http_request_di.status == 200){ var strValue = http_request_di.responseText; document.getElementById('leasingPriceCIP').value = strValue; } } } function LeasingLoadOptionsInner(){ var baseHref = document.getElementsByTagName('base')[0].href; var modelEl = document.getElementById('leasingModelIDInner'); var modelID = modelEl.options[modelEl.selectedIndex].value; makePOSTRequest(baseHref+'index.html/showroom|getOptions', '&modelID='+modelID, 'fillOptionSelectInner'); } function fillOptionSelectInner(){ if (http_request_di.readyState == 4) { if (http_request_di.status == 200){ var leasingOptionEL = document.getElementById('leasingOptionIDInner'); var strOptions = http_request_di.responseText; leasingOptionEL.innerHTML = ""; firstArray = arrayer(strOptions,"||"); if(firstArray.length > 0) { for(i=0;i < firstArray.length;i++) { secondArray=arrayer(firstArray[i],"|"); var elOptNew = document.createElement('option'); elOptNew.text = secondArray[1]; elOptNew.value = secondArray[0]; try { leasingOptionEL.add(elOptNew, null); // standards compliant; doesn't work in IE } catch(ex) { leasingOptionEL.add(elOptNew); // IE only } } } // var strOptions = http_request_di.responseText; // document.getElementById('leasingOptionIDInner').innerHTML = strOptions; LeasingLoadPriceCIPInner(); } } } function LeasingLoadPriceCIPInner(){ var baseHref = document.getElementsByTagName('base')[0].href; var modelEl = document.getElementById('leasingModelIDInner'); var modelID = modelEl.options[modelEl.selectedIndex].value; var optionEl = document.getElementById('leasingOptionIDInner'); var optionID = optionEl.options[optionEl.selectedIndex].value; makePOSTRequest(baseHref+'index.html/showroom|getOptions', '&modelID='+modelID+'&optionID='+optionID, 'fillPriceInputInner'); } function fillPriceInputInner(){ if (http_request_di.readyState == 4) { if (http_request_di.status == 200){ var strValue = http_request_di.responseText; document.getElementById('leasingPriceCIPInner').value = strValue; } } } var http_request_di = false; function makePOSTRequest(url, parameters, onreadystatechangeFunctionName) { http_request_di = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request_di = new XMLHttpRequest(); if (http_request_di.overrideMimeType) { http_request_di.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request_di = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request_di = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request_di) { alert('Cannot create XMLHTTP instance'); return false; } http_request_di.onreadystatechange = eval(onreadystatechangeFunctionName); http_request_di.open('POST', url, true); http_request_di.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request_di.setRequestHeader("Content-length", parameters.length); http_request_di.setRequestHeader("Connection", "close"); http_request_di.send(parameters); } function arrayer(arr,dupa) { freshArray= arr.split(dupa); return freshArray; } var brandIndex = 0; function cycleBrands(direction){ document.getElementById('brandsMenu['+brandIndex+']').style.display = 'none'; brandIndex = brandIndex + direction; if(document.getElementById('brandsMenu['+brandIndex+']')) document.getElementById('brandsMenu['+brandIndex+']').style.display = "inline"; else{ if(direction > 0) brandIndex = 0; else brandIndex = noBrandsIndex - 1; document.getElementById('brandsMenu['+brandIndex+']').style.display = "inline"; } } function changeInputType( oldElm, // a reference to the input element iType, // value of the type property: 'text' or 'password' iValue, // the default value, set to 'password' in the demo blankValue, // true if the value should be empty, false otherwise noFocus) { // set to true if the element should not be given focus if(!oldElm || !oldElm.parentNode || (iType.length<4) || !document.getElementById || !document.createElement) return; var newElm = document.createElement('input'); newElm.type = iType; if(oldElm.name) newElm.name = oldElm.name; if(oldElm.id) newElm.id = oldElm.id; if(oldElm.className) newElm.className = oldElm.className; if(oldElm.size) newElm.size = oldElm.size; if(oldElm.tabIndex) newElm.tabIndex = oldElm.tabIndex; if(oldElm.accessKey) newElm.accessKey = oldElm.accessKey; newElm.onfocus = function(){return function(){ if(this.hasFocus) return; var newElm = changeInputType(this,'password',iValue, (this.value.toLowerCase()==iValue.toLowerCase())?true:false); if(newElm) newElm.hasFocus=true; }}(); newElm.onblur = function(){return function(){ if(this.hasFocus) if(this.value=='' || (this.value.toLowerCase()==iValue.toLowerCase())) { changeInputType(this,'text',iValue,false,true); } }}(); // hasFocus is to prevent a loop where onfocus is triggered over and over again newElm.hasFocus=false; oldElm.parentNode.replaceChild(newElm,oldElm); if(!blankValue) newElm.value = iValue; if(!noFocus || typeof(noFocus)=='undefined') { window.tempElm = newElm; setTimeout("tempElm.hasFocus=true;tempElm.focus();",1); } return newElm; } function gE(elID) { return document.getElementById(elID); } function scrollToElement(element){ new Effect.ScrollTo(element,{offset: -24}) return false; } function show_flash(id) { document.getElementById(id).outerHTML = document.getElementById(id).outerHTML; } function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField.value.substring(0, limitNum); } else { limitCount.value = limitNum - limitField.value.length; } }