Venda.namespace("TipFinder");Venda.TipFinder=function(){};Venda.TipFinder.activeAdapter="";Venda.TipFinder.HTXT="";Venda.TipFinder.checkType=function(a){jQuery(".listdevices select[name=type]").val()!=""?Venda.TipFinder.selectCat("",a):jQuery("#tfw").show()}; Venda.TipFinder.selectCat=function(a,c){if(c!==""){Venda.TipFinder.powerAdapter=c;var d=document.getElementById("type"+c).value}else Venda.TipFinder.powerAdapter="",d=document.getElementById("type"+a).value;if(d!=="")return jQuery.ajax({url:"/page/"+d,cache:!1,success:function(a){jQuery("#tfw").html(a).show();jQuery("#highpowercharger").val()&&(a=jQuery("#tfwpopup_staticmsg").html(),jQuery("#tfw .staticmsg").html(a));jQuery("#brand_dropdown select").parent().not(".selector").find("select").uniform()}}), !1;else jQuery("#brand").val("").trigger("change").attr("disabled",!0);Venda.TipFinder.activeAdapter=a}; Venda.TipFinder.findByBrand=function(){if(jQuery("#type1").val()!="")if(jQuery("#brand").val()!=""){var a=jQuery("#tipsubmit").attr("src").replace("bt_tipnext.gif","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-tfwselectbrandalert").innerHTML);else alert(document.getElementById("tag-tfwselecttypealert").innerHTML)}; Venda.TipFinder.findTip=function(){var a=document.getElementById("termtexttipkeyword").value,c=document.getElementById("tag-tfwenterkeyword").innerHTML;a===""||a===c?alert(document.getElementById("tag-tfwenterkeywordalert").innerHTML):(jQuery(".listdevices select[name=type]").val()==""&&jQuery("#termtextpcatid").val("supported"),a=jQuery("#tipsearchsubmit").attr("src").replace("bt_tipsearch.png","mydevice_gopleasewait.png"),jQuery("#tipsearchsubmit").attr("src",a),ajaxFunction(document.getElementById("tag-action").innerHTML, "devicepopup","formtipfinder",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.TipFinder.toggle=function(a){a=document.getElementById(a);a.style.display=a.style.display=="none"?"":"none"}; Venda.TipFinder.swapText=function(a){a=document.getElementById(a);a.innerHTML=a.innerHTML==document.getElementById("tag-tfwviewall").innerHTML?document.getElementById("tag-tfwviewless").innerHTML:document.getElementById("tag-tfwviewall").innerHTML}; Venda.TipFinder.passSupported=function(a,c){dialogObj.dialog("close");var d=Venda.TipFinder.powerAdapter!==""?Venda.TipFinder.powerAdapter:Venda.TipFinder.activeAdapter;jQuery("#supportedprodtext"+d).addClass("compatible").removeClass("re-waiHide");jQuery("#supportedprod"+d).html(c);jQuery("#supportedprodsku"+d).html(a).hide();jQuery(".tipspopup"+d).hide();document.getElementById("foundtip"+d).innerHTML=document.getElementById("tag-tfwlocatingtip").innerHTML;if(document.createElement){var f=document.createElement("script"); f.type="text/javascript";f.src="/invt/"+a+"&temp=_tfwscript&layout=noheaders";document.getElementById("foundtip"+d).appendChild(f)}}; Venda.TipFinder.secondTip=function(a){if(document.getElementById("foundtip"+a)){var a=document.getElementById("foundtip"+a).innerHTML,c=document.getElementById("tag-tfwsecondtipalert1").innerHTML,d=document.getElementById("tag-tfwsecondtipalert2").innerHTML;if(a==="")return confirm(c);var f=document.getElementById("tip"+Venda.TipFinder.foundTip);if(f&&a!==""&&!f.checked)return confirm(d);if(!f&&a!=="")return confirm(c);document.getElementById("oixt"+Venda.TipFinder.activeAdapter).value=document.getElementById("supportedprod"+ Venda.TipFinder.activeAdapter).innerHTML;document.getElementById("oixtsku"+Venda.TipFinder.activeAdapter).value=document.getElementById("supportedprodsku"+Venda.TipFinder.activeAdapter).innerHTML}else return!0}; Venda.TipFinder.populateOixt=function(){if(document.getElementById("oixt1"))document.getElementById("oixt1").value=document.getElementById("supportedprod1").innerHTML,document.getElementById("oixtsku1").value=document.getElementById("supportedprodsku1").innerHTML;if(document.getElementById("oixt2"))document.getElementById("oixt2").value=document.getElementById("supportedprod2").innerHTML,document.getElementById("oixtsku2").value=document.getElementById("supportedprodsku2").innerHTML}; Venda.TipFinder.adapterTips=function(a){var c=document.getElementById("foundtip1"),d=document.getElementById("foundtip2"),f=document.getElementById("tag-twoTipsAlert").innerHTML,g=document.getElementById("tag-oneMoreTipAlert").innerHTML,h=document.getElementById("tag-oneTipAlert").innerHTML,i=document.getElementById("tag-sameTipAlert").innerHTML;if(c)var b=c.getElementsByTagName("input")[0];else return!0;if(d)var e=d.getElementsByTagName("input")[0];if(b&&a==="high"&&c.innerHTML!==""&&b.checked=== !1&&d.innerHTML==="")if(confirm(f))Venda.TipFinder.populateOixt();else return!1;else if(e&&a==="high"&&c.innerHTML===""&&d.innerHTML!==""&&e.checked===!1)if(confirm(f))Venda.TipFinder.populateOixt();else return!1;else if(a==="high"&&c.innerHTML===""&&d.innerHTML==="")if(confirm(f))Venda.TipFinder.populateOixt();else return!1;else if(b&&a==="high"&&c.innerHTML!==""&&d.innerHTML==="")if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(e&&a==="high"&&c.innerHTML===""&&d.innerHTML!=="")if(confirm(g))Venda.TipFinder.populateOixt(); else return!1;else if(a!=="high"&&c.innerHTML==="")if(confirm(h))Venda.TipFinder.populateOixt();else return!1;else if(b&&e&&a==="high"&&b.checked===!1&&e.checked===!1)if(confirm(f))Venda.TipFinder.populateOixt();else return!1;else if(b&&e&&a==="high"&&b.checked===!0&&e.checked===!1)if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(b&&e&&a==="high"&&b.checked===!1&&e.checked===!0)if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(b&&a!=="high"&&b.checked===!1)if(confirm(h))Venda.TipFinder.populateOixt(); else return!1;else if(b&&!e&&a==="high"&&b.checked===!1)if(confirm(f))Venda.TipFinder.populateOixt();else return!1;else if(!b&&e&&a==="high"&&e.checked===!1)if(confirm(f))Venda.TipFinder.populateOixt();else return!1;else if(b&&!e&&a==="high"&&b.checked===!0)if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(!b&&e&&a==="high"&&e.checked===!0)if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(!b&&!e&&a==="high")if(confirm(f))Venda.TipFinder.populateOixt();else return!1; else if(b&&e&&a==="high"&&b.checked===!1&&e.checked===!0)if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(b&&e&&a==="high"&&b.checked===!0&&e.checked===!1)if(confirm(g))Venda.TipFinder.populateOixt();else return!1;else if(!b&&a!=="high")if(confirm(h))Venda.TipFinder.populateOixt();else return!1;else if(b&&e&&a==="high"&&b.value===e.value)if(confirm(i))Venda.TipFinder.populateOixt();else return!1;else Venda.TipFinder.populateOixt();return!0}; Venda.TipFinder.clearAddedTips=function(a){jQuery("#supportedprod"+a+", #supportedprodsku"+a+", #foundtip"+a+", #displaysupportedprod"+a).html("");jQuery("#removetip"+a).hide();jQuery("#displaysupportedprod"+a).hide();jQuery(".claim_free .tipspopup"+a).show();var c=!0;jQuery("div.founddevice").each(function(){jQuery(this).html()!=""&&(c=!1)});c&&(jQuery(".tipsdescription").show(),jQuery("#yourselectedfreetip").hide(),jQuery(".tipspopup2").hide());a==1&&jQuery("#displaysupportedprod2").html()==""&& (jQuery("#tipspopup").show(),jQuery("#whatsthis").show(),jQuery("#foundtip2").html(""));a==2&&jQuery("#displaysupportedprod1").html()==""&&(jQuery("#tipspopup").hide(),jQuery("#whatsthis").hide(),jQuery("#foundtip1").html()==""&&(jQuery("#tipspopup").show(),jQuery("#whatsthis").show()))}; Venda.TipFinder.backToMain=function(){dialogObj.dialog("close");var a=document.getElementById("tag-invtref").innerHTML,c=jQuery(window).height(),d="",d=Venda.TipFinder.HTXT!=""?"/invt/"+a+"?htxt="+Venda.TipFinder.HTXT+"&temp=tipfinderwidget&layout=noheaders":"/invt/"+a+"?temp=tipfinderwidget&layout=noheaders";divObj=jQuery("<div>").attr("id","devicepopup").appendTo("body");dialogObj=jQuery(divObj);dialogObj.addClass("loadingImg");dialogObj.dialog({autoOpen:!1,closeOnEscape:!0,width:"809px",resizable:!1, dialogClass:"tipspopup",modal:!0,close:function(){dialogObj.dialog("destroy");dialogObj.remove()}});jQuery(".ui-dialog").popupIframe();dialogObj.dialog("open");jQuery.ajax({url:d,cache:!1,success:function(a){jQuery("#devicepopup").html(a);a=c-dialogObj.height();dialogObj.dialog("option","position",a);dialogObj.removeClass("loadingImg");jQuery("#devicepopup select").parent().not(".selector").find("select").uniform();Venda.Ebiz.scrolltop()}})};
