var flyingSpeed=25;var basket_div=false;var flyingDiv=false;var currentProductDiv=false;var basket_x=false;var basket_y=false;var slide_xFactor=false;var slide_yFactor=false;var diffX=false;var diffY=false;var currentXPos=false;var currentYPos=false;var ajaxObjects=new Array();function shoppingCart_getTopPos(a){var b=a.offsetTop;while((a=a.offsetParent)!=null){if(a.tagName!="HTML"){b+=a.offsetTop}}return b}function shoppingCart_getLeftPos(a){var b=a.offsetLeft;while((a=a.offsetParent)!=null){if(a.tagName!="HTML"){b+=a.offsetLeft}}return b}function addToBasket2(b,d,n,m){try{if(typeof _gaq!="undefined"&&typeof _gaq.push!="undefined"){_gaq.push(["_trackEvent","Product",productName,"Buy button"])}}catch(h){}var k="";$("#alert").empty();if((d==false)||(d=="false")||(d=="false")){var q=document.getElementById("variantGroups");if(q!=null){var g=q.getElementsByTagName("select");var l=new Array();for(var f=0;f<g.length;f++){var a=document.getElementsByName(g[f].name);for(var c=0;c<a.length;c++){var p=a.item(c);var o=g[f].name;if(p.value=="0"){k+="Du m&#229; velge "+g[f].name+"<br />"}}}}}if(k!=""){$("#ex4Trigger").removeClass("hide");$("#alert").append(k)}else{$("#ex4Trigger").addClass("hide");$("#alertContainer").jqmAddClose($("#ex4Trigger"));if(!basket_div){basket_div=document.getElementById("basket")}if(!flyingDiv){flyingDiv=document.createElement("DIV");flyingDiv.style.position="absolute";document.body.appendChild(flyingDiv)}basket_x=shoppingCart_getLeftPos(basket_div);basket_y=shoppingCart_getTopPos(basket_div);currentProductDiv=document.getElementById("slidingProduct"+b);currentXPos=shoppingCart_getLeftPos(currentProductDiv);currentYPos=shoppingCart_getTopPos(currentProductDiv);diffX=basket_x-currentXPos;diffY=basket_y-currentYPos;var e=currentProductDiv.cloneNode(true);e.id="";flyingDiv.innerHTML="";flyingDiv.style.left=currentXPos+"px";flyingDiv.style.top=currentYPos+"px";flyingDiv.appendChild(e);flyingDiv.style.display="block";flyingDiv.style.width=currentProductDiv.offsetWidth+"px";flyToBasket(b,n)}}function addToBasket(productId){var productIDVal=productId;var productX=$("#slidingProduct"+productIDVal).offset().left;var productY=$("#slidingProduct"+productIDVal).offset().top;if($("#slidingProduct"+productIDVal).length>0){var basketX=$("#basketTitleWrap").offset().left;var basketY=$("#basketTitleWrap").offset().top}else{var basketX=$("#basketTitleWrap").offset().left;var basketY=$("#basketTitleWrap").offset().top}var gotoX=basketX-productX;var gotoY=basketY-productY;var newImageWidth=$("#slidingProduct"+productIDVal).width()/3;var newImageHeight=$("#slidingProduct"+productIDVal).height()/3;$("#slidingProduct"+productIDVal).clone().prependTo("#slidingProduct"+productIDVal).css({position:"absolute",width:"200px"}).animate({opacity:0.4},100).animate({opacity:0.1,marginLeft:gotoX,marginTop:gotoY,width:newImageWidth,height:newImageHeight},1200,function(){$(this).remove();$("#notificationsLoader").html('<img src="images/loader.gif">');var vparam="";if($("#selectedParam")!=null){vparam=$("#selectedParam").val()}$.ajax({type:"POST",url:"Basket.asmx/AddBasketItem",data:"{'pId': '"+productId+"','oId':'"+$("#ownerBasket").val()+"','bId':'"+$("#browserIdBasket").val()+"','cId':'"+$("#contactBasket").val()+"','amount':'"+$("#pamount"+productId).val()+"','vparam':'"+vparam+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(theResponse){var result=(typeof theResponse.d)=="string"?eval("("+theResponse.d+")"):theResponse.d;if(result!=null){if(result.ErrorMessage!=null){alert(result.ErrorMessage)}if(result.Action!=null){if(result.Action=="ReloadPage"){window.location.reload()}}}if($("#slidingProduct"+productIDVal).length>0){$("#bp_output li:first").before(theResponse);$("#bp_output li:first").hide();$("#bp_output li:first").show("slow");$("#notificationsLoader").empty()}else{$("#bp_output li:first").before(theResponse);$("#bp_output li:first").hide();$("#bp_output li:first").show("slow");$("#notificationsLoader").empty()}getBasketProducts(true,true);window.scrollTo(0,0)},error:function(msg){errorHandler("Basket.asmx","AddBasketItem",msg.responseText+"pId: "+productId+"contact: "+$("#contactBasket").val())}})})}function stockEmpty(){alert("Varen finnes ikke på lager")}function flyToBasket(d,a){var b=Math.max(Math.abs(diffX),Math.abs(diffY));var e=(diffX/b)*flyingSpeed;var c=(diffY/b)*flyingSpeed;currentXPos=currentXPos+e;currentYPos=currentYPos+c;flyingDiv.style.left=Math.round(currentXPos)+"px";flyingDiv.style.top=Math.round(currentYPos)+"px";if(e>0&&currentXPos>basket_x){flyingDiv.style.display="none";window.scrollTo(0,0)}if(e<0&&currentXPos<basket_x){flyingDiv.style.display="none";window.scrollTo(0,0)}if(flyingDiv.style.display=="block"){setTimeout('flyToBasket("'+d+'", "'+a+'")',10)}else{ajaxAddProduct(d,a)}}function ajaxAddProduct(b,a){doAddProduct(b,a)}function buyCompareProduct(a){doAddCompareProduct(a)}function doAddProduct(id,vat){var vparam="";if(document.getElementById("selectedParam")!=null){vparam=document.getElementById("selectedParam").value}$.ajax({type:"POST",url:"Basket.asmx/AddBasketItem",data:"{'pId': '"+id+"','oId':'"+$("#ownerBasket").val()+"','bId':'"+$("#browserIdBasket").val()+"','cId':'"+$("#contactBasket").val()+"','amount':'"+$("#pamount"+id).val()+"','vparam':'"+vparam+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(result!=null){if(result.ErrorMessage!=null){alert(result.ErrorMessage)}if(result.Action!=null){if(result.Action=="ReloadPage"){window.location.reload()}}}getBasketProducts(true,vat);if(document.getElementById("window")!=null){$("#window").jqmHide()}},error:function(msg){errorHandler("Basket.asmx","AddBasketItem",msg.responseText+"pId: "+id+"contact: "+$("#contactBasket").val())}})}function doAddCompareProduct(id){var vparam="";if($("#selectedParam")!=null){vparam=$("#selectedParam").val()}$.ajax({type:"POST",url:"Basket.asmx/AddBasketItem",data:"{'pId': '"+id+"','oId':'"+$("#ownerBasket").val()+"','bId':'"+$("#browserIdBasket").val()+"','cId':'"+$("#contactBasket").val()+"','amount':'1','vparam':'"+vparam+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(result!=null){if(result.ErrorMessage!=null){alert(result.ErrorMessage)}if(result.Action!=null){if(result.Action=="ReloadPage"){window.location.reload()}}}getBasketProducts(true,true)},error:function(msg){errorHandler("Basket.asmx","AddBasketItem",msg.responseText+"pId: "+id+"contact: "+$("#contactBasket").val())}})}function getBasketProducts(smalBasket,vat){var showImg=false;if(!smalBasket){showImg=true}else{if(document.getElementById("basketBig_content_details")!=null){showImg=true}}$.ajax({type:"POST",url:"Basket.asmx/GetBasketProducts",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"', 'bId' : '"+$("#browserIdBasket").val()+"', 'showImg' : '"+showImg+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var products=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(smalBasket){AddSmallBasketHtml(products,vat)}else{AddBigBasketHtml(products)}if(document.getElementById("basketBig_content_details")!=null){AddBigBasketHtml(products)}},error:function(msg){errorHandler("Basket.asmx","getBasketProducts",msg.responseText+"oId: "+$("#ownerBasket").val()+"contact: "+$("#contactBasket").val()+"basket: "+$("#browserIdBasket").val())}})}function AddSmallBasketHtml(f,b){$("#bp_output").empty();$("#sum").empty();$("#p_count").empty();var a=0;var d=0;for(var c=0;c<f.length;c++){var e="";if(b){e='<li class="price">'+f[c].priceWithVat.toFixed(2)+"</li>"}else{e='<li class="price">'+f[c].price.toFixed(2)+"</li>"}$("#bp_output").append('<li class="item clearfix" id="basket_li'+f[c].basketId+'"><ul><li class="product">'+f[c].productName+'</li><li class="amount"><label value="'+f[c].basketId+'"></label><input class="buyAmount" value="'+f[c].amount+'" id="amount'+f[c].basketId+'" type="Text" maxlength="13" /></li><li class="refresh" onclick="update_bp('+f[c].basketId+')"></li>'+e+'<li class="remove" onclick="remove_bp('+f[c].basketId+')"></li></ul></li>');if(b){a+=f[c].priceWithVat*f[c].amount}else{a+=f[c].price*f[c].amount}d+=f[c].amount}$("#sum").append(a.toFixed(2));if(d>0){$("#b_empty").hide();$("#b_sum").show();$("#p_count").append(d);$("#basketContent").show()}else{$("#b_empty").show();$("#b_sum").hide();$("#basketContent").hide()}}function AddBigBasketHtml(e){$("#basketBig_content_details").empty();var d="";var a=0;for(var c=0;c<e.length;c++){var b="Webshop/ProductDetails.aspx?pageid=3934&Product="+e[c].productId;d+='<li id="basketBig_li'+e[c].basketId+'"><div class="clearfix"><span class="image"><a class="jqPDetails" href="'+b+'">';if(e[c].productImage==""){d+='<span class="emptyImg"></span>'}else{d+='<img width="100" alt="'+e[c].productName+'" src="'+e[c].productImage+'" />'}d+='</a></span><a class="jqPDetails" href="'+b+'"><span class="name">'+e[c].productName+'</span></a><span class="price">'+e[c].priceWithVat.toFixed(2)+'</span><span class="amount"><input type="text" id="big_amount'+e[c].basketId+'" value="'+e[c].amount+'" /><a class="refresh" onclick="update_big_bp('+e[c].basketId+')" /></span><span class="totalprice" id="price_row'+e[c].basketId+'">'+(e[c].priceWithVat*e[c].amount).toFixed(2)+'</span><span class="remove" onclick="remove_bp('+e[c].basketId+')"></span></div></li>';a+=e[c].priceWithVat*e[c].amount}$("#basketBig_content_details").append(d);if(document.getElementById("b_big_total")!=null){document.getElementById("b_big_total").innerHTML=a.toFixed(2)}}function showhide(a){if(document.getElementById){obj=document.getElementById(a);if(obj.style.display=="none"){obj.style.display=""}else{obj.style.display="none"}}}function showhide(c,a,b){if(document.getElementById){obj=document.getElementById(c);obj.style.display=(obj.style.display=="none")?"":"none";if(a!=null){if(a=="login"){document.getElementById("login_button").name=(b=="true")?"account":"login";document.getElementById("login").style.display="";document.getElementById("forgot").style.display="none"}else{document.getElementById("forgot").style.display="";document.getElementById("login").style.display="none"}}}}function remove_bp(a){doRemoveBp(a)}function doRemoveBp(a){if(!confirm("Er du sikker på at du vil fjerne varen?")){return false}$.ajax({type:"POST",url:"Basket.asmx/RemoveBasketItem",data:"{'bId': '"+a+"','oId':'"+$("#ownerBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){if(document.getElementById("basket_li"+a)!=null){$("#basket_li"+a).remove()}if(document.getElementById("basketBig_li"+a)!=null){$("#basketBig_li"+a).remove()}if(document.getElementById("basketConfirm_li"+a)!=null){$("#basketConfirm_li"+a).remove()}getTotalSumBasket()},error:function(b){errorHandler("Basket.asmx","RemoveBasketItem",b.responseText+"oId: "+$("#ownerBasket").val()+"basket: "+$("#browserIdBasket").val())}})}function update_bp(a){doUpdateAmount(a,false,false)}function update_big_bp(a){doUpdateAmount(a,true,false)}function update_confirm_bp(a){doUpdateAmount(a,false,true)}function doUpdateAmount(id,bigbasket,confirm){var amount=$("#amount"+id).val();if(bigbasket){amount=$("#big_amount"+id).val()}if(confirm){amount=$("#confirm_amount"+id).val()}$.ajax({type:"POST",url:"Basket.asmx/UpdateBasketAmount",data:"{'bId': '"+id+"','oId':'"+$("#ownerBasket").val()+"','amount':'"+amount+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var cId=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;document.getElementById("amount"+id).value=amount;if(document.getElementById("big_amount"+id)!=null){document.getElementById("big_amount"+id).value=amount}if(document.getElementById("confirm_amount"+id)!=null){document.getElementById("confirm_amount"+id).value=amount}if(document.getElementById("price_row"+id)!=null){$("#price_row"+id).empty();$("#price_row"+id).append(cId.toFixed(2))}if(document.getElementById("price_crow"+id)!=null){$("#price_crow"+id).empty();$("#price_crow"+id).append(cId.toFixed(2))}getTotalSumBasket()},error:function(msg){errorHandler("Basket.asmx","UpdateBasketAmount",msg.responseText+"oId: "+$("#ownerBasket").val()+"basket: "+$("#browserIdBasket").val())}})}function AjaxFailed(a){errorHandler("Basket.asmx","UpdateBasketAmount",a)}function getTotalSumBasket(){$.ajax({type:"POST",url:"Basket.asmx/GetTotalSumBasket",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"', 'bId' : '"+$("#browserIdBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var price=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;$("#sum").empty();$("#sum").append(price.totalSum.toFixed(2));$("#p_count").empty();$("#p_count").append(price.amount);if(price.amount>0){$("#b_empty").hide();$("#b_sum").show();$("#basketContent").show()}else{$("#b_empty").show();$("#b_sum").hide();$("#basketContent").hide()}if(document.getElementById("basketBig_content_footer")!=null){$("#basketBig_content_footer").empty();$("#basketBig_content_footer").append("Totalsum Kr : "+price.totalSum.toFixed(2))}if(document.getElementById("p_totalsum")!=null){var delivery=parseFloat(document.getElementById("p_delivery").innerHTML.replace(",","."));var dmva=((delivery-(delivery/1.25)));$("#p_mva").empty();$("#p_mva").append((price.mva+dmva).toFixed(2));var totPrice=price.totalSum+delivery;$("#p_totalsum").empty();$("#p_totalsum").append(totPrice.toFixed(2))}},error:function(msg){errorHandler("Basket.asmx","GetTotalSumBasket",msg.responseText+"oId: "+$("#ownerBasket").val()+"contact: "+$("#contactBasket").val()+"basket: "+$("#browserIdBasket").val())}})}function addToCompare(a){$.ajax({type:"POST",url:"Basket.asmx/AddCompareItem",data:"{'pId': '"+a+"','bId':'"+$("#browserIdBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){getCompareProducts()},error:function(b){errorHandler("Basket.asmx","AddCompareItem",b.responseText+"pId: "+a)}})}function remove_cp(a){doRemoveCp(a,getCompareProducts)}function doRemoveCp(b,a){if(!confirm("Er du sikker på at du vil fjerne varen?")){return false}$.ajax({type:"POST",url:"Basket.asmx/RemoveCompareItem",data:"{'id': '"+b+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:a,error:function(c){errorHandler("Basket.asmx","RemoveCompareItem",c.responseText+"id: "+b)}})}function getCompareProducts(){$.ajax({type:"POST",url:"Basket.asmx/GetCompareProducts",data:"{'oId':'"+$("#ownerBasket").val()+"', 'bId' : '"+$("#browserIdBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var products=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;$("#cp_output").empty();$("#comparisonList").empty();for(var i=0;i<products.length;i++){$("#cp_output").append('<ul class="item clearfix"><li><a href="'+products[i].productHref+'"><img src="'+products[i].imagePath+'" width="30px" alt="" /></a></li><li class="product">'+products[i].productName+'</li><li class="remove" onclick="remove_cp('+products[i].compareBasketId+')"></li></ul>')}},error:function(msg){errorHandler("Basket.asmx","GetCompareProducts",msg.responseText+"oId: "+$("#ownerBasket").val()+"basket: "+$("#browserIdBasket").val())}})}function changeSelection(obj,gId){var arr=document.getElementsByTagName("select");var array=new Array();for(var i=0;i<arr.length;i++){var obj2=document.getElementsByName(arr[i].name);for(var j=0;j<obj2.length;j++){var item=obj2.item(j);if(item.value!=""){array.push(item.value)}}}var catId=$("#catId").val();var astring="'array': [";for(var a=0;a<array.length;a++){astring+="'"+array[a]+"'";if(a!=array.length-1){astring+=","}}astring+="]";var myJSONObject="{ "+astring+", 'catId': '"+catId+"'}";if(typeof JSON!=="undefined"){myJSONObject=JSON.stringify({array:array,catId:catId})}$("#pLoader").html('<img src="images/loader2.gif">');$.ajax({type:"POST",url:"Basket.asmx/GetPropertyGroups",data:myJSONObject,contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var plist=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;$("#pg_boxes").empty();var t="<span>Avgrens s&#248;ket ditt: </span>";$("#pg_boxes").append(t);for(var i=0;i<plist.length;i++){var listHtml='<div class="selectionBox">'+plist[i].groupName+'<br><select multiple="multiple" size="5" name="'+plist[i].groupName+'" onchange="changeSelection(this,'+plist[i].groupId+');"><option value="all">Alle</option>';for(var j=0;j<plist[i].propertyes.length;j++){if(plist[i].propertyes[j].selected){var selected='selected = "selected"';listHtml+='<option value="'+plist[i].propertyes[j].parameterId+'" '+selected+'">'+plist[i].propertyes[j].parameterName+"</option>"}else{listHtml+='<option value="'+plist[i].propertyes[j].parameterId+'">'+plist[i].propertyes[j].parameterName+"</option>"}}listHtml+="</select></div>";$("#pg_boxes").append(listHtml)}$("#pLoader").empty()},error:function(msg){errorHandler("Basket.asmx","GetPropertyGroups",msg.responseText+"oId: "+$("#ownerBasket").val()+"contact: "+$("#contactBasket").val()+"basket: "+$("#browserIdBasket").val())}});var o=GetOrder();var d=GetDir();document.getElementById("pager").value="0";AddPagingNavigation((array));ListProducts(array,o,d)}function AddPagingNavigation(array){var gId=$("#groupId").val();var catId=$("#catId").val();var oId=$("#ownerBasket").val();var astring=GetArrayString(array);var myJSONObject="{ "+astring+", 'cId': '"+catId+"', 'gId': '"+gId+"', 'oId': '"+oId+"'}";if(typeof JSON!=="undefined"){myJSONObject=JSON.stringify({array:array,cId:catId,gId:gId,oId:oId})}$.ajax({type:"POST",url:"Basket.asmx/ProductCount",data:myJSONObject,contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){$("#nav_paging0").empty();$("#nav_paging1").empty();if(document.getElementById("pToShow")!=null){var pagesToShow=document.getElementById("pToShow").innerHTML;var p=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;var TotalPagesToShow=parseInt(Math.ceil(parseFloat(p)/parseFloat(pagesToShow)));if(TotalPagesToShow>1){for(var j=0;j<2;j++){var html="";for(var i=0;i<TotalPagesToShow;i++){html+='<span id="span'+j+"_"+(i+1)+'">';if(j==0){html+='<a href="#" id="pagertop'+(i+1)+'" onclick="showPages(\''+(i*pagesToShow)+"',this); return false;\">"+(i+1)+"</a></span>"}else{html+='<a href="#" id="pagerbottom'+(i+1)+'" onclick="showPages(\''+(i*pagesToShow)+"',this); return false;\">"+(i+1)+"</a></span>"}}html+='<span id="lnkShowAll'+j+'" class="lnkShowAll">';if(j==0){html+='<a href="#" id="pagerlnkShowAll_pagertop" onclick="showPages(\'all\', this); return false;">Vis alle</a></span>'}else{html+='<a href="#" id="pagerlnkShowAll_pagerbottom" onclick="showPages(\'all\', this); return false;">Vis alle</a></span>'}$("#nav_paging"+j).append(html);if(j==0){$("#pagertop1").addClass("selectedPager")}else{$("#pagerbottom1").addClass("selectedPager")}}}}},error:function(msg){errorHandler("Basket.asmx","ProductCount",msg.responseText)}})}function ListProducts(array,order,dir){var gId=$("#groupId").val();var catId=$("#catId").val();var oId=$("#ownerBasket").val();var cId=$("#contactBasket").val();var astring=GetArrayString(array);var pager=$("#pager").val();var uic=$("input.UICultureCode").val();var rows=2;if($(".productBox33").is(":visible")){rows=3}var myJSONObject="{ "+astring+", 'catId': '"+catId+"', 'gId': '"+gId+"', 'oId': '"+oId+"','cId': '"+cId+"', 'o': '"+order+"', 'd': '"+dir+"', 'pVat': 'true', 'p': '"+pager+"','ui': '"+uic+"', 'r':'"+rows+"' }";if(typeof JSON!=="undefined"){myJSONObject=JSON.stringify({array:array,catId:catId,gId:gId,cId:cId,oId:oId,o:order,d:dir,pVat:"true",p:pager,ui:uic,r:rows})}$("#pLoader").html('<img src="images/loader2.gif" />');$.ajax({type:"POST",url:"Basket.asmx/GetProductList",data:myJSONObject,contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var p=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;var amountText=$("span.amountText").html();var mI=$("span.moreInfo").html();var cT=$("span.compText").html();var pExV=false;if($(".priceExVat").is(":visible")){pExV=true}$("#productList").empty();var html="";var topProduct=false;if((p.length==0)&&(pExV)){html+='<span class="priceExVat">&nbsp;</span>'}if((p.length==0)&&(rows==3)){html+='<span class="productBox33" style="border:0">&nbsp;</span>'}for(var i=0;i<p.length;i++){var href=window.location.href.replace("#navi_main","")+"&Product="+p[i].pId+"#products";if((i==0)&&(p[i].topProduct)){topProduct=true;html+='<div class="catWrapper"><div class="productBox100 clearfix"><div class="productIntro clearfix">';html+=GetImageHtml(p[i].pId,href,p[i].imagePath,"300");html+='<div class="imgInfo">';html+=AddPNameHtml(p[i].pName,href);for(var j=0;j<p[i].extraFields.length;j++){html+=AddExraField(p[i].extraFields[j].name,p[i].extraFields[j].description);'<div class="extraFields"><span>'+p[i].extraFields[j].name+"</span><span>"+p[i].extraFields[j].description+"</span></div>"}html+=AddShortDescr(p[i].pShortDesc);html+='<p class="p-more">'+AddMoreInfoLink(href,p[i].pName,mI)+"</p>";html+="</div></div>";html+='<div class="productFooter"><div class="p-data clearfix">';html+=AddPrice(p[i].price,p[i].priceName,p[i].newPrice,p[i].priceExVat,pExV);if(p[i].canBuy){html+=AddingBuyButton(p[i].pId,p[i].isVariant,href,p[i].canBuyEmptyStock,amountText,true)}html+="</div>";html+='<div class="p-info">';html+=AddStock(p[i].showStock,p[i].stockAmount);html+=AddCompare(p[i].pId,cT);html+="</div>";html+="</div>";html+="</div></div>"}else{var l=(topProduct)?p.length-1:p.length;var j=(topProduct)?i:i+1;var add_cw=((((j+(rows-1))%rows)==0))?true:false;var end_cw=((((j)%rows)==0)||(j==l))?true:false;if(add_cw){html+='<div class="catWrapper">'}html+=AddProduct(p[i],href,amountText,mI,cT,pExV,rows);if(end_cw){html+='</div><div class="clearfloat" />'}}}$("#productList").append(html);if($(".productBox50").is(":visible")){$(".productBox50 img").each(function(){var $this=$(this);$this.css({width:"auto",height:"auto"});var height=$this.height();var maxHeight=170;var ratio=0;var width=$this.width();if(height>maxHeight){ratio=maxHeight/height;$(this).css("width",width*ratio);height=maxHeight}if(height!=0){$(this).css("height",height);$(this).parent().parent().css("height",maxHeight)}})}if($(".productBox33").is(":visible")){$(".productBox33 img").each(function(){var $this=$(this);$this.css({width:"auto",height:"auto"});var height=$this.height();var maxHeight=130;var ratio=0;var width=$this.width();if(height>maxHeight){ratio=maxHeight/height;$(this).css("width",width*ratio);height=maxHeight}if(height!=0){$(this).parent().parent().css("height",maxHeight)}})}jQuery.fn.equalHeights=function(){var maxHeight=0;this.each(function(){if(this.offsetHeight>maxHeight){maxHeight=this.offsetHeight}});this.each(function(){$(this).height(maxHeight+"px");if(this.offsetHeight>maxHeight){$(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px")}})};$(function(){$(".productBoxContent .productIntro").equalHeights()});$("#pLoader").empty()},error:function(msg){errorHandler("Basket.asmx","GetProductList",msg.responseText+"oId: "+oId+"cat: "+cId+"group: "+gId)}})}function AddProduct(b,a,c,h,g,d,i){var f=(i==3)?'<div class="productBox33"><div class="productBoxHeader">':'<div class="productBox50"><div class="productBoxHeader">';if(b.priceName!="price"){f+='<div class="sale"></div>'}f+='</div><div class="productBoxContent"><div class="productIntro clearfix">';f+=GetImageHtml(b.pId,a,b.imagePath,"250");f+=AddPNameHtml(b.pName,a);for(var e=0;e<b.extraFields.length;e++){f+=AddExraField(b.extraFields[e].name,b.extraFields[e].description);'<div class="extraFields"><span>'+b.extraFields[e].name+"</span><span>"+b.extraFields[e].description+"</span></div>"}f+=AddShortDescr(b.pShortDesc);f+='<div class="p-more">'+AddMoreInfoLink(a,b.pName,h)+"</div></div>";f+='<div class="clearfix">'+AddPrice(b.price,b.priceName,b.newPrice,b.priceExVat,d)+"</div>";if(b.canBuy){f+=AddingBuyButton(b.pId,b.isVariant,a,b.canBuyEmptyStock,c,false)}f+="</div>";f+='<div class="productFooter"><div class="p-info clearfix">';f+=AddStock(b.showStock,b.stockAmount);f+=AddCompare(b.pId,g)+"</div>";f+="</div></div>";return f}function GetImageHtml(d,b,c,a){if(c!=""){return'<div id="productImageWrapID_'+d+'" class="imgWrapper"><a href="'+b+'"><img src="'+c+'" width="'+a+'" alt="" /></a></div>'}else{return'<a href="'+b+'"><div class="emptyImg imgWrapper"></div></a>'}}function AddPNameHtml(b,a){return(b!=null)?'<h1><a href="'+a+'">'+b+"</a></h1>":""}function AddExraField(a,b){return'<div class="extraFields"><span>'+a+"</span><span>"+b+"</span></div>"}function AddShortDescr(a){if(a!=null){return"<p>"+a+"</p>"}else{return""}}function AddMoreInfoLink(b,c,a){return'<a target="" href="'+b+'"><span class="moreInfo">'+a+"</span>"+c+"</a>"}function AddPrice(f,c,e,a,b){var d="";if(f!=0){d='<div class="p-price"><h3>';if(c!="price"){d+="<strike>"+f+'</strike></h3><div class="clearfloat"></div><h3>'+c+" "+e}else{d+="&nbsp;</h3><h3>"+f}d+="</h3>";if(b){d+='<div class="clearfloat"></div><h3><span class="priceExVat">Eks. mva '+a+"</span></h3>"}d+="</div>"}return d}function AddingBuyButton(g,c,b,e,a,f){var d='<div class="p-data clearfix">';if(f){d+=AddAmount(g,a)+AddSlidingBuy(g,c,b,e)+"</div>"}else{d+='<div class="clearfix">'+AddSlidingBuy(g,c,b,e)+AddAmount(g,a)+"</div></div>"}return d}function AddAmount(b,a){return'<div class="p-amount"><span class="amountText">'+a+'</span><input value="1" id="pamount'+b+'" type="text" maxlength="13" /></div>'}function AddSlidingBuy(h,d,c,f){var a=$("input[name=buy][type=hidden]").val();var g=$("input[name=seebuy][type=hidden]").val();var e='<div id="slidingProduct'+h+'" class="sliding_product"><div class="p-purchase">';if(d){e+='<a class="oragne_button rc7" href="'+c+'">'+g+"</a>"}else{e+=(f)?'<a class="oragne_button rc7" href="#basket" onclick="addToBasket('+h+');return false">'+a+"</a>":'<a class="oragne_button rc7" href="#basket" onclick="stockEmpty();return false">'+a+"</a>"}return e+"</div></div>"}function AddStock(a,b){return(a)?'<div class="p-status"><span class="instore">'+b+"</span></div>":""}function AddCompare(b,a){return'<div class="p-compare"><a href="#basket" onclick="addToCompare('+b+');return false"><span class="compText">'+a+"</span></a></div>"}function GetArrayString(e){var d=e.length;var c="'array': [";for(var b=0;b<e.length;b++){c+="'"+e[b]+"'";if(b!=d-1){c+=","}}c+="]";var c="'array': [";for(var b=0;b<e.length;b++){c+="'"+e[b]+"'";if(b!=e.length-1){c+=","}}c+="]";return c}function changeOrder(c){var a=c.value;var b=GetDir();var d=GetSelProperty();if($("#pager").val()!="all"){document.getElementById("pager").value="0"}ListProducts(d,a,b)}function changeDirection(c){var b=c.value;var a=GetOrder();var d=GetSelProperty();if($("#pager").val()!="all"){document.getElementById("pager").value="0"}ListProducts(d,a,b)}function changeCustType(b){var a=b.value;if(a=="Firmakunde"){$(".company").show();$(".person").hide()}else{$(".company").hide();$(".person").show()}}function changedPayWay(obj,type){var v=obj.value;var oId=$("#ownerBasket").val();$.ajax({type:"POST",url:"Basket.asmx/GetDeliveryes",data:"{'pay': '"+v+"','oId': '"+oId+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var d=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;$("#delivery_content").empty();var html="";if(d.length==0){$("#p_delivery").empty();$("#p_delivery").append(0)}for(var i=0;i<d.length;i++){var checked="";if(i==0){checked='checked="checked"'}var click="";if(d[i].usePrice){click=' onclick="changedDelivery(this);"';if(i==0){if(document.getElementById("p_delivery")!==null){var dOld=document.getElementById("p_delivery").innerHTML.replace(",",".")}$("#p_delivery").empty();$("#p_delivery").append(d[i].price.toFixed(2));var mva=document.getElementById("p_mva").innerHTML.replace(",",".");var sum=document.getElementById("p_totalsum").innerHTML.replace(",",".");var odMva=((dOld-(dOld/1.25)));var ndMva=((d[i].price-(d[i].price/1.25)));mva=mva-odMva+ndMva;var total=parseFloat(sum)+d[i].price-parseFloat(dOld);$("#p_mva").empty();$("#p_mva").append(mva.toFixed(2));$("#p_totalsum").empty();$("#p_totalsum").append(total.toFixed(2))}}html+='<div><input id="radio_p'+d[i].id+'" type="radio" value="'+d[i].id+'" '+checked+' name="deliveryType" '+click+" />"+d[i].name+"</div>"}$("#delivery_content").append(html);if($("#klarnaContainer").length){$("#klarnaContainer").remove()}if($(".paymentContainer").length){$("div").removeClass("paymentContainer")}if(type=="K"){getData("Basket.asmx/GetControlHtml?kc="+document.getElementById("rl_"+obj.value).innerHTML+"&oid="+oId+"&ts="+document.getElementById("p_totalsum").innerHTML.replace(",","."),"~/Webshop/Controls/ucKlarnaTexboxes.ascx","#radio_"+obj.value+"")}},error:function(msg){errorHandler("Basket.asmx","GetDeliveryes",msg.responseText+"oId: "+$("#ownerBasket").val()+"pay: "+v)}})}function klarnaTextFields(){var a="";a+='<div><input id="pn" type="text"></div>';a+='<div><input id="tn" type="text"></div>';document.getElementById("radio_361679").parentNode.appendChild(a)}function changedDelivery(obj){$.ajax({type:"POST",url:"Basket.asmx/getDeliverySum",data:"{'dT': '"+obj.value+"','oId': '"+$("#ownerBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var dOld=document.getElementById("p_delivery").innerHTML.replace(",",".");var d=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;var mva=document.getElementById("p_mva").innerHTML.replace(",",".");var sum=document.getElementById("p_totalsum").innerHTML.replace(",",".");var odMva=((dOld-(dOld/1.25)));var ndMva=((d-(d/1.25)));mva=mva-odMva+ndMva;var total=parseFloat(sum)+d-parseFloat(dOld);document.getElementById("p_mva").innerHTML=mva.toFixed(2);document.getElementById("p_totalsum").innerHTML=total.toFixed(2);document.getElementById("p_delivery").innerHTML=d.toFixed(2)},error:function(msg){errorHandler("Basket.asmx","getDeliverySum",msg.responseText+"oId: "+$("#ownerBasket").val()+"delivery: "+obj.value)}})}function sameAdressChange(a){if(a.checked==true){document.getElementById("deliveryAdress").style.display="none"}else{document.getElementById("deliveryAdress").style.display=""}}function GetSelProperty(){var a=document.getElementsByTagName("select");var f=new Array();for(var c=0;c<a.length;c++){var e=document.getElementsByName(a[c].name);for(var b=0;b<e.length;b++){var d=e.item(b);if(d.value!=""){f.push(d.value)}}}return f}function GetDir(){var b=document.getElementsByName("Dire");var c="asc";for(var a=0;a<b.length;a++){if(b[a].checked){c=b[a].value}}return c}function GetOrder(){var b=document.getElementsByName("Order");var c="name";for(var a=0;a<b.length;a++){if(b[a].checked){c=b[a].value}}return c}function changeVariant(obj,gId,pId,mId,isMaster,isSimpleVariant){var oId=$("#ownerBasket").val();var cId=$("#contactBasket").val();var w="300";var vat="1";var vgDiv=document.getElementById("variantGroups");var arr=vgDiv.getElementsByTagName("select");var array=new Array();for(var i=0;i<arr.length;i++){var obj2=document.getElementsByName(arr[i].name);for(var j=0;j<obj2.length;j++){var item=obj2.item(j);if((item.value!="")&&(item.value!="0")){if((isSimpleVariant)||(isSimpleVariant=="True")){document.getElementById("selectedParam").value=item.value}array.push(item.value)}}}var astring="'array': [";for(var a=0;a<array.length;a++){astring+="'"+array[a]+"'";if(a!=array.length-1){astring+=","}}astring+="]";var myJSONObject="{ "+astring+", 'oId': '"+oId+"', 'pId': '"+pId+"', 'mId': '"+mId+"', 'isMaster': '"+isMaster+"', 'cId': '"+cId+"', 'vat': '"+vat+"', 'w': '"+w+"'}";if(typeof JSON!=="undefined"){myJSONObject=JSON.stringify({array:array,oId:oId,pId:pId,mId:mId,isMaster:isMaster,cId:cId,vat:vat,w:w})}$.ajax({type:"POST",url:"Basket.asmx/GetProductVariant",data:myJSONObject,contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var p=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;var vp=false;if($(".priceExVat").is(":visible")){vp=true}var pHtml="";if(p.isNewProduct){if(p.pNo!=null){$("#pcode").empty();$("#pcode").append(p.pNo)}if(p.pName!=null){$("#pname").empty();$("#pname").append(p.pName)}if(p.unit!=null){$("#punit").empty();$("#punit").append(p.unit)}if(p.weight!=null){$("#pweight").empty();$("#pweight").append(p.weight)}if(p.stockAmount!=null){$("#pstock").empty();if(p.showStockAmount){$("#pstock").append("På lager : "+p.stockAmount)}else{$("#pstock").append(p.stockAmount)}}if(p.pShortDesc!=null){$("#pshortDesc").empty();$("#pshortDesc").append(p.pShortDesc)}if((p.pLongDesc!=null)&&(document.getElementById("plongDesc")!=null)){var header=document.getElementById("plongDesc").innerHTML;$("#productdetailstext").empty();$("#productdetailstext").append('<span id="plongDesc">'+header+"</span>"+p.pLongDesc)}if(p.price!=null){$("#pprice").empty();if(p.priceName!="price"){$("#pprice").append("<h3><strike>"+p.price+"</strike></h3><h3>"+p.priceName+" "+p.newPrice+"</h3>")}else{$("#pprice").append("<h3>"+p.newPrice+"</h3>")}if(vp){$("#pprice").append('<h3><span class="priceExVat">Eks. mva '+p.priceExVat+"</span></h3>")}}if(p.canBuy!=null){var rp="false";$("#pcanbuy").empty();$("#pcanbuy").append('<div class="sliding_product" id="slidingProduct'+p.pId+'"><div class="p-purchase"><a id="ex4Trigger" href="#basket" class="oragne_button" onclick="addToBasket2('+p.pId+","+rp+",true,'"+p.pName+"'  );return false\">"+$("input[name=buy][type=hidden]").val()+'</a></div></div><div class="p-amount">Antall<input value="1" id="pamount'+p.pId+'" type="text" maxlength="13"></div>');$("#pcanbuy").show()}else{$("#pcanbuy").hide()}$("#imagearea").empty();var imgList="";if(p.imagePaths.length>0){imgList+='<div id="imageDiv" class="mainimage"><a title="" id="aThick" href="'+p.imagePaths[0].imagePath+'"><img src="'+p.imagePaths[0].thumbPath+'" class="centeredImage" width="'+p.imagePaths[0].width+'" height="'+p.imagePaths[0].height+'" border="0"></a></div>';if(p.imagePaths.length>1){imgList+='<div class="thumbImageList">'}for(var k=1;k<p.imagePaths.length;k++){imgList+='<a href="'+p.imagePaths[k].imagePath+'">';imgList+='<img src="'+p.imagePaths[k].thumbPath+'" alt="" onmouseover="showimage(\''+p.imagePaths[k].imagePath+"','"+p.imagePaths[k].thumbBigImage+"',"+p.imagePaths[k].width+","+p.imagePaths[k].height+",'',"+p.imagePaths[k].maxHeight+')" width="70" height="70" /></a>'}if(p.imagePaths.length>1){imgList+='<a href="'+p.imagePaths[0].imagePath+'"><img src="'+p.imagePaths[0].thumbPath+'" onmouseover="showimage(\''+p.imagePaths[0].imagePath+"','"+p.imagePaths[0].thumbPath+"',"+p.imagePaths[0].width+","+p.imagePaths[0].height+",'',"+p.imagePaths[0].maxHeight+')" width="70" height="70" /></a></div>'}imgList+='<div id="defaultImageDiv"></div>'}$("#imagearea").append(imgList);$("#tabarea").empty();var tHtml="<ul>";if(p.relatedGroups.length>0){var sgroup=0;for(var l=0;l<p.relatedGroups.length;l++){if(p.relatedGroups[l].selected){sgroup=p.relatedGroups[l].id;tHtml+='<li id="relTab'+p.relatedGroups[l].id+'" class="active" onclick="GetRelatedProducts('+p.pId+","+p.variantMasterId+","+p.relatedGroups[l].id+","+p.canBuy+","+p.canBuyEmptyStock+')">'+p.relatedGroups[l].name+"</li>"}else{tHtml+='<li id="relTab'+p.relatedGroups[l].id+'" onclick="GetRelatedProducts('+p.pId+","+p.variantMasterId+","+p.relatedGroups[l].id+","+p.canBuy+","+p.canBuyEmptyStock+')">'+p.relatedGroups[l].name+"</li>"}}GetRelatedProducts(p.pId,p.variantMasterId,sgroup,p.canBuy,p.canBuyEmptyStock)}tHtml+="</ul>";$("#tabarea").append(tHtml)}$("#variantGroups").empty();var listHtml="";for(var i=0;i<p.variantGroups.length;i++){listHtml+='<select  name="'+p.variantGroups[i].groupName+'" onchange="changeVariant(this,'+p.variantGroups[i].groupId+","+p.pId+","+p.variantMasterId+","+p.isMaster+","+p.variantGroups[i].isSimpleVariant+');"><option value="0">Velg '+p.variantGroups[i].groupName+"</option>";for(var j=0;j<p.variantGroups[i].variantParameters.length;j++){if(p.variantGroups[i].variantParameters[j].selected){var selected='selected = "selected"';listHtml+='<option value="'+p.variantGroups[i].variantParameters[j].parameterId+'" '+selected+'">'+p.variantGroups[i].variantParameters[j].parameterName+"</option>"}else{listHtml+='<option value="'+p.variantGroups[i].variantParameters[j].parameterId+'">'+p.variantGroups[i].variantParameters[j].parameterName+"</option>"}}listHtml+="</select>"}$("#variantGroups").append(listHtml)},error:function(msg){errorHandler("Basket.asmx","GetProductVariant",msg.responseText+"oId: "+$("#ownerBasket").val()+"pId: "+pId)}})}function GetRelatedProducts(pId,vmId,rg,cbuy,buyEmptyStock){$.ajax({type:"POST",url:"Basket.asmx/GetRelationProducts",data:"{'pId': '"+pId+"','vmId': '"+vmId+"','rGroup': '"+rg+"','oId': '"+$("#ownerBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var plist=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;$("#relProd").empty();$("#tabarea .active").removeClass("active");$("#relTab"+rg).addClass("active");var rphtml="";var queryString=window.location.href;var querySearch=window.location.search;querySearch=querySearch.substring(1);var arr1=querySearch.split("&");for(var j=0;j<arr1.length;j++){if(arr1[j].toString().contains("Product")){queryString=queryString.replace("&"+arr1[j].toString(),"")}}var b=$("input[name=buy][type=hidden]").val();var sb=$("input[name=seebuy][type=hidden]").val();for(var i=0;i<plist.length;i++){rphtml+='<div class="relProdTab">';if(plist[i].imagePath!=""){rphtml+='<div class="tabimg"><a href="'+queryString+"&Product="+plist[i].pId+'"><img alt="" src="'+plist[i].imagePath+'" /></a></div>'}else{rphtml+='<a href="'+queryString+'"><span class="tabimg emptyImg"></span></a>'}rphtml+="<h3>"+plist[i].pName+"</h3>";if(plist[i].price!=null){rphtml+='<div class="tabprice">'+plist[i].price+"</div>"}if(cbuy){rphtml+='<div class="tabBuy">';if(plist[i].variantMasterId!=0){rphtml+='<a class="oragne_button" href="'+queryString+"Product="+plist[i].pId+'">'+sb+"</a>"}else{if(buyEmptyStock){rphtml+='<div class="sliding_product" id="slidingProduct'+plist[i].pId+'"><a href="#basket" class="oragne_button" onclick="addToBasket2('+plist[i].pId+",true,true,'"+plist[i].pName+"');return false\">"+b+"</a></div>"}else{rphtml+='<div class="sliding_product" id="slidingProduct'+plist[i].pId+'"><a href="#basket" class="oragne_button" onclick="stockEmpty();return false">'+b+"</a></div>"}}rphtml+="</div>"}rphtml+="</div>"}$("#relProd").append(rphtml)},error:function(msg){errorHandler("Basket.asmx","GetRelationProducts",msg.responseText+"oId: "+$("#ownerBasket").val()+"pId: "+pId)}})}function errorHandler(b,f,g){try{var d;if(g.message==null){d=g}else{d=g.message}var a;a="Error in n FileName:"+b+"n Method Name:"+f+"n Message:"+d;submitToServer(b,f,a)}catch(c){alert("Exception Handler: Error:"+c.name+","+c.message)}}function submitToServer(a,d,c){try{$.getJSON("http://exceptionservice.kontoret.no/ClientExceptionHandler.svc/SubmitJavascriptError?callback=?&FileName="+escape(a)+"&MethodName="+escape(d)+"&ErrorMessage="+escape(c),null,null)}catch(b){alert("Exception Handler: Error:"+b.name+","+b.message)}}function addSubItems(id){var mainId=document.getElementById("nav_item_"+id);var $kids=$("#nav_item_"+id).children(".dummy_li").remove();var $kids2=$("#nav_item_"+id).children();if($kids2.length<=0){$.ajax({type:"POST",url:"Basket.asmx/GetSubitems",data:"{'gId':'"+id+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var sh="";var list=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(list.length<=0){sh='<li style="display:none"></li>'}$("#nav_item_"+id).empty();if(list.length>0){document.getElementById("nav_item_"+id).style.paddingBottom="30px"}for(var i=0;i<list.length;i++){sh+='<li><a href="'+list[i].href+'#navi_main">'+list[i].name+"</a>";if(list[i].subItems!=null){sh+='<ul class="sub_item_list">';for(var j=0;j<list[i].subItems.length;j++){sh+='<li><a href="'+list[i].subItems[j].href+'#navi_main">'+list[i].subItems[j].name+"</a></li>"}sh+="</ul>"}sh+="</li>"}$("#nav_item_"+id).append(sh);if($("#nav_item_"+id).hasClass("hidden")){$("#nav_item_"+id).removeClass("hidden")}},error:function(msg){errorHandler("Basket.asmx","GetSubitems",msg.responseText+"gId: "+id)}})}else{if($("#nav_item_"+id).hasClass("hidden")){$("#nav_item_"+id).removeClass("hidden")}}}function hideSubItems(a){$("#nav_item_"+a).addClass("hidden")}function showTerms(){$("#termsText").jqm()}function showComparation(){$("#comparisonContainer").jqm();var mainId=document.getElementById("comparisonList");var $kids=$("#comparisonList").children();var haveKids=true;if($kids.length<=0){haveKids=false}if(true){$.ajax({type:"POST",url:"Basket.asmx/GetCompareProductList",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"', 'bId' : '"+$("#browserIdBasket").val()+"', 'url':'"+window.location+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var clist=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;var test=$("li.price").html();$("#comparisonList").empty();var b=$("input[name=buy][type=hidden]").val();var sb=$("input[name=seebuy][type=hidden]").val();var html="";var ncss="odd";for(var i=0;i<clist.length;i++){var wholeNo=IsWholeNumber(Math.round(i)/4);if((i==0)||(wholeNo)){html+='<div class="compareListBox leadingText"><ul><li class="cp_image"></li>';ncss="odd";if(clist[i].name!=null){html+='<li class="cp_name '+ncss+'">'+$("li.product").html()+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].price!=null){html+='<li class="cp_price '+ncss+'">'+$("li.price").html()+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].weight!=null){html+='<li class="cp_weight '+ncss+'">'+$("input[name=weight][type=hidden]").val()+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].stockAmount!=null){html+='<li class="cp_stock '+ncss+'">P&aring; lager</li>';ncss=getCNodeCss(ncss)}if(clist[i].shortDescr!=null){html+='<li class="cp_shortDesc '+ncss+'">Kort beskrivelse</li>';ncss=getCNodeCss(ncss)}if(clist[i].longDescr!=null){html+='<li class="cp_longDesc '+ncss+'">Lang beskrivelse</li>';ncss=getCNodeCss(ncss)}if(clist[i].unit!=null){html+='<li class="cp_unit '+ncss+'">Enhet</li>';ncss=getCNodeCss(ncss)}if(clist[i].extraFields!=null){for(var j=0;j<clist[i].extraFields.length;j++){html+='<li class="extra '+ncss+'">'+clist[i].extraFields[j].name+"</li>";ncss=getCNodeCss(ncss)}}html+="</ul></div>"}html+='<div class="compareListBox"><ul><li class="cp_image">';html+=(clist[i].imagePath!="")?'<a href="'+clist[i].href+'"><img src="'+clist[i].imagePath+'" /></a>':'<a href="'+clist[i].href+'"><div class="emptyImg"></div></a>';if(clist[i].buyButtonText=="variantBuy"){html+='<div class="cp_buy"><a href="'+clist[i].href+'" class="oragne_button">'+sb+"</a></div></li>"}else{if(clist[i].buyButtonText=="productBuy"){html+='<div class="cp_buy"><a href="#basket" onclick="buyCompareProduct('+clist[i].id+');return false" class="oragne_button">'+b+"</a></div></li>"}else{if(clist[i].buyButtonText==""){html+="</li>"}else{html+='<div class="cp_buy"><a href="#basket" onclick="stockEmpty();return false" class="oragne_button">'+b+"</a></div></li>"}}}ncss="odd";if(clist[i].name!=null){html+='<li class="cp_name '+ncss+'">'+clist[i].name+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].price!=null){html+='<li class="cp_price '+ncss+'">'+clist[i].price+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].weight!=null){html+='<li class="cp_weight '+ncss+'">'+clist[i].weight+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].stockAmount!=null){html+='<li class="cp_stock '+ncss+'">'+clist[i].stockAmount+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].shortDescr!=null){html+='<li class="cp_shortDesc '+ncss+'">'+clist[i].shortDescr+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].longDescr!=null){html+='<li class="cp_longDesc '+ncss+'">'+clist[i].longDescr+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].unit!=null){html+='<li class="cp_unit '+ncss+'">'+clist[i].unit+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].freeText!=null){html+='<li class="cp_freetext '+ncss+'">'+clist[i].freeText+"</li>";ncss=getCNodeCss(ncss)}if(clist[i].extraFields!=null){for(var j=0;j<clist[i].extraFields.length;j++){html+='<li class="extra '+ncss+'">'+clist[i].extraFields[j].description+"</li>";ncss=getCNodeCss(ncss)}}html+="</ul></div>"}html+='<script language="javascript" type="text/javascript">$(function() { $(".compareListBox .cp_shortDesc").equalHeights(); });$(function() { $(".compareListBox .cp_longDesc").equalHeights(); });';html+='$(function() { $(".compareListBox .cp_name").equalHeights(); });$(function() { $(".compareListBox .cp_price").equalHeights(); });$(function() { $(".compareListBox .cp_weight").equalHeights(); });$(function() { $(".compareListBox .cp_stock").equalHeights(); });';html+='$(function() { $(".compareListBox .cp_unit").equalHeights(); });$(function() { $(".compareListBox .cp_freetext").equalHeights(); });$(function() { $(".compareListBox .extra").equalHeights(); });<\/script>';$("#comparisonContainer").jqm();$("#comparisonList").append(html)},error:function(msg){errorHandler("Basket.asmx","GetCompareProductList",msg.responseText+"oId: "+$("#ownerBasket").val()+"cId: "+$("#contactBasket").val()+"basket: "+$("#browserIdBasket").val())}})}}function AddHtml(a){$("#comparisonContainer").jqmShow().find("div.comparisonList").html(a)}function getCNodeCss(a){if(a=="odd"){return"even"}else{return"odd"}}function IsWholeNumber(a){return((a%1)==0)}function showiconpage(c){var d=window.location.search.replace("&contact=true","").replace("&info=true","").replace("&basket=true","").replace("&account=true","");var b=d.split("&");for(var a=0;a<b.length;a++){if(b[a].toString().contains("openpage")){d=d.replace("&"+b[a].toString(),"")}}window.location=d+"&"+c+"=true"}function GoBackToShopping(){var a=window.location.search.replace("&basket=true","");window.location=a}function LogIn(redirect){var u=$("#email").val();var p=$("#psw").val();if(redirect==false){u=$("#txtusername").val();p=$("#txtpassword").val()}$.ajax({type:"POST",url:"Basket.asmx/LogIn",data:"{'oId':'"+$("#ownerBasket").val()+"','u':'"+u+"', 'p' : '"+p+"','bId':'"+$("#browserIdBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(result!=0){$(".logInError").hide();if(redirect){if(document.getElementById("login_button").name=="account"){window.location.href=window.location.href.replace("&contact=true","").replace("&info=true","").replace("&basket=true","").replace("&account=true","").replace("#step1","").replace("#step2","").replace("#step3","")+"&account=true"}else{window.location.href=window.location.href.replace("&basket=true","").replace("#step1","").replace("#step2","").replace("#step3","")}}else{document.location.replace("#step3");getData("Basket.asmx/GetControlHtml","~/Webshop/Controls/ucTopIcons.ascx");GetUserControl(false);document.getElementById("contactBasket").value=result;getBasketProducts(true,true)}}else{$(".logInError").show()}},error:function(msg){errorHandler("Basket.asmx","LogIn",msg.responseText+"oId: "+$("#ownerBasket").val()+"user: "+u)}})}function LogOut(){$.ajax({type:"POST",url:"Basket.asmx/LogOut",data:"{}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(result==true){window.location.href=window.location.href.replace("&account=true","").replace("&basket=true","").replace("#step1","").replace("#step2","").replace("#step3","")}else{}},error:function(msg){errorHandler("Basket.asmx","LogOut",msg.responseText)}})}function showimage(b,f,d,a,e,c){objDiv1=document.getElementById("imageDiv");objDiv1.style.display="";objDiv1.style.height=c+"px";objAImage=document.getElementById("aThick");objAImage.href=b;objAImage.innerHTML='<img src="'+f+'" border="0" class="centeredImage" />'}function GetPage(){var b="<%$ Resources:Booking,add %>";var a='Brukernavn: <input type="text" id="txtusername" /> ';a+='Passord: <input id="txtpassword" type="password" /><input type="submit" value="Logg inn" onclick="LogIn(false)" />';$("#basketBig").append(a)}function getData(serviceURL,controlLocation,id){$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:serviceURL,data:"{'controlLocation':'"+controlLocation+"'}",success:function(response){var result=(typeof response)=="string"?eval("("+response+")"):response;var t=controlLocation.lastIndexOf("ucTopIcons");if(t!=-1){$("#top_icons").empty();document.getElementById("top_icons").innerHTML=result.d}else{if(controlLocation.lastIndexOf("ucKlarnaTexboxes")!=-1){$(id).parent().append(result.d);$(id).parent().addClass("paymentContainer")}else{$("#basketRegConfirm").show();$("#basketBig").hide();if(document.getElementById("basketRegConfirm")!=null){document.getElementById("basketRegConfirm").innerHTML=result.d}}}},error:function(XMLHttpRequest,textStatus,errorThrown){alert("Error Occured!")}})}function CancelRegister(){$(".conf").hide();$(".reg").show();var a=$("#radioPerType");var b=$("#radioCusType");if(a.length==1&&a.get(0).checked==true){$("#spanCusType_Company").show()}else{if(b.length==1&&b.get(0).checked==true){$("#spanCusType_Person").show()}}}function ConfirmRegister(country){var tel=document.getElementById("lblPhone").innerHTML;var mob=document.getElementById("lblMobile").innerHTML;var country=document.getElementById(country).value;var adr=document.getElementById("lblAdress").innerHTML;var zip=document.getElementById("txtZip").value;var city=document.getElementById("txtCity").value;var adr2=adr;var zip2=zip;var city2=city;if(!document.getElementById("chkSame").checked){adr2=document.getElementById("lblAdress2").innerHTML;var zip2=document.getElementById("txtZip2").value;var city2=document.getElementById("txtCity2").value}if(document.getElementById("radioPerType").checked){var fn=document.getElementById("lblFirstName").innerHTML;var ln=document.getElementById("lblLastName").innerHTML;$.ajax({type:"POST",url:"Basket.asmx/SaveContactInfoPerson",data:"{'oId':'"+$("#ownerBasket").val()+"','fName':'"+fn+"', 'lName' : '"+ln+"', 'p' : '"+tel+"', 'm' : '"+mob+"', 'a' : '"+adr+"', 'z' : '"+zip+"', 'c' : '"+city+"', 'country' : '"+country+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var contact=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;SaveUser(contact,country)},error:function(msg){errorHandler("Basket.asmx","SaveContactInfoPerson",msg.responseText+"oId: "+$("#ownerBasket").val())}})}else{var cn=document.getElementById("lblCompName").innerHTML;var on=document.getElementById("lblOrgNo").innerHTML;var cp=document.getElementById("lblContactPerson").innerHTML;$.ajax({type:"POST",url:"Basket.asmx/SaveContactInfoCompany",data:"{'oId':'"+$("#ownerBasket").val()+"','orgNo':'"+on+"', 'cName' : '"+cn+"', 'p' : '"+tel+"', 'm' : '"+mob+"', 'a' : '"+adr+"', 'z' : '"+zip+"', 'c' : '"+city+"', 'country' : '"+country+"', 'cp' : '"+cp+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var contact=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;SaveUser(contact,country)},error:function(msg){errorHandler("Basket.asmx","SaveContactInfoCompany",msg.responseText+"oId: "+$("#ownerBasket").val())}})}}function SaveUser(g,d){var k=document.getElementById("lblAdress2").innerHTML;var j=document.getElementById("txtZip2").value;var i=document.getElementById("txtCity2").value;var f=document.getElementById("lblEmailUser").innerHTML;var b=document.getElementById("txtRegUserPasswd").value;if(document.getElementById("chkSame").checked){k=document.getElementById("lblAdress").innerHTML;j=document.getElementById("txtZip").value;var i=document.getElementById("txtCity").value}var e=document.getElementById("txtDeliveryRecipient").value;var h=document.getElementById("lblContactPerson").innerHTML;$.ajax({type:"POST",url:"Basket.asmx/SaveWebshopUser",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+g+"', 'a' : '"+k+"', 'z' : '"+j+"', 'c' : '"+i+"', 'country' : '"+d+"', 'u' : '"+f+"', 'p' : '"+b+"', 'dr' : '"+e+"', 'cp' : '"+h+"','bId' : '"+$("#browserIdBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(a){$("#script").html('<script type="text/javascript">$(function() { $("#login_account").show(); });setTimeout(function() {$("#login_account").fadeOut();}, 1000);<\/script>');window.location.reload(true)},error:function(a){errorHandler("Basket.asmx","SaveWebshopUser",a.responseText+"oId: "+$("#ownerBasket").val()+"cId: "+g)}})}function SaveRegister(d){var e=document.getElementById(d);var c=e.selectedIndex;var b=e.options[c].text;var a=document.getElementById("txtEmailUser").value;emailExsist(a,b)}function ShowRegisteredInfo(c){var a=document.getElementById("txtusername").value;var f=isValid();if(f){$(".conf").show();$(".reg").hide();var b=$("#radioPerType");var h=$("#radioCusType");if(b.length==1&&b.get(0).checked==true){$("#spanCusType_Company").hide()}else{if(h.length==1&&h.get(0).checked==true){$("#spanCusType_Person").hide()}}document.getElementById("lblEmailUser").innerHTML=document.getElementById("txtEmailUser").value;var g="";var e=document.getElementById("txtRegUserPasswd").value.length;for(var d=0;d<e;d++){g+="*"}document.getElementById("lblRegUserPasswd").innerHTML=g;document.getElementById("lblRepeatPass").innerHTML=g;document.getElementById("lblCompName").innerHTML=document.getElementById("txtCompanyName").value;document.getElementById("lblOrgNo").innerHTML=document.getElementById("txtOrgNumber").value;document.getElementById("lblContactPerson").innerHTML=document.getElementById("txtContactPerson").value;document.getElementById("lblFirstName").innerHTML=document.getElementById("txtFirstName").value;document.getElementById("lblLastName").innerHTML=document.getElementById("txtLastName").value;document.getElementById("lblPhone").innerHTML=document.getElementById("txtPhone").value;document.getElementById("lblMobile").innerHTML=document.getElementById("txtMobile").value;document.getElementById("lblCountry").innerHTML=c;document.getElementById("lblAdress").innerHTML=document.getElementById("txtAdress").value;document.getElementById("lblZipCity").innerHTML=document.getElementById("txtZip").value+" "+document.getElementById("txtCity").value;document.getElementById("lblDeliveryRecipient").innerHTML=document.getElementById("txtDeliveryRecipient").value;if(document.getElementById("chkSame").checked){document.getElementById("lblAdress2").innerHTML=document.getElementById("txtAdress").value;document.getElementById("lblZipCity2").innerHTML=document.getElementById("txtZip").value+" "+document.getElementById("txtCity").value}else{document.getElementById("lblAdress2").innerHTML=document.getElementById("txtAdress2").value;document.getElementById("lblZipCity2").innerHTML=document.getElementById("txtZip2").value+" "+document.getElementById("txtCity2").value}}}function generatepass(){var e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var d=5;var c="";for(var a=0;a<d;a++){var b=Math.floor(Math.random()*e.length);c+=e.substring(b,b+1)}return c}function isValid(){var b=true;var a=document.getElementById("txtEmailUser").value;var c=validateEmail(a);if(c){document.getElementById("lblRegUserName_Alert").style.display="none"}else{document.getElementById("lblRegUserName_Alert").style.display="";b=false}if(document.getElementById("txtRegUserPasswd").value.length<5){b=false}document.getElementById("errorPassword").style.display=document.getElementById("txtRegUserPasswd").value.length<5?"":"none";if(document.getElementById("txtRegUserPasswd").value!=document.getElementById("txtRegUserRepeatPasswd").value){b=false}document.getElementById("errorRepeatPass").style.display=document.getElementById("txtRegUserPasswd").value==document.getElementById("txtRegUserRepeatPasswd").value?"none":"";if(document.getElementById("radioPerType").checked){document.getElementById("errorFirstName").style.display=document.getElementById("txtFirstName").value==""?"":"none";document.getElementById("errorLastName").style.display=document.getElementById("txtLastName").value==""?"":"none";if((document.getElementById("txtFirstName").value=="")||(document.getElementById("txtLastName").value=="")){b=false}}else{document.getElementById("errorCompName").style.display=document.getElementById("txtCompanyName").value==""?"":"none";document.getElementById("errorOrgNo").style.display=document.getElementById("txtOrgNumber").value==""?"":"none";if((document.getElementById("txtCompanyName").value=="")||(document.getElementById("txtOrgNumber").value=="")){b=false}}document.getElementById("errorAdress").style.display=document.getElementById("txtAdress").value==""?"":"none";if(document.getElementById("txtAdress").value==""){b=false}document.getElementById("errorZipCity").style.display=(document.getElementById("txtZip").value=="")||(document.getElementById("txtCity").value=="")?"":"none";if((document.getElementById("txtZip").value=="")||(document.getElementById("txtCity").value=="")){b=false}if(document.getElementById("chkTerms")!=null){if(document.getElementById("chkTerms").checked==false){b=false}document.getElementById("errorTerms").style.display=document.getElementById("chkTerms").checked?"none":""}return b}function validateEmail(b){var a=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;return a.test(b)}function emailExsist(id,cname){$.ajax({type:"POST",url:"Basket.asmx/CheckEmailExsist",data:"{'oId':'"+$("#ownerBasket").val()+"','value':'"+id+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;if(result){document.getElementById("lblRegUsername").style.display=""}else{document.getElementById("lblRegUsername").style.display="none";ShowRegisteredInfo(cname)}},error:function(msg){errorHandler("Basket.asmx","CheckEmailExsist",msg.responseText+"oId: "+$("#ownerBasket").val()+"email: "+id)}})}function ChangePassword(){var a=true;if(document.getElementById("txtOldPassword").value==""){document.getElementById("errorOldPassword").style.display="";a=false}else{document.getElementById("errorOldPassword").style.display="none"}if(document.getElementById("txtpassword").value==""){document.getElementById("errorPassword").style.display="";a=false}else{document.getElementById("errorPassword").style.display="none"}if(document.getElementById("txtpassword").value!=document.getElementById("repeatPassword").value){document.getElementById("errorRepeatPass").style.display="";a=false}else{document.getElementById("errorRepeatPass").style.display="none"}if(a){$.ajax({type:"POST",url:"Basket.asmx/Changep",data:"{'cId':'"+$("#contactBasket").val()+"','oldp':'"+$("#txtOldPassword").val()+"','newp':'"+$("#txtpassword").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){var c=b.d.lastIndexOf("false_");if(c!=-1){document.getElementById("msgPassword").innerHTML=b.d.replace("false_","");document.getElementById("msgPassword").style.color="Red"}else{document.getElementById("msgPassword").innerHTML=b.d.replace("true_","");document.getElementById("msgPassword").style.color="Green"}},error:function(b){errorHandler("Basket.asmx","Changep",b.responseText+"contact: "+$("#contactBasket").val())}})}}function UpdateAccountData(){var d=document.getElementById("txtPhone").value;var l=document.getElementById("txtMobile").value;var b=document.getElementById("txtAdress").value;var a=document.getElementById("txtZip").value;var c=document.getElementById("txtCity").value;var g=b;var m=a;var n=c;if(!document.getElementById("chkSame").checked){g=document.getElementById("lblAdress2").value;var m=document.getElementById("txtZip2").value;var n=document.getElementById("txtCity2").value}var e=document.getElementById("txtDeliveryRecipient").value;if(document.getElementById("txtFirstName")!=null){var j=document.getElementById("txtFirstName").value;var h=document.getElementById("txtLastName").value;$.ajax({type:"POST",url:"Basket.asmx/UpdateContactInfoPerson",data:"{'oId':'"+$("#ownerBasket").val()+"','fName':'"+j+"', 'lName' : '"+h+"', 'p' : '"+d+"', 'm' : '"+l+"', 'a' : '"+b+"', 'z' : '"+a+"', 'c' : '"+c+"', 'a2' : '"+g+"', 'z2' : '"+m+"', 'c2' : '"+n+"', 'dr' : '"+e+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(o){document.getElementById("msgUpdateAccount").innerHTML=o.d},error:function(o){errorHandler("Basket.asmx","UpdateContactInfoPerson",o.responseText+"oId: "+$("#ownerBasket").val()+"fname: "+j+"lName: "+h)}})}else{var k=document.getElementById("txtCompanyName").value;var f=document.getElementById("txtOrgNumber").value;var i=document.getElementById("txtContactPerson").value;$.ajax({type:"POST",url:"Basket.asmx/UpdateContactInfoCompany",data:"{'oId':'"+$("#ownerBasket").val()+"','orgNo':'"+f+"', 'cName' : '"+k+"', 'p' : '"+d+"', 'm' : '"+l+"', 'a' : '"+b+"', 'z' : '"+a+"', 'c' : '"+c+"', 'a2' : '"+g+"', 'z2' : '"+m+"', 'c2' : '"+n+"','cp' : '"+i+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(o){document.getElementById("msgUpdateAccount").innerHTML=o.d},error:function(o){errorHandler("Basket.asmx","UpdateContactInfoCompany",o.responseText+"oId: "+$("#ownerBasket").val()+"orgNo: "+f+"cName: "+k)}})}}function GetUserControl(finished){$.ajax({type:"POST",url:"Basket.asmx/CheckSession",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;var id=gup("pageid");var plid=gup("plId");if(result){if(finished){getData("Basket.asmx/GetControlHtml","~/Webshop/Controls/ucShoppingFinished.ascx");$("#basketBig_footer").hide()}else{$("#basketBig_footer").show();$(".confirm").show();$("#basketBig_footer .b-checkout").hide();getData("Basket.asmx/GetControlHtml?pageid="+id+"&plid="+plid,"~/Webshop/Controls/ucShopping.ascx")}}else{$("#basketBig_footer").hide();getData("Basket.asmx/GetControlHtml?pageid="+id+"&plid="+plid,"~/Webshop/Controls/uclogin_registration.ascx")}},error:function(msg){errorHandler("Basket.asmx","CheckSession",msg.responseText+"oId: "+$("#ownerBasket").val()+"cId: "+$("#contactBasket").val())}})}function gup(b){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+b+"=([^&#]*)";var d=new RegExp(a);var c=d.exec(window.location.href);if(c==null){return""}else{return c[1]}}$.urlParam=function(a){var b=new RegExp("[\\?&]"+a+"=([^&#]*)").exec(window.location.href);if(!b){return 0}return b[1]||0};function CheckSession(){$.ajax({type:"POST",url:"Basket.asmx/CheckSession",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d)=="string"?eval("("+response.d+")"):response.d;return result},error:function(msg){errorHandler("Basket.asmx","CheckSession",msg.responseText+"oId: "+$("#ownerBasket").val()+"cId: "+$("#contactBasket").val())}})}function ConfirmCheckOut(){var pw=document.getElementsByName("payWayType");var p=0;for(var i=0;i<pw.length;i++){if(pw[i].checked){p=pw[i].value}}var pn="",t="";if($("#pn").length){pn=$("#pn").val();t=$("#tn").val()}var dw=document.getElementsByName("deliveryType");var d=0;for(var i=0;i<dw.length;i++){if(dw[i].checked){d=i}}var confirm=true;if(document.getElementById("required_msg")!=null){if($("#txtMsg").val()==""){confirm=false}}if(confirm){$("#loader").html('<div><img src="images/loader2.gif" /></div>');$("#basketBig_footer").hide();$.ajax({type:"POST",url:"Basket.asmx/ConfirmCheckOut",data:"{'oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"','b':'"+$("#browserIdBasket").val()+"','p':'"+p+"','d':'"+d+"','m':'"+$("#txtMsg").val()+"', 'n':'"+$("#pn").val()+"', 't':'"+$("#tn").val()+"', 'kp':'"+($("#kp").val()!="undefined"?$("#kp").val():"-1")+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(response){var result=(typeof response.d=="string"&&response.d.length>0?eval("("+response.d+")"):response.d);if(typeof result.Error!="undefined"&&result.Error=="true"){if(typeof result.Message!="undefined"&&result.Message.length>0){alert(result.Message)}if(typeof result.Url!="undefined"&&result.Url.length>0){window.location=result.Url}}else{if(typeof result.Url!="undefined"&&result.Url.length>0){window.location=result.Url}else{document.location.replace("#step4")}}$("#loader").empty();$("#basketBig_footer").show();getBasketProducts(true,true);window.scrollTo(200,400)},error:function(msg){alert(msg.responseText)}})}else{$("#txtMsg").focus()}}function showUserAccount(){$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"Basket.asmx/GetControlHtml",data:"{'controlLocation':'~/Webshop/Controls/ucUserOrders.ascx'}",success:function(response){var result=(typeof response)=="string"?eval("("+response+")"):response;var nav=document.getElementById("breadcrumb").innerHTML;if(!document.getElementById("breadcrumb").innerHTML.contains(unescape("Min side"))){nav+=" &#187; Min side"}var html='<div id="breadcrumb" class="black">'+nav+"</div>";if(document.getElementById("ordersList_nav")!=null){document.getElementById("ordersList_nav").innerHTML='<span>Mine ordrer </span><a href="#" onclick="EditAccountInfo(); return false;">Mine opplysninger</a>'}else{html+='<div id="ordersList_nav"><span>Mine ordrer </span><a href="#" onclick="EditAccountInfo(); return false;">Mine opplysninger</a></div>'}$("#products").empty();document.getElementById("products").innerHTML=html+result.d;$(".descr").hide();$(".orderno").click(function(){if($(this).hasClass("toggla_hide")){$(this).removeClass("toggla_hide")}else{if($(this).hasClass("arrowOrder")){$(this).addClass("toggla_hide")}}if($(this).hasClass("arrowOrder")){$(this).next().next().next().next().slideToggle(600)}})},error:function(msg){errorHandler("Basket.asmx","GetControlHtml",msg.responseText+"control: ucUserOrders.ascx")}})}function EditAccountInfo(){var id=gup("pageid");$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"Basket.asmx/GetControlHtml?pageid="+id,data:"{'controlLocation':'~/Webshop/Controls/ucEditAccount.ascx'}",success:function(response){var result=(typeof response)=="string"?eval("("+response+")"):response;var nav=document.getElementById("breadcrumb").innerHTML;if(!document.getElementById("breadcrumb").innerHTML.contains(unescape("Min side"))){nav+=" &#187; Min side"}var html='<div id="breadcrumb" class="black">'+nav+"</div>";html+='<div id="ordersList_nav"><a href="#" onclick="showUserAccount(); return false;">Mine ordrer </a><span>Mine opplysninger</span></div>';$("#products").empty();document.getElementById("products").innerHTML=html+result.d},error:function(msg){errorHandler("Basket.asmx","GetControlHtml",msg.responseText+"control: ucEditAccount.ascx")}})}String.prototype.contains=function(a){return new RegExp(a,"i").test(this)};function ShowOrder(id){var d=document.getElementById("descr"+id);var $kids2=$("#descr"+id).children();if($kids2.length<=0){$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:"Basket.asmx/GetOrderInfo",data:"{'id':'"+id+"','oId':'"+$("#ownerBasket").val()+"','cId':'"+$("#contactBasket").val()+"'}",success:function(response){var result=(typeof response)=="string"?eval("("+response+")"):response;document.getElementById("descr"+id).innerHTML=result.d},error:function(msg){errorHandler("Basket.asmx","GetOrderInfo",msg.responseText+"oId: "+$("#ownerBasket").val()+"id: "+id)}})}}function showPages(a,m){var g=m.id;$("#nav_paging0 a").removeClass("selectedPager");$("#nav_paging1 a").removeClass("selectedPager");$("#"+m.id).addClass("selectedPager");var r=m.id.lastIndexOf("pagertop");if(r>-1){$("#"+m.id.replace("pagertop","pagerbottom")).addClass("selectedPager")}else{$("#"+m.id.replace("pagerbottom","pagertop")).addClass("selectedPager")}document.getElementById("pager").value=a;var k=document.getElementsByTagName("select");var l=new Array();for(var h=0;h<k.length;h++){var c=document.getElementsByName(k[h].name);for(var f=0;f<c.length;f++){var q=c.item(f).value;if(q!=""){l.push(q)}}}var b=GetOrder();var n=GetDir();ListProducts(l,b,n)}function sendForgotPassword(){var a=$("#emailforgot").val();if(a!=""){$.ajax({type:"POST",url:"Basket.asmx/SendForgotPassword",data:"{'oId':'"+$("#ownerBasket").val()+"','mail':'"+a+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){$("#statusForgotPass").empty();document.getElementById("statusForgotPass").innerHTML=b.d},error:function(b){errorHandler("Basket.asmx","SendForgotPassword",b.responseText+"oId: "+$("#ownerBasket").val()+"mail: "+a)}})}}function fnTrapKD(a,b){if((document.all)||(document.getElementById)||(document.layers)){if(b.keyCode==13){b.returnValue=false;b.cancel=true;document.getElementById(a).click();return false}}}function showDetails(){$("#window2").jqm({ajax:"Webshop/ProductDetails.aspx?pageid=3934&Product=5113"})};
