'); $('.assortprice .colorselect').removeAttr('class'); $('.assortprice .pricecolor-wrap div ').addClass('pricecolor'); }); if(viewprice== 'block'){ $('.assortunitprice').css('display','block'); $("").insertAfter("#item"); }else{ $('.assortunitprice').css('display','none'); $("").insertAfter("#item"); } }else{ $(".viewprice-icon").remove(); $('.xnum').show();$('.color_unitprice').remove(); $(".assortunitprice").remove(); if($('#blankchecked').val()!=3){$(".unitpriceblock").show();} document.getElementById('unitprice').innerHTML=data.unit_price;	} document.getElementById('item').innerHTML=data.itemp; document.getElementById('firstsetup').innerHTML=data.first_imprint; if($("#secondsetup").length!=0) { document.getElementById('secondsetup').innerHTML=data.second_imprint; } if($("#runcharge").length!=0) { document.getElementById('runcharge').innerHTML=data.runcharge; } if(data.total_price!=data.total){ document.getElementById('suntotstr').style.display = 'block'; document.getElementById('totalprice').innerHTML=data.total_price; } else{ if($("#suntotstr").length!=0) { document.getElementById('suntotstr').style.display = 'none'; } } if($("#eachrun").length!=0) { if(data.eachruncharge!="($0.00 Each)"){ document.getElementById('eachrun').innerHTML=data.eachruncharge; }else{ document.getElementById('eachrun').innerHTML=""; } } if($("#pmscharge").length!=0) { if(data.pmscharge!="$0.00"){ document.getElementById("pmschargeblock").style.display = 'block'; document.getElementById('pmscharge').innerHTML=data.pmscharge; }else{ document.getElementById("pmschargeblock").style.display = 'none'; document.getElementById('pmscharge').innerHTML=""; } } if(data.discount=='- $0.00' || data.discount=='$0.00'){ //document.getElementById('row1').style.display = 'none'; $('.freesetup_tooltip').html('Increase your order to $500 or more to qualify for $34.99 off on your order today!'); $('.freesetup_row').removeClass('freesetup_apply'); $('.freesetup_row1').removeClass('freesetup_apply'); document.getElementById('discount').innerHTML=data.discount; }else{ document.getElementById('row1').style.display = 'block'; document.getElementById('discount').innerHTML=data.discount; $('.freesetup_tooltip').html('You now qualify for $34.99 OFF on your order! Your discount will be applied at checkout.'); $('.freesetup_row').addClass('freesetup_apply'); $('.freesetup_row1').addClass('freesetup_apply'); } $('.xnum label').html(data.unit_price); if(data.productiontime=='' || data.productiontime==null){ $('.productiontime').hide(); }else{ if(data.productiontime == 1){ $('#ptime').html('24 Hours'); }else{ $('#ptime').html(data.productiontime+' Business Days'); } } if(document.getElementById('blankchecked').value==2){ var curquantity=$('#quantity').val(); var onlylength=$('.blankonlyqty').length; if(onlylength>0){ var blanknotonlyqty=$('.blanknoonlyqty').first().data('quantity'); if(curquantity < blanknotonlyqty && curquantity>1){ var setqty=0; var i=1; var firstsingleqty=0; var onlyqtyarray = new Array(); $('.blankonlyqty').each(function(){ if(i==1){ firstsingleqty=$(this).data('quantity'); } onlyqtyarray.push($(this).data('quantity')); if(curquantity==$(this).data('quantity')){ setqty=1; } i++; }); var goal = parseInt(curquantity); var closest = null; $.each(onlyqtyarray, function(){ if (closest == null || Math.abs(this - goal) < Math.abs(closest - goal)) { closest = this; } }); var newqty=parseInt(closest); if(setqty==0){ $("#warningmsg").html('Quantities from '+firstsingleqty+' to '+blanknotonlyqty+' can be ordered only in increments of 12'); $("#warningmsg").addClass('newwarning'); setTimeout(function(){$("#warningmsg").html("");$("#warningmsg").removeClass('newwarning');},3000); $('#quantity').val(newqty); var theID = $("input:radio:checked[name='productcolor_rr']").attr("id"); if(theID=='r1'){ window.lastElementClicked="INPUT"; window.lastElementClickedId="quantity"; $('#quantity').change(); } } } } } var str=data.total; data.total = str.replace("$",""); document.getElementById('total').innerHTML=data.total; document.getElementById('producttot').value=data.total; if(data.unit_price!="$0.00" && spclwarn!=1){ //$('#warningmsg').html(''); //$('#warningmsg').removeClass('newwarning'); }if(showerr!=1){ if(data.warning){ setTimeout(function() { $('#error_warng').remove(); if(data.quantityentered==qty){ if(document.getElementById("blankchecked").value!=3){ //dialogbox({ type:'alert', title: 'Alert!',content: data.warning, scrollid: 'tabsection'}); $("#warningmsg").html(data.warning);var error_flag=1; if(data.warning){$("#warningmsg").addClass('newwarning');} } } },2000); } if(data.spclwarning==1){ setTimeout(function() { if(data.quantityentered==qty){ if(data.quantityautochange!=0){ document.getElementById('quantity').value=data.quantityautochange; pricechange(1,0,1); window.lastElementClicked="INPUT"; window.lastElementClickedId="quantity"; $('#quantity').change(); $("#q_slider").slider('value',data.quantityautochange); $(".ui-slider-handle .tooltip").html(data.quantityautochange); } } },2000);	}	} //change=1;	} } }); var theID = $("input:radio:checked[name='productcolor_rr']").attr("id"); if(theID=='r1'){ $('.colorlargegroup .clsrsml.active').each(function() { var theID = $(this).attr("data-id"); $(this).children("input[id='qty" + theID + "']").val(qty); }); }else if(theID=='r2'){ } quantityboxselect(); } function trim(str) {return str.replace(/^\s+|\s+$/g,"");}