
var num=0;var interval=null;function doLists()
{num++;if(num<100)
{if(typeof get_makes=='function'&&typeof get_range=='function'&&typeof _model=='object'&&typeof make_v=='object'&&typeof make_d=='object')
{get_makes();get_range(_model[0]);clearInterval(interval);}}
else
{clearInterval(interval);}}
interval=setInterval("doLists()",100);function get_makes()
{var dropDown;selectedIndex=0;dropDown=document.getElementById("atsearch").make;if(dropDown)
{dropDown.length=0;for(index=0;index<make_d.length;index++)
{dropDown[index]=new Option(make_d[index],make_v[index]);if(make_d[index]=="Make"||make_d[index]=="MAKE")
{dropDown[index]=new Option(make_d[index],"");}
if(make_d[index]=="ANY MAKE")
{dropDown[index]=new Option(make_d[index],"ANY");}}
dropDown.options[selectedIndex].selected=true;}}
function get_range(ranges)
{selectedIndex=0;var dropDown;dropDown=document.getElementById("atsearch").model;if(dropDown)
{dropDown.length=0;for(index=0;index<ranges.length;index++)
{dropDown[index]=new Option(ranges[index],ranges[index]);if(ranges[index]=="Model"||ranges[index]=="MODEL")
{dropDown[index]=new Option(ranges[index],"");}
if(ranges[index]=="ANY MODEL")
{dropDown[index]=new Option(ranges[index],"ANY");}
else if(ranges[index].toUpperCase()=="ANY MODEL"&&req_model=="ANY")
{selectedIndex=index;}}
dropDown.options[selectedIndex].selected=true;}}
function setCookie(name,value,expires,path,domain,secure)
{var curCookie=name+"="+escape(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=curCookie;}
function doQuote(theForm)
{try
{var formElements=theForm.elements;var countryDropdown=formElements["countryDropdown"];var actionDropdown=formElements["actionDropdown"];var symbolText=formElements["symbol"].value;var outputSymbolText="";if(actionDropdown!=null)
{var selectedAction=actionDropdown.options[actionDropdown.selectedIndex].value;if(selectedAction!=""&&selectedAction!=null)
theForm.action=selectedAction;}
if(countryDropdown!=null)
{var selectedCountry=countryDropdown.options[countryDropdown.selectedIndex].value;var r=new RegExp("[^,;]+","gm");var arr;arr=r.exec(symbolText);while(arr!=null)
{var workingText=arr[0];var colonIndex=workingText.indexOf(":");if(colonIndex<0)
{var indicatorRegEx=new RegExp("[\^\$\/&]{1,1}");var indicatorResult=indicatorRegEx.exec(workingText);if(indicatorResult!=null)
{var indicatorValue=workingText.substring(indicatorResult.index-1,indicatorResult.lastIndex-1);var indicatorIndex=indicatorResult.index;if(indicatorValue!="/")
workingText=workingText.substring(0,indicatorIndex)+selectedCountry+":"+workingText.substr(indicatorIndex);}
else
workingText=selectedCountry+":"+workingText;}
if(outputSymbolText.length>0)
outputSymbolText=outputSymbolText+";"+workingText;else
outputSymbolText=outputSymbolText+workingText;arr=r.exec(symbolText);}}
theForm.action=theForm.action+outputSymbolText;return true;}
catch(e)
{return false;}}
function tabledisplay(pickDropdown)
{try
{var selectedId=pickDropdown.selectedIndex;var sibling=pickDropdown.parentNode.nextSibling;}
catch(e)
{return;}
var siblingCount=0;try
{while(sibling!=null)
{if(siblingCount==selectedId)
sibling.className="show";else
sibling.className="hide";siblingCount++;sibling=sibling.nextSibling;}}
catch(e){return;}}
function changelink(eventTarget)
{try
{parentUl=eventTarget.parentElement.parentElement;liChild=parentUl.firstChild;chartImage=parentUl.nextSibling;if(parentUl.childNodes!=null)
{var childCount=parentUl.childNodes.length;}
else
{return;}
for(count=1;count<=childCount;count++)
{if(liChild.firstChild==eventTarget)
{liChild.firstChild.className="hide";liChild.lastChild.className="show";chartImage.className="show";}
else
{liChild.firstChild.className="show";liChild.lastChild.className="hide";chartImage.className="hide";}
liChild=liChild.nextSibling;chartImage=chartImage.nextSibling;}}
catch(e)
{return;}}
function ord2()
{return(Math.random()*10000000000000000);}
function GoToProperscreen(pageType,currentQuestion,queCount)
{switch(pageType)
{case"QuizStartingPage":document.getElementById("QuizStartingPage").className="hide";createHit();document.getElementById("QuestionPage").className="show";document.getElementById("QuestionDiv1").className="show";break;case"QuestionPage":t="q"+currentQuestion;radiobtn=document.getElementsByName(t);nothingChecked=1;for(j=0;j<radiobtn.length;j++){if(radiobtn[j].checked){nothingChecked=0;if(radiobtn[j].value==1){if(currentQuestion==queCount){document.getElementById("QuizEndPage").className="show";document.getElementById("QuestionPage").className="hide";}
else{temp1="QuestionDiv"+currentQuestion;document.getElementById(temp1).className="hide";currentQuestion=currentQuestion+1;temp1="QuestionDiv"+currentQuestion;document.getElementById(temp1).className="show";}}
else{document.getElementById("QuizFailureEndPage").className="show";temp1="QuestionDiv"+currentQuestion;document.getElementById(temp1).className="hide";document.getElementById("QuestionPage").className="hide";}}}
if(nothingChecked==1){alert("Please select an answer");}
else{createHit();}
break;case"QuizEndPage":radiobtn=document.getElementsByName("e");nothingChecked=1;for(j=0;j<radiobtn.length;j++){if(radiobtn[j].checked){nothingChecked=0;window.open(radiobtn[j].value,'_parent','')}}
if(nothingChecked==1){alert("Please select an answer");}
break;case"QuizFailureEndPage":radiobtn=document.getElementsByName("f");nothingChecked=1;for(j=0;j<radiobtn.length;j++){if(radiobtn[j].checked){nothingChecked=0;window.open(radiobtn[j].value,'_parent','')}}
if(nothingChecked==1){alert("Please select an answer");}
break;}}
function createHit()
{if(document.getElementById("ctag")!=null)
{document.getElementById("ctag").src=document.getElementById("ctag").src;}}
function redir(frmDetails)
{var href=null
for(var i=0;i<frmDetails.R1.length;i++)
{if(frmDetails.R1[i].checked)
href=frmDetails.R1[i].value}
if(href!=null)
if(!validate(frmDetails)){return false;}
else
document.location.href="http://uswitch.money.msn.co.uk/"+href+frmDetails.postcode.value
return false}
function validPostcode(frmElement){var pcode=frmElement.value;var pcType1=/^[A-Z]{1}\d{1}\s{1}\d{1}[A-Z]{2}/;var pcType2=/^[A-Z]{2}\d{1}\s{1}\d{1}[A-Z]{2}/;var pcType3=/^[A-Z]{1}\d{2}\s{1}\d{1}[A-Z]{2}/;var pcType4=/^[A-Z]{2}\d{2}\s{1}\d{1}[A-Z]{2}/;var pcType5=/^[A-Z]{2}\d{1}[A-Z]{1}\s{1}\d{1}[A-Z]{2}/;var pcType6=/^[A-Z]{1}\d{1}[A-Z]{1}\s{1}\d{1}[A-Z]{2}/;var sAlertEmpty="Please enter a valid UK postcode.";var sAlertLength="Sorry, but the postcode you entered was too long or too short. Please enter a valid UK postcode.";var sAlertInvalid="Sorry, but the postcode you entered was not valid. Please enter a valid UK postcode.";if(pcode==null||pcode==""){alert(sAlertEmpty);return false;}
pcode=formatPostcode(pcode);if(pcode.length<6||pcode.length>8){alert(sAlertLength);return false;}
if(pcode.match(pcType1)||pcode.match(pcType2)||pcode.match(pcType3)||pcode.match(pcType4)||pcode.match(pcType5)||pcode.match(pcType6)){frmElement.value=pcode;return true;}
else{alert(sAlertInvalid);return false;}}
function formatPostcode(xPC){xPC=xPC.toUpperCase();xRegExp=/ /g;xPC=xPC.replace(xRegExp,"");xRegExp=/!/g;xPC=xPC.replace(xRegExp,"");xLen=xPC.length;xLastStart=xLen-3;xPart1=xPC.substr(0,xLastStart);xPart2=xPC.substr(xLastStart,3);xPC=xPart1+" "+xPart2;return xPC;}
function validate(frm){if(!validPostcode(frm.postcode)){return false;}
else{return true;}}
function validateForm(theForm)
{var bRtn=false;var objCheck=theForm.elements["SNID"];if(objCheck.length==null&&objCheck.checked)
{bRtn=true;}
else
{for(iLoop=0;iLoop<objCheck.length;iLoop++)
{if(objCheck[iLoop].checked==true)
{bRtn=true;break;}}}
if(bRtn==false)
{alert(selectionErrorMessage);return bRtn;}
return true;}