function showHelp(TheLink,evt,dwWid){dwWid=(dwWid)?dwWid:500;DW.createWindow("nextSibling",[0,dwWid,0],TheLink,evt,10,[4,0,0],"",1);}
function gFF(moneyIn,showZeroCents,noDollarSign){var moneyOut="";moneyIn=moneyIn.toFixed(2);var moneyInStr=moneyIn.toString();var Money=moneyInStr.split(".");var dollars=Money[0],cents=Money[1];var Dollars=new Array();var counter=0;for(var i=dollars.length-1;i>=0;i--){counter++;Dollars.push(dollars.charAt(i));if(counter%3==0&&i)Dollars.push(",");}
if(!noDollarSign)Dollars.push("$");Dollars.reverse();if(showZeroCents)cents="."+cents;else cents=(cents=="00")?"":"."+cents;moneyOut=Dollars.join("")+cents;return moneyOut;}
function gRF(numberIn){return parseFloat(numberIn.toFixed(2));}
function showBindingPriceQuoteMaterials(){var RequiredMaterials=gId("RequiredMaterials");RequiredMaterials.className=(RequiredMaterials.className=="off")?"on":"off";}
function writeTxt(theResult){var EstimateConsole=gId("EstimateConsole");EstimateConsole.innerHTML=theResult;}
function getCost(PullDown){var total=0;var Form=document.EstimateForm;var Size=Form.Size;var NumForms=Form.NumForms;var LogoDesign=Form.LogoDesign;var NumPhotos=Form.NumPhotos;var SlideShow=Form.SlideShow;var Ecommerce=Form.Ecommerce;var EZ_Edit=Form.EZ_Edit;var BookingCalendar=Form.BookingCalendar;var ThumbnailViewer=Form.ThumbnailViewer;var MobileVersion=Form.MobileVersion;var Missing=null;if(Size.selectedIndex)"davidEst".recordToCookie("Size",Size.selectedIndex);else if(!Missing)Missing=Size;if(NumForms.selectedIndex)"davidEst".recordToCookie("NumForms",NumForms.selectedIndex);else if(!Missing)Missing=NumForms;if(LogoDesign.selectedIndex)"davidEst".recordToCookie("LogoDesign",LogoDesign.selectedIndex);else if(!Missing)Missing=LogoDesign;if(NumPhotos.selectedIndex)"davidEst".recordToCookie("NumPhotos",NumPhotos.selectedIndex);else if(!Missing)Missing=NumPhotos;if(SlideShow.selectedIndex)"davidEst".recordToCookie("SlideShow",SlideShow.selectedIndex);else if(!Missing)Missing=SlideShow;if(Ecommerce.selectedIndex)"davidEst".recordToCookie("Ecommerce",Ecommerce.selectedIndex);else if(!Missing)Missing=Ecommerce;if(EZ_Edit.selectedIndex)"davidEst".recordToCookie("EZ_Edit",EZ_Edit.selectedIndex);else if(!Missing)Missing=EZ_Edit;if(BookingCalendar.selectedIndex)"davidEst".recordToCookie("BookingCalendar",BookingCalendar.selectedIndex);else if(!Missing)Missing=BookingCalendar;if(ThumbnailViewer.selectedIndex)"davidEst".recordToCookie("ThumbnailViewer",ThumbnailViewer.selectedIndex);else if(!Missing)Missing=ThumbnailViewer;if(MobileVersion.selectedIndex)"davidEst".recordToCookie("MobileVersion",MobileVersion.selectedIndex);else if(!Missing)Missing=MobileVersion;if(Missing){Missing.focus();writeTxt(Msg.EstimateInstructions);return;}
var thisHost=(G.live)?G.theHost+"/webdesign":G.theHost+"/david";"davidEst".recordToCookie("EstUrl","http://"+thisHost+"/estimate.aspx?A_"+Size.selectedIndex+"|B_"+NumForms.selectedIndex+"|C_"+LogoDesign.selectedIndex+"|D_"+NumPhotos.selectedIndex+"|E_"+SlideShow.selectedIndex+"|F_"+Ecommerce.selectedIndex+"|G_"+EZ_Edit.selectedIndex+"|H_"+BookingCalendar.selectedIndex+"|I_"+ThumbnailViewer.selectedIndex+"|J_"+MobileVersion.selectedIndex);total=parseInt(Size[Size.selectedIndex].value)+parseInt(NumForms[NumForms.selectedIndex].value)+parseInt(LogoDesign[LogoDesign.selectedIndex].value)+parseInt(NumPhotos[NumPhotos.selectedIndex].value)+parseInt(SlideShow[SlideShow.selectedIndex].value)+parseInt(Ecommerce[Ecommerce.selectedIndex].value)+parseInt(EZ_Edit[EZ_Edit.selectedIndex].value)+parseInt(BookingCalendar[BookingCalendar.selectedIndex].value)+parseInt(ThumbnailViewer[ThumbnailViewer.selectedIndex].value)+parseInt(MobileVersion[MobileVersion.selectedIndex].value);if(total<DB.Rates.Minimum)total=DB.Rates.Minimum;var deposit=Math.round(total/2);total=Math.round(total);var output="<div style='white-space:nowrap;'>";output+="<span class='smallCaps'>Estimate</span> "+gFF(total)+" <span class='bullet'>&#149;</span> <span class='smallCaps'>Deposit</span> "+gFF(deposit);if(G.DE)output+=" <span class='bullet'>&#149;</span> <a href='javascript:void(0);' onClick='getMailQuoteGUI( this, event );' onMouseover='this.title = Msg.EmailEst;'>Mail Quote</a>";output+="</div>";writeTxt(output);}
function setupEstimator(){var Form=document.EstimateForm;var davidEst=GetCookie("davidEst");var a=G.qStr.gV("A");var b=G.qStr.gV("B");var c=G.qStr.gV("C");var d=G.qStr.gV("D");var e=G.qStr.gV("E");var f=G.qStr.gV("F");var g=G.qStr.gV("G");var h=G.qStr.gV("H");var i=G.qStr.gV("I");var j=G.qStr.gV("J");var qStrComplete=(a&&b&&c&&d&&e&&f&&g&&h&&i&&j)?true:false;var qStrIsNum=isNaN(a+b+c+d+e+f+g+h+i+j)?false:true;if(qStrComplete&&qStrIsNum){Form.Size.selectedIndex=parseInt(a);Form.NumForms.selectedIndex=parseInt(b);Form.LogoDesign.selectedIndex=parseInt(c);Form.NumPhotos.selectedIndex=parseInt(d);Form.SlideShow.selectedIndex=parseInt(e);Form.Ecommerce.selectedIndex=parseInt(f);Form.EZ_Edit.selectedIndex=parseInt(g);Form.BookingCalendar.selectedIndex=parseInt(h);Form.ThumbnailViewer.selectedIndex=parseInt(i);Form.MobileVersion.selectedIndex=parseInt(j);getCost(null);}
else if(davidEst){var Size=davidEst.gV("Size");if(Size)Form.Size.selectedIndex=parseInt(Size);var NumForms=davidEst.gV("NumForms");if(NumForms)Form.NumForms.selectedIndex=parseInt(NumForms);var LogoDesign=davidEst.gV("LogoDesign");if(LogoDesign)Form.LogoDesign.selectedIndex=parseInt(LogoDesign);var NumPhotos=davidEst.gV("NumPhotos");if(NumPhotos)Form.NumPhotos.selectedIndex=parseInt(NumPhotos);var SlideShow=davidEst.gV("SlideShow");if(SlideShow)Form.SlideShow.selectedIndex=parseInt(SlideShow);var Ecommerce=davidEst.gV("Ecommerce");if(Ecommerce)Form.Ecommerce.selectedIndex=parseInt(Ecommerce);var EZ_Edit=davidEst.gV("EZ_Edit");if(EZ_Edit)Form.EZ_Edit.selectedIndex=parseInt(EZ_Edit);var BookingCalendar=davidEst.gV("BookingCalendar");if(BookingCalendar)Form.BookingCalendar.selectedIndex=parseInt(BookingCalendar);var ThumbnailViewer=davidEst.gV("ThumbnailViewer");if(ThumbnailViewer)Form.ThumbnailViewer.selectedIndex=parseInt(ThumbnailViewer);var MobileVersion=davidEst.gV("MobileVersion");if(MobileVersion)Form.MobileVersion.selectedIndex=parseInt(MobileVersion);getCost(null);}}
function mailQuote(Form){var MailStatus=gId("MailStatus");var Sender_Email=Form.Sender_Email;Sender_Email.value=Sender_Email.value.trim();var Recipient_Email=Form.Recipient_Email;Recipient_Email.value=Recipient_Email.value.trim();if(!Sender_Email.value){Sender_Email.focus();MailStatus.innerHTML="<span style='color:red;'>Enter your e-mail address</span>";return false;}
else if( !G.emailRE.test(Sender_Email.value)){Sender_Email.focus();MailStatus.innerHTML="<span style='color:red;'>Sender&rsquo;s e-mail is invalid - bad format</span>";return false;}
else if(!Recipient_Email.value){Recipient_Email.focus();MailStatus.innerHTML="<span style='color:red;'>Enter recipient&rsquo;s e-mail address</span>";return false;}
else if( !G.emailRE.test(Recipient_Email.value)){Recipient_Email.focus();MailStatus.innerHTML="<span style='color:red;'>Recipient&rsquo;s e-mail is invalid - bad format</span>";return false;}
else if(Form.Comments.value==Form.Comments.defaultValue)Form.Comments.value="";SetCookie("quoteSender",Sender_Email.value,365);Form.Subject.value="Web Site Quote from "+Sender_Email.value;var SubmitRequest=getAjaxRequest();MailStatus.innerHTML="<div align='center'>"+PB.getProgressBar(null,null,null,null,null,"10pt")+"</div>";PB.initProgressBar();var SubmitButton=gId("SubmitButton");SubmitButton.style.cursor="wait";SubmitButton.disabled=true;SubmitRequest.onreadystatechange=function(){try{if(SubmitRequest.readyState==4){if(SubmitRequest.status==200){var responseText=SubmitRequest.responseText;if( /<span id='ServerError'>/.test(responseText)){var aspError=responseText.replace(/\r/g, "" ).replace(/\n/g, "" );
aspError=aspError.replace(/^.*<span id='ServerError'>/, "" );
aspError=aspError.replace(/<\/span>.*$/, "" );
MailStatus.innerHTML="<span style='color:red;'><b>Error</b>: Your e-mail was undeliverable</span>";var Error=gId("ErrorMailingCart");Error.className="ErrorMailingCart";Error.innerHTML=aspError;}
else
DW.removeWin();}
else if(SubmitRequest.status)alert("Form post error, please try again...\n\nRequest.status expected: 200\nRequest.status returned: "+SubmitRequest.status);SubmitButton.disabled=false;SubmitButton.style.cursor="default";SubmitRequest=getAjaxRequest();}}
catch(Err){var eMsg="AJAX exception at submitForm\n\n";for(var i in Err)eMsg+=i+": "+Err[i]+"\n";try{alert(eMsg);} catch(Err){}}}
var EstimateForm=document.EstimateForm;var thisHost=(G.live)?G.theHost+"/webdesign":G.theHost+"/david";var MsgCanned=new Array();MsgCanned.push(Form.Sender_Email.value);MsgCanned.push(" has e-mailed you a price quote from the web site of David Regier, Web Developer. <a href='");MsgCanned.push("http://");MsgCanned.push(thisHost);MsgCanned.push("/estimate.aspx");MsgCanned.push("?A=");MsgCanned.push(EstimateForm.Size.selectedIndex);MsgCanned.push("&B=");MsgCanned.push(EstimateForm.NumForms.selectedIndex);MsgCanned.push("&C=");MsgCanned.push(EstimateForm.LogoDesign.selectedIndex);MsgCanned.push("&D=");MsgCanned.push(EstimateForm.NumPhotos.selectedIndex);MsgCanned.push("&E=");MsgCanned.push(EstimateForm.SlideShow.selectedIndex);MsgCanned.push("&F=");MsgCanned.push(EstimateForm.Ecommerce.selectedIndex);MsgCanned.push("&G=");MsgCanned.push(EstimateForm.EZ_Edit.selectedIndex);MsgCanned.push("&H=");MsgCanned.push(EstimateForm.BookingCalendar.selectedIndex);MsgCanned.push("&I=");MsgCanned.push(EstimateForm.ThumbnailViewer.selectedIndex);MsgCanned.push("&J=");MsgCanned.push(EstimateForm.MobileVersion.selectedIndex);MsgCanned.push("'>Click here</a> to view the price estimate.");var cannedMsg=MsgCanned.join("");Form.MailLink.value=cannedMsg;var requestBody=getRequestBody(Form);Form.action="form-mailer.aspx"+((G.qStr)?"?"+G.qStr:"");SubmitRequest.open("post",Form.action,true);SubmitRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");SubmitRequest.setRequestHeader("ASP_Job","Mail_Quote");SubmitRequest.send(requestBody);}
function getMailQuoteGUI(Link,evt){if(getAjaxRequest()){var H=new Array();H.push("<form name='MailCart' id='MailCart' onSubmit='mailQuote( this ); return false;' style='margin:0px 0px 0px 0px;'>");H.push("<input type='hidden' name='Subject' value='Web Site Quote from David Regier, Web Developer' />");H.push("<input type='hidden' name='MailLink' />");H.push("<table align='center'>");H.push("<tr align='left'>");H.push("<td style='padding:0px 0px 0px 0px;'>From</td>");H.push("<td style='padding:0px 0px 0px 15px;'>");H.push("<input name='Sender_Email' type='text' class='TextBox' style='width:250px;' title='Accurately enter your e-mail'>");H.push("</td>");H.push("</tr>");H.push("<tr align='left'>");H.push("<td style='padding:15px 0px 0px 0px;'>To</td>");H.push("<td style='padding:15px 0px 0px 15px;'>");H.push("<input name='Recipient_Email' type='text' class='TextBox' style='width:250px;' title='Accurately enter recipient&rsquo;s e-mail'>");H.push("</td>");H.push("</tr>");H.push("<tr>");H.push();H.push("<td colspan='2' align='center' style='padding:15px 0px 0px 0px;'>");H.push("<textarea name='Comments' onFocus='if( value == defaultValue ) value = \"\";' onBlur='if( !value ) value = defaultValue;' title='Message is optional' class='TextBox' style='width:300px; height:100px;'>Your Message</textarea>");H.push("</td>");H.push("</tr>");H.push("<tr>");H.push("<td colspan='2' align='center' style='padding:10px 0px 0px 0px;'>");H.push("<div id='MailStatus' style='font-size:10pt;'>A copy shall automatically be sent to you</div>");H.push("</td>");H.push("</tr>");H.push("<tr>");H.push("<td colspan='2' align='center' style='padding:10px 0px 0px 0px;'>");H.push("<input type='submit' name='SubmitButton' id='SubmitButton' value='Send' style='width:60px;'>");H.push("</td>");H.push("</tr>");H.push("<tr>");H.push("<td colspan='2'>");H.push("<div id='ErrorMailingCart' class='off'></div>");H.push("</td>");H.push("</tr>");H.push("</table>");H.push("</form>");var htm=H.join("");var MailQuote=["Mail Your Quote",htm];DW.createWindow(MailQuote,[0,360,0],Link,evt,15,[4,0,0],null,1);var quoteSender=GetCookie("quoteSender");var MailCart=document.MailCart;try{if(quoteSender){MailCart.Sender_Email.value=quoteSender;MailCart.Recipient_Email.focus();}
else
MailCart.Sender_Email.focus();}
catch(Err){}
if(0){document.MailCart.Sender_Email.value=G.testEmail;document.MailCart.Recipient_Email.value=G.testEmail;document.MailCart.Comments.value="The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.";}}
else{var htm="We're sorry, it appears that your web browser is not AJAX enabled. As a result you cannot use our &ldquo;Mail Estimate&rdquo; feature.";DW.createWindow(["Problem Detected",htm],[0,400,0],Link,evt,10,[2,0,-20],null,1);}}
