var showPriceDiv="";var currentSettings="";var parentSku="";var childSku="";var personalLib="";var ppLastRequest=0;var ppPrice=0;var ppStarted=false;var ppItemTypez="ball";var ppLastSku="";var ppUsePriceBreaks=false;var ppMinPriceBreak;var ppPriceBreaks="";
var ppTitleistRules=false;var wizardParams="";function OkToShowPrice(A){showPriceDiv=A}function ppStockAutoNotify(D,A,B){var C=new AJAX();C.callService(baseURL+"services/ProductAjax.asmx","StockAutoNotify","sku="+D,"email="+A,"notes="+B)}function ajaxStockAutoNotify(A){document.getElementById("AutoNotify").innerHTML="As soon as this item becomes available you will receive an email."
}function ppMultiPopup(){var A=window.open("/ProductImagePopupMulti.aspx?sku="+parentSku+"&settings="+currentSettings+"&image="+document.getElementById("largeimage").src,"productImagePopup","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=785,height=710")
}function ppStart(){t=setTimeout("ppUpdate()",400);var A=new Date();ppLastRequest=A.getSeconds();ppStarted=true}function ppUpdate(){var A=new Date();var B=(A.getSeconds()-ppLastRequest);if(B>0&&B<10){ppGetImage(ppItemTypez);ppLastRequest=A.getSeconds()}if(ppStarted==true){t=setTimeout("ppUpdate()",1000)
}}function ppGetImage(){if(ppStarted==true){var B=false;var C;C="";if(document.getElementById("personalization1")!=null){B=true;if(document.getElementById("personalization1").value!=""){C=C+document.getElementById("personalization1").value}}if(document.getElementById("personalization2")!=null){if(document.getElementById("personalization2").value!=""&&C!=""){C=C+"crlf"
}if(document.getElementById("personalization2").value!=""){C=C+document.getElementById("personalization2").value;B=true}}if(document.getElementById("personalization3")!=null){if(document.getElementById("personalization3").value!=""&&C!=""){C=C+"crlf"}if(document.getElementById("personalization3").value!=""){C=C+document.getElementById("personalization3").value;
B=true}}if(B){var A="";if(document.getElementById("perFont")!=null){if(document.getElementById("perFont").value!="Arial"){A=A+"&font="+document.getElementById("perFont").value}}if(document.getElementById("inkColor")!=null){if(document.getElementById("inkColor").value!="Black"){A=A+"&color="+document.getElementById("inkColor").value
}}if(parentSku.substring(0,5)=="B1300"&&document.getElementById("3")!=null&&document.getElementById("3")!="-"){if(GetDropdownValue("3")=="B"){A=A+"&wedding=BrideGroom"}else{if(GetDropdownValue("3")=="W"){A=A+"&wedding=Bells"}else{if(GetDropdownValue("3")=="H"){A=A+"&wedding=Hearts"
}}}}if(document.getElementById("alignStyle")!=null){A=A+"&idType="+document.getElementById("alignStyle").value}document.getElementById("previewImage").src=baseURL+"dynamic/images/"+encodeURIComponent(encodeHTML(C))+".jpeg?type="+ppItemTypez+A}ppStarted=false
}}function fnTrapRT(){if(document.all){if(event.keyCode==13){event.returnValue=false;event.cancel=true}}}function personalizationPreview(B){ppItemTypez=B;if(!ppStarted){ppStart()}var A=new Date();ppLastRequest=A.getSeconds();if(document.getElementById("personalization1")!=null){document.getElementById("personalization1").value=document.getElementById("personalization1").value.replace(/[^a-zA-Z 0-9\^\.,@#$?%&\*\(\)_!"'\-]+/g,"")
}if(document.getElementById("personalization2")!=null){document.getElementById("personalization2").value=document.getElementById("personalization2").value.replace(/[^a-zA-Z 0-9\^\.,@#$?%&\*\(\)_!"'\-]+/g,"")}if(document.getElementById("personalization3")!=null){document.getElementById("personalization3").value=document.getElementById("personalization3").value.replace(/[^a-zA-Z 0-9\^\.,@#$?%&\*\(\)_!"'\-]+/g,"")
}if(ppTitleistRules==true){personalizationTitleistRules()}}function personalizationTitleistRules(){if(document.getElementById("personalization1")!=null){personalizationTitleistRule(document.getElementById("personalization1"))}if(document.getElementById("personalization2")!=null){personalizationTitleistRule(document.getElementById("personalization2"))
}if(document.getElementById("personalization3")!=null){personalizationTitleistRule(document.getElementById("personalization3"))}}function personalizationTitleistRule(A){A.value=A.value.toUpperCase().replace(/[^a-zA-Z 0-9\^\.,@#$%&\*\(\)_!'\-]+/g,"");if(A.length>17){A.value=A.value.substring(1,17)
}}function ajaxProductPostBack(B){document.getElementById("title").innerHTML=xmlValue(B,"title");document.getElementById("prodSelectionHolderDiv").innerHTML=xmlValue(B,"HTML");document.getElementById("prodBelowFoldInclude").innerHTML=xmlValue(B,"belowFold");
xmlValue(B,"aboveFold");document.getElementById("prodAboveFoldInclude").innerHTML=xmlValue(B,"aboveFold");document.getElementById("includeDescription").innerHTML=xmlValue(B,"includeDescription");document.getElementById("descriptionFold").innerHTML=xmlValue(B,"descriptionFold");
ppPrice=xmlValue(B,"price");ppLastSku=xmlValue(B,"productSku");if(xmlValue(B,"imageHtml")!=""){document.getElementById("imageHtml").innerHTML=xmlValue(B,"imageHtml")}else{if(document.getElementById("mainProductImage")!=null){if(ppLastSku.indexOf("-S")<0){document.getElementById("mainProductImage").src="http://www.golfballs.com/productImages/lg/"+ppLastSku+".gif"
}else{document.getElementById("mainProductImage").src="http://www.golfballs.com/productImages/sm/"+ppLastSku+".gif"}}}if(document.getElementById("cboLogoGroup")!=null){db_initialise()}if(xmlValue(B,"PBREQ")=="true"){ppUsePriceBreaks=true;ppMinPriceBreak=xmlValue(B,"PBMINQTY");
ppPriceBreaks=xmlValue(B,"PBSTRING")}else{ppUsePriceBreaks=false}ppStarted=false;document.getElementById("previewImage").src="http://www.golfballs.com/images/spacer.gif";currentSettings=xmlValue(B,"currentSettings");for(var A=0;A<acctSkus.length;A++){if(acctSkus[A]!=""){if(acctSkus[A]==ppLastSku){document.getElementById(acctSkus[A]).bgColor="yellow"
}else{document.getElementById(acctSkus[A]).bgColor="white"}}}if(showPriceDiv!=""){showtbody(showPriceDiv);hidetbody("HideMe")}if(parentSku.substring(0,1)=="B"){ppStarted=true;ppGetImage()}if(document.getElementById("personalization1")!=null&&document.getElementById("personalization1").onkeyup!=null){document.getElementById("personalization1").onkeyup()
}}function productSelection(A,C){var B=new AJAX();B.callService(baseURL+"services/ProductAjax.asmx","ProductPostBack","ParentSKU="+parentSku,"CurrentSettingsParam="+currentSettings,"WidgetID="+A,"WidgetValue="+C,"OpenBox="+openbox)}function ajaxGetReviewForm(A){document.getElementById("ReviewPlaceHolderDiv").innerHTML=A
}function GetReviewForm(){var A=new AJAX();A.callService(baseURL+"services/ProductAjax.asmx","GetReviewForm","parentSku="+parentSku)}function ajaxGetReview(A){document.getElementById("ReviewPlaceHolderDiv").innerHTML=A}function GetReviews(A){var B=new AJAX();
B.callService(baseURL+"services/ProductAjax.asmx","GetReview","parentSku="+parentSku,"reviewPage="+A)}function reviewsPost(){var A="";if(document.getElementById("reviewBody").value.length<5||document.getElementById("reviewName").value.length<2||document.getElementById("reviewTitle").value.length<3||document.getElementById("reviewZip").value.length<2){A=A+"All review fields are required\n";
var B=new AJAX();B.callService(baseURL+"services/ProductAjax.asmx","ProductPostBack","ParentSKU="+parentSku,"CurrentSettingsParam="+currentSettings,"WidgetID="+widgetID,"WidgetValue="+widgetValue)}}function popupImage(){var B="";if(ppLastSku!=""){B=ppLastSku
}else{if(childSku==""){B=parentSku}else{B=childSku}}var A=window.open("/Site/ProductImagePopup.aspx?sku="+B,"productImagePopup","toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=100,height=100")}function ppAddToCart(A){document.getElementById("formQty").value=sanatizeQuantity(document.getElementById("formQty"));
if(ppUsePriceBreaks&&ppPriceFromQty(document.getElementById("formQty").value)==0){return }else{redirect("/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+A)}}function ppAddToCartOpenBox(A){document.getElementById("formQty").value=sanatizeQuantity(document.getElementById("formQty"));
if(ppUsePriceBreaks&&ppPriceFromQty(document.getElementById("formQty").value)==0){return }else{redirect("/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+A+"&openbox=true")}}function ppAddPersonalizedToCart(B){document.getElementById("formQty").value=sanatizeQuantity(document.getElementById("formQty"));
if(B.substring(0,5)=="M1192"){redirect("/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+B+";0;"+GeneratePersonalizationXMLForGiftCertificates())}else{if(ppUsePriceBreaks&&ppPriceFromQty(document.getElementById("formQty").value)==0){}else{if(document.getElementById("alignStyle")==null&&document.getElementById("personalization1").value==""&&document.getElementById("personalization2").value==""&&document.getElementById("personalization3").value==""){alert("One of the personalization fields must be filled in.")
}else{var A=""}if(document.getElementById("rushpersonalization").checked){A=document.getElementById("formQty").value+";M1507-V|"}redirect("/Cart.aspx?cartString="+A+document.getElementById("formQty").value+";"+B+";0;"+GeneratePersonalizationXML())}}}function sanatizeQuantity(A){A.value=A.value.replace(/[^0-9]*/g,"");
if(A.value==""||parseInt(A.value)==0){A.value="1"}if(parseInt(A.value)>12000){A.value="1"}return A.value}function GeneratePersonalizationXMLForGiftCertificates(){var A="<personalization>";if(document.getElementById("personalization1")!=null){A+="<to><![CDATA["+encodeURIComponent(document.getElementById("personalization1").value)+"]]></to>"
}if(document.getElementById("personalization2")!=null){A+="<email><![CDATA["+encodeURIComponent(document.getElementById("personalization2").value)+"]]></email>"}if(document.getElementById("personalization3")!=null){A+="<message><![CDATA["+encodeURIComponent(document.getElementById("personalization3").value)+"]]></message>"
}A+="</personalization>";A=A.replace(/(%7C)+|(%3B)+/g,"%3A");return A}function GeneratePersonalizationXML(){var C="<personalization>";var A=1;var B="";if(document.getElementById("alignStyle")!=null){B=' type="'+document.getElementById("alignStyle").value+'"';
C+="<line1"+B+"><![CDATA["+encodeURIComponent(document.getElementById("personalization1").value).replace(/(%7C)+|(%3B)+/g,"%3A")+"]]></line1>"}else{for(var D=0;D<5;D++){if(document.getElementById("personalization"+D)!=null&&document.getElementById("personalization"+D).value!=""){C+="<line"+A+B+"><![CDATA["+encodeURIComponent(document.getElementById("personalization"+D).value).replace(/(%7C)+|(%3B)+/g,"%3A")+"]]></line"+A+">";
A+=1}}}if(parentSku.substring(0,5)=="B1300"&&document.getElementById("3")!=null&&document.getElementById("3")!="-"){if(GetDropdownValue("3")=="B"){C+="<logo>Bride and Groom</logo>"}else{if(GetDropdownValue("3")=="W"){C+="<logo>Wedding Bells</logo>"}else{if(GetDropdownValue("3")=="H"){C+="<logo>Hearts</logo>"
}}}}if(document.getElementById("inkColor")!=null){C+="<inkColor>"+document.getElementById("inkColor").value+"</inkColor>"}if(document.getElementById("perFont")!=null){if(document.getElementById("perFont").value!="Arial"){C+="<font>"+document.getElementById("perFont").value+"</font>"
}}C+="</personalization>";return C}function wizardPost(B,D,A){if(B.indexOf("Custom")>-1){if(document.getElementById("formQty").value==""){alert("Quantity cannot be empty");return }else{if(ppUsePriceBreaks&&(parseInt(document.getElementById("formQty").value)<parseInt(ppMinPriceBreak))){alert("Quantity cannot be less than the price break, which is: "+ppMinPriceBreak);
return }}}if(A!=""){if(A=="clear"){wizardParams=""}if(wizardParams!=""){wizardParams=wizardParams+"&"}wizardParams=wizardParams+A}var C=new AJAX();C.callService(baseURL+"services/ProductAjax.asmx","WizardRequest","wizardName="+B,"wizardStep="+D,"params="+wizardParams)
}function GetLinesXML(){var A;if(document.getElementById("personalization1").value!=null){A="<line1>"+encodeURIComponent(document.getElementById("personalization1").value).replace(/(%7C)+|(%3B)+/g,"%3A")+"</line1>"}if(document.getElementById("personalization2").value!=null){A+="<line2>"+encodeURIComponent(document.getElementById("personalization1").value).replace(/(%7C)+|(%3B)+/g,"%3A")+"</line2>"
}return A}function GetLines(){var A;if(document.getElementById("personalization1").value!=""){A="line1="+encodeURIComponent(document.getElementById("personalization1").value)}if(document.getElementById("personalization2").value!=""){A+="&line2="+encodeURIComponent(document.getElementById("personalization2").value)
}return A}function GetLinesBasic(){var A;if(document.getElementById("personalization1").value!=""){A=encodeURIComponent(document.getElementById("personalization1").value)}if(document.getElementById("personalization2").value!=""){A+="crlf"+encodeURIComponent(document.getElementById("personalization2").value)
}return A}function ppIDAlignSelectArrow(){ppStarted=true;ppGetImage()}function ppEmbroideryNextStep(A,B,C){wizardParams="";if(ppUsePriceBreaks){if(ppPriceFromQty(document.getElementById("formQty").value)>0){wizardPost("EmbroideryWizard","OptMain","cartItem="+A+"&price="+ppPriceFromQty(document.getElementById("formQty").value)+"&quantity="+document.getElementById("formQty").value+"&description="+B+"&packof="+C)
}document.getElementById("wzTitle").innerHTML="Your "+B}else{wizardPost("EmbroideryWizard","OptMain","cartItem="+A+"&price="+ppPrice+"&quantity="+document.getElementById("formQty").value+"&description="+B+"&packof="+C);document.getElementById("wzTitle").innerHTML="Your "+B
}}function EnableDisableHasLogoChanged(A){if(document.getElementById("setupCharge")!=null&&document.getElementById("setupCharge").value==parseInt(0)){return false}if(A.value=="yes"){document.getElementById("div_logoChanged").style.display="block"}else{document.getElementById("div_logoChanged").style.display="none"
}return true}function GenerateCustomLogoXML(){return GenerateCustomLogoXML(document.getElementById("logoOnFile1"),document.getElementById("hasLogoChanged1"),document.getElementById("notes"),document.getElementById("proofEmail"),null)}function GenerateCustomLogoXML(A,D,C,F,E){var B="";
if(A!=null){B+="<logoOnFile>"+A+"</logoOnFile>"}if(D!=null){B+="<logoChanged>"+D+"</logoChanged>"}if(C!=null&&C!=""){B+="<notes>"+encodeURIComponent(C)+"</notes>"}if(F!=null&&F!=""&&F!="Enter Email Address"){B+="<proofEmail>"+encodeURIComponent(F)+"</proofEmail>"
}if(E!=null&&E!=""){B+='<logoImageName title="Logo%20Name:">'+E+"</logoImageName>"}if(B!=""){B="<personalization>"+B+"</personalization>"}return B}function ppAddCustomLogoToCart(B){if(document.getElementById("logoOnFile1")!=null){if(selectedRadioInc("logoOnFile")==""){alert('Please indicated "your logo is on file with us", or "this is a new order".');
return }else{if(selectedRadioInc("logoOnFile")=="yes"&&selectedRadioInc("hasLogoChanged")==""){alert("Please indicated if your logo has changed.");return }}}var C,A;if(selectedRadioInc("logoOnFile")=="yes"){A=0}else{switch(B.substring(0,1)){case"B":A=0;break;
case"A":A=50;break;default:if(document.getElementById("setupCharge")==null){A=0}else{A=document.getElementById("setupCharge").value}}}if(document.getElementById("expressCustom")==null){C="/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+B+";"+A+";"+GenerateCustomLogoXML()
}else{C="/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+B+";"+A+";"+GenerateCustomLogoXML()+"&ServiceLevel="+document.getElementById("expressCustom").value}redirect(C)}function ppAddCustomLogoToCart(F,C){var B;var A=null;var E;var D;if(ppPriceFromQty(document.getElementById("formQty").value)==0){return 
}if(document.getElementById("expressCustom")==null){B=""}else{B="&ServiceLevel="+document.getElementById("expressCustom").value}document.getElementById("formQty").value=sanatizeQuantity(document.getElementById("formQty"));if(document.getElementById("Logo")!=null){A=document.getElementById("Logo").value
}D=GenerateCustomLogoXML(null,null,null,null,A);E="/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+F+";"+C;if(D!=""){E+=";"+D}E+=B;redirect(E)}function ppCustomLogoNextStep(A,B,C){wizardParams="";if(ppUsePriceBreaks){if(ppPriceFromQty(document.getElementById("formQty").value)>0){wizardPost("CustomLogoWizard","OptMain","cartItem="+A+"&price="+ppPriceFromQty(document.getElementById("formQty").value)+"&quantity="+document.getElementById("formQty").value+"&description="+B+"&packof="+C)
}document.getElementById("wzTitle").innerHTML="Your "+B}else{wizardPost("CustomLogoWizard","OptMain","cartItem="+A+"&price="+ppPrice+"&quantity="+document.getElementById("formQty").value+"&description="+B+"&packof="+C);document.getElementById("wzTitle").innerHTML="Your "+B
}}function ppCustomLogoDynamicWizardNextStep(A,B,D,C){if(ppUsePriceBreaks){if(ppPriceFromQty(document.getElementById("formQty").value)>0){wizardPost("CustomLogoDynamicWizard","OptMain","cartItem="+A+"&price="+ppPriceFromQty(document.getElementById("formQty").value)+"&quantity="+document.getElementById("formQty").value+"&description="+B+"&packof="+D+"&rules="+C)
}document.getElementById("wzTitle").innerHTML="Your "+B}else{wizardPost("CustomLogoDynamicWizard","OptMain","cartItem="+A+"&price="+ppPrice+"&quantity="+document.getElementById("formQty").value+"&description="+B+"&packof="+D+"&rules="+C);document.getElementById("wzTitle").innerHTML="Your "+B
}}function ppPriceFromQty(C){if(IsNumeric(C)){if(ppPriceBreaks==""){return C}var B=ppPriceBreaks.split("|");var A=B.length/2;for(x=1;x<=A;x+=1){if(C>=parseFloat(B[(x-1)*2])){return B[(x-1)*2+1]}}alert("You must order at least "+B[B.length-2]+" units");return 0
}else{alert("Please enter a valid qty in the qty box.");return 0}}function ppDbAddToCart(){if(document.getElementById("formQty").value==""||parseInt(document.getElementById("formQty").value)==0){document.getElementById("formQty").value="1"}var A="";if(document.getElementById("rushpersonalization").checked){A="|1;M1507-V;"
}redirect("/Cart.aspx?cartString="+document.getElementById("formQty").value+";"+ppLastSku+";0;<personalization>"+dbGetDesignPersonalization()+"</personalization>"+A)}function sendEmailToFriend(){var B="";if(document.getElementById("emailFriendName").value.length<2||document.getElementById("emailYourName").value.length<2||document.getElementById("emailFriendBody").value.length<2){B=B+"All email a friend fields are required\n"
}var A=new RegExp("^[\\w-_.]*[\\w-_.]@[\\w].+[\\w]+[\\w]$");if(!A.test(document.getElementById("emailFriendEmail").value)||!A.test(document.getElementById("emailYourEmail").value)){B=B+"The email address provided is not valid\n"}if(B==""){var C=new AJAX();
C.callService(baseURL+"services/ProductAjax.asmx","EmailAFriend","emailFriendName="+document.getElementById("emailFriendName").value,"emailFriendEmail="+document.getElementById("emailFriendEmail").value,"emailYourName="+document.getElementById("emailYourName").value,"emailYourEmail="+document.getElementById("emailYourEmail").value,"emailFriendBody="+document.getElementById("emailFriendBody").value.replace(/\r\n|\r|\n/g," "),"sku="+parentSku)
}else{alert(B)}}function ajaxEmailAFriend(A){document.getElementById("EmailPlaceHolderDiv").innerHTML=A}function reviewsPost(){var B="";if(document.getElementById("reviewBody").value.length<5||document.getElementById("reviewName").value.length<2||document.getElementById("reviewTitle").value.length<3||document.getElementById("reviewZip").value.length<2){B=B+"All review fields are required\n"
}var A=new RegExp("^[\\w-_.]*[\\w-_.]@[\\w].+[\\w]+[\\w]$");if(!A.test(document.getElementById("reviewEmail").value)){B=B+"The email address provided is not valid\n"}if(B==""){var D;if(document.getElementById("addToList").checked){D="1"}else{D="0"}var C=new AJAX();
C.callService(baseURL+"services/ProductAjax.asmx","PostReview","sku="+parentSku,"reviewBody="+document.getElementById("reviewBody").value,"reviewEmail="+document.getElementById("reviewEmail").value,"reviewName="+document.getElementById("reviewName").value,"reviewTitle="+document.getElementById("reviewTitle").value,"reviewZip="+document.getElementById("reviewZip").value,"reviewHandicap="+GetDropdownValue("reviewHandicap"),"reviewRaiting="+GetDropdownValue("reviewRaiting"),"addToList="+D)
}else{alert(B)}}function ajaxPostReview(A){document.getElementById("ReviewPlaceHolderDiv").innerHTML=A}function postQuestion(){var A=new Hash();A.set("productSku",parentSku);ajaxWebFormSubmit("services/ProductAjax.asmx","AskAQuestion","AskAQuestion","postQuestionComplete(ajaxResponse);",null,A)
}function postQuestionComplete(A){if(A.result==null){hide_div("qaForm");show_div("qaThankYou")}else{alert("There was  problem submitting your question. Pease try later or contact support@golfballs.com")}}function ppQuestionShowForm(B){var A="";if($("QuestionAnswer").getParent().hasClass("post")){A=$("QuestionAnswer").getParent().id
}$(B).empty();$(B).adopt($("QuestionAnswer"));show_div("QuestionAnswer");if(A!=""){$(A).set("html",'<A href="javascript:void(0);" OnMouseDown="javascript:ppQuestionShowForm(\''+A+"');\">post your own answer to this question</A>")}}function ppQuestionHideAnswerForm(){}function postQuestionAnswer(){var A=new Hash();
A.set("qaID",$("QuestionAnswer").getParent().id);ajaxWebFormSubmit("services/ProductAjax.asmx","AnswerAQuestion","QuestionAnswer","postAnswerComplete(ajaxResponse);",null,A)}function postAnswerComplete(A){if(A.answerDiv!=null){RePopDiv=$("QuestionAnswer").getParent().id;
$("QuestionAnswerHolder").adopt($("QuestionAnswer"));$(RePopDiv).set("html",A.answerDiv);alert("Your answer has been posted.")}else{alert("There was  problem submitting your question. Pease try later or contact support@golfballs.com")}}function ppToggleShipping(){var A=$("shiptable").getElements("td[id^=stdprint]");
var B=$("shiptable").getElements("td[id^=rshprint]");if($("rushpersonalization").checked){for(X=0;X<A.length;X+=1){A[X].removeClass("highlight")}for(X=0;X<B.length;X+=1){B[X].addClass("highlight")}}else{for(X=0;X<A.length;X+=1){A[X].addClass("highlight")}for(X=0;
X<B.length;X+=1){B[X].removeClass("highlight")}}}