//common.js
//script.asp?Action=main
//creditcard.js
//drag.js
//jquery.pwSuggest.js
function rowMouseOver(a){a.style.backgroundColor="#eee";}function rowMouseOut(a){a.style.backgroundColor="";}function rowMouseOverPlus(a,b){a.style.backgroundColor="#eee";a.parentNode.rows[a.rowIndex+b].style.backgroundColor="#eee";}function rowMouseOutPlus(a,b){a.style.backgroundColor="";a.parentNode.rows[a.rowIndex+b].style.backgroundColor="";}function RadioCheck(b,a){find_object("method"+b).checked=true;refreshOrder(this,true);}function searchFocus(b){var a=b.value;if(a==_searchDefault){b.value="";b.className="search_text";}b.select();}function searchBlur(b){var a=b.value;if(a==null||a.length==0){b.value=_searchDefault;b.className="search_helptext";}}function textFocus(a){a.className="input-focus";}function textBlur(a){a.className="input-blur";}function selectFocus(a){document.getElementById(a).className="select-focus";}function selectBlur(a){document.getElementById(a).className="select-blur";}function findPos(){var a=document.getElementById("estimate");var b=curtop=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;while(a==a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop;}}return[b,curtop];}function formatCurrency(a){a=a.toString().replace(/\$|\,/g,"");if(isNaN(a)){a="0";}sign=(a==(a=Math.abs(a)));a=Math.floor(a*100+0.50000000001);cents=a%100;a=Math.floor(a/100).toString();if(cents<10){cents="0"+cents;}for(var b=0;b<Math.floor((a.length-(1+b))/3);b++){a=a.substring(0,a.length-(4*b+3))+","+a.substring(a.length-(4*b+3));}return(((sign)?"":"-")+"$"+a+"."+cents);}function billDestinationChanged(a){changeDiv("billinginfo",("billaddress"==a.value)?"block":"none");}function getCheckedValue(b){if(!b){return"";}var c=b.length;if(c==undefined){if(b.checked){return b.value;}else{return"";}}for(var a=0;a<c;a++){if(b[a].checked){return b[a].value;}}return"";}function CheckPOBox(){var d=find_object("ShippingInfo_Address_Address").value.toUpperCase();var e=find_object("boxwarning");var c=find_object("boxstart");var a=find_object("boxend");if(document.fmCheckout){var b=document.fmCheckout.ShippingMethodID;if(b){var f=getCheckedValue(b);if(f=="1041"||f=="1042"||f=="1039"||f=="1040"||f=="1037"||f=="1036"||f=="1035"||f=="1034"||f=="1033"||f=="1032"||f=="1031"){if(d.indexOf("P O BOX")==-1&&d.indexOf("P. O. BOX")==-1&&d.indexOf("POBOX")==-1&&d.indexOf("PO BOX")==-1&&d.indexOf("P.O. BOX")==-1&&d.indexOf("P.O BOX")==-1&&d.indexOf("PMB ")==-1&&d.indexOf("PO. BOX")==-1){e.style.visibility="hidden";e.style.display="none";c.className="";a.className="";}else{e.style.visibility="visible";e.style.display="block";c.className="err_start";a.className="err_end";pobox=true;}}else{e.style.visibility="hidden";e.style.display="none";}}}}function GetResourceString(b,a){return a;}function Added(){alert(GetResourceString(81074,"Your item has been added to your shopping cart"));}function OnLoad(){}function loadShippingMethods(countryID,prefix,useShipping){var xmlHttp=GetXmlHttpObject();if(xmlHttp!=null){var stateID="",postalCode="";var sel=document.getElementById("ShippingMethodID");if(sel!=null){while(sel.length>0){sel.options[0]=null;}}sel=find_object(prefix+"StateID");if(sel!=null){stateID=sel.value;}sel=find_object(prefix+"PostalCode");if(sel!=null){postalCode=sel.value;}var url="ajax_contact.asp?OrderID="+sOrderID+"&CountryID="+countryID+"&GroupID="+sGroupID+"&Prefix="+prefix+"&UseShipping="+useShipping+"&StateID="+stateID+"&PostalCode="+postalCode;xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){try{eval(xmlHttp.responseText);}catch(e){}}};if(window.XMLHttpRequest){xmlHttp.open("GET",url,true);}else{if(window.ActiveXObject){xmlHttp.open("GET",url,false);}}xmlHttp.send(null);}else{Refresh();}}function updateBillingInfo(f){if(null==document.getElementById("ExpressCheckout")){return;}if("undefined"==typeof(f)){return;}var g=new Array("Contact_FirstName","Contact_LastName","Contact_Phone","Contact_Email","Address_City","Address_PostalCode","Address_Address");var e;for(e=0;e<g.length;e++){if(f[g[e]].value==""){return;}}var b=GetXmlHttpObject();if(b!=null){var d=f.Action.value;f.Action.value="ajax-updatebilling";var a=getFormElements(f);f.Action.value=d;var c="ajax_order.asp";b.onreadystatechange=function(){if(b.readyState==4||b.readyState=="complete"){try{}catch(h){}finally{}}};if(window.XMLHttpRequest){b.open("POST",c,true);}else{if(window.ActiveXObject){b.open("POST",c,false);}}b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(a);}}function refreshOrder(el,recalculate){if(document.getElementById("ExpressCheckout")==null){return;}var xmlHttp=GetXmlHttpObject();if(xmlHttp!=null){prefix="ShippingInfo_";var elState=document.getElementById(prefix+"Address_StateID");var lStateID="";if(elState!=null){lStateID=elState.value;}var elPostalCode=document.getElementById(prefix+"Address_PostalCode");var sPostalCode="";if(sPostalCode!=null){sPostalCode=elPostalCode.value;}var elShipping=document.fmCheckout.ShippingMethodID;var lShippingMethodID="";if(elShipping!=null){var val=0;for(i=0;i<elShipping.length;i++){if(elShipping[i].checked==true){lShippingMethodID=elShipping[i].value;}}}var url="ajax_contact.asp?CurrentOrderID="+sOrderID+"&CurrentShippingMethodID="+lShippingMethodID+"&StateID="+lStateID+"&Prefix="+prefix+"&PostalCode="+sPostalCode;xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){try{eval(xmlHttp.responseText);var progressDiv=find_object("progress_div");if(progressDiv){progressDiv.hide();}CheckPOBox();}catch(e){}finally{var progressDiv=find_object("progress_div");if(progressDiv){progressDiv.hide();}}}};if(window.XMLHttpRequest){xmlHttp.open("GET",url,true);}else{if(window.ActiveXObject){xmlHttp.open("GET",url,false);}}xmlHttp.send(null);}else{if("undefined"==typeof(recalculate)){Refresh();}else{el.form.Action.value="recalculate";el.form.submit();}}}function recalculateOrder(){if(null==document.getElementById("ExpressCheckout")){return;}var CountryID=find_object("ShippingInfo_Address_CountryID");if(CountryID.value==223){if(find_object("ShippingInfo_Address_PostalCode").value==""||find_object("ShippingInfo_Address_StateID").value==""){return;}}var xmlHttp=GetXmlHttpObject();if(xmlHttp!=null){var form=document.fmCheckout;var tmp=form.Action.value;form.Action.value="ajax-recalculate";var querystring=getFormElements(form);form.Action.value=tmp;var url="expresscheckout.asp";find_object("divShippingMethodContainer").innerHTML='<div class="loading"></div><div class="small"><strong>Loading...</strong></div>';xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){clearTimeout(requestTimer);if(xmlHttp.status!=200){showShippingError();return;}try{eval(xmlHttp.responseText);}catch(e){showShippingError();}finally{}}};var requestTimer=setTimeout(function(){xmlHttp.abort();showShippingError();},10000);if(window.XMLHttpRequest){xmlHttp.open("POST",url,true);}else{if(window.ActiveXObject){xmlHttp.open("POST",url,false);}}xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(querystring);}else{var el=find_object("tdRecalculate");if(el!=null){el.style.display="block";}}}function showShippingError(){find_object("divShippingMethodContainer").innerHTML=find_object("divShippingError").innerHTML;}function selectForm(d){var b=document.getElementById("check-form");var a=document.getElementById("card-form");var c=document.getElementById("title_grid");var e=document.getElementById("title_grid_space");a.style.display="none";b.style.display="none";c.style.display="none";e.style.display="none";if(d=="card"){a.style.display="inline";c.style.display="inline";e.style.display="inline";}if(d=="check"){b.style.display="inline";c.style.display="inline";e.style.display="inline";}}function openAddressBookItem(id,customerID,paymentType){var xmlHttp=GetXmlHttpObject();if((paymentType!="card")&&(paymentType!="check")){paymentType="";}if(xmlHttp&&(customerID.length>0)&&(id>0)){document.fmObject.ID.value=id.toString();document.fmObject.Action.value="update";setValue("Contact_FirstName","");setValue("Contact_LastName","");setValue("Contact_Company","");setValue("Address_Address","");setValue("Address_Address2","");setValue("Address_City","");setValue("Address_PostalCode","");setValue("Address_CountryID","");setValue("Contact_Phone","");setValue("Contact_Email","");if(paymentType=="card"){pTitle.style.display="inline";pTitleSpace.style.display="inline";pCardForm.style.display="block";}if(paymentType=="check"){pTitle.style.display="inline";pTitleSpace.style.display="inline";pCheckForm.style.display="block";}var sel=document.getElementById("Address_StateID");while(sel.length>0){sel.options[0]=null;}if(window.ActiveXObject){var td1=document.getElementById("Address_StateID_1");var td2=document.getElementById("Address_StateID_2");sel.disabled=true;td1.style.display="none";td2.style.display="none";}var url="ajax_contact.asp?AddressBookItemID="+id+"&ClientID="+customerID+"&PaymentType="+paymentType;xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){eval(xmlHttp.responseText);var progressDiv=find_object("progress_div");if(progressDiv!=null){progressDiv.hide();}}};if(window.XMLHttpRequest){xmlHttp.open("GET",url,true);}else{if(window.ActiveXObject){xmlHttp.open("GET",url,false);}}xmlHttp.send(null);}else{window.location=location.pathname+"?ID="+id;}}function setValue(a,c){var b=document.getElementById(a);if(b!=null){b.value=c;}else{for(i=0;i<document.forms.length;i++){b=document.forms[i].elements[a];if(b!=null){b.value=c;return;}}}}function loadAddressBook(addrBookID,prefix,clientID){var xmlHttp=GetXmlHttpObject();if(xmlHttp){if(addrBookID!="empty"){if(addrBookID==-1){setValue(prefix+"Contact_FirstName","");setValue(prefix+"Contact_LastName","");setValue(prefix+"Contact_Company","");setValue(prefix+"Address_Address","");setValue(prefix+"Address_Address2","");setValue(prefix+"Address_City","");setValue(prefix+"Address_PostalCode","");setValue(prefix+"Address_CountryID","");setValue(prefix+"Contact_Phone","");setValue(prefix+"Contact_Email","");var sel=document.getElementById(prefix+"Address_StateID");while(sel.length>0){sel.options[0]=null;}if(window.ActiveXObject){var td1=document.getElementById(prefix+"Address_StateID_1");var td2=document.getElementById(prefix+"Address_StateID_2");sel.disabled=true;td1.style.display="none";td2.style.display="none";}}if(addrBookID==0){document.getElementById(prefix+"AddressBookItem").value="empty";setValue(prefix+"Contact_FirstName",document.getElementById("Contact_FirstName").value);setValue(prefix+"Contact_LastName",document.getElementById("Contact_LastName").value);setValue(prefix+"Contact_Company",document.getElementById("Contact_Company").value);setValue(prefix+"Address_Address",document.getElementById("Address_Address").value);setValue(prefix+"Address_Address2",document.getElementById("Address_Address2").value);setValue(prefix+"Address_City",document.getElementById("Address_City").value);setValue(prefix+"Address_PostalCode",document.getElementById("Address_PostalCode").value);setValue(prefix+"Address_CountryID",document.getElementById("Address_CountryID").value);setValue(prefix+"Contact_Phone",document.getElementById("Contact_Phone").value);setValue(prefix+"Contact_Email",document.getElementById("Contact_Email").value);var sel=document.getElementById(prefix+"Address_StateID");while(sel.length>0){sel.options[0]=null;}var td1=document.getElementById(prefix+"Address_StateID_1");var td2=document.getElementById(prefix+"Address_StateID_2");sel.disabled=true;td1.style.display="none";td2.style.display="none";if(document.getElementById("Address_StateID").value>0){loadStates(document.getElementById("Address_CountryID").value,prefix);document.getElementById(prefix+"Address_StateID").value=document.getElementById("Address_StateID").value;}}if(addrBookID>0){var url="ajax_contact.asp?AddressBookID="+addrBookID+"&Prefix="+prefix+"&ClientID="+clientID;xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){eval(xmlHttp.responseText);var progressDiv=find_object("progress_div");if(progressDiv!=null){progressDiv.hide();}var el;if(el=document.getElementById("tdRecalculate")){el.style.display="block";}}};if(window.XMLHttpRequest){xmlHttp.open("GET",url,true);}else{if(window.ActiveXObject){xmlHttp.open("GET",url,false);}}xmlHttp.send(null);}}}else{}}function loadStates(countryID,prefix){if(find_object("ExpressCheckout")){if(prefix=="ShippingInfo_"){recalculateExpressCheckout(countryID,prefix);}}if(countryID>0){if(prefix=="undefined"){prefix="";}statePrefix=prefix+"Address_StateID";var sel=document.getElementById(statePrefix);var xmlHttp=GetXmlHttpObject();if(xmlHttp!=null){while(sel.length>0){sel.options[0]=null;}sel.disabled=true;}else{sel.form.action=location;Refresh();return;}var sel2=find_object(prefix+"Address_StateID_1");if(sel2){if(countryID==223){sel2.innerHTML='State <span class="warning">*</span>';}if(countryID==38){sel2.innerHTML='Province <span class="warning">*</span>';}}var url="ajax_contact.asp?CountryID="+countryID+"&Prefix="+statePrefix;xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){try{eval(xmlHttp.responseText);var progressDiv=find_object("progress_div");if(progressDiv){progressDiv.hide();}}catch(e){}finally{var progressDiv=find_object("progress_div");if(progressDiv){progressDiv.hide();}}}};if(window.XMLHttpRequest){xmlHttp.open("GET",url,true);}else{if(window.ActiveXObject){xmlHttp.open("GET",url,false);}}xmlHttp.send(null);}}function recalculateExpressCheckout(a,b){recalculateOrder();}function shipDestinationChanged(a){changeDiv("shippinginfo",("shipaddress"==a.value)?"block":"none");var b=("shipaddress"==a.value)?"ShippingInfo_":"";if(document.getElementById("ExpressCheckout")){xmlHttp=GetXmlHttpObject();if(xmlHttp!=null){recalculateExpressCheckout(find_object(b+"Address_CountryID").value,b);}else{a.form.Action.value="recalculate";a.form.submit();}}}function loadPayments(){var b=GetXmlHttpObject();var f=false;if(b){var e=document.fmCheckout;if(!e){e=document.fmSettlePayment;f=true;}var d=e.Action.value;e.Action.value="ajax-payment-method";var a=getFormElements(e);e.Action.value=d;var c=((f)?"settlepayment.asp?":"expresscheckout.asp?");b.onreadystatechange=function(){if(b.readyState==4||b.readyState=="complete"){try{var h=b.responseText;if(h!=""){var k=find_object("divPaymentMethodContainer");if(k!=null){k.innerHTML=h;}var g=find_object("progress_div");if(g){g.hide();}}}catch(j){}finally{var g=find_object("progress_div");if(g){g.hide();}}}};if(window.XMLHttpRequest){b.open("POST",c,true);}else{if(window.ActiveXObject){b.open("POST",c,false);}}b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(a);}else{Refresh();}}function accumulateQueryString(b,a){if(b==""){b=a;}else{b=b+"&"+a;}return b;}function getFormElements(e){var a="";var c=new Array();if(e!=null){if(typeof e=="string"){var d=document.getElementById(e);if(d!=null){c=d.elements;}}else{c=e.elements;}}var b=toQueryString(c);return accumulateQueryString(a,b);}function toQueryString(f){var e=null;var a="";var b="";var d="";for(var c=0;c<f.length;c++){d="";e=f[c];b=e.getAttribute("name");if(!b){b=e.getAttribute("id");}b=encodeURIComponent(b);if(e.tagName.toLowerCase()=="input"){if(e.type.toLowerCase()=="radio"||e.type.toLowerCase()=="checkbox"){if(e.checked){d=b+"="+encodeURIComponent(e.value);}}if(e.type.toLowerCase()=="text"||e.type.toLowerCase()=="hidden"||e.type.toLowerCase()=="password"){d=b+"="+encodeURIComponent(e.value);}}else{if(e.tagName.toLowerCase()=="select"){d=getSelectedOptions(e);}else{if(e.tagName.toLowerCase()=="textarea"){d=b+"="+encodeURIComponent(e.value);}}}if(d!=""){if(a==""){a=d;}else{a=a+"&"+d;}}}return a;}function getSelectedOptions(c){var d=c.options;var e=null;var b="";var f="";for(var a=0;a<d.length;a++){f="";e=d[a];if(e.selected){f=encodeURIComponent(c.name)+"="+encodeURIComponent(e.value);}if(f!=""){if(b==""){b=f;}else{b=b+"&"+f;}}}return b;}function GetXmlHttpObject(){var a=false;try{a=new XMLHttpRequest();}catch(b){try{a=new ActiveXObject("Msxml2.XMLHTTP");}catch(b){try{a=new ActiveXObject("Microsoft.XMLHTTP");}catch(b){alert("Your browser does not support AJAX!");return false;}}}return a;}function openWindow(c,b,e,a,d){var h;var g=0;var f=0;if(screen.width>e){f=(screen.width-e)/2;}if(screen.height>a){g=(screen.height-a)/2;}if(typeof(d)=="undefined"){h=window.open(c,b,"left="+f+",top="+g+",screenX="+f+",screenY="+g+",width="+e+",height="+a);}else{h=window.open(c,b,"left="+f+",top="+g+",screenX="+f+",screenY="+g+",width="+e+",height="+a+", "+d);}if(navigator.appName!="Microsoft Internet Explorer"){if(window.focus){h.focus();}}}function preview(g,a){var d=find_object("preview_div"+a);var h=find_object("preview_img"+a);var e=find_object("thumb_img"+a);if(!d||!h){return;}var f=0;var c=0;var b=parseInt(d.style.width);var j=parseInt(d.style.height);d.style.display="inline";init(h,e);if(h.inited){h.expand();}}function init(a,b){a.originalHeight=a.height;a.originalWidth=a.width;a.width=b.width;if(parseInt(a.originalWidth)>0){a.height=parseInt(b.width)/parseInt(a.originalWidth)*parseInt(a.originalHeight);}a.expand=function(){var d=Math.round(a.height*0.15);var c=Math.round(a.width*0.15);if(a.width+c<a.originalWidth){a.width+=c;a.height+=d;a.imgDelayID=window.setTimeout(a.expand,5);}else{a.width=a.originalWidth;a.height=a.originalHeight;clearTimeout(a.imgDelayID);}};a.inited=true;}function closePreview(c){var a=find_object("preview_img"+c);var b=find_object("thumb_img"+c);if(a&&b){if(a.inited){clearTimeout(a.imgDelayID);a.height=a.originalHeight;a.width=a.originalWidth;a.inited=false;}}setVisibility("preview_div"+c,false);}function setVisibility(d,b,a){var c=find_object(d);if(!c){return;}if("visibility"==a){c.style.visibility=b?"visible":"hidden";}else{c.style.display=b?"inline":"none";}}function find_object(a){if(document.getElementById){return document.getElementById(a);}else{if(document.all){return document.all[a];}else{if(document.layers){return document.layers[a];}else{return null;}}}}var _searchDefault="Search Powerwerx";function ValidateSearch(){if(document.fmSearch.search_box.value.length>2&&document.fmSearch.search_box.value!=_searchDefault){return(true);}else{return(false);}}function Search(){if(ValidateSearch()){document.fmSearch.submit();}}function AdvancedSearch(){document.fmSearch.Action.value="";document.fmSearch.submit();}function AddToCart(){document.fmProduct.Action.value="add";document.fmProduct.submit();}function getCC(o){var l=document.getElementById("ccType");var k=document.getElementById("pm-visa");var f=document.getElementById("pm-mc");var e=document.getElementById("pm-disc");var b=document.getElementById("pm-amex");if(o){var p=o.form.name;function c(){b.style.opacity="0.13";b.style.filter="alpha(opacity=20)";}function j(){b.style.opacity="1";b.style.filter="alpha(opacity=100)";l.value="American Express";}function a(){e.style.opacity="0.13";e.style.filter="alpha(opacity=20)";}function h(){e.style.opacity="1";e.style.filter="alpha(opacity=100)";l.value="Discover";}function g(){f.style.opacity="0.13";f.style.filter="alpha(opacity=20)";}function n(){f.style.opacity="1";f.style.filter="alpha(opacity=100)";l.value="MasterCard";}function d(){k.style.opacity="0.13";k.style.filter="alpha(opacity=20)";}function m(){k.style.opacity="1";k.style.filter="alpha(opacity=100)";l.value="Visa";}if(o.value.length>1){switch(true){case (o.value.substring(0,1)=="3"):if(o.value.substring(1,2)=="6"){if(k){d();}if(b){c();}if(e){a();}if(f){n();}}else{if(o.value.substring(1,2)=="5"){if(k){d();}if(b){c();}if(e){a();}if(f){g();}}else{if(k){d();}if(f){g();}if(e){a();}if(b){j();}}}break;case (o.value.substring(0,1)=="4"):if(f){g();}if(b){c();}if(e){a();}if(k){m();}break;case (o.value.substring(0,1)=="5"):if(k){d();}if(b){c();}if(e){a();}if(f){n();}break;case (o.value.substring(0,1)=="6"):if(k){d();}if(f){g();}if(b){c();}if(e){h();}break;}}else{if(k){k.style.opacity="1";k.style.filter="alpha(opacity=100)";}if(f){f.style.opacity="1";f.style.filter="alpha(opacity=100)";}if(b){b.style.opacity="1";b.style.filter="alpha(opacity=100)";}if(e){e.style.opacity="1";e.style.filter="alpha(opacity=100)";}}}}function initialize(){var a=document.getElementById("Number");if(a){getCC(a);}}function Browser(){var b,c,a;this.isIE=false;this.isNS=false;this.version=null;b=navigator.userAgent;c="MSIE";if((a=b.indexOf(c))>=0){this.isIE=true;this.version=parseFloat(b.substr(a+c.length));return;}c="Netscape6/";if((a=b.indexOf(c))>=0){this.isNS=true;this.version=parseFloat(b.substr(a+c.length));return;}c="Gecko";if((a=b.indexOf(c))>=0){this.isNS=true;this.version=6.1;return;}}var browser=new Browser();var dragObj=new Object();dragObj.zIndex=0;function dragStart(c,e){var b;var a,d;if(e){dragObj.elNode=document.getElementById(e);}else{if(browser.isIE){dragObj.elNode=window.event.srcElement;}if(browser.isNS){dragObj.elNode=c.target;}if(dragObj.elNode.nodeType==3){dragObj.elNode=dragObj.elNode.parentNode;}}if(browser.isIE){a=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;d=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;}if(browser.isNS){a=c.clientX+window.scrollX;d=c.clientY+window.scrollY;}dragObj.cursorStartX=a;dragObj.cursorStartY=d;dragObj.elStartLeft=parseInt(dragObj.elNode.style.left,10);dragObj.elStartTop=parseInt(dragObj.elNode.style.top,10);if(isNaN(dragObj.elStartLeft)){dragObj.elStartLeft=0;}if(isNaN(dragObj.elStartTop)){dragObj.elStartTop=0;}dragObj.elNode.style.zIndex=++dragObj.zIndex;if(browser.isIE){document.attachEvent("onmousemove",dragGo);document.attachEvent("onmouseup",dragStop);window.event.cancelBubble=true;window.event.returnValue=false;}if(browser.isNS){document.addEventListener("mousemove",dragGo,true);document.addEventListener("mouseup",dragStop,true);c.preventDefault();}}function dragGo(b){var a,c;if(browser.isIE){a=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;c=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop;}if(browser.isNS){a=b.clientX+window.scrollX;c=b.clientY+window.scrollY;}dragObj.elNode.style.left=(dragObj.elStartLeft+a-dragObj.cursorStartX)+"px";dragObj.elNode.style.top=(dragObj.elStartTop+c-dragObj.cursorStartY)+"px";if(browser.isIE){window.event.cancelBubble=true;window.event.returnValue=false;}if(browser.isNS){b.preventDefault();}}function dragStop(a){if(browser.isIE){document.detachEvent("onmousemove",dragGo);document.detachEvent("onmouseup",dragStop);}if(browser.isNS){document.removeEventListener("mousemove",dragGo,true);document.removeEventListener("mouseup",dragStop,true);}}(function(a){a.fn.jsonSuggest=function(c,b){var d={minCharacters:1,maxResults:undefined,wildCard:"",caseSensitive:false,notCharacter:"!",maxHeight:350,highlightMatches:true,onSelect:undefined,ajaxResults:false,width:undefined};b=a.extend(d,b);return this.each(function(){function j(t,y){var v=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];if(y){for(var x=0;x<v.length;x++){if(v[x]===y){v.splice(x,1);}}}var w=new RegExp("(\\"+v.join("|\\")+")","g");return t.replace(w,"\\$1");}var n=a(this),h=new RegExp(j(b.wildCard||""),"g"),o=a("<div />"),k,m,l;function g(t){a(o).html("").hide();if(typeof b.onSelect==="function"){b.onSelect(t);}}function f(t){a("div.resultItem",o).removeClass("hover");a(t).addClass("hover");k=t;}function e(){var t=a("#search_box");t.val("");a(".jsonSuggestResults").empty().hide();t.focus();}function u(t,y){y="("+y+")";var x=true,w,C=0,z=b.caseSensitive?new RegExp(y,"g"):new RegExp(y,"ig");a(o).html("").hide();for(w=0;w<t.length;w+=1){var B=a("<div />"),A=t[w].text;sku=t[w].sku;var v="";if(typeof t[w].sku==="string"&&t[w].sku!==""){v="SKU: "+t[w].sku;}if(b.highlightMatches===true){A=A.replace(z,"<strong class='highlight'>$1</strong>");sku=v.replace(z,"<strong class='highlight'>$1</strong>");}a(B).append('<p class="text">'+A+'</p><div style="display:block; text-align:left; width:260px; float:right; margin-bottom:10px;">'+sku+"</div>");if(typeof t[w].extra==="string"){a(B).append('<p class="extra">'+t[w].extra+"</p>");}if(typeof t[w].image==="string"){a(B).prepend('<img src="'+t[w].image+'">').append('<div style="clear:both;display:block;height:0px;font-size:0px;width:320px;line-height:0px; font-size:0; padding:0; margin:0;"></div>');}a(B).addClass("resultItem").addClass((x)?"odd":"even").click(function(D){return function(){g(t[D]);};}(w)).mouseover(function(D){return function(){f(D);};}(B));a(o).append(B);x=!x;C+=1;if(typeof b.maxResults==="number"&&C>=b.maxResults){break;}}if(a("div",o).length>0){k=undefined;a(o).show().css("height","auto");if(a(o).height()>b.maxHeight){a(o).css({overflow:"auto",height:b.maxHeight});}a('<div id="view_all_results"><img src="/_design/powerwerx/_images/searchViewAllResults.gif"/></div>').appendTo(".jsonSuggestResults").mousedown(function(){a('<img src="/_design/powerwerx/_images/loading_results.gif" style="border:none;" />').load(function(){a("a.search_button").css({backgroundImage:"url(/_design/powerwerx/_images/loading_results.gif)"});});Search();}).mouseover(function(){a(".jsonSuggestResults div").removeClass("hover");a("#view_all_results img").attr({src:"/_design/powerwerx/_images/searchViewAllResultsOvr.gif"});}).mouseout(function(){a("#view_all_results img").attr({src:"/_design/powerwerx/_images/searchViewAllResults.gif"});});}else{a('<div class="resultItem" id="no_results" style="padding:5px 0">Sorry, your search returned no results..</div>').appendTo(o).mousedown(function(){e();return false;}).bind("click",function(){e();return false;});a(o).show().css("height","auto");}}function q(z){if(this.value.length<b.minCharacters){a(o).html("").hide();return false;}var x=[],w=(!b.wildCard)?j(this.value):j(this.value,b.wildCard).replace(h,".*"),t=true,y,v;if(b.notCharacter&&w.indexOf(b.notCharacter)===0){w=w.substr(b.notCharacter.length,w.length);if(w.length>0){t=false;}}w=w||".*";w=b.wildCard?"^"+w:w;y=b.caseSensitive?new RegExp(w):new RegExp(w,"i");if(b.ajaxResults===true){x=c(this.value,b.wildCard,b.caseSensitive,b.notCharacter);if(typeof x==="string"){x=JSON.parse(x);}}else{for(v=0;v<c.length;v+=1){if(y.test(c[v].text)===t){x.push(c[v]);}}}u(x,w);}var p=0;var s;function r(x){switch(x.keyCode){case 13:a(k).trigger("click");case 40:if(typeof k==="undefined"){k=a("div.resultItem:first",o).get(0);}else{k=a(k).next().get(0);}f(k);if(k){a(o).scrollTop(k.offsetTop);}return false;case 38:if(typeof k==="undefined"){k=a("div.resultItem:last",o).get(0);}else{k=a(k).prev().get(0);}f(k);if(k){a(o).scrollTop(k.offsetTop);}return false;default:var w=this;function v(){q.apply(w,[x]);}function t(){if(this.timeoutId){window.clearTimeout(this.timeoutId);}this.timeoutId=window.setTimeout(v,200);}t();}}a(o).addClass("jsonSuggestResults").css({top:(n.position().top+n.height()+5)+"px",right:10+"px",width:331+"px"}).hide();n.after(o).keyup(r).blur(function(v){var t=a(o).offset();t.bottom=t.top+a(o).height();t.right=t.left+a(o).width();if(l<t.top||l>t.bottom||m<t.left||m>t.right){a(o).hide();}}).focus(function(t){a(o).css({top:(n.position().top+n.height()+5)+"px"});if(a("div",o).length>0){a(o).show();}}).attr("autocomplete","off");a().mousemove(function(t){m=t.pageX;l=t.pageY;});if(a.browser.opera){n.keydown(function(t){if(t.keyCode===40){return r(t);}});}b.notCharacter=j(b.notCharacter||"");if(!b.ajaxResults){if(typeof c==="function"){c=c();}if(typeof c==="string"){c=JSON.parse(c);}}});};})(jQuery);if(!this.JSON){JSON=function(){function f(n){return n<10?"0"+n:n;}Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z";};var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapeable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapeable.lastIndex=0;return escapeable.test(string)?'"'+string.replace(escapeable,function(a){var c=meta[a];if(typeof c==="string"){return c;}return"\\u"+("0000"+(+(a.charCodeAt(0))).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key);}if(typeof rep==="function"){value=rep.call(holder,key,value);}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null";}gap+=indent;partial=[];if(typeof value.length==="number"&&!(value.propertyIsEnumerable("length"))){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null";}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v;}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value,rep);if(v){partial.push(quote(k)+(gap?": ":":")+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value,rep);if(v){partial.push(quote(k)+(gap?": ":":")+v);}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v;}}return{stringify:function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" ";}}else{if(typeof space==="string"){indent=space;}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify");}return str("",{"":value});},parse:function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+(+(a.charCodeAt(0))).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j;}throw new SyntaxError("JSON.parse");}};}();}$('<img src="/_design/powerwerx/_images/loading_results.gif">').load();function dSb(){$("a.search_button").css({backgroundImage:"url(/_design/powerwerx/_images/searchButtons.gif)"});}function beforeSendAction(){$("a.search_button").css({backgroundImage:"url(/_design/powerwerx/_images/loading_results.gif)"});var a=setTimeout(dSb,500);}function callback(a){$("a.search_button").css({backgroundImage:"url(/_design/powerwerx/_images/loading_results.gif)"});window.location=a.href;}$(function(){$("a.search_button").click(function(){Search();});$("input#search_box").jsonSuggest(function(text,wildCard,caseSensitive,notCharacter){rez=$.ajax({type:"GET",url:"/searchsuggestdata.asp",data:"q="+text,dataType:"json",async:false,beforeSend:beforeSendAction});return eval(rez.responseText);},{ajaxResults:true,minCharacters:3,maxResults:8,maxHeight:800,onSelect:callback});});

// Logo hover
$(document).ready(function () {
    $('#logo').hover(
        function () {
            $("#home").css("opacity", "0"); 
            $('#home').show();
            $('#home').stop().animate({opacity: 1}, "fast");  
        },
        function () {
            $('#home').show();
            $('#home').stop().animate({ opacity: 0 }, "fast");  
        }
    );
});

/* Smooth scrolling
   Changes links that link to other parts of this page to scroll
   smoothly to those links rather than jump to them directly, which
   can be a little disorienting.

   sil, http://www.kryogenix.org/

   v1.0 2003-11-11
   v1.1 2005-06-16 wrap it up in an object
*/
var ss={fixAllLinks:function(){var b=document.getElementsByTagName("a");for(var a=0;a<b.length;a++){var c=b[a];if((c.href&&c.href.indexOf("#")!=-1)&&((c.pathname==location.pathname)||("/"+c.pathname==location.pathname))&&(c.search==location.search)){ss.addEvent(c,"click",ss.smoothScroll)}}},smoothScroll:function(k){if(window.event){target=window.event.srcElement}else{if(k){target=k.target}else{return}}if(target.nodeType==3){target=target.parentNode}if(target.nodeName.toLowerCase()!="a"){return}anchor=target.hash.substr(1);var n=document.getElementsByTagName("a");var d=document.getElementsByTagName("div");var m=[n,d];var l=null;for(var f=0;f<m.length;f++){for(var g=0;g<m[f].length;g++){var h=m[f][g];if(h.name&&(h.name==anchor)){l=h;break}else{if(h.id&&(h.id==anchor)){l=h;break}}}}if(!l){return true}var c=l.offsetLeft;var a=l.offsetTop;var b=l;while(b.offsetParent&&(b.offsetParent!=document.body)){b=b.offsetParent;c+=b.offsetLeft;a+=b.offsetTop}clearInterval(ss.INTERVAL);cypos=ss.getCurrentYPos();ss_stepsize=parseInt((a-cypos)/ss.STEPS);ss.INTERVAL=setInterval("ss.scrollWindow("+ss_stepsize+","+a+',"'+anchor+'")',10);if(window.event){window.event.cancelBubble=true;window.event.returnValue=false}if(k&&k.preventDefault&&k.stopPropagation){k.preventDefault();k.stopPropagation()}},scrollWindow:function(a,c,b){wascypos=ss.getCurrentYPos();isAbove=(wascypos<c);window.scrollTo(0,parseInt(wascypos+(c-wascypos)/12+4));iscypos=ss.getCurrentYPos();isAboveNow=(iscypos<c);if((isAbove!=isAboveNow)||(wascypos==iscypos)){window.scrollTo(0,c);clearInterval(ss.INTERVAL);location.hash=b}},getCurrentYPos:function(){if(document.body&&document.body.scrollTop){return document.body.scrollTop}if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}if(window.pageYOffset){return window.pageYOffset}return 0},addEvent:function(e,d,b,a){if(e.addEventListener){e.addEventListener(d,b,a);return true}else{if(e.attachEvent){var c=e.attachEvent("on"+d,b);return c}else{alert("Handler could not be removed")}}}};ss.STEPS=25;ss.addEvent(window,"load",ss.fixAllLinks);

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:250,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/* facebox.js */
(function(f){f.facebox=function(m,l){f.facebox.loading();if(m.ajax){g(m.ajax)}else{if(m.image){c(m.image)}else{if(m.div){j(m.div)}else{if(f.isFunction(m)){m.call(f)}else{f.facebox.reveal(m,l)}}}}};f.extend(f.facebox,{settings:{opacity:0.4,overlay:true,loadingImage:"/facebox/loading.gif",closeImage:"/facebox/closelabel.gif",imageTypes:["png","jpg","jpeg","gif"],faceboxHtml:'	  <div id="facebox" style="display:none;"> 				  <div class="popup">         <table>           <tbody>             <tr>               <td class="tl"/><td class="b"/><td class="tr"/>             </tr>             <tr>               <td class="b"/>               <td class="body"> 			  <div class="genericLightboxHeading">				  <h2>d				  </h2>				  <a href="#" class="close" />				</div>				<div class="footer"> 				</div> 				<div class="content"> 				</div>               </td>               <td class="b"/>             </tr>             <tr>               <td class="bl"/><td class="b"/><td class="br"/>             </tr>           </tbody>         </table>       </div>     </div>',controlsHtml:'	  <div class="faceboxControls">		  <a id="button-previous">		  </a>		  <a id="button-next">		  </a>	  </div>'},loading:function(){k();if(f("#facebox .loading").length==1){return true}e();f("#facebox .content").empty();f("#facebox .body").children().hide().end().append('<div class="loading"></div>');f("#facebox").css({top:h()[1]+(i()/10),left:385.5}).show();f(document).bind("keydown.facebox",function(l){if(l.keyCode==27){f.facebox.close()}return true});f(document).trigger("loading.facebox")},reveal:function(q,t){var p=f(".prod_img2 a").length;var l;var o;var u=f(q).find("img").attr("src");var m=f(".prod_img2 a:eq(0)").attr("href");var n=f("#pw-gallery .prod_img3 a").attr("href");var s=(u.indexOf(n)!=-1||u.indexOf(m)!=-1);var w;u=u.replace(getBaseURL(),"/");f(".prod_img2 a[href^=clickedImage]").addClass("active");if(s){if(f(".prod_desc_title h1").find("span").text()!=""&&f(".prod_desc_title h1").find("span").text()!=undefined){l=f(".prod_desc_title h1").text()}else{if(f(".prod_desc_title h1 span").text()!=""&&f(".prod_desc_title h1 span").text()!=undefined){l=f(".prod_desc_title h1 span").text()}else{if(f("#lt_prod_wrapper h1").text()!=""&&f("#lt_prod_wrapper h1").text()!=undefined){l=f("#lt_prod_wrapper h1").text()}else{if(f(".prod_img3 img").attr("alt")){l=f(".prod_img3 img").attr("alt")}else{l=f("#spec-visible .prod_name").text()}}}}}else{if(p==0){if(f(".prod_desc_title h1").find("span").text()==""){l=f(".prod_desc_title h1").text()}else{l=f(".prod_desc_title h1 span").text()}}else{f(".prod_img2 a").each(function(){o=f(this).attr("href");if(o.indexOf(u)!=-1||u.indexOf(o)!=-1){l=f(this).find("img").attr("alt")}})}}f("#facebox .genericLightboxHeading h2").html("<span>"+l+"</span>");if(p>0&&p<=4){var r='<div id="facebox-counter"><span>1</span> of '+p+"</div>";var v='<div id="facebox-thumbs"></div>';f("#facebox .footer").html(f.facebox.settings.controlsHtml+r+v);f(".prod_img2 a").each(function(){var y=f(this).clone();y.click(function(){var B=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;var A=f(this).attr("href");var z=f(this).find("img").attr("alt");if(A!=f("#facebox .content .image img").attr("src")){f("#facebox .content .image").css({height:f("#facebox .content .image").height()});if(B){f('<div style="display:none"></div>').load(A,function(){f('<div style="display:none" id="imagePreload"><img src="'+A+'"></div>').appendTo("body");w=f("#imagePreload img").height();f("#facebox .content .image").css({height:w}).empty();f('<img src="'+A+'" alt="'+z+'" style="display:none" />').appendTo("#facebox .content .image");f("#facebox .content .image").animate({height:f("#facebox .content .image img").height()},500,function(){f("#facebox .content .image img").fadeIn();f("#facebox .genericLightboxHeading span").text(z)})})}else{f('<img src="'+A+'" alt="'+z+'" style="display:none" />').load(function(){f("#facebox .content .image").empty().append(this);f("#facebox .content .image").animate({height:f("#facebox .content .image img").height()},500,function(){f("#facebox .content .image img").fadeIn();f("#facebox .genericLightboxHeading span").text(z)})})}}return false});y.find("img").removeAttr("width").removeAttr("height").attr("src",y.find("img").attr("src").replace(/\.(jpg|png|gif)$/,"").replace(/(sm|med|lrg|xlrg)$/,"")+"med.gif");y.appendTo("#facebox-thumbs");if(y.attr("href")==u){y.addClass("active");f("#facebox-counter span").text(f(".prod_img2 a").index(this)+1)}});f("#button-next").click(function(){navigateThumbs("next")});f("#button-prvious").click(function(){navigateThumbs("previous")});var x=1;f("#facebox-thumbs a").each(function(){var y=f(this).find("img").attr("src");f(this).attr("rel",x).click(function(){var z=f("#facebox-thumbs a").index(this);f("#facebox-counter span").text(z+1);f("#facebox-thumbs a").removeClass("active");f(this).addClass("active")}).hoverIntent(function(){f(this).click()},function(){});x++});f("a#button-next").unbind("click").click(function(){var z=f("#facebox-thumbs a").length;var y=parseInt(f("#facebox-thumbs a.active").attr("rel"));if(y==z){f("#facebox-thumbs a:first").click()}else{f("#facebox-thumbs a.active").next().click()}});f("a#button-previous").unbind("click").click(function(){var z=f("#facebox-thumbs a").length;var y=parseInt(f("#facebox-thumbs a.active").attr("rel"));var A=parseInt(y-1);if(y==1){f("#facebox-thumbs a:last").click()}else{f("#facebox-thumbs a.active").prev().click()}});f("#facebox .footer").show()}else{if(p>4){}}f(document).trigger("beforeReveal.facebox");if(t){f("#facebox .content").addClass(t)}f("#facebox .content").append(q);f("#facebox .loading").remove();f("#facebox .body").children().not(".footer").fadeIn("normal");f("#facebox").css("left",f(window).width()/2-(f("#facebox table").width()/2));f(document).trigger("reveal.facebox").trigger("afterReveal.facebox")},close:function(){f(document).trigger("close.facebox");return false}});f.fn.facebox=function(l){function m(){f.facebox.loading(true);var n=this.rel.match(/facebox\[?\.(\w+)\]?/);if(n){n=n[1]}j(this.href,n);return false}return this.click(m)};function k(n){if(f.facebox.settings.inited){return true}else{f.facebox.settings.inited=true}f(document).trigger("init.facebox");d();var l=f.facebox.settings.imageTypes.join("|");f.facebox.settings.imageTypesRegexp=new RegExp("."+l+"$","i");if(n){f.extend(f.facebox.settings,n)}f("body").append(f.facebox.settings.faceboxHtml);var m=[new Image(),new Image()];m[0].src=f.facebox.settings.closeImage;m[1].src=f.facebox.settings.loadingImage;f("#facebox").find(".b:first, .bl, .br, .tl, .tr").each(function(){m.push(new Image());m.slice(-1).src=f(this).css("background-image").replace(/url\((.+)\)/,"$1")});f("#facebox .close").click(f.facebox.close);f("#facebox .close_image").attr("src",f.facebox.settings.closeImage)}function h(){var m,l;if(self.pageYOffset){l=self.pageYOffset;m=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){l=document.documentElement.scrollTop;m=document.documentElement.scrollLeft}else{if(document.body){l=document.body.scrollTop;m=document.body.scrollLeft}}}return new Array(m,l)}function i(){var l;if(self.innerHeight){l=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){l=document.documentElement.clientHeight}else{if(document.body){l=document.body.clientHeight}}}return l}function d(){var l=f.facebox.settings;l.loadingImage=l.loading_image||l.loadingImage;l.closeImage=l.close_image||l.closeImage;l.imageTypes=l.image_types||l.imageTypes;l.faceboxHtml=l.facebox_html||l.faceboxHtml}function j(m,l){if(m.match(/#/)){var n=window.location.href.split("#")[0];var o=m.replace(n,"");f.facebox.reveal(f(o).clone().show(),l)}else{if(m.match(f.facebox.settings.imageTypesRegexp)){c(m,l)}else{g(m,l)}}}function c(m,l){var n=new Image();n.onload=function(){f.facebox.reveal('<div class="image"><img src="'+n.src+'" /></div>',l)};n.src=m}function g(m,l){f.get(m,function(n){f.facebox.reveal(n,l)})}function b(){return f.facebox.settings.overlay==false||f.facebox.settings.opacity===null}function e(){if(b()){return}if(f("facebox_overlay").length==0){f("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')}f("#facebox_overlay").hide().addClass("facebox_overlayBG").css("opacity",f.facebox.settings.opacity).click(function(){f(document).trigger("close.facebox")}).fadeIn(200);return false}function a(){if(b()){return}f("#facebox_overlay").fadeOut(200,function(){f("#facebox_overlay").removeClass("facebox_overlayBG");f("#facebox_overlay").addClass("facebox_hide");f("#facebox_overlay").remove()});return false}f(document).bind("close.facebox",function(){f(document).unbind("keydown.facebox");f("#facebox").fadeOut(function(){f("#facebox .content").removeClass().addClass("content");a();f("#facebox .loading").remove()})})})(jQuery);function getBaseURL(){var a=location.href;var b=a.substring(0,a.indexOf("/",14));if(b.indexOf("http://localhost")!=-1){var a=location.href;var c=location.pathname;var f=a.indexOf(c);var e=a.indexOf("/",f+1);var d=a.substr(0,f);return d+"/"}else{return b+"/"}};

/* hide specs */

/**
 * Callback for hideRows, attaches a clickable event to expand hidden rows to the specified HTML
 * @name exampleCallback
 * @param {string} [selector] A CSS selector
 */ 
function exampleCallback(selector){
	// Attach a div that instructs users to click to expand.
	$('<a style="cursor:pointer" class="expando">More Specifications</a>')
		.insertAfter(selector)
		.click(function() {
			$(selector).find('tr').each(function() { $(this).show() });	
			$(this).hide();
		});
}
/**
 * Hides Rows in a table or list based off of a range
 * @name hideRows
 * @param {string}  [selector] A CSS selector
 * @param {integer} [start] Base zero number in which the hiding will begin.
 * @param {integer} [stop] Base zero number in which the hiding will end.
 * @param {function}[callback] This optional function will be called after the rows are hidden.
 */ 
function hideRows(selector, start, stop, callback){
	var currIndex,
	selector  = (selector) ? $(selector) : null,
	start     = (start) ? start : null,
	stop      = (stop) ? stop : selector.length,
	callback  = (callback) ? callback : null;
	
	selector.each(function() {
		currIndex = selector.index(this);
	
	if(currIndex >= start && currIndex <= stop)
			$(this).hide();
	});	
	if(callback)
		callback
}

