$(function(){$(".snapview").css("opacity",0.8).click(function(b){var a=new RegExp("/product/([^/]+)/?","i");var c=$(this).children("a").attr("href").match(a);var d="#snapviewContent";if(c.length>1){$("form").append('<div id="snapviewBackground"></div>').append('<div id="loadingImg" class="QV_Loading"><img src="/CONTENT/Common%20to%20All/IMAGES/Product/loadingprogressbar.gif" /></div>');$("#snapviewBackground").css({opacity:0.3}).click(function(){return CloseFlyout();});$("#loadingImg").centerInClient().dropShadow({left:2,top:2,color:"#333333"});$.ajax({url:"/product/snapview.aspx",type:"GET",data:{ca:c[1]},datatype:"html",timeout:10000,success:function(f){$("#loadingImg").removeShadow().remove();$("form").append('<div id="snapviewContent" class="hide"></div>');var e=$(d);e.html(f).centerInClient().show("normal",function(){$("div.QV_MainBox_Fill").dropShadow({left:4,top:4,color:"#333333"});});$(".QV_Close").click(function(){return CloseFlyout();});$(d+" > form").attr({disabled:false});},error:function(){window.location=c[0];}});return false;}}).parent().bind("mouseover",function(a){$(this).children(".snapview").show();}).bind("mouseout",function(a){$(this).children(".snapview").hide();});});function CloseFlyout(){$("#snapviewContent").removeShadow().animate({height:"hide",width:"hide",opacity:"hide"},"fast",function(){$("#snapviewContent").remove();$("#snapviewBackground").remove();});return false;}function ToggleBackground(c,d){var a=$("#qty"+c.toString());var b;if(a.css("background-color")=="rgb(244, 244, 244)"||a.css("background-color")=="#f4f4f4"){b="#ffffff";}else{b="#f4f4f4";}a.css("background-color",b);$("#RegPrice"+c.toString()).css("background-color",b);if(d){$("#SalePrice"+c.toString()).css("background-color",b);}}function SetQuantity(a,b){if(b!=null){$get(b).value=a;}}function OpenImprintColors(){$("#QV_DetailsBlock").slideUp("fast",function(){$("#QV_ImprintBlock").slideDown("fast");});}function SetImprintColor(b,a){$("#ImprintColorID").attr("value",a);$(".QV_ImprintColorBox").css("background-color",b);$("#QV_ImprintBlock").slideUp("fast",function(){$("#QV_DetailsBlock").slideDown("fast");});Colorize();}function UpdateItemColor(a){$("#ColorValue").attr("value",$("#"+a).val());Colorize();}function Colorize(){if(recolorAvailable){var b=$("#ColorValue").attr("value").split("/");if(b.length==2){var a=$("#ImprintColorID").attr("value");if(a==""){$(".QV_DetailedImg img").attr("src","http://secure.4imprint.com/images/recoloredimage.ashx?ID="+prodID+"&CA="+catAlias+"&base="+b[0]+"&trim="+b[1]);}else{$(".QV_DetailedImg img").attr("src","http://secure.4imprint.com/images/recoloredimage.ashx?ID="+prodID+"&CA="+catAlias+"&base="+b[0]+"&trim="+b[1]+"&imp="+a);}}}}function ValidateControl(c,a){if($("#"+c)){var b=$("#"+c).val();if(b==""||!IsNumeric(b)){alert("Please specify how many of this item you would like to order by either entering a numeric value in the quantity field greater than or equal to the lowest quantity break or by clicking one of the quantity fields above the price.");return false;}else{if(b<a){alert("You must order at least "+a.toString()+" of this item. Please correct and resubmit.");return false;}}}if($("#ColorValue").val()==""){alert("Please select the color you would like the item in.");return false;}else{if($("#ImprintColorID").val()==""){alert("Please select the color you would like this item imprinted with.");return false;}}}function SaveItem(c,d,b){if(ValidateControl(d,b)!=false){$("#QV_ProgressBar").toggle();$(".QV_CartAddSuccessMsg").hide();$("#btnAddToCart").attr("disabled","disabled").hide();var a="{'ProductID':"+c.toString()+",'Quantity':"+$("#"+d).val()+",'Color':'"+$("#ColorValue").val()+"','ImprintLocationID':"+$("#ImprintLocationID").val()+",'ProductImprintLocationID':"+$("#ProductImprintLocationID").val()+",'ImprintColorID':"+$("#ImprintColorID").val()+"}";$.ajax({url:"/cart/ajaxaddtocart.aspx",type:"POST",data:a,contentType:"application/json; charset=utf-8",dataType:"json",timeout:10000,success:function(e){if(e.result==true){$(".QV_CartAddSuccessMsg").html("<strong>This item has been added to your cart.</strong><br><a href='/cart'>Click here to go your cart.</a><br><a onclick='return CloseFlyout();' href='/' class='pointer'>Click here to continue shopping.</a>").show();}else{$(".QV_CartAddSuccessMsg").html("We're sorry, but there was a problem adding this item to your cart. Please <a href="+$(".QV_FullDetailsLink").children("a").attr("href")+">click here</a> to see more details on this item and try a different way.").show();}$("#QV_ProgressBar").toggle();},error:function(){$(".QV_CartAddSuccessMsg").html("We're sorry, but there was a problem adding this item to your cart. Please <a href="+$(".QV_FullDetailsLink").children("a").attr("href")+">click here</a> to see more details on this item and try a different way.").show();$("#QV_ProgressBar").toggle();}});}return false;}function IsNumeric(a){if(a.match(/^\d+$/)==null){return false;}else{return true;}}function OmniLogCartAdd(a){if(typeof s!="undefined"){s.events=(a)?"scOpen, scAdd":"scAdd";s.pageName="Snapview";s.products=savedProdID;var b=s.t();if(b){document.write(b);}}}