/*
=============================================
 Development By: Infinity Arts Interactive, LLC - www.InfinityArts.com, © Copyright 2010-2012 - All rights reserved.
 Description: Inifnity Arts JS Library, Simple Cart Class
 Date: 09/25/2010
 Last Revised: 02/06/2012
=============================================
*/
document.write('<script type="text/javascript" src="'+'/js-libr/api.core.min.js'+'"></scr'+'ipt>');document.write('<script type="text/javascript" src="'+'/js-libr/api.ccval.min.js'+'"></scr'+'ipt>');var iastartup=window.onload,cmpntPath='/components/';window.onload=function(){$(document).ready(function(){$('input[name=CBsameShip]').click(function(e){if($(this).attr('checked')){simplecart.copyShipInfo();}});$('input[name=bill_phone]').keyup(function(e){iacore.keyPhone.key(e,$(this));});$('a[href$=#help-cid]').click(function(e){e.preventDefault();iacore.popwin({url:cmpntPath+'simplecart-cid.aspx',w:400,h:540,s:true});});$('select[name=country]').change(function(){simplecart.destSel();});$('.SCitemPhoto a:eq(0)').attr('title',$('.SCitemPhoto .gallery a:eq(0)').attr('title'));$('.SCitemPhoto .gallery img').mouseover(function(e){$('.SCitemPhoto a:eq(0)').attr('href',$(this).attr('src'));$('.SCitemPhoto a:eq(0) img').attr('src',$(this).attr('src'));});$('a[href$=#help-sp]').click(function(e){e.preventDefault();iacore.popwin({url:cmpntPath+'simplecart-sp.aspx',w:400,h:540,s:true});});if($('input[name=HFshipToErr]').length>0&&$('input[name=HFshipToErr]').val()!=''){alert('We are not currently shipping orders to '+$('input[name=HFshipToErr]').val()+'. Please review our Shipping Policy for more details.');}});if(iastartup){iastartup();}};function SCcontrols(){this.cmpntPath='/components/';};SCcontrols.prototype.getItemForm=function(oProdID){return document.forms['SCprodForm-'+oProdID];};SCcontrols.prototype.selOpt=function(oProdID,oPos,oObj){if(oObj.selectedIndex==0){this.selOpt.disable(oProdID,oPos);}
else{this.selOpt.enable(oProdID,oPos);}};SCcontrols.prototype.selOpt.disable=function(oProdID,oPos){var i=oPos+1;while(this.selbox(oProdID,i)){this.selbox(oProdID,i).disabled=true;this.selbox(oProdID,i).selectedIndex=0;i++;}};SCcontrols.prototype.selOpt.enable=function(oProdID,oPos){var baseClass=new SCcontrols;var i=0;while(this.selbox(oProdID,i)){this.selbox(oProdID,i).disabled=(i<=oPos)?false:true;if(i>oPos){this.selbox(oProdID,i).selectedIndex=0;}
i++;}
i=oPos+1;if(this.selbox(oProdID,i)){iacore.ajax({obj:$('#DIVscProdOpt-'+oProdID+'-'+i),trgt:baseClass.cmpntPath+'simplecart-products.asp?actiontype=getProdOpts&idno='+oProdID+'&optIdno='+this.selOptID(oProdID,i).value+'&optPos='+i+'&selPrice='+this.selPrice(oProdID,oPos),nowrap:true});}};SCcontrols.prototype.selOpt.selbox=function(oProdID,oPos){var baseClass=new SCcontrols;return baseClass.getItemForm(oProdID)['optVal-'+oPos];};SCcontrols.prototype.selOpt.selOptID=function(oProdID,oPos){var baseClass=new SCcontrols;return baseClass.getItemForm(oProdID)['prodOpt-'+oPos];};SCcontrols.prototype.selOpt.selPrice=function(oProdID,oPos){var obj=this.selbox(oProdID,oPos),txt=obj.options[obj.selectedIndex].text;return(txt.indexOf(':')>-1)?txt.split(': $')[1]:0;};SCcontrols.prototype.selOpt.selValue=function(oProdID,oPos){var obj=this.selbox(oProdID,oPos);return obj.options[obj.selectedIndex].value;};SCcontrols.prototype.share=function(oGoTo){var uri=escape(location.href);var title=escape(document.title);var shareon='';if(oGoTo=='all'){window.open('http://www.addthis.com/bookmark.php?wt=nw&amp;pub=ia92589&amp;url='+uri+'&amp;title='+title,'addthis','scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100');return;}
switch(oGoTo){case'facebook':shareon='http://www.addthis.com/bookmark.php?v=250&pub=ia92589&s=facebook&amp;url='+uri+'&title='+title;break;case'twitter':shareon='http://twitter.com/home?status=Sharing+--+'+uri;break;}
if(shareon!=''){window.open(shareon);}};SCcontrols.prototype.addItem=function(oProdID){var form=this.getItemForm(oProdID);var i=0;while(this.selOpt.selbox(oProdID,i)){if(this.selOpt.selValue(oProdID,i)==''){formError('Please select the Item Option to continue.',this.selOpt.selbox(oProdID,i));return;}
i++;}
form.prodOpts.value=i;form.uri.value=location.href;form.qnty.value=form.qnty.value.replace(/[^0-9]/gi,'');if(form.qnty.value==''){form.qnty.value=1;}
form.submit();};SCcontrols.prototype.modItem=function(oPos){var form=document.form1;form['qnty-'+oPos].value=form['qnty-'+oPos].value.replace(/[^0-9]/gi,'');if(form['qnty-'+oPos].value==''){form['qnty-'+oPos].value=1;}
form.HFqnty.value=form['qnty-'+oPos].value;form.HFactionType.value='modItem';form.HFitemPos.value=oPos;form.submit();};SCcontrols.prototype.delItem=function(oPos){var form=document.form1;form.HFactionType.value='delItem';form.HFitemPos.value=oPos;form.submit();};SCcontrols.prototype.destSel=function(){$('input[name=zipcode]').val('');$('#LBLshipRate').text('$0.00');$('#LBLtaxRate').text('$0.00');$('#LBLcartTotal').text('$'+$('input[name=HFsubTotal]').val());if($('select[name=country]').val()=='United States'){$('select[name=shipTypeIdno]').val('').attr('disabled',true);$('#SCzipCalc').show();return;}
var baseClass=new SCcontrols;$('#SCzipCalc').hide();$('input[name=HFcountry]').val($('select[name=country]').val());iacore.ajax({obj:$('#PNLshipSelBox'),trgt:baseClass.cmpntPath+'simplecart.aspx?actiontype=calcShip&country='+$('input[name=HFcountry]').val()+'&zipcode='+$('input[name=zipcode]').val(),nowrap:true});};SCcontrols.prototype.shipCalc=function(){var baseClass=new SCcontrols;$('#LBLshipRate').text('$0.00');$('#LBLcartTotal').text('$'+$('input[name=HFsubTotal]').val());if($('select[name=country]').length>0){$('input[name=HFcountry]').val($('select[name=country]').val());if($('input[name=HFcountry]').val()=='United States'){$('input[name=zipcode]').val($('input[name=zipcode]').val().replace(/[^0-9]/gi,''));}}
if(!iacore.valForm.length($('input[name=zipcode]'),5,'Please enter your Zip Code to continue.')){return false;}
iacore.ajax({obj:$('#PNLshipSelBox'),trgt:baseClass.cmpntPath+'simplecart.aspx?actiontype=calcShip&country='+$('input[name=HFcountry]').val()+'&zipcode='+$('input[name=zipcode]').val(),nowrap:true});if($('input[name=HFcountry]').val()!='United States'){$('#LBLshipRate').text('$0.00');}
else{iacore.ajax({obj:$('#LBLtaxRate'),trgt:baseClass.cmpntPath+'simplecart.aspx?actiontype=calcTax&country='+$('input[name=HFcountry]').val()+'&zipcode='+$('input[name=zipcode]').val(),nowrap:true});}
return false;};SCcontrols.prototype.shipSel=function(){var shipType=$('select[name=shipTypeIdno]').val();if(shipType==''){$('#LBLshipRate').text('$0.00');$('#LBLcartTotal').text('$'+$('input[name=HFsubTotal]').val());return;}
var shipArr=shipType.split('|');var shipRate=parseFloat(shipArr[1]);var taxRate=parseFloat($('#LBLtaxRate').text().replace(/[^0-9\.]/gi,''));var subTotal=parseFloat($('input[name=HFsubTotal]').val());$('#LBLshipRate').text('$'+iacore.formatNum(shipRate));$('#LBLcartTotal').text('$'+iacore.formatNum(shipRate+taxRate+subTotal));};SCcontrols.prototype.promoCode=function(){if(!iacore.valForm.text($('#promoCode'),'Please enter a Promo Code to continue.')){return false;}
return true;};SCcontrols.prototype.checkOut=function(oVer){if($('select[name=shipTypeIdno]').length==0){alert('System Error!\nAn error has occurred while attempting Calculate your Shipping options. Please verify your Zip Code and retry your request. Please contact us for assistance if you continue to experience challenges.');return false;}
if($('select[name=shipTypeIdno]').attr('disabled')){alert('To start the checkout process, please enter a Zip Code and click Update to Calculate your Shipping options.');return false;}
if(!iacore.valForm.select($('select[name=shipTypeIdno]'),'Please enter a select a Shipping Option to continue.')){return false;}
$('input[name=HFactionType]').val((oVer=='pp')?'checkoutPP':'checkoutAN');$('#form1').submit();};SCcontrols.prototype.checkOutInfo=function(){if(!iacore.valForm.text($('input[name=ship_fname]'),'Please enter your First Name to continue.')){return false;}
if(!iacore.valForm.text($('input[name=ship_lname]'),'Please enter your Last Name to continue.')){return false;}
if(!iacore.valForm.text($('input[name=ship_address1]'),'Please enter your Address to continue.')){return false;}
if(!iacore.valForm.text($('input[name=ship_city]'),'Please enter your City to continue.')){return false;}
if($('select[name=ship_country]').val()=='United States'){if($('select[name=ship_state]').val()==''&&$('input[name=ship_stateAlt]').val()==''){iacore.formErr($('select[name=ship_state]'),'Please select or enter your State to continue.');return false;}}else{if($('input[name=ship_stateAlt]').val()==''){iacore.formErr($('input[name=ship_stateAlt]'),'Please enter your State/Province/Region to continue.');return false;}}
if($('select[name=ship_country]').val()=='United States'&&!iacore.valForm.numeric($('input[name=ship_zipcode]'),'Please enter your Zip Code to continue.')){return false;}
if(!iacore.valForm.text($('input[name=bill_fname]'),'Please enter your First Name to continue.')){return false;}
if(!iacore.valForm.text($('input[name=bill_lname]'),'Please enter your Last Name to continue.')){return false;}
if(!iacore.valForm.phone($('input[name=bill_phone]'),'Please enter a valid Phone Number to continue.')){return false;}
if(!iacore.valForm.email($('input[name=bill_email]'),'Please enter a valid Email Address to continue.')){return false;}
if(!iacore.valForm.text($('input[name=bill_address1]'),'Please enter your Address to continue.')){return false;}
if(!iacore.valForm.text($('input[name=bill_city]'),'Please enter your City to continue.')){return false;}
if($('select[name=bill_country]').val()=='United States'){if($('select[name=bill_state]').val()==''&&$('input[name=bill_stateAlt]').val()==''){iacore.formErr($('select[name=bill_state]'),'Please select or enter your State to continue.');return false;}}else{if($('input[name=bill_stateAlt]').val()==''){iacore.formErr($('input[name=bill_stateAlt]'),'Please enter your State/Province/Region to continue.');return false;}}
if($('select[name=bill_country]').val()=='United States'&&!iacore.valForm.numeric($('input[name=bill_zipcode]'),'Please enter your Zip Code to continue.')){return false;}
if(!iacore.valForm.select($('select[name=ccType]'),'Please enter a select a Payment Type to continue.')){return false;}
if(!checkCreditCard($('input[name=ccNum]').val(),$('select[name=ccType]').val())){iacore.formErr($('input[name=ccNum]'),'Please enter a Valid Credit Card Number to continue.');return false;}
if(!iacore.valForm.select($('select[name=expMo]'),'Please enter a select a Expiration Month to continue.')){return false;}
if(!iacore.valForm.select($('select[name=expYr]'),'Please enter a select a Expiration Year to continue.')){return false;}
if(!iacore.valForm.length($('input[name=ccId]'),3,'Please enter the Credit Card CID to continue.')){return false;}
$('select[name=ship_country], input[name=ship_zipcode]').attr('disabled',false);return true;}
SCcontrols.prototype.copyShipInfo=function(){var fldArr='fname,lname,company,address1,address2,city,state,stateAlt,zipcode,country'.split(',');for(var i=0;i<fldArr.length;i++){if($('select[name=bill_'+fldArr[i]+']').length>0){$('select[name=bill_'+fldArr[i]+']').val($('select[name=ship_'+fldArr[i]+']').val());}
else{$('input[name=bill_'+fldArr[i]+']').val($('input[name=ship_'+fldArr[i]+']').val());}}}
var simplecart=new SCcontrols();
