
GLOBAL_CLICKED=false;var displayInfoOnName="<span><img src='../images/information.gif' align='absmiddle'> Minimum 4 characters,maximum 15 characters</span> "
var displayValInfoOnName="<span style='font-weight:bold; font-size:12px'><img src='../images/register-error.gif' align='absmiddle'> Minimum 4 characters,maximum 15 characters</span> "
var displayInfoOnModel="<span><img src='../images/information.gif' align='absmiddle'> Vehicle model required</span>"
var displayInfoOnHomePhone="<span><img src='../images/information.gif' align='absmiddle'> Please enter home telephone number</span>"
var displayInfoOnBuss="<span><img src='../images/information.gif' align='absmiddle'> Please enter business telephone number</span>"
var displayInfoOnCell="<span><img src='../images/information.gif' align='absmiddle'> Please enter cell number starting with 0</span>"
var displayInfoOnEmail="<span><img src='../images/information.gif' align='absmiddle'> Please use a real email address</span>"
var displayValInfoOnEmail="<span style='font-weight:bold; font-size:12px'><img src='../images/register-error.gif' align='absmiddle'> The email provided does not appear to be valid</span>"
var displaySuccessOnEmail="<span style='font-weight:bold; font-size:12px'><img src='../images/register-success.gif' align='absmiddle'> Your email address appears valid.</span>"
var displayInfoOnConfrmEmail="<span><img src='../images/information.gif' align='absmiddle'> Type in your email address again  for verification purpose</span>"
var displayValInfoOnConfirmEmail="<span style='font-weight:bold; font-size:12px'><img src='../images/register-error.gif' align='absmiddle'> Your email addresses do not match.</span>"
var blank=""
function out(obj,color){obj.style.backgroundColor=color;}
function over(obj,color){obj.style.backgroundColor=color;cursor(obj);}
function cursor(obj){obj.style.cursor='hand';}
function ShowErrorFixError(aObject,aMessage,aDefault){if(!aDefault){aDefault=0;}
aObject.value=aDefault;aObject.focus();}
function viewDetailUsedPartner(adnumber,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewVehiclePartner.asp?RequestTimeout=99999&adnumber="+adnumber+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function viewDetailUsed(adnumber,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewVehicle.asp?RequestTimeout=99999&adnumber="+adnumber+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function getSize(itype)
{if(itype==0)
{if(document.body.scrollWidth)
return document.body.scrollWidth;var w=document.documentElement.offsetWidth;if(window.scrollMaxX)
w+=window.scrollMaxX;return w;}
else{if(document.body.scrollHeight)
return document.body.scrollHeight;return document.documentElement.offsetHeight;}}
function StopProp(e)
{if(!e)
{var e=window.event;}
if(navigator.appName.indexOf("Microsoft")!=-1)
{e.cancelBubble=true;}
else
{e.stopPropagation();}}
function showDetail()
{var oitem1=document.getElementsByName("DetailShowRear")[0];var oitem2=document.getElementsByName("DetailShowFront")[0];oitem1.style.display="block";oitem2.style.display="block";oitem1.style.height=getSize(1);oitem1.style.width=getSize(0);try{var ipkVehicleMakeID=document.getElementsByName("ipkVehicleMakeID")[0];ipkVehicleMakeID.style.display="none";}catch(ex){}
try{var ipkVehicleMakeID=document.getElementsByName("ipkVehicleSeriesID")[0];ipkVehicleMakeID.style.display="none";}catch(ex){}
try{var ipkVehicleMakeID=document.getElementsByName("ipkRegionID")[0];ipkVehicleMakeID.style.display="none";}catch(ex){}
PosIT(oitem2);}
function getScrollingPosition()
{var position=[0,0];if(typeof window.pageYOffset!='undefined')
{position=[window.pageXOffset,window.pageYOffset];}
else if(typeof document.documentElement.scrollTop!='undefined'&&document.documentElement.scrollTop>0)
{position=[document.documentElement.scrollLeft,document.documentElement.scrollTop];}
else if(typeof document.body.scrollTop!='undefined')
{position=[document.body.scrollLeft,document.body.scrollTop];}
return position;}
function PosIT(oitem)
{arrPos=getScrollingPosition();oitem.style.top=arrPos[1];}
function closeDetail()
{var oitem1=document.getElementsByName("DetailShowRear")[0];var oitem2=document.getElementsByName("DetailShowFront")[0];oitem1.style.display="none";oitem2.style.display="none";try{var ipkVehicleMakeID=document.getElementsByName("ipkVehicleMakeID")[0];ipkVehicleMakeID.style.display="";}catch(ex){}
try{var ipkVehicleMakeID=document.getElementsByName("ipkVehicleSeriesID")[0];ipkVehicleMakeID.style.display="";}catch(ex){}
try{var ipkVehicleMakeID=document.getElementsByName("ipkRegionID")[0];ipkVehicleMakeID.style.display="";}catch(ex){}}
function viewDetailNew(carID,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewVehicle.asp?RequestTimeout=99999&carID="+carID+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function viewDetailSpecial(carID,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewSpecial.asp?RequestTimeout=99999&carID="+carID+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function viewDetailBurch(carID,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewDealerSpecial.asp?RequestTimeout=99999&ipkUsedVehicleID="+carID+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function viewDetailCommVehicle(WebSpecID,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewCommVehicle.asp?RequestTimeout=99999&WebSpecID="+WebSpecID+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function viewDealerVehicle(WebSpecID,page){var oarea=document.getElementsByName("VehicleDetailContainer")[0];sURL="viewDealerVehicle.asp?RequestTimeout=99999&WebSpecID="+WebSpecID+page;ajaxpage(sURL,"VehicleDetailContainer");showDetail();bod=document.getElementById('theBody');loc=document.location+'';if(loc.indexOf('#enqForm')!=-1){if(loc.indexOf('##')!=-1){document.location=loc.replace('##','#');}else{document.location=document.location;}}else{document.location=document.location+'#enqForm';}}
function viewDetailNewSpecial(carID,page,price){sURL="viewVehicle.asp?RequestTimeout=99999&carID="+carID+page+"&sPrice="+price+"&special=1";ID="detailWin";t=window.open(sURL,ID,'width=680, height=540, scrollbars=yes');t.focus();}
function addList(cons,carID,Type){if(Type=="New"){varString="carID";}else{varString="adnumber";}
frames.frmLoaderFrame.document.location='botbar.asp?'+varString+'='+carID+'&Type='+Type;var tempImageObject;tempImageObject=eval("document."+cons+carID);if(tempImageObject!=undefined){tempImageObject.src="../images/misc/blankBut.gif";}}
var whitespace=" \t\n\r";var ilegal="!\"#$%&'()*+,/:;<=>?[\\]^`{|}~? ???? ĄĸŖ¤ĨĻ§¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩļˇ¸šēģŧŊžŋ"
var g_strFromDB="";function isEmpty(s){return((s==null)||(s.length==0))}
function isWhitespace(s){var i;if(isEmpty(s))return true;for(i=0;i<s.length;i++){var c=s.charAt(i);if(whitespace.indexOf(c)==-1)return false;}
return true;}
function isEmail(s,canBeEmpty){if(isEmpty(s))
if(!canBeEmpty)return false;else return true;if(isWhitespace(s))return false;var i=1;var sLength=s.length;while((i<sLength)&&(s.charAt(i)!="@")){i++}
if((i>=sLength)||(s.charAt(i)!="@"))return false;else i+=2;while((i<sLength)&&(s.charAt(i)!=".")){i++}
if(s.indexOf("@")!=-1){if(s.indexOf("@",s.indexOf("@")+1)!=-1){return false;}}
if((i>=sLength-1)||(s.charAt(i)!="."))return false;else return true;}
function isLegal(s){var i;if(isEmail(s)){ilegal1=ilegal}else{ilegal1=ilegal+"@"}
for(i=0;i<s.length;i++){var c=s.charAt(i);if(ilegal1.indexOf(c)!=-1)return false;}
return true;}
function cleanNumericField(iVal){var re=/\s|\W|\D/g;if(iVal!=''){var tmpStr=iVal;tmpStr=tmpStr.replace(re,'');if(tmpStr!=''){return parseInt(tmpStr);}else{return parseInt(0);}}else{return parseInt(0);}}
function isNum(obj){if(isNaN(parseFloat(obj.value))==true){alert('Please enter valid number');obj.value='';obj.focus();}}
function checkLen(obj,maxLen){if(obj.value.length>=maxLen){return false;}
return true;}
function SetMainContent(aContent){s="<table width=100% height=100%><tr><td align=center valign=middle style='font-family:verdana;color:#c0c0c0'>"+aContent+"</td></tr></table>"
parent.frames.Main.document.clear();parent.frames.Main.document.write(s)
parent.frames.Main.document.close();}
function frmValidation(frmObj){with(frmObj){var functionArr=new Array(4);var frmObjItem;functionArr[0]='isEmpty(frmObjItem.value)';functionArr[1]='!isEmail(frmObjItem.value)';functionArr[2]='!isLegal(frmObjItem.value)';functionArr[3]='!isSAID(frmObjItem.value)';functionArr[4]='!isNum(frmObjItem.value)';for(i=0;i<frmObj.length;i++){if(frmObj[i].attributes.param!=undefined){tmpArr=frmObj[i].attributes.param.value.split(',');if(tmpArr[0]==1){frmObjItem=frmObj[i];if(isNaN(tmpArr[1])){if(eval(tmpArr[1].substr(1,tmpArr[1].length-2))){frmObjItem.focus();return false;}}else{if(eval(functionArr[tmpArr[1]])){frmObjItem.focus();return false;}}}}}}
return true;}
function openWin(url,w,h){window.open(url,'pop','width='+w+',height='+h+',scrollbars=no,toolbars=no');}
function popDiv(visDiv,hidDiv,hidDiv2){document.all[visDiv].style.visibility="visible";document.all[hidDiv].style.visibility="hidden";document.all[hidDiv2].style.visibility="hidden";}
function viewVehicle(newContent,displayHere){newDiv=eval('document.all.'+newContent);disDiv=eval('document.all.'+displayHere);disDiv.innerHTML=newDiv.innerHTML;}
function valueOfDropDown(aDropDown){return aDropDown.options[aDropDown.selectedIndex].value;}
function textOfDropDown(aDropDown){return aDropDown.options[aDropDown.selectedIndex].text;}
function PopulateHiddenValue(aform,afield,aDropDown){theField=eval("document."+aform+"."+afield);theField.value=aDropDown.options[aDropDown.selectedIndex].text;}
function PopulateHiddenValueNoDrop(aform,afield,aDropDown){theField=eval("document."+aform+"."+afield);theField.value=aDropDown;}
var numeric="0123456789";function y2k(number){return(number<1000)?number+1900:number;}
function isInteger(val){for(var i=0;i<val.length;i++){if(!isDigit(val.charAt(i))){return false;}}
return true;}
function isDigit(num){if(num.length>1){return false;}
if(numeric.indexOf(num)!=-1){return true;}
return false;}
function isNotNumeric(num){if(num.length==0){return true;}
for(i=0;i<num.length;i++){if(numeric.indexOf(num.charAt(i))>-1){return false;}}
return true;}
function isNumeric(num){if(num.length==0){return true;}
for(i=0;i<num.length;i++){if(numeric.indexOf(num.charAt(i))<0){return false;}}
return true;}
function isEmail(string){if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1)
return true;else
return false;}
function isDate(day,month,year){var today=new Date();year=((!year)?y2k(today.getYear()):year);month=((!month)?today.getMonth():month-1);if(!day)return false
var test=new Date(year,month,day);if((y2k(test.getYear())==year)&&(month==test.getMonth())&&(day==test.getDate()))
return true;else
return false}
function viewLargeImage(imageName)
{URL="largeImage.asp?image="+imageName;ID="LargeImage";t=window.open(URL,ID,'width=450, height=550, scrollbars=yes');t.focus();}
function goFinance(sURL){if(!sURL){URL="https://www.wesbank.co.za/fastapp/callacar/index.asp";}else{URL=sURL;}
ID="Finance";t=window.open(URL,ID,'width=780, height=480, scrollbars=yes');t.focus();}
function openCalc(){URL="chooseCalc.asp";ID="CalculatorWindow";calcWin=window.open(URL,ID,'width=502, heigh=360, scrollbars=yes');calcWin.focus();}
function openBook(){URL="bookService.asp";ID="BookAService";bookWin=window.open(URL,ID,'width=770, height=435, scrollbars=no');bookWin.focus();}
function openLink(URL){window.location.href=URL;}
function dealerships(){URL="http://www.mccarthylimited.co.za";ID="dealerships";dealershipsWin=window.open(URL,ID);dealershipsWin.focus();}
function insurance(){URL="http://www.mccarthyinsurance.co.za/content.asp?ipkCategoryID=169";ID="insurance";insuranceWin=window.open(URL,ID);insuranceWin.focus();}
function openTerms(){URL="terms.asp";ID="TermsWindow";termsWin=window.open(URL,ID,'width=616, height=450, scrollbars=yes');}
function popUp(URL,WIDTH,HEIGHT){day=new Date();id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+WIDTH+",height="+HEIGHT+",left = 316,top = 332');");}
function clearList(){if(confirm("Are you sure you wish to clear the list?")){frames.frmLoaderFrame.document.location='botbar.asp?clearlist=1';}}
function alertEmpty(){alert('There are currently no selected vehicles in your list.\nYou must add vehicles to your list by clicking on\nthe Add button next to the vehicle detail before you can view your list.');}
function openTerms(){URL="terms.asp";ID="TermsWindow";termsWin=window.open(URL,ID,'width=616, height=450, scrollbars=yes');}
function twodec(value){tempValue=parseInt(value*100)/100;return tempValue;}
function getOBJ(name,document){try{return document.getElementById(name);}catch(e){return null;}}
function interCheck(){if(document.CACForm.international.checked==true){alert("International Phone Number selected");document.CACForm.homecode.value="0860";document.CACForm.hometel.value="223345";document.CACForm.homecode.disabled=true;document.CACForm.buscode.disabled=true;document.CACForm.cellcode.disabled=true;document.CACForm.hometel.disabled=true;document.CACForm.cell.disabled=true;document.CACForm.bustel.disabled=true;}else{document.CACForm.homecode.value="";document.CACForm.hometel.value="";document.CACForm.homecode.disabled=false;document.CACForm.buscode.disabled=false;document.CACForm.cellcode.disabled=false;document.CACForm.hometel.disabled=false;document.CACForm.cell.disabled=false;document.CACForm.bustel.disabled=false;}}
function getRadioValue(radioButtonOrGroup){var buttonsLength=radioButtonOrGroup.length;if(buttonsLength){for(var b=0;b<buttonsLength;b++)
if(radioButtonOrGroup[b].checked)
return radioButtonOrGroup[b].value;}
else if(radioButtonOrGroup.checked)
return radioButtonOrGroup.value;return null;}
function PopulateHiddenID(aform,afield,aValue){theField=eval("document."+aform+"."+afield);theField.value=aValue;}
function openTerms(){URL="terms.asp";ID="TermsWindow";termsWin=window.open(URL,ID,'width=616, height=450, scrollbars=yes');}
function LoadEnquirepartnerForm(squerystring){sURL="enquirepartner.asp?"+squerystring;ajaxpage(sURL,'SecondaryContentArea');$('#SecondaryContentArea').css({"background-color":"#9EB5C7","display":"block","width":"230px"});}
function LoadEnquireForm(squerystring)
{sURL="enquire.asp?"+squerystring;ajaxpage(sURL,'SecondaryContentArea');$('#SecondaryContentArea').css({"background-color":"#9EB5C7","display":"inline-table"});}
function swapImage(oTarget,oSource)
{oTarget.src=oSource.src;}
function printdetail()
{var a=window.open('','','width=300,height=300');a.document.open("text/html");a.document.write(document.getElementsByName('DetailShowFront')[0].innerHTML);a.document.close();a.print();a.close();}
function DisplayDiv(sitemname,e)
{var oitem=document.getElementsByName(sitemname)[0];try{if(oitem.getAttribute("dropItLikeItsHot")){if(oitem.style.display=='none')
{oitem.style.display='block';}
else if(oitem.style.display=='block')
{oitem.style.display='none';}
else
{oitem.style.display='none';}}
MeBod=document.getElementById('theBody');MeBod.setAttribute('dropDown',1);StopProp(e);}catch(e){}}
function SetDropdown(oitem,eleName,formName,submitIt,displaySpan,theDropDown,e)
{var otargetfield=document.getElementsByName(eleName)[0];var oform=document.getElementsByName(formName)[0];var oDisplayField=document.getElementById(displaySpan);otargetfield.value=oitem.getAttribute("value");if(submitIt){changeSrchResults(1,oitem.getAttribute("value"),10,'');}else{oDisplayField.innerHTML=oitem.innerHTML;DisplayDiv(theDropDown,e);}}
function EditRegion(yayOrNay)
{if(yayOrNay){document.getElementById('DropdownContainerDiv2').dropItLikeItsHot=1;}else{document.getElementById('DropdownContainerDiv2').dropItLikeItsHot=0;document.getElementById('ipkRegionID').value='';document.getElementById('displayRegion').innerHTML='All Regions';}}
function checkSearch(vehType,region,make,series,price,transmission,yearFrom,yearTo){var countEm=0;if(vehType=='Used'){var tot=2;if(region!=''){countEm++;}}else{var tot=1;}
if(make!=''){countEm++;}
if(series!=''){countEm++;}
if(price!=''){countEm++;}
if(transmission!=''){countEm++;}
if(yearFrom!=''){countEm++;}
if(yearTo!=''){countEm++;}
if(countEm<tot){alert('Please select a minimum of '+tot+' options.');return false;}else{return true;}}
function submitIt(){ipkRegionID=document.getElementById('ipkRegionID').value;ipkVehicleMakeID=document.getElementById('ipkVehicleMakeID').value;vehicleMake=document.getElementById('vehicleMake').value;ipkVehicleSeriesID=document.getElementById('ipkVehicleSeriesID').value;iPriceIncl=document.getElementById('iPriceIncl').value;ifkVehicleTransmissionID=document.getElementById('ifkVehicleTransmissionID').value;iModelYearFrom=document.getElementById('iModelYearFrom').value;iModelYearTo=document.getElementById('iModelYearTo').value;if(document.getElementById('vehicleTypeNew').checked){theType='New';}else{theType='Used';}
if(checkSearch(theType,ipkRegionID,ipkVehicleMakeID,ipkVehicleSeriesID,iPriceIncl,ifkVehicleTransmissionID)){ajaxpage('searchResults.asp?ipkRegionID='+ipkRegionID+'&ipkVehicleMakeID='+ipkVehicleMakeID+'&ipkVehicleSeriesID='+ipkVehicleSeriesID+'&iPriceIncl='+iPriceIncl+'&vehicleType='+theType+'&ifkVehicleTransmissionID='+ifkVehicleTransmissionID+'&iModelYearFrom='+iModelYearFrom+'&iModelYearTo='+iModelYearTo,'content', "try{ajaxpage('loadBanner.asp?vehicleMake='+vehicleMake+'&vehicleType='+theType+'&ifkVehicleTransmissionID='+ifkVehicleTransmissionID+'&iPriceIncl='+iPriceIncl+'&iModelYearFrom='+iModelYearFrom+'&iModelYearTo='+iModelYearTo, 'frontBanners')}catch(e){};");}}
function resetEm(){document.getElementById('ipkRegionID').value='';document.getElementById('ipkVehicleMakeID').value='';document.getElementById('ipkVehicleSeriesID').value='';document.getElementById('iPriceIncl').value='';document.getElementById('ifkVehicleTransmissionID').value='';}
function changeSrchResults(pageNum,region,maxRows,orderBy){ipkVehicleMakeID=document.getElementById('ripkVehicleMakeID').value;ipkVehicleSeriesID=document.getElementById('ripkVehicleSeriesID').value;iPriceIncl=document.getElementById('riPriceIncl').value;iModelYearFrom=document.getElementById('riModelYearFrom').value;iModelYearTo=document.getElementById('riModelYearTo').value;vehicleType=document.getElementById('rvehicleType').value;ifkVehicleTransmissionID=document.getElementById('rifkVehicleTransmissionID').value;if(orderBy==''){orderBy=document.getElementById('rOrderBy').value;}else{orderBy=orderBy;}
if(maxRows==''){MaxRows=document.getElementById('riMaxRows').value;}else{MaxRows=maxRows;}
if(pageNum==''){iPageNum=1;}else{iPageNum=pageNum;}
ajaxpage('searchResults.asp?ipkRegionID='+region+'&ipkVehicleMakeID='+ipkVehicleMakeID+'&ipkVehicleSeriesID='+ipkVehicleSeriesID+'&iPriceIncl='+iPriceIncl+'&vehicleType='+vehicleType+'&orderBy='+orderBy+'&MaxRows='+MaxRows+'&iPageNum='+iPageNum+'&ifkVehicleTransmissionID='+ifkVehicleTransmissionID+'&iModelYearFrom='+iModelYearFrom+'&iModelYearTo='+iModelYearTo,'content');}
function changeSrchResults2(pageNum,region,maxRows,orderBy){ipkVehicleMakeID=document.getElementById('ripkVehicleMakeID').value;ipkVehicleSeriesID=document.getElementById('ripkVehicleSeriesID').value;iPriceIncl=document.getElementById('riPriceIncl').value;iModelYearFrom=document.getElementById('riModelYearFrom').value;iModelYearTo=document.getElementById('riModelYearTo').value;vehicleType=document.getElementById('rvehicleType').value;iGroupDealerCode=document.getElementById('riGroupDealerCode').value;iGroupDealerCode2=document.getElementById('riGroupDealerCode2').value;ifkVehicleTransmissionID=document.getElementById('rifkVehicleTransmissionID').value;if(orderBy==''){orderBy=document.getElementById('rOrderBy').value;}else{orderBy=orderBy;}
if(maxRows==''){MaxRows=document.getElementById('riMaxRows').value;}else{MaxRows=maxRows;}
if(pageNum==''){iPageNum=1;}else{iPageNum=pageNum;}
ajaxpage('dealerstock.asp?ipkRegionID='+region+'&ipkVehicleMakeID='+ipkVehicleMakeID+'&ipkVehicleSeriesID='+ipkVehicleSeriesID+'&iPriceIncl='+iPriceIncl+'&vehicleType='+vehicleType+'&orderBy='+orderBy+'&MaxRows='+MaxRows+'&iPageNum='+iPageNum+'&ifkVehicleTransmissionID='+ifkVehicleTransmissionID+'&iModelYearFrom='+iModelYearFrom+'&iModelYearTo='+iModelYearTo+'&iGroupDealerCode='+iGroupDealerCode+'&iGroupDealerCode2='+iGroupDealerCode2,'content');}
function changeSpecialResults(pageNum,maxRows){ipkVehicleMakeID=document.getElementById('ripkVehicleMakeID').value;if(maxRows==''){MaxRows=document.getElementById('riMaxRows').value;}else{MaxRows=maxRows;}
if(pageNum==''){iPageNum=1;}else{iPageNum=pageNum;}
ajaxpage('newSpecials.asp?ipkVehicleMakeID='+ipkVehicleMakeID+'&MaxRows='+MaxRows+'&iPageNum='+iPageNum,'content');}
function SubmitForm(sformname,sareaname)
{var oform=document.getElementsByName(sformname)[0];if(oform!=undefined){var surl=new String();var surltmp=new String();for(var i=0;i<oform.elements.length;i++)
{var oitem=oform.elements[i];if(oitem.name!='')
{if(surltmp.length>0)
{surltmp+='&';}
surltmp+=oitem.name+'='+Url.encode(oitem.value);}}
surl=oform.action;if(surl.indexOf("?")>=0)
{surl+="&"+surltmp;}
else
{surl+="?"+surltmp;}
ajaxpage(surl,sareaname);}}
function validate(){var frm=document.cantFindForm;var error=0;var EM=new Array();var err_msg='';with(frm){if(frm.Title.value==""){EM[error]='Title required.';error++;}
if(frm.firstname.value.length<=1){EM[error]='First name required.';error++;}else{if(!isNotNumeric(frm.firstname.value)){EM[error]='You must use letters only for your first names.';error++;}}
if(frm.lastname.value.length<=1){EM[error]='Last name required.';error++;}else{if(!isNotNumeric(frm.lastname.value)){EM[error]='You must use letters only for your surname.';error++;}}
if(frm.email.value!=""){if(frm.email.value!=frm.emailconfirm.value){EM[error]='Your email addresses do not match.';error++;}else{if(!isEmail(frm.email.value)&&frm.email.value!=''){EM[error]='Your email address is not valid.';error++;}}}
if(frm.hometel.value==''||frm.homecode.value==''){if(frm.cell.value==''){EM[error]='Home telephone number required.';error++;}}else{var string=frm.homecode.value+frm.hometel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your home number must be made up of numbers only.(more than 9 digits)';error++;}}
if(frm.bustel.value==''||frm.buscode.value==''){}else{var string=frm.buscode.value+frm.bustel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your business number must be made up of numbers only.(more than 9 digits)';error++;}}
if(frm.cell.value==''||frm.cellcode.value==''){if(frm.hometel.value==''){EM[error]='Cell telephone number required.';error++;}}else{if(frm.cellcode.value.substring(0,1)!="0"){EM[error]='Your cellphone telephone number must start with 0.';error++;}
var string=frm.cellcode.value+frm.cell.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your cell number must be made up of numbers only.(more than 9 digits)';error++;}}
if(frm.ipkRegionID.value==""){EM[error]='Region required.';error++;}
if(frm.Make.value=='0'){EM[error]='Vehicle Make required.';error++;}
if(frm.Series.value==0||frm.Series.value==""){EM[error]='Vehicle Series required.';error++;}
if(frm.ModelType.value==''){EM[error]='Vehicle Model required.';error++;}
if(frm.terms.checked==false){EM[error]='Select the tickbox to indicate that you agree to our Terms and Conditions.';error++;}
if(error>0){err_msg='Please correct the following in your application.';for(var i=0;i<error;i++){err_msg=err_msg+'\n - '+EM[i];}
alert(err_msg);return false;}else{}}
SubmitForm('cantFindForm','content');}
function validateTestDrivePartner(){var frm=document.CACForm;var error=0;var EM=new Array();var allElms=new Array();var err_msg='';with(frm){if(frm.TitleDesc.value==""){EM[error]='Title required.';allElms[allElms.length]=frm.TitleDesc;error++;}else{frm.TitleDesc.className="input";}
if(frm.firstname.value.length<=1){EM[error]='First name required.';allElms[allElms.length]=frm.firstname;error++;}else{if(!isNotNumeric(frm.firstname.value)){EM[error]='You must use letters only for your first names.';allElms[allElms.length]=frm.firstname;error++;}else{frm.firstname.className="input";}}
if(frm.lastname.value.length<=1){EM[error]='Last name required.';allElms[allElms.length]=frm.lastname;error++;}else{if(!isNotNumeric(frm.lastname.value)){EM[error]='You must use letters only for your surname.';allElms[allElms.length]=frm.lastname;error++;}else{frm.lastname.className="input";}}
if(hometel.value==""&&cell.value==""&&bustel.value==""){EM[error]='You must supply us with at least one phone number where we can contact you!';allElms[allElms.length]=frm.homecode;allElms[allElms.length]=frm.hometel;error++;}else{phoneCount=0;if(frm.hometel.value==''||frm.homecode.value==''){phoneCount++;}else{var string=frm.homecode.value+frm.hometel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your home number must be made up of numbers only.(more than 9 digits)';allElms[allElms.length]=frm.hometel;error++;}else{frm.homecode.className="input";frm.hometel.className="input";}}
if(frm.bustel.value==''||frm.buscode.value==''){phoneCount++;}else{var string=frm.buscode.value+frm.bustel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your business number must be made up of numbers only.(more than 9 digits)';allElms[allElms.length]=buscode;allElms[allElms.length]=bustel;error++;}else{frm.buscode.className="input";}}
if(frm.cell.value==''||frm.cellcode.value==''){phoneCount++;}else{if(frm.cellcode.value.substring(0,1)!="0"){EM[error]='Your cellphone telephone number must start with 0.';allElms[allElms.length]=cellcode;error++;}
var string=frm.cellcode.value+frm.cell.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your cell number must be made up of numbers only.(more than 9 digits)';allElms[allElms.length]=cellcode;allElms[allElms.length]=cell;error++;}else{frm.cellcode.className="input";frm.cell.className="input";}}
if(phoneCount==3){EM[error]='You must supply us with at least one phone number where we can contact you!';error++;}}
if(frm.email.value!=""){if(!isEmail(frm.email.value)&&frm.email.value!=''){EM[error]='Your email address is not valid.';allElms[allElms.length]=frm.email;error++;}
frm.email.className="input";}else{EM[error]='Please enter your e-mail address!';allElms[allElms.length]=frm.email;error++;}}
if(frm.ipkRegionID.value==""){EM[error]='Region required.';allElms[allElms.length]=frm.ipkRegionID;error++;}else{frm.ipkRegionID.className="input";}
if(frm.terms.checked==false){EM[error]='Select the tickbox to indicate that you agree to our Terms and Conditions.';error++;}
if(error>0){err_msg='Please correct the following in your application.';for(var i=0;i<error;i++){err_msg=err_msg+'\n - '+EM[i];}
alert(err_msg);return false;}else{if(frm.webspecid!=undefined||frm.adnumber!=undefined){frames.frmLoaderFrame.document.location='botbar.asp?clearlist=1&noload=1';}
SubmitForm('CACForm','enquire');}
if(frm.webspecid!=undefined||frm.adnumber!=undefined){frames.frmLoaderFrame.document.location='botbar.asp?clearlist=1&noload=1';}
SubmitForm('CACForm','enquire');}
function validateTestDrive(){var frm=document.CACForm;var error=0;var EM=new Array();var allElms=new Array();var err_msg='';with(frm){if(frm.TitleDesc.value==""){EM[error]='Title required.';allElms[allElms.length]=frm.TitleDesc;error++;}else{frm.TitleDesc.className="input";}
if(frm.firstname.value.length<=1){EM[error]='First name required.';allElms[allElms.length]=frm.firstname;error++;}else{if(!isNotNumeric(frm.firstname.value)){EM[error]='You must use letters only for your first names.';allElms[allElms.length]=frm.firstname;error++;}else{frm.firstname.className="input";}}
if(frm.lastname.value.length<=1){EM[error]='Last name required.';allElms[allElms.length]=frm.lastname;error++;}else{if(!isNotNumeric(frm.lastname.value)){EM[error]='You must use letters only for your surname.';allElms[allElms.length]=frm.lastname;error++;}else{frm.lastname.className="input";}}
if(cell.value==""&&bustel.value==""){EM[error]='You must supply us with at least one phone number where we can contact you!';allElms[allElms.length]=frm.homecode;error++;}else{phoneCount=0;if(frm.bustel.value==''||frm.buscode.value==''){phoneCount++;}else{var string=frm.buscode.value+frm.bustel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your business number must be made up of numbers only.(more than 9 digits)';allElms[allElms.length]=buscode;allElms[allElms.length]=bustel;error++;}else{frm.buscode.className="input";}}
if(frm.cell.value==''||frm.cellcode.value==''){phoneCount++;}else{if(frm.cellcode.value.substring(0,1)!="0"){EM[error]='Your cellphone telephone number must start with 0.';allElms[allElms.length]=cellcode;error++;}
var string=frm.cellcode.value+frm.cell.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your cell number must be made up of numbers only.(more than 9 digits)';allElms[allElms.length]=cellcode;allElms[allElms.length]=cell;error++;}else{frm.cellcode.className="input";frm.cell.className="input";}}
if(phoneCount==3){EM[error]='You must supply us with at least one phone number where we can contact you!';error++;}}
if(frm.email.value!=""){if(!isEmail(frm.email.value)&&frm.email.value!=''){EM[error]='Your email address is not valid.';allElms[allElms.length]=frm.email;error++;}
frm.email.className="input";}else{EM[error]='Please enter your e-mail address!';allElms[allElms.length]=frm.email;error++;}}
if(frm.ipkRegionID.value==""){EM[error]='Region required.';allElms[allElms.length]=frm.ipkRegionID;error++;}else{frm.ipkRegionID.className="input";}
if(frm.terms.checked==false){EM[error]='Select the tickbox to indicate that you agree to our Terms and Conditions.';error++;}
if(error>0){err_msg='Please correct the following in your application.';for(var i=0;i<error;i++){err_msg=err_msg+'\n - '+EM[i];}
alert(err_msg);return false;}else{if(frm.webspecid!=undefined||frm.adnumber!=undefined){frames.frmLoaderFrame.document.location='botbar.asp?clearlist=1&noload=1';}
SubmitForm('CACForm','enquire');}
if(frm.webspecid!=undefined||frm.adnumber!=undefined){frames.frmLoaderFrame.document.location='botbar.asp?clearlist=1&noload=1';}
SubmitForm('CACForm','enquire');}
function checkMemNo(){with(document.CACForm){if(memNo.value.length==13){d1=parseFloat(memNo.value.substr(0,1));d2=parseFloat(memNo.value.substr(1,1));d3=parseFloat(memNo.value.substr(2,1));d4=parseFloat(memNo.value.substr(3,1));d5=parseFloat(memNo.value.substr(4,1));d6=parseFloat(memNo.value.substr(5,1));d7=parseFloat(memNo.value.substr(6,1));d8=parseFloat(memNo.value.substr(7,1));d9=parseFloat(memNo.value.substr(8,1));d10=parseFloat(memNo.value.substr(9,1));d11=parseFloat(memNo.value.substr(10,1));d12=parseFloat(memNo.value.substr(11,1));d13=parseFloat(memNo.value.substr(12,1));totChk=parseFloat((d1*3))+parseFloat((d2*2))+parseFloat((d3*10))+parseFloat((d4*9))+parseFloat((d5*8))+parseFloat((d6*7))+parseFloat((d7*6))+parseFloat((d8*5))+parseFloat((d9*4))+parseFloat((d10*3))+parseFloat((d11*2))+parseFloat((d12*1))+parseFloat((d13*1));if(totChk%11!=0){alert('Your Membership Number is invalid');return false;}else{return true;}}else{alert('Your Membership Number must be 13 digits');return false;memNo.focus();}}}
function validateSpecial(){var frm=document.CACForm;var error=0;var EM=new Array();var err_msg='';with(frm){if(frm.Title.value==""){EM[error]='Title required.';error++;}
if(frm.firstname.value.length<=1){EM[error]='First name required.';error++;}else{if(!isNotNumeric(frm.firstname.value)){EM[error]='You must use letters only for your first names.';error++;}}
if(frm.lastname.value.length<=1){EM[error]='Last name required.';error++;}else{if(!isNotNumeric(frm.lastname.value)){EM[error]='You must use letters only for your surname.';error++;}}
if(hometel.value==""&&cell.value==""&&bustel.value==""){EM[error]='You must supply us with at least one phone number where we can contact you!';error++;}else{phoneCount=0;if(frm.hometel.value==''||frm.homecode.value==''){phoneCount++;}else{var string=frm.homecode.value+frm.hometel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your home number must be made up of numbers only.(more than 9 digits)';error++;}}
if(frm.bustel.value==''||frm.buscode.value==''){phoneCount++;}else{var string=frm.buscode.value+frm.bustel.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your business number must be made up of numbers only.(more than 9 digits)';error++;}}
if(frm.cell.value==''||frm.cellcode.value==''){phoneCount++;}else{if(frm.cellcode.value.substring(0,1)!="0"){EM[error]='Your cellphone telephone number must start with 0.';error++;}
var string=frm.cellcode.value+frm.cell.value
var re=/^[\d]{8,16}$/;if(!re.test(string)){EM[error]='Your cell number must be made up of numbers only.(more than 9 digits)';error++;}}
if(phoneCount==3){EM[error]='You must supply us with at least one phone number where we can contact you!';error++;}}
if(frm.email.value!=""){if(!isEmail(frm.email.value)&&frm.email.value!=''){EM[error]='Your email address is not valid.';error++;}}else{EM[error]='Please enter your e-mail address!';error++;}}
if(frm.terms.checked==false){EM[error]='Select the tickbox to indicate that you agree to our Terms and Conditions.';error++;}
var re=/^[\d]{4,18}$/;if(error>0){err_msg='Please correct the following in your application.';for(var i=0;i<error;i++){err_msg=err_msg+'\n - '+EM[i];}
alert(err_msg);return false;}else{SubmitForm('CACForm','enquire');}
SubmitForm('CACForm','enquire');}
var iChildCount=0;var oImgChecked=new Image();var oImgUnChecked=new Image();var bEnableScroll=false;var oitem=null;var otimer=null;var ispeed=2;function ScrollRight()
{if(oitem.scrollLeft>=0&&(oitem.scrollLeft+ispeed)>0&&bEnableScroll==true)
{oitem.scrollLeft+=ispeed;}
if(oitem.scrollLeft>=oitem.scrollWidth-661)
{setScrollDir('left');}
if(otimer)
{clearInterval(otimer);}
otimer=setInterval(ScrollRight,1);}
function ScrollLeft()
{try{if(oitem.scrollLeft>0&&(oitem.scrollLeft-ispeed)>0&&bEnableScroll==true)
{oitem.scrollLeft-=ispeed;}
else if(oitem.scrollLeft<=1)
{setScrollDir("right");}
if(otimer)
{clearInterval(otimer);}
otimer=setInterval(ScrollLeft,1);}catch(ex){}}
function StartScroll(sListName,iNewSpeed)
{oitem=document.getElementsByName(sListName)[0];bEnableScroll=true;ispeed=iNewSpeed;}
function setScrollDir(sdir)
{oitem.setAttribute('autoscroll_dir',sdir)}
function StopScroll()
{if(oscrolltimer)
{clearInterval(oscrolltimer);}
clearInterval(otimer);bEnableScroll=false;}
function ScrollState()
{try{return oitem.getAttribute('autoscroll_dir');}catch(evp){}}
var oscrolltimer=null;function AutoScroll(sListName)
{StartScroll(sListName,1);if(ScrollState()=='right')
{ScrollRight();}
else
{ScrollLeft();}
StopScroll();oscrolltimer=setInterval("AutoScroll('"+sListName+"')",30);}
var doIt=0;function validateFeedback(){var frm=document.feedbackForm;var error=0;var EM=new Array();var err_msg='';with(frm){if(frm.sFirstName.value.length<=1){EM[error]='First name required.';error++;}else{if(!isNotNumeric(frm.sFirstName.value)){EM[error]='You must use letters only for your first names.';error++;}}
if(frm.sLastName.value.length<=1){EM[error]='Last name required.';error++;}else{if(!isNotNumeric(frm.sLastName.value)){EM[error]='You must use letters only for your surname.';error++;}}
if(frm.sEmailAddress.value==""){EM[error]='Please enter your email address.';error++;}else{if(!isEmail(frm.sEmailAddress.value)&&frm.sEmailAddress.value!=''){EM[error]='Your email address is not valid.';error++;}}
if(frm.sContactNumber.value==''){if(frm.sContactNumber.value==''){EM[error]='Contact telephone number required.';error++;}}else{var string=frm.sContactNumber.value
var re=/^[\d\s]{8,16}$/;if(!re.test(string)){EM[error]='Your home telephone number must be made up of numbers and spaces only. more than 8 digits';error++;}}
if(sComment.value==""){EM[error]='Please enter your comments';error++;}
for(i=0;i<divisions.length;i++)
{if(divisions[i].checked==true)
{doIt=1;}}
if(doIt!=1)
{EM[error]='Please select at least one division to contact.';error++;}
if(error>0){err_msg='Please correct the following in your application.';for(var i=0;i<error;i++){err_msg=err_msg+'\n - '+EM[i];}
alert(err_msg);return false;}else{SubmitForm('feedbackForm','content');}}
SubmitForm('feedbackForm','content');}
function countSpecials(sdefname,iminrange,imaxrange)
{var icurr=0;for(var i=iminrange;i<=imaxrange;i++)
{if(!document.getElementById(sdefname+i))
{break;}
icurr=i;}
return icurr;}
var specTimeout=null;var iMaxSepCnt=null
function flipSpecials(whichOne,specific){try{if(iMaxSepCnt==null)
{iMaxSepCnt=countSpecials('specButt',1,100);}
if(document.getElementById('specialHolder')!=undefined){if(specTimeout){clearInterval(specTimeout);}
try{document.getElementById('specialHolder').innerHTML=document.getElementById('special'+whichOne).innerHTML;}catch(err){try{setTimeout('document.getElementById(\'specialHolder\').innerHTML=document.getElementById(\'special1\').innerHTML;',3000);}catch(errt){}}
for(var n=1;n<=iMaxSepCnt;n++){document.getElementById('specButt'+n).className='specButt';}
if(whichOne==1){prevOne=iMaxSepCnt;}else{prevOne=parseInt(whichOne)-1;}
document.getElementById('specButt'+prevOne).className='specButt';document.getElementById('specButt'+whichOne).className='specButtHover';if(whichOne!=iMaxSepCnt){nextOne=parseInt(whichOne)+1;}else{nextOne=1;}
if(!specific){specTimeout=setTimeout('flipSpecials('+nextOne+')',3000);}else{clearInterval(specTimeout);}}}catch(ex){}}
function outSpecials(whichOne){if(iMaxSepCnt==null)
{iMaxSepCnt=countSpecials('specButt',1,100);}
if(specTimeout){clearInterval(specTimeout);}
if(whichOne!=iMaxSepCnt){nextOne=parseInt(whichOne)+1;}else{nextOne=1;}
specTimeout=setTimeout('flipSpecials('+nextOne+')',6000);}
function popOBJ(name,content){theDiv=document.getElementById(''+name);theDiv.innerHTML=content;}
function checkDrops(){MeBod=document.getElementById('theBody');try{if(MeBod.getAttribute('dropDown')==1){try{if(document.getElementById('DropdownMakes')!=undefined){document.getElementById('DropdownMakes').style.display='none';}
if(document.getElementById('DropdownPrice')!=undefined){document.getElementById('DropdownPrice').style.display='none';}
if(document.getElementById('DropdownSeries')!=undefined){document.getElementById('DropdownSeries').style.display='none';}
if(document.getElementById('DropdownContainerDiv2')!=undefined){document.getElementById('DropdownContainerDiv2').style.display='none';}
if(document.getElementById('DropdownContainerDiv22')!=undefined){document.getElementById('DropdownContainerDiv22').style.display='none';}
if(document.getElementById('DropdownMakesForm')!=undefined){document.getElementById('DropdownMakesForm').style.display='none';}
if(document.getElementById('DropdownSeriesForm')!=undefined){document.getElementById('DropdownSeriesForm').style.display='none';}
MeBod.setAttribute('dropDown',0);}catch(e){}}else{}}catch(e){alert(e);}}
var whichBanner=0;function switchTheBanner(){try{if(whichBanner==0){document.getElementById('1stBanner').style.display='block';document.getElementById('2ndBanner').style.display='none';whichBanner=1;}else{document.getElementById('1stBanner').style.display='none';document.getElementById('2ndBanner').style.display='block';whichBanner=0;}}catch(ex){}
contactTime=setTimeout('switchTheBanner()',5000);}
function CheckForm(aform)
{theForm=eval(aform);if(theForm.Title.value=="")
{alert("Please select your title from the list provided");theForm.Title.focus();return false;}
else if(theForm.sName.value=="")
{alert("Please enter your name");theForm.sName.focus;return false;}
else if(theForm.sSurname.value=="")
{alert("Please enter your Surname");theForm.sSurname.focus;return false;}
else if(theForm.sEmailaddress.value=="")
{alert("Please enter your Email address");theForm.sEmailaddress.focus;return false;}
else if(theForm.Message.value=="")
{alert("Please enter your message in the box provided");theForm.Message.focus();return false;}
else
{SubmitForm('contactForm','content');}}
var thisPage=1;function goToPage(chg){document.getElementById('viewMore').style.display='none';document.getElementById('pageNos').style.display='block';totPages=document.getElementById('theTotalPage').innerHTML;document.getElementById('pages').innerHTML=totPages;len=document.getElementsByName('pg'+thisPage).length;for(var i=0;i<len;i++){if(document.getElementsByName('pg'+thisPage)[i]!=undefined){document.getElementsByName('pg'+thisPage)[i].style.display='none';}}
len2=document.getElementsByName('pg'+thisPage).length;thisPage=parseInt(thisPage)+parseInt(chg);for(var i=0;i<len;i++){if(document.getElementsByName('pg'+thisPage)[i]!=undefined){document.getElementsByName('pg'+thisPage)[i].style.display='block';}}
if(thisPage>1){document.getElementById('leftArr').style.visibility='visible';}
if(thisPage==1){document.getElementById('leftArr').style.visibility='hidden';}
if(thisPage==totPages){document.getElementById('rightArr').style.visibility='hidden';}else{document.getElementById('rightArr').style.visibility='visible';}
document.getElementById('thisPage').innerHTML=thisPage;}
function checkAndVarifyEmail(str)
{var txtEmail=document.getElementById('email')
var txtConfirmEmail=document.getElementById('emailconfirm')
if(txtEmail.value!="")
{if(str=='email')
{if(!isEmail(txtEmail.value)&&txtEmail.value!='')
{document.getElementById('divEmail').innerHTML=displayValInfoOnEmail}
else
{document.getElementById('divEmail').innerHTML=displaySuccessOnEmail}}
else if(txtEmail.value!=""&&txtConfirmEmail.value!="")
{if(txtEmail.value!=txtConfirmEmail.value)
{document.getElementById('divEmailConfirm').innerHTML=displayValInfoOnConfirmEmail}
else
{document.getElementById('divEmailConfirm').innerHTML=blank}}}
else
{document.getElementById('divEmail').innerHTML=blank
document.getElementById('divEmailConfirm').innerHTML=blank}}
function showInformation(str)
{switch(str)
{case'firstname':checkLength(str);break;case'lastname':checkLength(str);break;case'hometel':document.getElementById('divHome').innerHTML=displayInfoOnHomePhone
break;case'bustel':document.getElementById('divBuss').innerHTML=displayInfoOnBuss
break;case'cell':document.getElementById('divCell').innerHTML=displayInfoOnCell
break;case'email':document.getElementById('divEmail').innerHTML=displayInfoOnEmail
break;case'emailconfirm':document.getElementById('divEmailConfirm').innerHTML=displayInfoOnConfrmEmail
break;default:document.getElementById('divModel').innerHTML=displayInfoOnModel}}
function hideInformation(str)
{switch(str)
{case'firstname':document.getElementById('divFirstName').innerHTML=blank
break;case'lastname':document.getElementById('divLastName').innerHTML=blank
break;case'hometel':document.getElementById('divHome').innerHTML=blank
break;case'bustel':document.getElementById('divBuss').innerHTML=blank
break;case'cell':document.getElementById('divCell').innerHTML=blank
break;case'email':checkAndVarifyEmail(str);break;case'emailconfirm':checkAndVarifyEmail(str);break;default:document.getElementById('divModel').innerHTML=blank}}
function checkLength(str)
{var txtFirstNameLength=document.getElementById('firstname')
var txtLastNameLength=document.getElementById('lastname')
if(str=='firstname')
{document.getElementById('divLastName').innerHTML=blank
if(txtFirstNameLength.value.length==0)
{document.getElementById('divFirstName').innerHTML=displayInfoOnName}
else if(txtFirstNameLength.value.length<4||txtFirstNameLength.value.length>15)
{document.getElementById('divFirstName').innerHTML=displayValInfoOnName}
else
{document.getElementById('divFirstName').innerHTML=blank}}
else
{document.getElementById('divFirstName').innerHTML=blank
if(txtLastNameLength.value.length==0)
{document.getElementById('divLastName').innerHTML=displayInfoOnName}
else if(txtLastNameLength.value.length<4||txtLastNameLength.value.length>15)
{document.getElementById('divLastName').innerHTML=displayValInfoOnName}
else
{document.getElementById('divLastName').innerHTML=blank}}}
function validateEmail(frm,field){email=document.getElementById(field);if(isEmail(email.value)){SubmitForm(frm,'content')}else{alert('Please enter a valid email address');}}
function sellacarnew(){w=600;h=800;LINKS=(w/2-(600/2));BOONSTE=(h/2-(800/2));vWinCal=window.open("sellacar.asp?PopUp=1",'sellacarnewPopUp','noframe,width=600,height=800,left='+LINKS+',top='+BOONSTE+',scrollbars=1');vWinCal.opener=self;}
function validateSell(){var frm=document.SellForm;var error=0;var EM=new Array();var err_msg='';with(frm){if(frm.Title.value==""){EM[error]='Title required.';error++;}
if(frm.firstname.value.length<=1){EM[error]='First name required.';error++;}else{if(!isNotNumeric(frm.firstname.value)){EM[error]='You must use letters only for your first names.';error++;}}
if(frm.lastname.value.length<=1){EM[error]='Last name required.';error++;}else{if(!isNotNumeric(frm.lastname.value)){EM[error]='You must use letters only for your surname.';error++;}}
if(frm.email.value!=""){if(frm.email.value!=frm.emailConfirm.value){EM[error]='Your email addresses do not match.';error++;}else{if(!isEmail(frm.email.value)&&frm.email.value!=''){EM[error]='Your email address is not valid.';error++;}}}
if(frm.hometel.value==''){if(frm.cell.value==''){EM[error]='Home telephone number required.';error++;}}
if(frm.bustel.value==''){EM[error]='Business telephone number required.';error++;}
if(frm.cell.value==''){if(frm.hometel.value==''){EM[error]='Cellphone number required.';error++;}}
if(frm.ipkRegionID.value==""){EM[error]='Region required.';error++;}
if(frm.Series==null){EM[error]='Vehicle Make required.';error++;}else{if(frm.Series.value==0||frm.Series.value==""){EM[error]='Vehicle Series required.';error++;}}
if(frm.UserModelType.value==""){EM[error]='Vehicle Model required.';error++;}
if(year.value==""){EM[error]='Vehicle Year required.';error++;}else{var string=frm.year.value
if(!isInteger(string)){EM[error]='Vehicle Year not valid.';error++;}}
if(price.value==""){EM[error]='Vehicle Price required.';error++;}else{var string=frm.price.value
if(!isInteger(string)){EM[error]='Vehicle Price not valid.';error++;}}
if(colour.value==""){EM[error]='Vehicle Color required.';error++;}
if(km.value==""){EM[error]='Vehicle Kilometers required.';error++;}else{var string=frm.km.value
if(!isInteger(string)){EM[error]='Vehicle Kilometers not valid.';error++;}}
if(reg.value==""){EM[error]='Vehicle Registration required.';error++;}
if(was.value==""){EM[error]='Settlement Amount required.';error++;}else{var string=frm.was.value
if(!isInteger(string)){EM[error]='Settlement Amount not valid.';error++;}}
if(error>0){err_msg='Please correct the following in your application.';for(var i=0;i<error;i++){err_msg=err_msg+'\n - '+EM[i];}
alert(err_msg);return false;}else{}}
SubmitForm('SellForm','content');}
function loader(){SelectedRadio=getRadioValue(document.SearchForm.vehicleType);loadXMLMakes(SelectedRadio,'SellForm',FormType);}
function validateForm()
{with(document.contactForm)
{message="";if(sFirstName.value=="")
{message=message+"Please enter a first name\n"}
if(sLastName.value=="")
{message=message+"Please enter a last name\n"}
if(sEmail.value==""&&sContactNumber.value=="")
{message=message+"Please enter either an email address or a contact number\n"}
if(sEmail.value!="")
{if(sEmail.value!=sEmailConfirm.value)
{message=message+"Emails dont match\n"}}
if(sContactNumber!="")
{if(!isNumeric(sContactNumber.value))
{message=message+"Please enter a numeric value for the contact number\n"}}
if(message=="")
{return true;}
else
{alert(message);return false;}}}
function contactFormCheck()
{if(validateForm())
{SubmitForm('contactForm','content')}}