Venda.namespace("YourDevices");Venda.YourDevices=function(){};Venda.YourDevices.addSupported=function(a){var b=document.getElementById("existingowned").innerHTML;if(b==="")var c=a;b!==""&&(c=b+","+a);document.getElementById("usxtownedsupportedprods").value=c;ajaxFunction("/bin/venda","formsubmit","updateSupported",Venda.YourDevices.updateAdd)}; Venda.YourDevices.updateAdd=function(){document.getElementById("mysupportedbutton").innerHTML=document.getElementById("removebutton").innerHTML;YAHOO.util.Dom.setStyle("popupcontent_panel","width","575px");YAHOO.util.Dom.setStyle("popupcontent","height","500px");featurePanel.setHeader(document.getElementById("tag-myspheading").innerHTML);featurePanel.show();ajaxFunction("/page/mysupportedprods&layout=noheaders","existingowned",null,Venda.YourDevices.showSupported)}; Venda.YourDevices.findByBrand=function(){if(jQuery("#type").val()!="")if(jQuery("#brand").val()!=""){var a=jQuery("#tipsubmit").attr("src").replace("bt_tipnext.png","mydevice_pleasewait.png");jQuery("#tipsubmit").attr("src",a);jQuery.ajax({url:jQuery("#brand").val()+"&layout=noheaders",cache:!1,success:function(a){jQuery("#devicepopup").html(a);jQuery("#devicepopup").delegate(".pagnFirstRow span a, .termtext a,#term a","click",function(a){a.preventDefault();a=jQuery(this).attr("href");a!=""&&a!="#"&& ajaxFunction(a,"devicepopup",null,function(){Venda.Ebiz.checkImg.fix()})});Venda.Ebiz.checkImg.fix();Venda.Ebiz.scrolltop()}})}else alert(document.getElementById("tag-tfwselectbrandalerttop").innerHTML);else alert(document.getElementById("tag-tfwselecttypealerttop").innerHTML)}; Venda.YourDevices.showSupported=function(a){if(typeof a==="object")document.getElementById("devicepopup").innerHTML='<ul id="showproducts"></ul>';for(var a=[],a=document.getElementById("existingowned").innerHTML.split(","),b=0;b<a.length;b++){var c=a[b].replace(/^\s*|\s*$/g,"");c!==""&&(document.getElementById("showproducts").innerHTML+='<div id="device'+c+'"></div>',Venda.YourDevices.fetchInvt(c))}}; Venda.YourDevices.fetchInvt=function(a,b){jQuery.ajax({url:"/invt/"+a+"&temp=yourdevice&layout=noheaders",success:function(c){jQuery("#device"+a).html(c);Venda.Ebiz.checkImg.fix();typeof b=="function"&&b()}})}; Venda.YourDevices.selectCat=function(){var a=document.getElementById("type").value;a!==""?(jQuery(window).height(),jQuery.ajax({url:"/page/"+a+"&layout=mysupportedpopup",cache:!1,success:function(a){jQuery("#tfw").html(a);jQuery("#brand_dropdown select").parent().not(".selector").find("select").uniform()}})):jQuery("#brand").val("").trigger("change").attr("disabled",!0)}; Venda.YourDevices.launchCat=function(a){a!==""?(jQuery(window).height(),jQuery.ajax({url:a+"&layout=empty",cache:!1,success:function(a){jQuery("#devicepopup").html(a);jQuery("#devicepopup select").parent().not(".selector").find("select").uniform()}})):alert(document.getElementById("tag-select").innerHTML)}; Venda.YourDevices.findSupported=function(){var a=document.getElementById("termtexttipkeyword").value,b=document.getElementById("tag-enterkeyword").innerHTML;a===""||a===b?alert(document.getElementById("tag-enterkeywordalert").innerHTML):(jQuery("#type").val()==""&&jQuery("#termtextpcatid").val("supported"),a=jQuery("#tipsearchsubmit").attr("src").replace("bt_tipsearch.gif","mydevice_gopleasewait.png"),jQuery("#tipsearchsubmit").attr("src",a),ajaxFunction("/bin/venda","devicepopup","formsupportedfinder", function(){jQuery("#devicepopup").delegate(".pagnFirstRow span a, .termtext a,#term a","click",function(a){a.preventDefault();a=jQuery(this).attr("href");a!=""&&a!="#"&&ajaxFunction(a,"devicepopup",null,function(){Venda.Ebiz.checkImg.fix()})});Venda.Ebiz.checkImg.fix();Venda.Ebiz.scrolltop()}));return!1}; Venda.YourDevices.passSupported=function(a){try{dialogObj.dialog("close")}catch(b){txt="There was an error on this page.\n\n",txt+="Error description: "+b.description+"\n\n",txt+="Click OK to continue.\n\n"}if(document.getElementById("existingowned").innerHTML.indexOf(a)!==-1)alert(document.getElementById("tag-alreadyadded").innerHTML);else{var c=document.getElementById("existingowned").innerHTML,d=[];if(c!=="")for(var c=c.split(","),e=0;e<c.length;e++)c[e]!=""&&d.push(c[e]);d.push(a);document.getElementById("usxtownedsupportedprods").value= d.join(",");ajaxFunction("/bin/venda","formsubmit","updateSupported",function(){ajaxFunction("/page/mysupportedprods&layout=noheaders","existingowned",null,function(){if(document.getElementById("showproducts")){document.getElementById("showproducts").innerHTML="";for(var a=document.getElementById("existingowned").innerHTML,b=[],c=getMyFirstDevice(),b=a.split(","),a=0;a<b.length;a++){var d=b[a].replace(/^\s*|\s*$/g,"");d!==""&&(document.getElementById("showproducts").innerHTML+='<div id="device'+d+ '"></div>',c==d?Venda.YourDevices.fetchInvt(d,function(){jQuery(".viewrecommendations").show();jQuery("#deviceli_"+c).find(".viewrecommendations").hide()}):Venda.YourDevices.fetchInvt(d))}}typeof changeLink=="function"&&changeLink();jQuery(".Lcat_myaccountnav .Lmyaccordermydevices ul li#mydeviceinfo").html("You have added item(s) to your 'My Devices' list. Please click on the 'Manage My Devices' link to manage your list.<style type='text/css'>.myaccount_mydevices h1 .hdr_remove {display:block !important;}</style>")})})}}; Venda.YourDevices.passSupportedinSearchlist=function(a){if(document.getElementById("existingowned").innerHTML.indexOf(a)!==-1)alert(document.getElementById("tag-alreadyadded").innerHTML);else{var b=document.getElementById("existingowned").innerHTML,c=[];if(b!=="")for(var b=b.split(","),d=0;d<b.length;d++)b[d]!=""&&c.push(b[d]);c.push(a);document.getElementById("usxtownedsupportedprods"+a).value=c.join(",");ajaxFunction("/bin/venda","formsubmit","updateSupported"+a,function(){ajaxFunction("/page/mysupportedprods&layout=noheaders", "existingowned",null,function(){changeLink(a)})})}}; Venda.YourDevices.removeSupported=function(a,b){var c=jQuery("#existingowned").html(),c=c.replace(a,"");jQuery("#usxtownedsupportedprods").val(c);c=jQuery("#usxtownedsupportedprods").val();c=c.replace(/\$|,|@|#|~|`|\%|\*|\^|\&|\(|\)|\+|\=|\[|\-|\_|\]|\[|\}|\{|\;|\:|\'|\"|\<|\>|\?|\||\\|\!|\$|\./g,"");c=c.replace(/ /g,"");c==""&&jQuery(".Lcat_myaccountnav .Lmyaccordermydevices ul li#mydeviceinfo").html("You currently have no items added to your Devices.<br><br>Add to your Devices to receive personalized products and great deals.<style type='text/css'>.hdr_remove {display:none;}</style>");typeof b=== "undefined"&&ajaxFunction("/bin/venda","formsubmit","updateSupported",function(){ajaxFunction("page/mysupportedprods&layout=noheaders","existingowned",null,function(){document.getElementById("mysupportedbutton").innerHTML=document.getElementById("addbutton").innerHTML})});typeof b!=="undefined"&&ajaxFunction("/bin/venda","formsubmit","updateSupported",function(){ajaxFunction("page/mysupportedprods&layout=noheaders","existingowned",null,function(){MyFirstDevice=getMyFirstDevice();MyFirstDevice!=""? (document.getElementById("tag-myfirstdeviceref").innerHTML=MyFirstDevice,myDevicesLanded=!1,getRecommendationProd()):jQuery("#mydev-recommendations").hide();jQuery("#"+b).hide();if(document.getElementById("tag-invtref")&&a===document.getElementById("tag-invtref").innerHTML)document.getElementById("mysupportedbutton").innerHTML=document.getElementById("addbutton").innerHTML})})}; Venda.YourDevices.addCheckboxes=function(){for(var a=document.getElementsByName("mysupported"),b=0;b<a.length;b++)a[b].checked===!0&&document.getElementById("existingowned").innerHTML.indexOf(a[b].value)===-1&&(document.getElementById("existingowned").innerHTML+=","+a[b].value);document.getElementById("usxtownedsupportedprods").value=document.getElementById("existingowned").innerHTML;ajaxFunction("/bin/venda","formsubmit","updateSupported",function(){alert(document.getElementById("tag-itemsadded").innerHTML)})}; Venda.YourDevices.backToMain=function(a){var b=document.location.protocol;a.indexOf("http:")==0&&b=="https:"&&(a=a.replace("http:","https:"));jQuery.ajax({url:a+"&layout=noheaders",cache:!1,success:function(a){jQuery("#devicepopup").html(a);jQuery("#devicepopup select").parent().not(".selector").find("select").uniform();Venda.Ebiz.scrolltop()}})}; Venda.YourDevices.getSubstitute=function(a){jQuery("#mydev-recommendations").show();jQuery("#vbm-panel-loading").ajaxStart(function(){jQuery(this).show()});jQuery("#vbm-panel-vbmmydevice").load("/invt/"+a+"&temp=showisubfeature&layout=noheaders",function(){Venda.Ebiz.checkImg.fix();Venda.Widget.MinicartPopup.gatherAdds();jQuery("#vbmlist li").size()>0&&Venda.Widget.VBM.showVBMH2("vbmmydevice");jQuery("#vbmlist li:first").addClass("first");jQuery("#vbmlist li").size()>0||jQuery(".noresult").size()> 0?(MyDevicesScroll(a),jQuery("#mydev-recommendations").show()):jQuery("#mydev-recommendations").hide()})};
