if(typeof Enm=="undefined"){Enm={}}var bIfrFx=false;var bIfrIE=false;$(document).ready(function(){$("#nav1 #liafs").mouseover(function(){var d=$("#OAS_CONTENT_Frame2",$("#OAS_PH_Frame2")).contents().find("embed").attr("wmode");if(d==null){bIfrIE=true;var a=$("#OAS_CONTENT_Frame2",$("#OAS_PH_Frame2")).get(0);if(a!=null){var c=(a.contentDocument?a.contentDocument:a.contentWindow.document);if(c!=null){var b=c.body.innerHTML.toLowerCase().indexOf('param name="wmode" value="window"');if(b>0){$("#OAS_CONTENT_Frame2",$("#OAS_PH_Frame2")).width(0)}}}}else{if(d!=null&&d.toLowerCase()=="window"){bIfrIE=false;$("#OAS_CONTENT_Frame2",$("#OAS_PH_Frame2")).width(0)}}}).mouseleave(function(){$("#OAS_CONTENT_Frame2",$("#OAS_PH_Frame2")).width(303)})});function iFrameFriendly(){if(bIfrIE){if(!bIfrFx){$("#nav1 li ul,#nav4 li ul").each(function(){var b=$(this);$("li",b).css({"z-index":"10",position:"relative"});var a='<iframe class="ifrmFix" style="width:100%;height:100%;position:absolute;z-index:2;"></iframe>'+$("ul",$(this).parent()).html();$("ul",$(this).parent()).html(a)});$(".ifrmFix").show()}bIfrFx=true}else{$("#OAS_CONTENT_Frame2",$("#OAS_PH_Frame2")).width(0)}}Enm.Core={PrepModal:function(){$.each($(".window"),function(){var e=parseInt($("#"+this.id).attr("height")),c=parseInt($("#"+this.id).attr("width"));var d=e+40,b=c+40,a=$(this).children(".pu_cont");if(a.length>0){a.height(d).width(b);a.children(".pu_t,.pu_b").children(".pu_tm,.pu_bm").width(c);a.children(".pu_cl,.pu_cr,.pu_c").height(e);a.children(".pu_c").width(c)}});$("a[name=modal]").click(function(g){g.preventDefault();var f=$(window),a="#"+$(this).attr("pop"),b=$(document).height(),d=f.width();$("#msk").css({width:"100%",height:"100%"}).fadeTo(1300,0.4);var c=f.height(),h=f.width();var k=(c<parseInt($(a).attr("height"))||(h<960));if($(a).attr("height")!=null){$(a+",.window").height(parseInt($(a).attr("height")))}if($(a).attr("width")!=null){$(a+",.window").width(parseInt($(a).attr("width")))}if(k){$(a).css({position:"absolute",top:"90px",left:"5px"});$("html,body").animate({scrollTop:0,scrollLeft:0},"slow")}else{var l=(c/2)-($(a).height()/2);$(a).css({position:"absolute",top:l<90?90:l,left:960/2-$(a).width()/2+f.scrollLeft()})}$(a).fadeIn(600);var j=parseInt($(a).css("top").replace("px",""));$(a).css("top",(parseInt(j)+($(window).scrollTop()/2)));if(parseInt($(a).css("top").replace("px",""))<(f.scrollTop()+20)){f.scrollTop(j-20)}Enm.Core.HideOAS()});$("#mdlPop .close,.closePop").click(function(a){a.preventDefault();$("#msk,.window").hide();Enm.Core.ShowOAS()});$("#msk").click(function(){$(this).hide();$("#msk,.window,.mdlPopup").hide();Enm.Core.ShowOAS()});$("a[name=modal],#mdlPop .close,.closePop").css("cursor","pointer")},HideOAS:function(){$('[id^="OAS_"],#enm_adv').css("width","0px")},ShowOAS:function(){$('[id^="OAS_"],#enm_adv').css("width","auto")},LogEvt:function(b,a,c){$.get("/handle/stats/logevent.ashx?"+new Date().getTime(),{event:b,adid:(a==null?"":a),orgid:(c==null?"":c)},function(d){})},Err:function(a){if(testServerDebug){$("#devWarnings").html($("#devWarnings").html()+"<br/>"+a).slideDown(700);for(i=0;i<3;i++){$("#devWarnings").fadeTo("slow",0.1).fadeTo("slow",1)}}},Login:function(){$("#netPG").val(escape(window.location));$("#gologin").submit()},SelMLPTab:function(b,a){$("#mlp ul.tabs a").each(function(){$(this).removeClass("sel")});switch(b){case"mlpmakes":a.parent().css("height","33px");a.parent().next().css("height","32px");a.parent().next().next().css("height","32px");a.css("background-position","-230px -778px").next().css("background-position","-430px -778px");a.children("a").addClass("sel");a.parent().next().children("div[class='tabl']").css("background-position","-440px -778px").next().css("background-position","-450px -778px");a.parent().next().next().children("div[class='tabl']").css("background-position","-648px -778px").next().css("background-position","-849px -778px");break;case"mlploc":a.parent().prev().css("height","32px");a.parent().css("height","33px");a.parent().next().css("height","32px");a.parent().prev().children("div[class='tabl']").css("background-position","-649px -778px").next().css("background-position","-639px -778px");a.css("background-position","-230px -778px").next().css("background-position","-430px -778px");a.children("a").addClass("sel");a.parent().next().children("div[class='tabl']").css("background-position","-440px -778px").next().css("background-position","-849px -778px");break;case"mlppop":a.parent().prev().prev().css("height","32px");a.parent().prev().css("height","32px");a.parent().css("height","33px");a.parent().prev().prev().children("div[class='tabl']").css("background-position","-649px -778px").next().css("background-position","-849px -778px");a.parent().prev().children("div[class='tabl']").css("background-position","-649px -778px").next().css("background-position","-639px -778px");a.css("background-position","-230px -778px").next().css("background-position","-430px -778px");a.children("a").addClass("sel");break;default:}$("#mlp div.mlpcont").children().each(function(){$(this).addClass("dn")});$("."+b).toggleClass("dn")}};Enm.AdView={ShowSpecs:function(a){$(".tabls").removeClass("tabls").addClass("tabl");$(".tabrs").removeClass("tabrs").addClass("tabr");$("div","#"+a).each(function(){var b=$(this).attr("class");$(this).removeClass(b).addClass(b+"s")});$("ul.items li").each(function(){if($(this).hasClass(a+"i")||$(this).hasClass(a+"di")){$(this).removeClass("dn")}else{$(this).addClass("dn")}})}};Enm.Feature={FeaturePos:null,CurrentDiv:1,PreviewMode:false,Prep:function(){Enm.Feature.Show(0);var a="";for(var c=0;c<featureItems.features.length;c++){a+='<div pos="'+c+'"'+(c==0?' style="margin-left:0"':(c==(featureItems.features.length-1)?' style="margin-right:0"':""))+">"+featureItems.features[c].label+"</div>"}$("#ftur_mnu_itms").html(a);$("div",$("#ftur_mnu_itms")).first().addClass("ftur_mnu_sel");var d=parseInt((634/featureItems.features.length))-6;var e=(634-((d+4)*(featureItems.features.length))-4);var b=0;if(e%featureItems.features.length==0){d+=1;b=d}else{b=d+e}$("div",$("#ftur_mnu_itms")).click(function(){Enm.Feature.Show($(this).attr("pos"));$("div",$("#ftur_mnu_itms")).removeClass("ftur_mnu_sel");$(this).addClass("ftur_mnu_sel")}).width(d).first().css("width",b+"px");$("#ftur_cont1,#ftur_cont2").click(function(){var f=featureItems.features[Enm.Feature.FeaturePos];document.location=f.link+(Enm.Feature.PreviewMode?"?preview=true":"")})},Show:function(c){if(Enm.Feature.FeaturePos==null){Enm.Feature.FeaturePos=c;Enm.Feature.CurrentDiv=1;$("#ftur_cont"+Enm.Feature.CurrentDiv).hide().html($("<div/>").html(unescape(featureItems.features[c].html)).text()).show()}else{if(c!=Enm.Feature.FeaturePos){var b=(c<Enm.Feature.FeaturePos?"left":"right");Enm.Feature.FeaturePos=c;Enm.Feature.CurrentDiv=Enm.Feature.CurrentDiv==1?2:1;var a=Enm.Feature.CurrentDiv==1?2:1;$("#ftur_cont"+Enm.Feature.CurrentDiv).css("left",(b=="right"?"645px":"-645px")).hide().html($("<div/>").html(unescape(featureItems.features[c].html)).text()).show().animate({left:0},600);$("#ftur_cont"+a).animate({left:(b=="right"?"-645px":"645px")},600)}}}};Enm.Recent={RL:null,Prep:function(a){$("#rcntsrchi").width($("#rcntsrch").width()-40);$.ajax({contentType:"application/json; charset=utf-8",dataType:"json",type:"GET",async:true,cache:false,timeout:30000,url:"../Handle/Search/RecentSearchResults.ashx",data:{surl:a},beforeSend:function(){$("#rcntloading").show()},complete:function(){$("#rcntloading").hide()},success:function(e){$("#rcntsrchi h3").html(e.Title);Enm.Recent.RL=e.Items;var d=Math.floor($("#rcntsrchi").width()/163);var c=Enm.Recent.RL.length<d?Enm.Recent.RL.length:d;for(var b=0;b<c;b++){if($("#rcntsrchi li").length==0){$("#rcntsrchi ul").html(Enm.Recent.BuildListItem(Enm.Recent.RL[b],d))}else{$("#rcntsrchi li:last").after(Enm.Recent.BuildListItem(Enm.Recent.RL[b],d))}}$("#rcntsrchi li").width($("#rcntsrchi").width()/d);if(Enm.Recent.RL.length>d){$("#rcntsrchla, #rcntsrchra").show()
}},error:function(d,b,c){alert(b+": "+d.status+" "+d.statusText)}})},BuildListItem:function(a,b){return'<li style="width:'+b+'px"><div><a href="'+a.Url+'"><img src="'+a.Img+'" alt="'+a.Desc+'" /></a></div><a href="'+a.Url+'">'+a.Desc+"</a></li>"},ScrollRecent:function(a){if(Enm.Recent.RL){if(a){$("#rcntsrchi li:first").remove();$("#rcntsrchi li:last").after(Enm.Recent.GetItem(true,$("#rcntsrchi li:last").children("a").attr("href")))}else{$("#rcntsrchi li:last").remove();$("#rcntsrchi li:first").before(Enm.Recent.GetItem(false,$("#rcntsrchi li:first").children("a").attr("href")))}}},GetItem:function(b,d){var c="";for(var a in Enm.Recent.RL){if(Enm.Recent.RL[a].Url==d){var e=0;if(b){e=parseInt(a)==(Enm.Recent.RL.length-1)?0:parseInt(a)+1}else{e=parseInt(a)==0?(Enm.Recent.RL.length-1):parseInt(a)-1}c=Enm.Recent.BuildListItem(Enm.Recent.RL[e],$("#rcntsrchi").width()/(Math.floor($("#rcntsrchi").width()/163)))}}return c}};Enm.Google={BuildMapByAdId:function(c,b){$("#goomap").html("");var a='<iframe id="mapif" src="'+c+"/google/GooMap.aspx?adid="+b+'" frameBorder="0" style="height:650px;margin:0;padding:0;width:100%"></iframe>';$("#goomap").html(a)},BuildMapByOrgId:function(b,c){$("#goomap").html("");var a='<iframe id="mapif" src="'+b+"/google/GooMap.aspx?orgid="+c+'" frameBorder="0" style="height:650px;margin:0;padding:0;width:100%"></iframe>';$("#goomap").html(a)}};function doDealerMail(g){var m=0,j="",d=$("#edFromName").val(),f=$("#edFromEmail").val(),e=$("#edPhone").val(),h=$("#edAltPhone").val(),l=$("#edComment").val(),c=$("#edContactTime").val();if(d==""){$("#spa_d_fromname").html("Please enter your name.");m++}else{$("#spa_d_fromname").html("")}if((f.length==0)||(!checkemailnd(f))){$("#spa_d_fromemail").html(sErrEmail);m++}else{$("#spa_d_fromemail").html("")}if(e.length!=0){if((e.length>12)||(e.length<10)){$("#spa_phone").html("The telephone "+sTelInvalidUK);m++}else{if(!checkphone(e)){$("#spa_phone").html("The telephone "+sTelInvalidUK);m++}else{$("#spa_phone").html("")}}}else{$("#spa_phone").html("")}if(l==""){$("#spa_d_c").html("Please enter a message.");m++}else{$("#spa_d_c").html("")}var a=new Fetcher(true);if(m==0){$("#spa_d_form,#spa_d_button").hide();$("#spa_d_success").html("Sending...");var b="/handle/sendemail.ashx?";j=a.now(b+"type=dealer&orgid="+sOrgID+"&adid="+sAdID+"&f1="+escape(d)+"&f2="+escape(f)+"&f3="+escape(e)+"&f4="+escape(h)+"&f5="+escape(c)+"&c="+escape(l)+(g?"&dp=1":""));if(j!=""){if(j.indexOf("RespEx")==0){udAdVwStats("ESL");omniClick(document.getElementById("spa_d_button"),"products,events","event5","Email Dealer");var k=jQuery.parseJSON(j.replace("RespEx:",""));if(k.length>0){$("#msk").click();prepMPS();setupResponseExchange(k,sAdID,d,f,e);$("a[id=aResponseExchange]").click()}}else{$("#spa_d_success").html(j);if(j.indexOf("Your message has been sent")==-1){omniEmailBlocked(document.getElementById("spa_d_button"),j);$("#spa_d_form,#spa_d_button").hide()}else{udAdVwStats("ESL");omniClick(document.getElementById("spa_d_button"),"products,events","event5","Email Dealer")}}}}else{$("#spa_d_success").html(j)}return false}function doRequestCallback(m,b,e,h){var k=0,f=$("#cmbfromemail").val(),p=$("#cmbfn").val(),c=$("#cmbsn").val(),j=m,l=b,g=e,s=$("#cmbphone").val(),d=$("#cmbaltphone").val(),r=$("#cmbcontacttime").val(),a=$("#cmbcomment").val(),q="";if(p.length<=1){$("#spa_cmbfn").html("Your firstname should comprise at least 2 characters.");k++}else{$("#spa_cmbfn").html("")}if(c.length<=1){$("#spa_cmbsn").html("Your surname should comprise at least 2 characters.");k++}else{$("#spa_cmbsn").html("")}if((f.length==0)||(!checkemailnd(f))){$("#spa_cmbfromemail").html(sErrEmail);k++}else{$("#spa_cmbfromemail").html("")}if(s.length==0){$("#spa_cmbphone").html("Please enter a valid phone number");k++}else{if(s.length!=0){if((s.length>12)||(s.length<10)){$("#spa_cmbphone").html("The telephone "+sTelInvalidUK);k++}else{if(!checkphone(s)){$("#spa_cmbphone").html("The telephone "+sTelInvalidUK);k++}else{$("#spa_cmbphone").html("")}}}else{$("#spa_cmbphone").html("")}}if(d.length!=0){if((d.length>12)||(d.length<10)){$("#spa_cmbaltphone").html("The alternate telephone "+sTelInvalidUK);k++}else{if(!checkphone(d)){$("#spa_cmbaltphone").html("The alternate telephone "+sTelInvalidUK);k++}else{$("#spa_cmbaltphone").html("")}}}else{$("#spa_cmbaltphone").html("")}if(r.length<=1){$("#spa_cmbcontacttime").html("Please let the dealer know the best time to contact you");k++}else{$("#spa_cmbcontacttime").html("")}var n=new Fetcher(true);if(k==0){q=n.now("/validation/getemail.asp?f1="+f+"&f2=editprofile");if(q!=""){$("#spa_d_fromemail").html(q);k++}else{$("#spa_d_fromemail").html("")}}if((k==0)&&(p!="")){q=n.now(sBWVAL+p);if(q!=""){$("#spa_fn").html(q);k++}else{$("#spa_fn").html("")}}if((k==0)&&(c!="")){q=n.now(sBWVAL+c);if(q!=""){$("#spa_sn").html(q);k++}else{$("#spa_sn").html("")}}if((k==0)&&(r!="")){q=n.now(sBWVAL+r);if(q!=""){$("#spa_cmbcontacttime").html(q);k++}else{$("#spa_cmbcontacttime").html("")}}if(k==0){$("#spa_cmb_form,#spa_cmb_button").hide();$("#spa_cmb_success").html("Sending...");var o="/handle/sendemail.ashx?";q=n.now(o+"type=callback&adid="+h+"&orgid="+escape(l)+"&ncvehid="+escape(j)+"&ncfranchiseid="+escape(g)+"&email="+escape(f)+"&fn="+escape(p)+"&sn="+escape(c)+"&phone="+escape(s)+"&altphone="+escape(d)+"&ct="+escape(r)+"&c="+escape(a));if(q!=""){$("#spa_cmb_success").html(q)}}else{$("#spa_cmb_success").html(q)}return false}var sBWVAL="/validation/getbadwords.asp?txt=",sErrEmail="The email address you have entered is not valid.",sPostCodeNotFound="The postcode you have provided cannot be found.",sTelInvalidUK="number you have provided doesn't appear to be a valid UK geographic number.";function EmailSeller(){document.getElementById("emailPrivSellerTop").style.display="inline";document.getElementById("emailPrivSellerAdvice").style.display="none"}function setupResponseExchange(c){if(c.length>0){var b=$("#respx");if(b!=null){for(var a=0;a<c.length;a++){b.append('<div style="margin:2px 0"><div class="cbTick" style="margin-right:6px"></div><p id="'+c[a].OrgID+'">'+c[a].OrgName+"</p></div>")}}}}function doResponseExchangeMail(){var e=$("#edFromName").val(),c=$("#edFromEmail").val(),a=$("#edPhone").val(),d=[];$("#respx > div > p").each(function(){d.push(this.id)});var b=new Fetcher(true);sResp=b.now("/handle/sendemail.ashx?type=responseexchange&dealers="+d.join("|")+"&adid="+sAdID+"&name="+e+"&email="+c+"&phone="+a);$("#msk").click()}function doSupportMail(){var j=0,a=$("#rta_whyReport").val(),d=$("#rta_fromname").val(),g=$("#rta_fromemail").val(),h="";try{if(d==""){$("#rta_e_fromname").html("Please enter your name.");j++}else{$("#rta_e_fromname").html("&nbsp;")}if((g.length==0)||(!checkemailnd(g))){$("#rta_e_fromemail").html(sErrEmail);j++}else{$("#rta_e_fromemail").html("&nbsp;")}if(a==""){$("#rta_e_whyReport").html("Please enter a message.");j++}else{$("#rta_e_whyReport").html("&nbsp;")}if(j==0){$("#rta_button").hide();var e="Ad Title: "+escape(sAdHeading)+"\r\n";e+="Adid: "+sAdID+"\r\n";e+="Reported By: "+d+"\r\n";e+="User's email: "+g+"\r\n\r\n";e+="Reason for reporting: "+a;var b=new Fetcher(true),c="/handle/sendemail.ashx?";h=b.now(c+"type=support&email="+escape(g)+"&message="+escape(e));if(h!=""){if(h.indexOf("Your message has been sent")==0){$("#reportThisAdMain").hide();$("#reportThisAdThx").show()}}}}catch(f){alert(f.description)}return false}function showtf(){$("#tf").slideDown();$("html,body").animate({scrollTop:$("#tf").offset().top},"slow")}function hidetf(){$("#tf").style.display="none"}function doFriendMail(){var f=0,d="",h=$("#tfFromName").val(),b=$("#tfFromEmail").val(),e=$("#tfEmail").val(),a=$("#tfComment").val();if(h==""){$("#spa_fromname").html("Please enter your name.");f++}else{$("#spa_fromname").html("&nbsp;")}if((b.length==0)||(!checkemailnd(b))){$("#spa_fromemail").html(sErrEmail);f++}else{$("#spa_fromemail").html("&nbsp;")}if((e.length==0)||(!checkemailnd(e))){$("#spa_email").html("The friend's email address you have entered is not valid. Please check and try again.");
f++}else{$("#spa_email").html("&nbsp;")}if(a==""){$("#spa_c").html("Please enter a message.");f++}else{$("#spa_c").html("&nbsp;")}if($("#recaptcha_response_field").val()==""){d="Please enter the two security words";f++}if(f==0){$("#spa_form,#spa_button,#captcha").hide();$("#spa_success").html("Sending...");var g=$("#recaptcha_challenge_field").val();var c=$("#recaptcha_response_field").val();$.ajax({type:"GET",url:"/handle/sendemail.ashx",data:{type:"tellfriend",adid:sAdID,f1:escape(h),f2:escape(b),f3:escape(e),c:escape(encode(a)),rc:g,rr:c},success:function(j){d=j;if(d!=""){$("#spa_success").html(d);if(d.indexOf("Invalid Captcha Response")>=0){$("#spa_form,#spa_button,#captcha").show();Recaptcha.reload()}else{if(d.indexOf("Your message has been sent")==-1){omniEmailBlocked(document.getElementById("spa_button"),d);$("#spa_form,#spa_button").hide()}else{$("#spa_success").html(d);udAdVwStats("TLF");omniClick(document.getElementById("spa_button"),"products,events","event11","Tell A Friend");bValid=true}}}},async:false})}else{$("#spa_success").html(d);Recaptcha.reload()}}function doDealerTestDrive(a,C,r,o,y,u,l,c,d){var k=0,j=$("#tdfromemail").val(),t=$("#tdfn").val(),e=$("#tdsn").val(),q=$("#"+C).val(),B=$("#"+r).val(),A=$("#"+o).val(),b=$("#"+y).val(),s=$("#"+u).val(),h=$("#"+a).val().trim(),g=l,x=c,m=d,f=$("#tdphone").val(),w=$("#tdaltphone").val(),z=$("#tdcomment").val(),v="";if(t.length<=1){$("#spa_tdfn").html("Your firstname should comprise at least 2 characters.");k++}else{$("#spa_tdfn").html("")}if(e.length<=1){$("#spa_tdsn").html("Your surname should comprise at least 2 characters.");k++}else{$("#spa_tdsn").html("")}if((j.length==0)||(!checkemailnd(j))){$("#spa_tdfromemail").html(sErrEmail);k++}else{$("#spa_tdfromemail").html("")}if(f.length!=0){if((f.length>12)||(f.length<10)){$("#spa_tdphone").html("The telephone "+sTelInvalidUK);k++}else{if(!checkphone(f)){$("#spa_tdphone").html("The telephone "+sTelInvalidUK);k++}else{$("#spa_tdphone").html("")}}}else{$("#spa_tdphone").html("")}if(w.length!=0){if((w.length>12)||(w.length<10)){$("#spa_tdaltphone").html("The alternate telephone "+sTelInvalidUK);k++}else{if(!checkphone(w)){$("#spa_tdaltphone").html("The alternate telephone "+sTelInvalidUK);k++}else{$("#spa_tdaltphone").html("")}}}else{$("#spa_tdaltphone").html("")}if(h.length<5){$("#spa_pc").html("Please use a full postcode.");k++}else{$("#spa_pc").html("");if(!checkpostcodend(h)){$("#spa_pc").html("The postcode you have provided cannot be found.");k++}else{$("#spa_pc").html("")}}var n=new Fetcher(true);if(k==0){v=n.now("/validation/getemail.asp?f1="+j+"&f2=editprofile");if(v!=""){$("#spa_d_fromemail").html(v);k++}else{$("#spa_d_fromemail").html("")}}if(k==0){v=n.now("/validation/getpostcode.asp?f1="+h);if(v!=""){$("#spa_pc").html(v);k++}else{$("#spa_pc").html("")}}if((k==0)&&(t!="")){v=n.now(sBWVAL+t);if(v!=""){$("#spa_fn").html(v);k++}else{$("#spa_fn").html("")}}if((k==0)&&(e!="")){v=n.now(sBWVAL+e);if(v!=""){$("#spa_sn").html(v);k++}else{$("#spa_sn").html("")}}if((k==0)&&(B!="")){v=n.now(sBWVAL+B);if(v!=""){$("#spa_address1").html(v);k++}else{$("#spa_address1").html("")}}if((k==0)&&(A!="")){v=n.now(sBWVAL+A);if(v!=""){$("#spa_address2").html(v);k++}else{$("#spa_address2").html("")}}else{$("#spa_address2").html("")}if((k==0)&&(b!="")){v=n.now(sBWVAL+b);if(v!=""){$("#spa_town").html(v);k++}else{$("#spa_town").html("")}}if((k==0)&&(s!="")){v=n.now(sBWVAL+s);if(v!=""){$("#spa_county").html(v);k++}else{$("#spa_county").html("")}}else{$("#spa_county").html("")}if(k==0){$("#spa_td_form,#spa_td_button").hide();$("#spa_td_success").html("Sending...");var p="/handle/sendemail.ashx?";v=n.now(p+"type=testdrive&orgid="+escape(x)+"&adid="+sAdID+"&fn="+escape(t)+"&sn="+escape(e)+"&hs="+escape(q)+"&a1="+escape(B)+"&a2="+escape(A)+"&town="+escape(b)+"&county="+escape(s)+"&pc="+escape(h)+"&email="+escape(j)+"&phone="+escape(f)+"&altphone="+escape(w)+"&c="+escape(z)+"&ncvehid="+escape(g)+"&ncfranchiseid="+escape(m));if(v!=""){$("#spa_td_success").html(v);if(v.indexOf("Your message has been sent.")>=0){if(typeof NewCar!="undefined"&&NewCar==false){udAdVwStats("RTD")}omniClick(document.getElementById("spa_td_button"),"products,events","event4","Arrange Test Drive")}else{omniEmailBlocked(document.getElementById("spa_td_button"),v)}}}else{$("#spa_td_success").html(v)}return false}function updateShortList(){var a=document.URL,b;if(a.indexOf("used-motorbikes-for-sale")>=0){b=21}else{if(a.indexOf("used-vans-for-sale")>=0){b=25}else{if(a.indexOf("used-caravans-for-sale")>=0){b=26}else{if(a.indexOf("used-parts-for-sale")>=0){b=64}else{if(a.indexOf("items-for-sale")>=0){b=67}else{if(a.indexOf("wanted-items")>=0){b=671}else{if(a.indexOf("giveaway-items")>=0){b=672}else{b=20}}}}}}}$.post("/handle/Shortlist/GetSL.ashx",{start:((currPage*recSize)-(recSize-1)),adTypeID:b},function(e){var h=jQuery.parseJSON(e);if(h!=null&&h.noOfAds>0){var j=h.noOfAds,d=h.maxPages,c=h.currentPage;if(c==1){$(".slPre").css("visibility","hidden")}else{$(".slPre").css("visibility","visible")}if(c==d){$(".slNxt").css("visibility","hidden")}else{$(".slNxt").css("visibility","visible")}$("#noitems").hide();$(".slNav,#allsl").show();$(".slSummary").each(function(){$(this).html(j+" ads shortlisted. Now viewing "+((c*recSize)-(recSize-1))+" - "+((c*recSize)>j?j:(c*recSize)))});var f=0;var g='<img src="%IMGURL%"/><p style="font-size:11px"><a href="%LINK%">%HEADING%</a>- <a href="javascript:removeShortlist(%ADID%);" class="emph">remove</a></p>';$(".slitem").each(function(){if(h.items[f]!=null){$(this).html(g.replace("%IMGURL%",h.items[f].img).replace("%HEADING%",h.items[f].hd).replace("%ADID%",h.items[f].adid).replace("£","&pound;").replace("%LINK%",h.items[f].lnk));$(this).attr("id","sl"+h.items[f].indx+"-"+h.items[f].adid)}else{$(this).attr("id","");$(this).html("")}f++})}else{$("#noitems").show();$("#noitems").html("Your shortlist contains no items.");$(".slNav,#allsl").hide()}})}function prepareSL(){$("#content").css("position","static");$("#slmsk").click(function(){showSL()});$(".slPre").click(function(){if(currPage!=1){currPage=currPage-1;updateShortList()}});$(".slNxt").click(function(){if(currPage<maxPage){currPage=currPage+1;updateShortList()}})}function getSim(a){if(a!=null){simPg=simPg+(a=="N"?1:a=="P"?-1:0)}$(".simCar").html("loading...");$("#simN,#simP").hide();$.post("/handle/Similar/GetSimilar.ashx",{start:0,backURL:simBack,page:simPg,adid:simAdID},function(b){var e='<a href="%URL%" onclick="udAdVwStats(\'SIM\');">%IMG% %HEADING%</a>';var d=jQuery.parseJSON(b);var c=0;if(d.length>0){$(".simCar").each(function(){if(d[c]!=null){var f='<img src="'+(d[c].img==null?"http://www.exchangeandmart.co.uk/img/awaitingimage_120.gif":"http://images.exchangeandmart.co.uk/images/mmo/"+d[c].img)+'"'+(d[c].img==null?"":'alt="'+d[c].hd+'"')+" />";$(this).html(e.replace("%ADID%",d[c].adid).replace("%HEADING%",d[c].hd).replace("%IMG%",f).replace("%URL%",d[c].lnk))}else{$(this).hide()}c++});if(simPg>1){$("#simP").show()}if(d.length==6){$("#simN").show()}}else{if(simPg>1){$("#simP").show();$(".simCar").html("")}else{$("#simCarCont").slideUp()}}})}function closeShareTglCd(){if($("#shShowCode").hasClass("sh_sc27")){$("#shShowCode").attr("class","sh_hc27");$("#shShowText").html("HIDE THE CODE");$("#shrThisAdCode").slideDown(400)}else{$("#shShowCode").attr("class","sh_sc27");$("#shShowText").html("SHOW THE CODE");$("#shrThisAdCode").slideUp(400)}}function showSL(){if(!shown){updateShortList();if(currPage==1){$(".slPre").css("visibility","hidden")}$("#shortlist").slideDown(500);$("#slbtn").css("background-position","-604px -580px");var a=$(document).height();var b=$(window).width();$("#slmsk").fadeTo(100,0.3)}else{$("#shortlist").slideUp(250);$("#slbtn").css("background-position","-580px -580px");$("#slmsk").hide()}shown=!shown}function shwDetls(a){if(a!=curDetails){$("#dtlsHrdGWO a").each(function(){$("#"+this.id).css("border-bottom","solid 1px #ADB9BA")});$("#detailsGWO").html($("#detHid"+a).html());$("#detailsLnk"+a).css("border-bottom","solid 1px transparent");
curDetails=a}$("#container1_2").css("top",$("#container1_1").height()+4)}function udAdVwStats(a){if(iAdTyp==20&&bLogStats){$.get("/Handle/AdStats/LogAdCompletion.ashx?"+new Date().getTime(),{AdVwID:AdViewID,AdVwAction:(a==null?"":a)},function(b){})}}window.fbAsyncInit=function(){FB.init({appId:"224053847651759",status:true,cookie:true,xfbml:true,oauth:true});FB.getLoginStatus(function(a){if(a.status==="connected"){var c=a.authResponse.userID;var b=a.authResponse.accessToken;FB.logout()}});FB.Event.subscribe("auth.login",function(a){window.location="/facebook/facebookauth.aspx?code="+a.authResponse.accessToken})};$(document).ready(function(){var a,c="facebook-jssdk",b=document;if(b.getElementById(c)){return}a=b.createElement("script");a.id=c;a.async=true;a.src="//connect.facebook.net/en_US/all.js";b.getElementsByTagName("head")[0].appendChild(a)});
