var Rank=-1;var MaxRank=-1;var Custfailed=false;var CustPrice=0;var PlotArray=new Array();var currencydisplay=false;var parameters="";var addtocartfunction="";var addtocartfunctionorig="";function RestrictShipPopup(a){window.open(a,null,"height=300, width=500, status=yes, toolbar=no, menubar=no, location=no, scrollbars=yes");void ("")}function ItemToggle(b){var a=b.getElementsByTagName("img");switch(b.id){case"proddesc":element=document.getElementById("divproddesc").style;break;case"specification":element=document.getElementById("divspecification").style;break;case"resources":element=document.getElementById("divresources").style;break;case"manufacturerinfo":element=document.getElementById("divmanufacturerinfo").style;break;case"similaritems":element=document.getElementById("divsimilaritems").style;break;case"customerdiscussion":element=document.getElementById("divcustomerdiscussion").style;break;case"engravingitems":element=document.getElementById("divengravingitems").style;break}if(element.display=="block"){element.display="none";a[0].src="Images/expand.jpg";a[0].alt="Expand"}else{element.display="block";a[0].src="Images/collapse.jpg";a[0].alt="Collapse"}}function ToggleCheck(a){if(a.value==0){a.checked=true;a.value=1}else{if(a.value==1){a.checked=false;a.value=0}}}function ToggleCustDiscussionDesc(a){elementshort=document.getElementById("divdescshort"+a.id).style;elementfull=document.getElementById("divdescfull"+a.id).style;if(elementfull.display=="block"){elementfull.display="none";elementshort.display="block";a.alt="Expand"}else{elementfull.display="block";elementshort.display="none";a.alt="Collapse"}}function ValidateQty(c,a,d,b){if(c.value==""){return}if(c.value<b){if(a==0){c.value=b;document.getElementById("divQtyMin").style.display="block"}else{c.value=b;document.getElementById("gcdivminqty"+a).style.display="block"}}else{if(c.value>d&&d!=-1){if(a==0){document.getElementById("divCartLimit").style.display="block"}else{document.getElementById("gcdivcartlimit"+a).style.display="block"}}else{if(a==0){document.getElementById("divQtyMin").style.display="none";document.getElementById("divCartLimit").style.display="none"}else{document.getElementById("gcdivcartlimit"+a).style.display="none";document.getElementById("gcdivminqty"+a).style.display="none"}}}}function Popup(a){if(a.id.substring(0,1)=="T"){var b="DT"+a.id.substring(1);ToolTip_Show(a,document.getElementById(b).innerHTML,"")}else{if(a.id.substring(0,1)=="R"){b="DR"+a.id.substring(1);ToolTip_Show(a,document.getElementById(b).innerHTML,"")}}}function ToolTip_Show(a,c,d){intIndexOfMatch=0;var b;if(c!=""||d!=""){while(intIndexOfMatch!=-1){c=c.replace("¿","'");intIndexOfMatch=c.indexOf("¿")}if(d==""){b="<table><tr><td>"+c+"</td></tr></table>"}else{b="<table><tr valign='top'><td><img alt='' src='"+d+"'/></td><td>"+c+"</td></tr></table>"}a.tt=new zxcOOPToolTip(a,b);clearTimeout(a.tt.to);a.tt.setTimeOut("show()",0)}}function zxcOOPToolTip(b,d){var e=document.getElementById("divtooltip");e.innerHTML="<div style='text-align:right;'><img src='Images/close.gif' alt='' onclick='Tooltip_Hide()' /></div>"+d;var c=(Tooltip_getLeftPos(b)+b.offsetWidth);var a=Tooltip_getTopPos(b);e.style.left=c+"px";e.style.top=a+"px";this.tt=e;this.ref="zxcooptt";window[this.ref]=this;this.to=null}zxcOOPToolTip.prototype.show=function(){this.tt.style.display="block"};zxcOOPToolTip.prototype.hide=function(){this.tt.style.display="none"};zxcOOPToolTip.prototype.setTimeOut=function(a,b){this.to=setTimeout("window."+this.ref+"."+a,b)};function Tooltip_getTopPos(b){var a=b.offsetTop;while((b=b.offsetParent)!=null){if(b.tagName!="HTML"){a+=b.offsetTop}}return a}function Tooltip_getLeftPos(b){var a=b.offsetLeft;while((b=b.offsetParent)!=null){if(b.tagName!="HTML"){a+=b.offsetLeft}}return a}function Tooltip_Hide(){if(document.getElementById("divtooltip")!=null){document.getElementById("divtooltip").style.display="none"}}function CustDiscussionOnClick(a,c,b){parameters="{'itemNo':'"+a+"','desc':'"+c+"','pgIndex':'"+b+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetCustDiscussion",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(d){OnCustDiscussionSucceeded(d.d)},error:function(f,d,e){}});return false}function OnCustDiscussionFailed(){}function OnCustDiscussionSucceeded(a){ele=document.getElementById("divcustomerdiscussion");ele.innerHTML=a}function DropDownListCompSelected(a,e,g){var d=false;var c=0;var f=e.options[e.selectedIndex].value;var h=e.options[e.selectedIndex].title;var b=h.indexOf("¿",0);if(b>=0){d=h.substring(0,b);c=h.substring(b+1)}$("input[name='crdcomp']").each(function(){if($(this).val()==f){$(this).attr("checked",true)}});ListCompSelectionChange(a,f,g,d,c)}function RadioListCompSelected(a,e,g,c,b){var f=e.value;var d=document.getElementById("ddlistcomp").options;for(i=0;i<d.length;i++){if(d[i].value==f){d[i].selected=true}}ListCompSelectionChange(a,f,g,c,b)}function ListCompSelectionChange(a,d,e,c,b){parameters="{'ParentItemNo':'"+a+"','SelectedItemNo':'"+d+"','SourceCode':'"+e+"','PriceDisplay':'"+c+"','PriceMatchID':'"+b+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetSelectedListComp",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(f){OnListCompSelectionChangeSucceeded(f.d)},error:function(h,f,g){alert(h.statusText)}});return false}function OnListCompSelectionChangeFailed(){}function OnListCompSelectionChangeSucceeded(a){if(a!=null){if(a[0]!=null&&a[0]!=""){document.getElementById("ctl00_ContentPlaceHolder1_segshortdesc").innerHTML=a[0]}if(a[1]!=null&&a[1]!=""){$("#ctl00_ContentPlaceHolder1_segresourcepromo").html(a[1]);$("#ctl00_ContentPlaceHolder1_segresourcepromo").css("display","block")}else{$("#ctl00_ContentPlaceHolder1_segresourcepromo").css("display","none")}$("#ctl00_ContentPlaceHolder1_segimage").html(a[2]);$("#ctl00_ContentPlaceHolder1_segranking").html(a[3]);if(a[4]!=null&&a[4]!=""){$("#ctl00_ContentPlaceHolder1_segresources").html(a[4]);$("#ctl00_ContentPlaceHolder1_segresources").css("display","block")}else{$("#ctl00_ContentPlaceHolder1_segresources").css("display","none")}if(a[5]!=null&&a[5]!=""){$("#ctl00_ContentPlaceHolder1_segmanfinfo").html(a[5]);$("#ctl00_ContentPlaceHolder1_segmanfinfo").css("display","block")}else{$("#ctl00_ContentPlaceHolder1_segmanfinfo").css("display","none")}$("#ctl00_ContentPlaceHolder1_segqty").html(a[6]);if(a[7]!=null&&a[7]!=""){$("#ctl00_ContentPlaceHolder1_segcustomization").html(a[7]);$("#ctl00_ContentPlaceHolder1_segcustomization").css("display","block")}else{$("#ctl00_ContentPlaceHolder1_segcustomization").html("");$("#ctl00_ContentPlaceHolder1_segcustomization").css("display","none")}}}function VKitSelectionChange(a,d,c,e){var b="";$("select[name='ddvkitcomp'] :selected").each(function(){b+="¿"+$(this).val()});if(b!=""){parameters="{'ParentItemNo':'"+a+"','SelectedItemNos':'"+b+"','PriceDisplay':'"+d+"','PriceMatchID':'"+c+"','SourceCode':'"+e+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetVKitCompPriceandAvail",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(f){OnVKitSelectionChangeSucceeded(f.d)},error:function(h,f,g){}});return false}}function OnVKitSelectionChangeFailed(){}function OnVKitSelectionChangeSucceeded(a){var b=document.getElementById("ctl00_ContentPlaceHolder1_segprice");if(b!=null){b.innerHTML=a}setPostBackPriceRef()}function disableAddtocart(){var b=document.getElementById("AddtoCartButtonItem");var c=b.innerHTML;var d=0;if(c.indexOf("return")>0){return false}addtocartfunctionorig=c;d=c.indexOf("AddToButtonClick");var a=c.indexOf("alt");addtocartfunction=c.substring(d,a-2);b.innerHTML=c.substr(0,d)+'return false;"'+c.substr(a)}function enableAddtocart(){var a=document.getElementById("AddtoCartButtonItem");a.innerHTML=addtocartfunctionorig}function allstyleon(){var b=true;var a=$("#ipdropdownsID1");if(a.val()!=null&&a.children()[0].selected){b=false}a=$("#ipdropdownsID2");if(a.val()!=null&&a.children()[0].selected){b=false}a=$("#ipdropdownsID3");if(a.val()!=null&&a.children()[0].selected){b=false}return b}function StyleSelectionChange(a,e,f,g){var c="";var b="";if(!allstyleon()){return false}disableAddtocart();$("#AddtoCartButtonItem img:first").fadeOut("slow");$("select[name='ddstyles'] :selected").each(function(){c+="¿"+$(this).val();b+=" "+$(this).attr("title")});if(c!=""){var d="{'ParentItemNo':'"+a+"','SelectedPropVal':'"+c+"','SelectedPropText':'"+b.replace(/\'/g,"\\'")+"','PriceDisplayandPriceMatchID':'"+e+"','SourceCode':'"+f+"','ErrMsg':'"+g+"','topID':'0','leftID':'0'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetSelectedStyleComp",data:d,contentType:"application/json; charset=utf-8",dataType:"json",success:function(h){OnStyleSelectionChangeSucceeded(h.d)},error:function(m,h,l){}});return false}}function IntStyleSelectionChange(g,b,h,f,l){var c="";var m="";var e=null;var n=true;disableAddtocart();$(".style_container").each(function(){if($(this).find("select[name='ddstyles']").length>0){e=$(this).find("select[name='ddstyles']");if($(e).val()==-1){$(e)[0].selectedIndex=1}c+="¿"+$(e).val()}else{if($(this).find("UL").length>0){e=$(this).find("UL");var o="";$(e).children("li").each(function(){if(l>0){if(l==$(this).attr("id")){o=$(this).attr("id");$(this).css("borderWidth","3px")}else{$(this).css("borderWidth","1px")}}else{if($(this).css("borderWidth").indexOf("3px",0)!=-1){o=$(this).attr("id")}}});if(o!=""){c+="¿"+o}else{c+="¿"+$(this).find("UL li:first").attr("id")}}}});$("select[name='ddstyles'] :selected").each(function(){m+=" "+$(this).attr("title")});var d=0;var a=0;list=document.getElementById("topfilter");for(i=0;i<list.childNodes.length;i++){child=list.childNodes.item(i);if(child.innerHTML!=null){if(child.innerHTML.indexOf("_on",0)>0){d=child.id.substring(1);break}}}list=document.getElementById("leftfilter");for(i=0;i<list.childNodes.length;i++){child=list.childNodes.item(i);if(child.innerHTML!=null){if(child.innerHTML.indexOf("_on",0)>0){a=child.id.substring(1);break}}}if(c!=""){parameters="{'ParentItemNo':'"+g+"','SelectedPropVal':'"+c+"','SelectedPropText':'"+m+"','PriceDisplayandPriceMatchID':'"+b+"','SourceCode':'"+h+"','ErrMsg':'"+f+"','topID':'"+d+"','leftID':'"+a+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetSelectedStyleComp",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(o){OnStyleSelectionChangeSucceeded(o.d);SetDraggables()},error:function(q,o,p){}});return false}}function OnStyleSelectionChangeSucceeded(a){if(a.length==1){if(document.getElementById("ctl00_ContentPlaceHolder1_segintstyles").innerHTML!=""){err=document.getElementById("segstyleerr2")}else{err=document.getElementById("segstyleerr1")}err.innerHTML=a[0];err.style.display="block";err.style.background="ivory";err.style.color="red"}else{document.getElementById("segstyleerr1").style.display="none";document.getElementById("segstyleerr2").style.display="none";if(document.getElementById("ctl00_ContentPlaceHolder1_segintstyles").innerHTML!=""){err=document.getElementById("segstyleerr2")}else{err=document.getElementById("segstyleerr1")}err.innerHTML=" ";document.getElementById("ctl00_ContentPlaceHolder1_segshortdesc").innerHTML=a[0];document.getElementById("ctl00_ContentPlaceHolder1_segimage").innerHTML=a[1];document.getElementById("ctl00_ContentPlaceHolder1_segranking").innerHTML=a[2];document.getElementById("ctl00_ContentPlaceHolder1_segprice").innerHTML=a[3];enableAddtocart();setPostBackPriceRef();if(a[5]!=null&&a[5]!=""){$("#ctl00_ContentPlaceHolder1_segcustomization").html(a[5]);$("#ctl00_ContentPlaceHolder1_segcustomization").css("display","block");if(currencydisplay){var b=document.getElementById("custpriceperchar");if(b!=null){b.innerHTML=getInitPriceSavingRef(b.innerHTML)}b=document.getElementById("custprice");if(b!=null){b.innerHTML=getInitPriceSavingRef(b.innerHTML)}}}else{$("#ctl00_ContentPlaceHolder1_segcustomization").html("");$("#ctl00_ContentPlaceHolder1_segcustomization").css("display","none")}if(a[6]!=null&&a[6]!=""){$("#ctl00_ContentPlaceHolder1_segintstyles").html(a[6]);$("#ctl00_ContentPlaceHolder1_segintstyles").css("display","block")}else{$("#ctl00_ContentPlaceHolder1_segintstyles").css("display","none")}if(a[7]!=null&&a[7]!=""){$("#ctl00_ContentPlaceHolder1_seggrpitems").html(a[7]);$("#ctl00_ContentPlaceHolder1_seggrpitems").css("display","block")}else{$("#ctl00_ContentPlaceHolder1_seggrpitems").css("display","none")}if(document.getElementById("ctl00_ContentPlaceHolder1_seggrpitems")!=null){if(document.getElementById("ctl00_ContentPlaceHolder1_seggrpitems").innerHTML!=""){SetDroppables();SetPreloadedIcons();CalIntItemPrice()}}}}function EngSelectionChange(a){var b=0;$("select[name='ddengvkitcomp'] :selected").each(function(){b+=$(this).attr("title")});parameters="{'webprice':'"+b+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/EngItemPriceFormat",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){OnEngPriceFormatSucceeded(c.d)},error:function(e,c,d){}});return false}function OnEngPriceFormatSucceeded(a){$("#divengprice").html("<label class='ourprice4'>"+a+"</label>")}function OnGetNoAttachmentErrSucceeded(a){$("#segstyleerr1").removeAttr("style");$("#segstyleerr1").html(a)}function AddToButtonClick(z,v,r,D){var m;var b;var E;var B="";var q="";var s="";var c=0;var d=0;var a=false;var y=0;var l=0;var G=0;var n="";var t="";var x="";var F=1;var f=1;var h="";var A="";var o=false;var w=false;var g=new RegExp("[1-9]");var p="";var C="";$("#segstyleerr1").html("");var u=true;$(".style_container").each(function(){if($(this).find("select[name='ddstyles']").length>0){E=$(this).find("select[name='ddstyles']");if($(E).val()==-1){u=false;return false}}else{if($(this).find("UL").length>0){E=$(this).find("UL");var H=false;$(E).children("li").each(function(){if($(this).find("img").css("borderWidth").indexOf("3px",0)!=-1){H=true}});if(H==false){u=false;return false}}}});if(!u){$("#segstyleerr1").html("Please select style options");$("#segstyleerr1").css({"background-color":"ivory",color:"red",display:"block",padding:"0",margin:"0"});return false}if($("#ddlistcomp").val()=="-1"){$("#segstyleerr1").html("Please select a list item");$("#segstyleerr1").css({"background-color":"ivory",color:"red"});return false}if(!allstyleon()){return}disableAddtocart();if($("#divimg").length>0){for(i=0;i<PlotArray.length;i++){if(PlotArray[i][2]!=""){w=true;break}}if(!w){parameters="{}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetNoAttachmentErr",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(H){OnGetNoAttachmentErrSucceeded(H.d)},error:function(J,H,I){}});return false}}w=false;if($("#tblCust").length>0){CalculateCustPrice();if(Custfailed){return}}if(v=="CART"||v=="WISHLIST"){B=$("#itemno").attr("title");q=$("#txtQuantity").val()}else{if(v=="EKITCART"){B=r;q=D}else{if(v=="ITEMLISTCART"||v=="WISHLISTCART"){B=r;q=D;v="CART"}}}if(v=="CART"||v=="GRIDCART"||v=="EKITCART"){$("input[name='ckaddrectoorder']").each(function(){if($(this).is(":checked")){s+="¿"+$(this).attr("id")}});$("input[name='ckaddtoptoorder']").each(function(){if($(this).is(":checked")){s+="¿"+$(this).attr("id")}})}if(v=="CART"||v=="WISHLIST"){if($("input[name='crdcomp']").length>0){$("input[name='crdcomp']").each(function(){if($(this).is(":checked")){position=$(this).attr("id").substring($(this).attr("id").indexOf("-",0)+1);if($("#cwebprice"+position).length>0){c=trim($("#cwebprice"+position).text())}if($("#cexclvatprice"+position).length>0){c=trim($("#cexclvatprice"+position).text())}if($("#csurchrg"+position).length>0){d=trim($("#csurchrg"+position).text())}if($("#cexclvatsurchrg"+position).length>0){d=trim($("#cexclvatsurchrg"+position).text())}if($("#cpriceoverride"+position).length>0){y=1;l=$("#cpriceoverride"+position).val();if(!g.test(l)){$("#cpriceoverride"+position).css("color:red");$("#cpriceoverride"+position).focus();return}}if($("#cpricematch"+position).length>0){y=2;l=trim($("#cpricematch"+position).text())}if($("#cpricematchid").length>0){G=$("#cpricematchid").val()}if($("#cavail"+position).length>0){a=$("#cavail"+position).val()}}})}else{if($("#webprice").length>0){c=trim($("#webprice").text())}if($("#exclvatprice").length>0){c=trim($("#exclvatprice").text())}if($("#surchrg").length>0){d=trim($("#surchrg").text())}if($("#exclvatsurchrg").length>0){d=trim($("#exclvatsurchrg").text())}if($("#priceoverride").length>0){y=1;l=$("#priceoverride").val();if(!g.test(l)){$("#priceoverride").css("color:red");$("#priceoverride").focus();return}}if($("#pricematch").length>0){y=2;l=trim($("#pricematch").text())}if($("#pricematchid").length>0){G=$("#pricematchid").val()}if($("#avail").length>0){a=$("#avail").val()}}}if(v=="CART"){$("#tblCust input:text").each(function(){n+="¿"+$(this).val()});if($("#custdisptxt").length>0){p=$("#custdisptxt").val()}$("select[name='ddvkitcomp'] :selected").each(function(){if($(this).attr("selectedIndex")!=0){t+="¿"+$(this).val()}});if($("#divimg").length>0){for(i=0;i<PlotArray.length;i++){if(PlotArray[i][2]!=""){t+="¿"+PlotArray[i][2]+"|"+PlotArray[i][1]}}}if($("#ckengraving").is(":checked")){x=$("#eitemno").val();f=$("#eitemtype").val();$("input[name='txtCustParam']").each(function(){h+="¿"+$(this).val()});$("select[name='ddengvkitcomp'] :selected").each(function(){var H=$(this).val().indexOf(" : ",0);if(H!=-1){A+="¿"+$(this).val().substr(H+3)}else{A+="¿"+$(this).val()}})}}if(v=="GRIDCART"||v=="GRIDWISHLIST"){$(".gridcomp *").each(function(){var H=$(this).attr("id");var I=$(this).attr("name");if(H!=null&&H!=""){if(H.indexOf("gcitemno",0)!=-1){B=$(this).attr("title")}else{if(H.indexOf("gcpricematch",0)!=-1){y=2;l=trim($(this).val())}else{if(H.indexOf("gcpriceoverride",0)!=-1){y=1;l=trim($(this).val());if(!g.test(l)){$(this).css("color","red");$(this).focus();return}}else{if(H.indexOf("gcwebprice",0)!=-1){c=trim($(this).text())}else{if(H.indexOf("gcexclvatprice",0)!=-1){c=trim($(this).text())}else{if(H.indexOf("gcsurchrg",0)!=-1){d=trim($(this).text())}else{if(H.indexOf("gcexclvatsurchrg",0)!=-1){d=trim($(this).text())}else{if(H.indexOf("gctxtQuantity",0)!=-1){q=$(this).val();if(q>0){C+="<Item>";C+="<ItemNo>"+B+"</ItemNo>";C+="<ItemType>"+z+"</ItemType>";C+="<Qty>"+q+"</Qty>";C+="<PriceOvrdFlag>"+y+"</PriceOvrdFlag>";C+="<PriceOvrdAmt>"+l+"</PriceOvrdAmt>";C+="<PriceMatchID>"+G+"</PriceMatchID>";C+="<WebPrice>"+c+"</WebPrice>";C+="<Stock>"+a+"</Stock>";C+="<SurChrg>"+d+"</SurChrg>";C+="<VKits>"+t+"</VKits>";C+="</Item>"}t=""}}}}}}}}}else{if(I=="gcitemtype"){z=$(this).val()}else{if(I=="gcpricematchid"){G=$(this).val()}else{if(I=="gcavail"){a=$(this).val()}else{if(I=="ddvkitcomp"){if($(this).val()!="0"){t+="¿"+$(this).val()}}}}}}})}if(v=="CART"||v=="EKITCART"){var e=p.replace("'","&#39;");parameters="{'ItemNo':'"+B+"','ItemType':'"+z+"','Qty':'"+q+"','AddToOrderItems':'"+s+"','PriceOvrdFlag':'"+y+"','PriceMatchId':'"+G+"','PriceOvrdAmt':'"+l+"','Customization':'"+n+"','VkitComps':'"+t+"','EngItemNo':'"+x+"','EngQty':'"+F+"','EngItemType':'"+f+"', 'EngCustomization':'"+h+"','EngVKits':'"+A+"','CustPrice':'"+CustPrice+"','CustDispText':'"+e+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/AddItemToCart",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(H){OnAddToCartSucceeded(H.d)},error:function(J,H,I){OnAddToCartFailed(J,H,I)}})}else{if(v=="GRIDCART"){parameters="{'GridComps':'<Items>"+C+"</Items>','AddToOrderItems':'"+s+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/AddItemsToCart",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(H){OnAddToCartSucceeded(H.d)},error:function(J,H,I){OnAddToCartFailed(J,H,I)}})}else{if(v=="WISHLIST"){parameters="{'ItemNo':'"+B+"','ItemType':'"+z+"','Qty':'"+q+"','WebPrice':'"+c+"','Surcharge':'"+d+"','Stock':'"+a+"','PriceOvrdAmt':'"+l+"','CustPrice':'"+CustPrice+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/AddItemToWishList",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(H){OnAddToWishListSucceeded(H.d)},error:function(J,H,I){}})}else{if(v=="GRIDWISHLIST"){parameters="{'GridComps':'<Items>"+C+"</Items>'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/AddItemsToWishList",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(H){OnAddToWishListSucceeded(H.d)},error:function(J,H,I){}})}}}}return false}function OnAddToCartFailed(xhr,status,error){var err=eval("("+xhr.responseText+")");var displayMessage=(err.Message!==undefined)?err.Message:"An error occurred adding this item to your cart.";$("#segstyleerr1").html(displayMessage);$("#segstyleerr1").css({"background-color":"ivory",color:"red"})}function OnAddToCartSucceeded(a){var c=a.split("||");var b=c[0];var d=c[1];enableAddtocart();if(d=="true"){GetFloatingCart(b)}else{var e="/CartPage.aspx";if(b!=null||b.length>0){if(b.indexOf("--item-")>-1){e="/CartPage"+b}}window.location.href=e}}function OnAddToWishListFailed(){}function OnAddToWishListSucceeded(a){window.location.href="Members/WishListUpdate.aspx"}function ToggleRateIt(b){var c=b.options[b.selectedIndex].value;Rank=c;MaxRank=b.length-1;var e=document.getElementById("divcustrating");var a;if(e!=null){for(a=0;a<e.childNodes.length;a++){var d=e.childNodes.item(a);if(d.nodeName=="IMG"){if(c==-1){d.style.visibility="hidden"}else{d.style.visibility="visible"}break}}}}function RateItOnClick(a){parameters="{'itemno':'"+a+"','rank':'"+Rank+"','maxrank':'"+MaxRank+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/InsertItemOverallRanking",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){OnRateItSucceeded(b.d)},error:function(d,b,c){}});return false}function OnRateItFailed(){}function OnRateItSucceeded(a){window.location.href=a}function CalculateCustPrice(){PricePerChar=0;PricePerCharThld=0;FlatFee=0;defCurSymbol="";customization="";Custfailed=false;PricePerChar=new Number($("#PricePerChar").val());PricePerCharThld=new Number($("#PricePerCharThld").val());FlatFee=new Number($("#FlatFee").val());defCurSymbol=$("#defSymbol").val();$("#tblCust input:text").each(function(){if($(this).attr("name")=="txtCustReq"&&trim($(this).val()).length==0){$(this).focus();Custfailed=true;$(this).parent().parent().find(".custreq").css({color:"Red"})}else{if($(this).attr("name")=="txtCustReq"&&trim($(this).val()).length>0){$(this).parent().parent().find(".custreq").css({color:"Black"});customization+=trim($(this).val())}else{if($(this).attr("name")=="txtCustOpt"){customization+=trim($(this).val())}}}});if(Custfailed){return -1}CustPrice=0;if(customization.length>0&&(PricePerChar>0||FlatFee>0)){CustPrice=FlatFee;j=0;temp=new Array();for(i=0;i<customization.length;i++){if(customization[i]!=" "){temp[j]=customization[i];j++}}if(temp.length>PricePerCharThld){CustPrice=((temp.length-PricePerCharThld)*PricePerChar)+FlatFee}var b=document.createElement("div");b.innerHTML=setCustCalPrice(defCurSymbol+CustPrice.toFixed(2));CustPrice=b.innerHTML;var a=document.getElementById("custprice");if(a!=null){a.innerHTML=CustPrice}}}function GridVKitSelectionChange(e,a,d,c,f,g){var b="";$("select[name='ddvkitcomp'] :selected").each(function(){b+="¿"+$(this).val()});if(b!=""){parameters="{'GridHdr':'"+e+"','ParentItemNo':'"+a+"','SelectedItemNos':'"+b+"','PriceDisplay':'"+d+"','PriceMatchID':'"+c+"','SourceCode':'"+f+"','CompPosition':'"+g+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GridVKitSelectionChange",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(h){OnGridVKitSelectionChangeSucceeded(h.d)},error:function(m,h,l){}});return false}}function OnGridVKitSelectionChangeFailed(){}function OnGridVKitSelectionChangeSucceeded(a){for(row=document.getElementById("tbgridcomp").rows[0];row!=null;row=row.nextSibling){if(row.nodeType==1&&row.rowIndex==a[0]){for(cell=row.firstChild;cell!=null;cell=cell.nextSibling){if(cell.nodeType==1){if(cell.innerHTML.indexOf("gcavail",0)>0){cell.innerHTML=a[1]}else{if(cell.innerHTML.indexOf("tdprice",0)>0){cell.innerHTML=a[2]}}}}}}}function TopFilterChange(d,c){InteractiveImgID=0;if(document.getElementById("intimgid")!=null){InteractiveImgID=document.getElementById("intimgid").value}var e=document.getElementById("topfilter");var a=0;var b=0;for(i=0;i<e.childNodes.length;i++){var f=e.childNodes.item(i);if(f==d){f.innerHTML=f.innerHTML.replace("_off","_on")||f.innerHTML.replace("_Off","_on");a=f.id.substring(1)}}e=document.getElementById("leftfilter");for(i=0;i<e.childNodes.length;i++){f=e.childNodes.item(i);if(f.innerHTML!=null){if(f.innerHTML.indexOf("_on",0)>0||f.innerHTML.indexOf("_On",0)>0){b=f.id.substring(1);break}}}parameters="{'itemNo':'"+c+"','topID':'"+a+"','leftID':'"+b+"','InteractiveImgID':'"+InteractiveImgID+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetGroupItems",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(g){OnGetGroupItemsSucceeded(g.d)},error:function(l,g,h){}});return false}function LeftFilterChange(d,c){InteractiveImgID=0;if(document.getElementById("intimgid")!=null){InteractiveImgID=document.getElementById("intimgid").value}var e=document.getElementById("leftfilter");var a=0;var b=0;for(i=0;i<e.childNodes.length;i++){var f=e.childNodes.item(i);if(f==d){f.innerHTML=f.innerHTML.replace("_off","_on")||f.innerHTML.replace("_Off","_on");b=f.id.substring(1)}}e=document.getElementById("topfilter");for(i=0;i<e.childNodes.length;i++){f=e.childNodes.item(i);if(f.innerHTML!=null){if(f.innerHTML.indexOf("_on",0)>0||f.innerHTML.indexOf("_On",0)>0){a=f.id.substring(1);break}}}parameters="{'itemNo':'"+c+"','topID':'"+a+"','leftID':'"+b+"','InteractiveImgID':'"+InteractiveImgID+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetGroupItems",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(g){OnGetGroupItemsSucceeded(g.d)},error:function(l,g,h){}});return false}function OnGetGroupItemsFailed(){}function OnGetGroupItemsSucceeded(a){if(a!=null){var b=document.getElementById("ctl00_ContentPlaceHolder1_seggrpitems");if(b!=null){b.innerHTML="";b.innerHTML=a;SetDraggables()}}}function GetAlternativeImgView(a,g,f,e,c){var b=0;var d=0;list=document.getElementById("topfilter");for(i=0;i<list.childNodes.length;i++){child=list.childNodes.item(i);if(child.innerHTML!=null){if(child.innerHTML.indexOf("_on",0)>0){b=child.id.substring(1);break}}}list=document.getElementById("leftfilter");for(i=0;i<list.childNodes.length;i++){child=list.childNodes.item(i);if(child.innerHTML!=null){if(child.innerHTML.indexOf("_on",0)>0){d=child.id.substring(1);break}}}parameters="{'ParentItemNo':'"+a+"','ParentItemType':'"+g+"','SelectedItemNo':'"+f+"','SourceCode':'"+e+"','selectedImgID':'"+c+"','topID':'"+b+"','leftID':'"+d+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/GetAlternativeImgView",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(h){OnGetAlternativeImgViewSucceeded(h.d)},error:function(m,h,l){}});return false}function OnGetAlternativeImgViewFailed(){}function OnGetAlternativeImgViewSucceeded(a){if(a!=null){if(a[0]!=null||a[0]!=""){div=document.getElementById("ctl00_ContentPlaceHolder1_segimage");if(div!=null){div.innerHTML="";div.innerHTML=a[0];SetDroppables();SetPreloadedIcons();CalIntItemPrice()}}if(a[1]!=null||a[1]!=""){div=document.getElementById("ctl00_ContentPlaceHolder1_seggrpitems");if(div!=null){div.innerHTML="";div.innerHTML=a[1];SetDraggables()}}}}function SetDroppables(){$(document).ready(function(){$("#divimg > div").droppable({accept:"#draggables:td img",drop:function(b,c){var d=false;$(this).html("");$(this).css("backgroundColor","transparent");c.draggable.attr("title","Double click to remove the icons");c.draggable.attr("ondblclick","javascript:RemoveImage(this);");c.draggable.ondblclick=function(){RemoveImage(this)};$(this).append(c.draggable.clone().css("width",$(this).css("width")).css("height",$(this).css("height"))).fadeIn();var a=document.getElementById("segstyleerr1");a.innerHTML="";a.style.display="none";for(j=0;j<PlotArray.length;j++){if(PlotArray[j]!=null){if(PlotArray[j][0]==$(this).attr("id")){PlotArray[j][1]=$(this).attr("title");PlotArray[j][2]=c.draggable.attr("id");PlotArray[j][3]=c.draggable.attr("src");PlotArray[j][4]=c.draggable.attr("alt");d=true;break}}}if(!d){k=PlotArray.length;PlotArray[k]=new Array(5);PlotArray[k][0]=$(this).attr("id");PlotArray[k][1]=$(this).attr("title");PlotArray[k][2]=c.draggable.attr("id");PlotArray[k][3]=c.draggable.attr("src");PlotArray[k][4]=c.draggable.attr("alt")}CalIntItemPrice()}})})}function CalIntItemPrice(){attachItemIDs="";for(i=0;i<PlotArray.length;i++){if(PlotArray[i][2]!=""){attachItemIDs+="¿"+PlotArray[i][2]}}if(attachItemIDs!=""){parameters="{'ParentItemNo':'"+document.getElementById("itemno").title+"','AttachedItemIDs':'"+attachItemIDs+"','SourceCode':'"+document.getElementById("source").value+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/CalIntItemPrice",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(a){CalIntItemPriceSucceeded(a.d)},error:function(c,a,b){}});return false}}function CalIntItemPriceFailed(){}function CalIntItemPriceSucceeded(a){if(a!=null){var b=document.getElementById("ctl00_ContentPlaceHolder1_segprice");if(b!=null){b.innerHTML="";b.innerHTML=a}}}function SetDraggables(){$(document).ready(function(){$("#draggables:td img").draggable({revert:"valid",cursor:"move",helper:"clone"})})}function SetPreloadedIcons(){var b=document.getElementById("divimg");if(b!=null){for(i=0;i<b.childNodes.length;i++){child=b.childNodes.item(i);if(child.id.indexOf("plot",0)!=-1){for(j=0;j<PlotArray.length;j++){if(PlotArray[j]!=null){if(PlotArray[j][0]==child.id){if(PlotArray[j][2]!=""){var a=document.createElement("IMG");a.setAttribute("id",PlotArray[j][2]);a.setAttribute("src",PlotArray[j][3]);a.setAttribute("alt",PlotArray[j][4]);a.setAttribute("width",child.style.width);a.setAttribute("height",child.style.height);a.setAttribute("title","Double click to remove the icons");a.setAttribute("ondblclick","javascript:RemoveImage(this);");a.ondblclick=function(){RemoveImage(this)};child.style.backgroundColor="transparent";child.appendChild(a);a.style.width=child.style.width;a.style.height=child.style.height}}}}}}}}function RemoveImage(a){id=a.parentNode.id;a.parentNode.style.backgroundColor="transparent";a.parentNode.innerHTML="";for(i=0;i<PlotArray.length;i++){if(id==PlotArray[i][0]){PlotArray[i][2]="";PlotArray[i][3]="";PlotArray[i][4]=""}}attachItemIDs="";for(i=0;i<PlotArray.length;i++){if(PlotArray[i][2]!=""){attachItemIDs+="¿"+PlotArray[i][2]}}parameters="{'ParentItemNo':'"+document.getElementById("itemno").title+"','AttachedItemIDs':'"+attachItemIDs+"','SourceCode':'"+document.getElementById("source").value+"'}";$.ajax({type:"POST",url:getBaseURL()+"MCWebServices/ItemService.asmx/CalIntItemPrice",data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(b){CalIntItemPriceSucceeded(b.d)},error:function(d,b,c){}});return false}function LTrim(b){var a=/\s*((\S+\s*)*)/;return b.replace(a,"$1")}function RTrim(b){var a=/((\s*\S+)*)\s*/;return b.replace(a,"$1")}function trim(a){return LTrim(RTrim(a))}function setCustCalPrice(a){if(!currencydisplay){return a}return getInitPrice(a)}function setPostBackPriceRef(){if(!currencydisplay){return}setPostBackPrice()}function getInitPriceSavingRef(a){if(!currencydisplay){return}getInitPriceSaving(a)};
