var xmlHttp;function GetXmlHttp(){var b=null;try{b=new XMLHttpRequest()}catch(a){try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){b=new ActiveXObject("Microsoft.XMLHTTP")}}if(b==null){alert("Browser does not support HTTP Request");return}else{return b}}$(document).ready(function(){$("a[rel*=facebox]").facebox({loadingImage:"/scripts/facebox/loading.gif",closeImage:"/scripts/facebox/closelabel.gif"});ini_help_tip();$(".large_img_preview").wTooltip({follow:false,offsetX:50,offsetY:-80,delay:750})});function ini_help_tip(){$(".help_tip").wTooltip({className:"toolTipStyle",follow:false})}function getElementsByClassName(b,e,c){var g=(e=="*"&&b.all)?b.all:b.getElementsByTagName(e);var a=new Array();c=c.replace(/\-/g,"\\-");var f=new RegExp("(^|\\s)"+c+"(\\s|$)");var j;for(var h=0;h<g.length;h++){j=g[h];if(f.test(j.className)){a.push(j)}}return(a)}function hover(a){document.getElementById("product_list_info_"+a).className="product_list_info_hover";document.getElementById("product_list_addtobasket_"+a).className="product_list_addtobasket_hover";document.getElementById("product_list_image_"+a).className="product_list_image_hover"}function unhover(a){document.getElementById("product_list_info_"+a).className="product_list_info";document.getElementById("product_list_addtobasket_"+a).className="product_list_addtobasket";document.getElementById("product_list_image_"+a).className="product_list_image"}function basketBlink(){document.getElementById("basketSelect").className="basketListBlink";setTimeout("document.getElementById('basketSelect').className = 'basketList'",250);setTimeout("document.getElementById('basketSelect').className = 'basketListBlink'",500);setTimeout("document.getElementById('basketSelect').className = 'basketList'",750);setTimeout("document.getElementById('basketSelect').className = 'basketListBlink'",1000);setTimeout("document.getElementById('basketSelect').className = 'basketList'",1250)}function get_tire(a){target_td=document.getElementById("tire_select_td_"+a);var b="scripts/ajax_get_tire.php?td="+a;xmlhttp=GetXmlHttp();xmlhttp.open("POST",b);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){target_td.innerHTML=xmlhttp.responseText;document.getElementById("product_list_gettyre_btn_"+a).style.display="none";document.getElementById("product_list_info_btn_"+a).style.display="inline"}};xmlhttp.send(null)}function fromFlash(a){switch(a){case"dalarna":index=0;outLan="DALARNA";break;case"halland":outLan="HALLAND";break;case"jamtland":outLan="J%C4MTLAND";break;case"medelpad":outLan="MEDELPAD";break;case"narke":outLan="N?RKE";break;case"skane":outLan="SKANE";break;case"smaland":outLan="SMALAND";break;case"stockholm":outLan="STOCKHOLM";break;case"sodermanland":outLan="S?DERMANLAND";break;case"uppland":outLan="UPPLAND";break;case"varmland":outLan="V?RMLAND";break;case"vasterbotten":outLan="V?STERBOTTEN";break;case"vaster_gotaland":outLan="V?STRA+G?TALAND";break;case"ostergotaland":outLan="?STERG?TLAND";break}document.getElementById("areaSelect").value=outLan;getCities(2,outLan)}function switch_product_image(a){document.getElementById("product_image").style.background="no-repeat bottom right url("+a+")";document.getElementById("large_price").style.display="none"}function select_tyre(b,a){var e=getElementsByClassName(document,"tr","tyre_row");for(var c=0;c<e.length;c++){e[c].style.backgroundColor="#ffffff"}document.getElementById("tyre_row_"+b).style.backgroundColor="#e9f0f4";document.getElementById("product_list_basket_btn_"+a).style.display="inline"}function submitLargeSearch(a){var b=document.forms.carForm.elements.carId.options[document.forms.carForm.elements.carId.selectedIndex].value;var f=document.forms.search;var e=0;if(document.forms.regNoForm!=undefined){var c=document.forms.regNoForm.elements.regNo1.value+""+document.forms.regNoForm.elements.regNo2.value;if(c.length==6&&c!="ABC123"){e=1;location.href="/scripts/getCarIdByRegNo.php?regNo="+c+"&pageId="+a}}if(b!=""&&e==0){f.elements.carId.value=b;f.elements.page.value=a;f.submit()}else{if(e==0){location.href="?page="+a}}}function openWin(c,b,a){window.open(c,c,"location=no,status=yes,scrollbars=yes,width="+b+",height="+a)}function getElement(b){var a;if(document.getElementById){a=document.getElementById(b)}else{if(document.all){a=document.all[b]}else{if(document.layers){a=document.layers[b]}}}return a}function showBasketSign(){$.fn.colorbox({width:"450px",inline:true,href:"#basketSign",open:true})}function hideBasketSign(){$.fn.colorbox.close()}function showQuantityErrorSign(){document.getElementById("quantityErrorSign").style.display="block"}function hideQuantityErrorSign(){document.getElementById("quantityErrorSign").style.display="none"}function showSection(a){el=getElement(a);if(el.style.display=="block"){el.style.display="none"}else{el.style.display="block"}}function manualSearch(a){el=document.getElementById("reg-box2");if(el.style.display=="block"){el.style.display="none";document.getElementById(a).style.height="45px"}else{el.style.display="block";document.getElementById(a).style.height="105px";if(a=="reg-search-start"){showStep2("manual")}}}function showStep2(a){if(a=="manual"){d=document.getElementById("search_box_2");d.style.display="block"}else{if(a.value.length==3){d=document.getElementById("search_box_2");d.style.display="block"}else{return true}}}function submitCarSearch(a,b,e,c){if(a=="folkdacket"){a="80&campaign=folkdacket"}else{if(a=="suv_0810_kompl"){a="121&campaign="+a}else{if(a=="sep_08_kompl"){a="121&campaign="+a}}}if(e.length==6&&e!="ABC123"){location.href="/scripts/getCarIdByRegNo.php?pageId="+a+"®No="+e}else{if(b!=""){location.href="?page="+a+"&carId="+b}else{alert(c)}}}function enterPressRegNo(f,g,c,a,e){var b=(e.which)?e.which:event.keyCode;if(b==13){submitCarSearch(f,g,c,a)}else{return true}}function regSearch(){var e=document.forms.box_reg_search_form.elements.regNo1.value+""+document.forms.box_reg_search_form.elements.regNo2.value;var f=document.forms.box_reg_search_form.elements.toPage.value;var a=document.forms.box_reg_search_form.elements.referer!=undefined?document.forms.box_reg_search_form.elements.referer.value:null;var c=document.forms.box_reg_search_form.elements.additional!=undefined?document.forms.box_reg_search_form.elements.additional.value:null;var b=document.forms.box_reg_search_form.elements.michelinwinter!=undefined?document.forms.box_reg_search_form.elements.michelinwinter.value:null;var g=document.forms.box_reg_search_form.elements.showFamily!=undefined?document.forms.box_reg_search_form.elements.showFamily.value:null;if(e.length==6&&e!="ABC123"){regNoActive=1;location.href="/scripts/getCarIdByRegNo.php?reg-no="+e+"&page-id="+f+"&referer="+a+(c!=null?"&additional="+c:"")+(b!=null?"&michelinwinter="+b:"")+(g!=null?"&show-family="+g:"")}}function enterPressRegSearch(a){var b=(a.which)?a.which:a.keyCode;if(b==13){regSearch()}else{return true}}function enterPressBargainBoxRegNo(a){var b=(a.which)?a.which:a.keyCode;if(b==13){updateBargainBoxCarBox(document.getElementById("RegNoInput").value)}else{return true}}function enterPressBargainBoxRegNo2(a){var b=(a.which)?a.which:a.keyCode;if(b==13){updateBargainBoxCarBox(document.box_reg_search_form.new_box_reg1_inp.value+document.box_reg_search_form.new_box_reg2_inp.value)}else{return true}}function updateManualCarSearchSelect(c,e,a,f){getString="ajaxRequest="+c+"Options&make="+e;if(a!=undefined){getString+="&model="+a}if(f!=undefined){getString+="&year="+f}var b="scripts/getCarData.php?"+getString;xmlhttp=GetXmlHttp();xmlhttp.open("POST",b);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){document.box_carchooser_form[c].options.length=0;var g=xmlhttp.responseText.split("|||");counter=0;for(i=0;i<g.length;i=i+2){document.box_carchooser_form[c].options[counter]=new Option(g[i+1],g[i]);counter++}}};xmlhttp.send(null)}function changeTyreSurface(a){if(a==1||a==2){document.getElementById("tyre_surface").value=a}else{document.getElementById("tyre_surface").value=""}}function changeTyreSurfaceUE(a){if(a==1){document.getElementById("tyre_surface").value=2;document.getElementById("type-friction").value=2}else{document.getElementById("tyre_surface").value="";document.getElementById("type-friction").value=""}}function switch_display(a,b){document.getElementById(a).style.display="block";document.getElementById(b).style.display="none"}function ShowHideDiv(a){var b=document.getElementById(a).style;if(b.display=="none"||b.display==undefined){b.display="block"}else{b.display="none"}}function updateBargainBoxCarBox(c){GetString="ajaxRequest=GetCarDataByRegNo&RegNo="+c;var e=document.getElementById("bargain_ajax_feedback");var a=document.getElementById("bargain_ajax_feedback2");var b="scripts/getCarData.php?"+GetString;if(c.length==6){xmlhttp=GetXmlHttp();xmlhttp.open("POST",b);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4&&xmlhttp.status==200){var h=xmlhttp.responseText.split("|||");var g=h[0];var j=h[1];if(g==0){var f=document.box_reg_search_form.ProductCategory.value;if(f!="All"){j=j+"&ProductCategory="+f}location.href=""+j+"";e.style.display="none"}else{e.style.display="none";a.style.display="block";a.innerHTML="<p>"+j+"</p>";document.getElementById("bargain_search_box2_inner").style.display="none";document.getElementById("bargain_search_box2b_inner").style.display="block";bargain_search_box2b_inner_height=parseInt(document.getElementById("bargain_search_box2b_inner").offsetHeight)-2;bargain_search_box2_height=parseInt(document.getElementById("bargain_search_box2").offsetHeight);document.getElementById("bargain_search_box2b_inner").style.height=bargain_search_box2b_inner_height+a.offsetHeight+"px";document.getElementById("bargain_search_box2").style.height=bargain_search_box2_height+a.offsetHeight+"px"}}else{e.style.display="block";e.innerHTML="<img src='/graphic/ajaxloader.gif' />"}};xmlhttp.send(null)}else{document.getElementById("RegNoInput").style.backgroundColor="#ffdddd";document.getElementById("RegNoInput").focus()}}function submitBargainsTyreSizeSearch(){frm=document.TyreSizeForm;TyreWidth=frm.TyreWidth.options[frm.TyreWidth.selectedIndex].value;TyreProfile=frm.TyreProfile.options[frm.TyreProfile.selectedIndex].value;WheelHeight=frm.WheelHeight.options[frm.WheelHeight.selectedIndex].value;ProductCategory=document.box_reg_search_form.ProductCategory.value;newUrl="?page=134&ProductCategory="+ProductCategory+"&TyreWidth="+TyreWidth+"&TyreProfile="+TyreProfile+"&WheelHeight="+WheelHeight;location.href=newUrl}function switch_bargain_reg_advanced(){if(document.getElementById("bargain_search_box2c_inner").style.display=="none"){document.getElementById("bargain_search_box2_inner").style.display="none";document.getElementById("bargain_search_box2b_inner").style.display="none";document.getElementById("bargain_search_box2c_inner").style.display="block";document.getElementById("bargain_reg_advanced_switch").innerHTML=document.getElementById("bargain_link_text_holder2").innerHTML;if(bargain_search_box2_height){document.getElementById("bargain_search_box2").style.height=bargain_search_box2_height+"px";document.getElementById("bargain_search_box2b_inner").style.height=bargain_search_box2b_inner_height+"px"}}else{document.getElementById("bargain_search_box2_inner").style.display="block";document.getElementById("bargain_search_box2c_inner").style.display="none";document.getElementById("bargain_reg_advanced_switch").innerHTML=document.getElementById("bargain_link_text_holder1").innerHTML}}function switch_bargain_reg_manual(){if(document.getElementById("bargain_search_box2b_inner").style.display=="none"){document.getElementById("bargain_search_box2_inner").style.display="none";document.getElementById("bargain_search_box2c_inner").style.display="none";document.getElementById("bargain_search_box2b_inner").style.display="block";if(bargain_search_box2_height){document.getElementById("bargain_search_box2").style.height=bargain_search_box2_height+"px";document.getElementById("bargain_search_box2b_inner").style.height=bargain_search_box2b_inner_height+"px";document.getElementById("bargain_ajax_feedback2").style.display="none"}}else{document.getElementById("bargain_search_box2_inner").style.display="block";document.getElementById("bargain_search_box2b_inner").style.display="none";if(bargain_search_box2_height){document.getElementById("bargain_search_box2").style.height=bargain_search_box2_height+"px";document.getElementById("bargain_search_box2b_inner").style.height=bargain_search_box2b_inner_height+"px";document.getElementById("bargain_ajax_feedback2").style.display="none"}}}function LoadCornerBox(){$(".CornerBox").corner({radio:30,borderSize:2})};
