function grow(img){img.style.marginTop='0px';img.style.marginRight='0px';img.style.marginBottom='0px';img.style.marginLeft='0px';img.style.width='70px';img.style.height='70px';}function shrink(img){img.style.marginTop='20px';img.style.marginRight='10px';img.style.marginBottom='0px';img.style.marginLeft='10px';img.style.width='50px';img.style.height='50px';}function chooseSubItem(catalogsku,url,popUrl){var selector=document.getElementById('subItemSelector');selector.value=catalogsku;var link=document.getElementById('enlargeImage');link.onclick=function(){show_lightbox(popUrl+'1')};var link=document.getElementById('moreImages');if(link){link.onclick=function(){show_lightbox(popUrl+'2')};}changeImage(url);}function changeImage(url){var image=document.getElementById('productImage');image.src=url;}function initializeAddToBagForms(){$('form[name=addtobag]').ajaxForm(function(rsp){if(rsp.match(/\S/)){popupWarning(rsp);}else{updateItemNumber('');refreshBagNSuggestedProd();show_lightbox('/index.jp?edge=display.afterAddToBag');}});}function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}function refreshBagNSuggestedProd(){var dt=new Date();var giftwrapChecked=$('input#giftwrapcheckbox:checkbox').attr('checked');if(giftwrapChecked){$('div#shoppingBagForm').load('/index.jp?edge=checkout.shoppingbagForm&giftwrapChecked=true&ajax=D'+dt.getTime());}else{$('div#shoppingBagForm').load('/index.jp?edge=checkout.shoppingbagForm&ajax=E'+dt.getTime());}$('div#suggestedProd').load('/index.jp?edge=checkout.suggestedProd&ajax=F'+(new Date()).getTime(),initializeAddToBagForms);}function validateEmail(email){var eRegExp=new RegExp(/^([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))$/);return eRegExp.test(email);}

function mailing_list(){
var o_sfield=document.getElementById('subscriber_field');
var email=o_sfield.value;var emailEncoded=escape(email);
var firstname	= document.getElementById ( 'firstname' ).value;
var lastname = document.getElementById ( 'lastname' ).value;
var city	= document.getElementById ( 'city' ).value;
var state = document.getElementById ( 'state' ).value;
var zip	= document.getElementById ( 'zip' ).value;
var address1 = document.getElementById ( 'address1' ).value;
var address2 = document.getElementById ( 'address2' ).value;
var age = document.getElementById ( 'age' ).value;
var gender = document.getElementById ( 'gender' ).value; 
if(validateEmail(email)){o_sfield.style.color='#999';o_sfield.value='';window.location.href='/index.jp?edge=display.addSubscriber&emailaddress='+emailEncoded + '&firstname=' + firstname +'&lastname=' + lastname +'&address1=' + address1 +'&address2=' + address2 +'&city=' + city +'&state=' + state +'&zip=' + zip +'&age=' + age +'&gender=' + gender;}
else{alert('Please enter a valid email.');}}function updateItemNumber(successText){$('#header #itemNumber').load('/index.jp?edge=display.getItemsNum&ajax=G'+(new Date()).getTime(),function(a,b,c){if(b=='success'){if(successText.length>0)popupText(successText);}});}function popupText(txtShow){show_lightbox("/index.jp?edge=display.popupTemplate&ContentBody="+txtShow);}function popupWarning(txtShow){show_lightbox("/index.jp?edge=display.popupWarnings&ContentBody="+txtShow);}var tabimg_on=new Array();tabimg_on['you_might']="you_might_also_like-on.png";tabimg_on['tips']="tips-on.png";tabimg_on['ingredients']="ingredients-on.png";var tabimg_off=new Array();tabimg_off['you_might']="you_might_also_like-off.png";tabimg_off['tips']="tips-off.png";tabimg_off['ingredients']="ingredients-off.png";function activate_item_tabs(tab_name){document.getElementById("tabs_bar_on").style.display="block";o_divs=document.getElementsByTagName("div");for(i in o_divs){var curr_div=o_divs[i];var c_name=curr_div.className;if(c_name=="tab_title"||c_name=="tab_content"){curr_div.style.display="none";}}document.getElementById("tabcont_"+tab_name).style.display="block";document.getElementById("tab_"+tab_name).className="tab tab_on";document.getElementById("tabimg_"+tab_name).src="/images/"+tabimg_on[tab_name];}function item_tab_click(tab_name){for(i in tabimg_off){if(document.getElementById("tab_"+i)){document.getElementById("tab_"+i).className="tab";document.getElementById("tabimg_"+i).src="/images/"+tabimg_off[i];document.getElementById("tabcont_"+i).style.display="none";}}document.getElementById("tab_"+tab_name).className="tab tab_on";document.getElementById("tabimg_"+tab_name).src="/images/"+tabimg_on[tab_name];document.getElementById("tabcont_"+tab_name).style.display="block";}function select_visibility(property){for(s=0;s<document.forms.length;s++){for(r=0;r<document.forms[s].length;r++){if(document.forms[s].elements[r].options){document.forms[s].elements[r].style.visibility=property;}}}}function cart_overlay(onoff){document.getElementById("cart_overlay").style.display=(onoff)?"block":"none";}function show_lightbox(url){select_visibility('hidden');document.getElementById("lightbox_container").style.display="block";document.getElementById("lightbox_container").style.height=document.body.clientHeight+"px";if(url.toString().search('\\?')>-1){var ajaxTokenAppend=url+"&ajax=H"+(new Date()).getTime();}else{var ajaxTokenAppend=url+"?ajax=H"+(new Date()).getTime();}document.getElementById("ifr_lightbox").src=ajaxTokenAppend;}function close_lightbox(){select_visibility('visible');document.getElementById("ifr_lightbox").src="";document.getElementById("lightbox_container").style.display="none";}function isLeapYear(yy){var rtn=false;if(yy<50){yy+=2000;}if(yy%4==0&&(yy%100>0||yy%400==0)){rtn=true;}return rtn;}function isValidDate(yy,mm,dd){var rtn=true;if(mm<1||mm>12){rtn=false;}if(dd<1){rtn=false;}if(mm==1||mm==3||mm==5||mm==7||mm==8||mm==10||mm==12){if(dd>31){rtn=false;}}else if(mm==2){if(dd>29||dd==29&&!isLeapYear(yy)){rtn=false;}}else{if(dd>30){rtn=false;}}return rtn;}function toggle_layer(div_id){o_div=document.getElementById(div_id);if(o_div.style.display=="none"||!o_div.style.display){o_div.style.display="block";}else{o_div.style.display="none";}}
