function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function eraseCookie(a){createCookie(a,"",-1)}function editCookie(a){if(readCookie(a)==0){createCookie(a,1,7)}else{createCookie(a,0,7)}}function cookieRules(a){if(readCookie(a)==1){if($(a)){Element.toggle(a)}}}function toggleTags(b){if($(b)){var a=$(b);a.each(function(c){$(this).toggle(c)})}}function getPageScroll(){var a;if(self.pageYOffset){a=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop}else{if(document.body){a=document.body.scrollTop}}}return a}function getPageSize(){var c,a;if(window.innerHeight&&window.scrollMaxY){c=document.body.scrollWidth;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}var b,d;if(self.innerHeight){b=self.innerWidth;d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=b}else{pageWidth=c}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function imgActions(d,c){src=d.src;var a=src.substr(src.lastIndexOf("."),src.length);if(c=="over"){var b=src.substr(0,src.lastIndexOf("."));overSrc=b+"_h"+a;return overSrc}if(c=="out"){var b=src.substr(0,src.lastIndexOf("_"));outSrc=b+a;return outSrc}if(c=="click"){var b=src.substr(0,src.lastIndexOf("_"));clickSrc=b+"_c"+a;return clickSrc}}function enterSubmitFix(b,c){if((c.which&&c.which==13)||(c.keyCode&&c.keyCode==13)){var a=document.getElementById(b.split(":").join("_"));if(a.type=="button"||a.type=="image"||a.type=="submit"){a.focus();a.click()}else{__doPostBack(b.split(":").join("$"),"")}return false}else{return true}}function setFocus(a){setFocusWithScroll(a,false)}function setFocusWithScroll(a,b){var c=document.getElementById(a);c.focus();if(b){c.scrollIntoView()}}function HashTable(){this.hashTable=new Array();this.length=0;this.get=hash_get;this.put=hash_put}function hash_get(a){return this.hashTable[a]}function hash_put(a,b){if(a!=null&&b!=null){this.hashTable[a]=b;this.length++}}function addErrorNotification(c){var a=document.getElementById("divNotifications");var b=document.getElementById("notificationMessages");a.style.color="#c00";addNotificationMessage(a,b,c)}function addNotification(c){var a=document.getElementById("divNotifications");var b=document.getElementById("notificationMessages");a.style.color="#000";addNotificationMessage(a,b,c)}function addNotificationMessage(a,b,c){a.style.visibility="visible";b.innerHTML+="<li>"+c+"</li>"}function clearNotifications(){var a=document.getElementById("notificationMessages");a.innerHTML=""}function hasNotifications(){var a=document.getElementById("notificationMessages");if(a.innerHTML.length>0){return true}else{return false}}function offerBoxSelected(a){var b=document.getElementById("viewCart_offerCodeCheckbox_offerCode");if(b==null){b=document.getElementById("checkOutShipMethods_offerCodeCheckbox_offerCode")}if(a.checked){b.value="true"}else{b.value="false"}}function checkEmail(a){var b=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(b.test(a)){return true}return false}function EmailFriend(g){clearNotifications();var h=document.getElementById(g);var i=document.getElementById("txtRecipientsEmail");var m=document.getElementById("txtMessage");if(h==null||i==null||m==null){addErrorNotification("Could not submit form.  If this problem continues, please contact customer support at 1-888-437-4448.")}else{var l=/^[A-Za-z0-9._%-]+@[A-Za-z0-9._%-]+\.[A-Za-z]{2,4}$/;if(i.value.match(l)==null){addErrorNotification("Please enter a properly formatted e-mail address for your friend.")}if(h.value.match(l)==null){addErrorNotification("Please enter your properly formatted e-mail address.")}if(m.value==""){addErrorNotification("Please enter a message to send to your friend.")}if(!hasNotifications()){var b=null;var a=0;var f=0;if(window.location.href.toLowerCase().indexOf("paudio.aspx")>0||window.location.href.toLowerCase().indexOf("pvideo.aspx")>0){b=document.referrer;if(window.location.href.toLowerCase().indexOf("paudio.aspx")>0){f=1}if(window.location.href.toLowerCase().indexOf("pvideo.aspx")>0){a=1}}if(f||a){var e=GetQueryStringParams();var d=e.get("pn");var j=e.get("itm");if(f){b="http://"+window.location.hostname+"/dietunes/"}else{b="http://"+window.location.hostname+"/bootube/";b+=d+"-"+j+"/"}}else{b=window.location.href}var k=postdataStart+'<EmailFriend xmlns="http://tempuri.org/">\n<sender>'+h.value+"</sender>\n<recipient>"+i.value+"</recipient>\n<message>"+m.value+"</message>\n<url>"+b+"</url>\n<isAudio>"+f+"</isAudio>\n<isVideo>"+a+"</isVideo>\n</EmailFriend>\n"+postdataEnd;alert(k);var c=new Array("Content-Type","text/xml; charset=utf-8","Content-Length",k.length,"SOAPAction","http://tempuri.org/EmailFriend","Host",location.hostname);$.ajax({type:"POST",url:"http://"+location.hostname+"/WebServices.asmx?WSDL",data:k,headers:c,contentType:"text/xml; charset=utf8",dataType:"xml",success:function(o){var n=o.getElementsByTagName("EmailFriendResult");if(n[0].firstChild.nodeValue=="true"){document.getElementById("divEmailFriend").style.visibility="hidden";addNotification("Your message has successfully been sent.  Close this window to continue.")}else{addErrorNotification("An error occurred sending your message.  Please try again later.  If this problem continues, please contact customer support at 1-866-986-3767.")}},error:function(n){addErrorNotification("An error occurred sending your message.  Please try again later.  If this problem continues, please contact customer support at 1-866-986-3767.")}})}}};