var error='';var errClr="inputError";sfHover=function(){var sfEls=document.getElementById("nav").getElementsByTagName("LI");for(var i=0;i<sfEls.length;i++){sfEls[i].onmouseover=function(){this.className+=" sfhover";}
sfEls[i].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"");}}}
if(window.attachEvent)window.attachEvent("onload",sfHover);var loctypeLabels={Business:'Company Name / Suite',School:'School Name',Hospital:'Hospital Name / Room',"Funeral Home":'Funeral Home Name',Rural:'Company / Address 2',Apartment:'Apartment Name / Apt. No.',Church:'Company / Address 2',Residence:'Company / Address 2'};function handlerLocTypeChanged(objSelect){var objOption=objSelect.options[objSelect.selectedIndex];var key=objOption.text;var label=loctypeLabels[key];$('f_address2_lbl').innerHTML=label+':';}
function verifyUsername(returnFunc){verifyEmail();}
function verifyEmail(v){if(document.domain=='secure.1-800-balloons.com'){url=SSLpath+"register/verify/";}else{url=AJAXpath+"register/verify/";}
var myAjax=new Ajax.Request(url,{method:'post',parameters:"returnNumeric=1&checkEmail="+$F('f_email'),onComplete:verifyUsernameCheckout});}
function verifyUsernameCheckout(v){if(v.responseText==0){error="<li>Your email address is already in use. Please try another or use <a href=\"/account/passwordRecover/\">recover password</a> link.</li>";}
checkField('f_email','','<li>You must your email address.</li>');checkField('f_password','','<li>You must enter a password.</li>');if($F('f_password')!=$F('f_verify')){error+='<li>Your passwords do not match.</li>';highlightErrorField('f_password');highlightErrorField('f_verify');}else{deHighlightErrorField('f_password');deHighlightErrorField('f_verify');}
if(error==''){$('fm-generic').submit();}else{error="<ul>"+error+"</ul>";$('errorContainer').innerHTML=error;error='';}}
function accountErrorCheck(which){error='';if(which=='reminder'){checkField('f_title','','<li>You must enter a reminder title.</li>');checkField('f_date_mo','','<li>You must choose a reminder month.</li>');checkField('f_date_day','','<li>You must choose a reminder month.</li>');}
if(which=='profile'){checkField('f_firstname','','<li>You must enter a first name.</li>');checkField('f_lastname','','<li>You must enter a last name.</li>');}
if(error==''){$('checkoutForm').submit();}else{$('errorContainer').innerHTML="<h3>An Error Occurred With Your Submission</h3><ul>"+error+"</ul>";}}
function saveDate(resultURL){var url=SSLpath+'checkout/saveDate/';var date=$('f_delDate_yr').value+'-'+$('f_delDate_mo').value+'-'+$('f_delDate_day').value;var rec=$F('f_rec');var pars='delDate='+date+'&rec='+rec;var checkoutAjax=new Ajax.Request(url,{method:'post',parameters:pars});document.location=resultURL;}
function tellAFriend(url){try{document.location=url+$('productAdd').value+"/";}catch(e){document.location=url;}}
function storeAdd2Cart(){document.getElementById('balloonsCart').submit();}
function storeRecipientSelect(id,r){url=SSLpath+'checkout/step1/rec_'+escape(thisR)+'/';pars='action=setRecipient&id='+escape(id)+'&r='+escape(r);try{pars+='&ajax=t';var checkoutAjax=new Ajax.Updater('shippingContainer',url,{method:'post',parameters:pars});}catch(e){url='index.php';pars+='sbx=checkout.step1';document.location=url+'?'+pars;}}
function storeCheckOutShippedGiftStep(step,errorcheck){if(errorcheck){error='';if(step=='shippingForm'){if($F('f_delDate_yr')=='Year'||$F('f_delDate_mo')=='Month'||$F('f_delDate_day')=='Day'){error+='<li>You must choose a delivery date.</li>';}else{var today=new Date();var compareDate=new Date();compareDate.setFullYear($F('f_delDate_yr'),$F('f_delDate_mo')-1,$F('f_delDate_day'))
var holidayDate=new Date();holidayDate.setFullYear(2007,6,4)
if(compareDate.getTime()==holidayDate.getTime()){error+='<li>This is a National holiday we will be closed.  May we suggest sending your order out on the 3rd of July?</li>';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}else{if(compareDate<today){error+='<li>Your delivery date is in the past. Please choose a new date.</li>';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}
else if(document.getElementById('sunday_message').value==1){error+='<li>We are no longer taking orders for this Sunday in the requested delivery area, please change your delivery date to Monday.';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}
else{var futuredays=new Date();futuredays.setTime(today.getTime()+(60*(24*60*60*1000)));if(futuredays<compareDate)
{error+='<li>Your delivery date is further than 60 days in the future. Please select a delivery date that is within the next 90 days or call 1-800-225-5666.</li>';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}else{deHighlightErrorField('f_delDate_yr');deHighlightErrorField('f_delDate_mo');deHighlightErrorField('f_delDate_day');}}}}
checkField('f_locType','','<li>You must choose a location type.</li>');cardLength=$('f_card_msg').value.length;if(cardLength>125){error+='<li>Your card message is too long. It must be 125 characters or less. It is currently '+cardLength+' characters long.';highlightErrorField('f_card_msg');}else deHighlightErrorField('f_card_msg');}
var isRemoteCheck=false;if(step=='shippingForm'||step=='billingForm'){checkField('f_fname','','<li>You must enter a first name.</li>');checkField('f_lname','','<li>You must enter a last name.</li>');checkField('f_address1','','<li>You must enter an address.</li>');checkField('f_city','','<li>You must enter a city.</li>');if($('f_state').value==''){error+='<li>You must enter a state.</li>';highlightErrorField('f_state');}else deHighlightErrorField('f_state');checkField('f_zip','','<li>You must enter a receipient zip.</li>');checkField('f_phone','','<li>You must enter a phone.</li>');}
if(step=='billingForm'){checkField('f_email','','<li>You must enter an email address.</li>');if(!verifyEmailFormat($('f_email').value)){error+='<p class=\"error\">Your email address is not in a valid format.  Please enter a proper email address.</p>';highlightErrorField('email');}
checkField('f_phone','','<li>You must enter a phone number.</li>');checkField('f_ccnum','','<li>You must enter a credit card number.</li>');checkField('f_ccexp_mo','','<li>You must enter a valid credit card expiration month.</li>');checkField('f_ccexp_yr','','<li>You must enter a valid credit card expiration year.</li>');checkField('f_cccvv','','<li>You must enter a credit card security code.</li>');}
if(step=='reviewForm'){if(!$('f_substitution').checked){error+='<li>You must agree to the substitution policy before you can place your order.</li>';}}
if(step=='shippingForm'&&isRemoteCheck)return;if(error=='')
{$('checkoutForm').submit();}
else
{$('errorContainer').innerHTML="<h3>An Error Occurred With Your Submission</h3><ul>"+error+"</ul>";if(step=='shippingForm')
{location.hash='errorHash';new Effect.Highlight('errorContainer');}}}}
function storeCheckOutStep(step,errorcheck){if(errorcheck){error='';if(step=='shippingForm'){if($F('f_delDate_yr')=='Year'||$F('f_delDate_mo')=='Month'||$F('f_delDate_day')=='Day'){error+='<li>You must choose a delivery date.</li>';}else{var today=new Date();var compareDate=new Date();compareDate.setFullYear($F('f_delDate_yr'),$F('f_delDate_mo')-1,$F('f_delDate_day'))
var holidayDate=new Date();holidayDate.setFullYear(2007,6,4)
if(compareDate.getTime()==holidayDate.getTime()){error+='<li>This is a National holiday we will be closed.  May we suggest sending your order out on the 3rd of July?</li>';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}else{if(compareDate<today){error+='<li>Your delivery date is in the past. Please choose a new date.</li>';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}
else if(document.getElementById('sunday_message').value==11){error+='<li>We are no longer taking orders for this Sunday in the requested delivery area, please change your delivery date to Monday.';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}
else{var futuredays=new Date();futuredays.setTime(today.getTime()+(60*(24*60*60*1000)));if(futuredays<compareDate)
{error+='<li>Your delivery date is further than 60 days in the future. Please select a delivery date that is within the next 90 days or call 1-800-225-5666.</li>';highlightErrorField('f_delDate_yr');highlightErrorField('f_delDate_mo');highlightErrorField('f_delDate_day');}else{deHighlightErrorField('f_delDate_yr');deHighlightErrorField('f_delDate_mo');deHighlightErrorField('f_delDate_day');}}}}
checkField('f_locType','','<li>You must choose a location type.</li>');cardLength=$('f_card_msg').value.length;if(cardLength>125){error+='<li>Your card message is too long. It must be 125 characters or less. It is currently '+cardLength+' characters long.';highlightErrorField('f_card_msg');}else deHighlightErrorField('f_card_msg');}
var isRemoteCheck=false;if(step=='shippingForm'||step=='billingForm'){checkField('f_fname','','<li>You must enter a first name.</li>');checkField('f_lname','','<li>You must enter a last name.</li>');checkField('f_address1','','<li>You must enter an address.</li>');checkField('f_city','','<li>You must enter a city.</li>');if($('f_state').value==''){error+='<li>You must enter a state.</li>';highlightErrorField('f_state');}else deHighlightErrorField('f_state');checkField('f_zip','','<li>You must enter a receipient zip.</li>');checkField('f_phone','','<li>You must enter a phone.</li>');}
if(step=='shippingForm')
{var d=new Date();d.setFullYear($('f_delDate_yr').value,$('f_delDate_mo').value-1,$('f_delDate_day').value)
var container=getNotifyContainer2($('f_delDate_mo').value,$('f_delDate_day').value,$('f_delDate_yr').value,d.getDay()+1);error+=(container==null?'':'&nbsp;');}
if(step=='billingForm'){checkField('f_email','','<li>You must enter an email address.</li>');if(!verifyEmailFormat($('f_email').value)){error+='<p class=\"error\">Your email address is not in a valid format.  Please enter a proper email address.</p>';highlightErrorField('email');}
checkField('f_phone','','<li>You must enter a phone number.</li>');if(document.getElementById('pay1').checked){checkField('f_ccnum','','<li>You must enter a credit card number.</li>');checkField('f_ccexp_mo','','<li>You must enter a valid credit card expiration month.</li>');checkField('f_ccexp_yr','','<li>You must enter a valid credit card expiration year.</li>');checkField('f_cccvv','','<li>You must enter a credit card security code.</li>');}}
if(step=='reviewForm'){if(!$('f_substitution').checked){error+='<li>You must agree to the substitution policy before you can place your order.</li>';}}
if(step=='shippingForm'&&isRemoteCheck)return;if(error=='')
{$('checkoutForm').submit();}
else
{$('errorContainer').innerHTML="<h3>An Error Occurred With Your Submission</h3><ul>"+error+"</ul>";if(step=='shippingForm')
{location.hash='errorHash';new Effect.Highlight('errorContainer');}}}}
function verifyLocation(v)
{if(v.responseText=='')
{}
if(error=='')
{$('checkoutForm').submit();}
else
{$('errorContainer').innerHTML="<h3>An Error Occurred With Your Submission</h3><ul>"+error+"</ul>";location.hash='errorHash';new Effect.Highlight('errorContainer');}}
function popupCal(){url=SSLpath+'calendar/';pars='';var mailAjax=new Ajax.Updater('calPopup',url,{method:'get',parameters:pars,onComplete:popupCalShow()});}
function popupCalShow(){try{new Effect.Appear('calPopup');}catch(e){document.getElementById('calPopup').style.display='block';}}
function getCalDt(date){url=SSLpath+'calendar/';pars='dt='+escape(date);var mailAjax=new Ajax.Updater('calPopup',url,{method:'post',parameters:pars,onComplete:popupCalShow()});}
function appearNotifyContainer(name)
{try{new Effect.Appear(name);}
catch(e){$(name).style.display='block';}}
function fadeNotifyContainer(name)
{try{new Effect.Fade(name);}
catch(e){$(name).style.display='none';}}
function getNotifyContainer2(m,d,y,weekday)
{if((m=='12'&&d=='25')||((m=='1'||m=='01')&&(d=='1'||d=='01'))||(m=='11'&&d=='26'))
return'newYearNotice';else
return null;}
function getNotifyContainer(m,d,y,weekday)
{if(document.getElementById('shippedGiftFlg').value==1){url=SSLpath+'dtCheckShippedGift/';pars='dt='+m+':'+d+':'+y+':'+weekday;var mailAjax=new Ajax.Updater('shippedGiftDiv',url,{method:'post',parameters:pars,onComplete:popupCalShow()});return'shippedGiftDiv';}
document.getElementById('sunday_message').value=0;if((m=='2'||m=='02')&&(d=='11'||d=='12'||d=='13'||d=='14'))
return'valDayNoticeFeb12';else
if((m=='2'||m=='02')&&(d=='13'||d=='14'))
return'valDayNotice-capacity';else if((m=='7'||m=='07')&&(d=='4'||d=='04'))
return'closedNotice';else if((m=='12'&&d=='25')||((m=='1'||m=='01')&&(d=='1'||d=='01'))||(m=='11'&&d=='26'))
return'newYearNotice';else if(weekday==1||weekday==7){url=SSLpath+'dtCheckSunday/';pars='dt='+m+':'+d+':'+y+':'+weekday;var mailAjax=new Ajax.Updater('weekendNotice',url,{method:'post',parameters:pars,onComplete:popupCalShow()});return'weekendNotice';}
else
return null;}
var currentContainer;function setCalDt(m,d,y,weekday)
{fadeNotifyContainer('calPopup');var container=getNotifyContainer(m,d,y,weekday);if(container!=currentContainer)
{if(currentContainer)fadeNotifyContainer(currentContainer);if(container)appearNotifyContainer(container);}
currentContainer=container;var monthcount=$("f_delDate_mo").length+1;var monthvalue=$("f_delDate_mo").value;for(i=1;i<monthcount;i++){if(m==i)$("f_delDate_mo").selectedIndex=i;}
var daycount=$("f_delDate_day").length+1;var dayvalue=$("f_delDate_day").value;for(i=1;i<daycount;i++){if(d==i)$("f_delDate_day").selectedIndex=i;}
var yearcount=$("f_delDate_yr").length+1;var yearvalue=$("f_delDate_yr").value;for(i=1;i<yearcount;i++){if(y==i)$("f_delDate_yr").selectedIndex=i;}}
function checkDelDates()
{var d=new Date();d.setFullYear($('f_delDate_yr').value,$('f_delDate_mo').value-1,$('f_delDate_day').value)
setCalDt($('f_delDate_mo').value,$('f_delDate_day').value,$('f_delDate_yr').value,d.getDay()+1);}
function mailingListJoin(){try{url=AJAXpath+'service/list/join/';pars='ajax=t&mlUser='+escape($F('mlUser'));var mailAjax=new Ajax.Updater('mlFormResults',url,{method:'post',parameters:pars});}catch(e){alert(e);document.getElementById('formMailingList').submit();}}
function getPage(url,pars,div){var myAjax=new Ajax.Updater(div,url,{method:'get',parameters:pars});}
function serviceForm(){error='';checkField('fname','','<li>You must enter your first name.</li>');checkField('lname','','<li>You must enter your last name.</li>');checkField('rname','','<li>You must enter the recipient\'s name.</li>');checkField('email','','<li>You must enter your email.</li>');if($F('email')!=$F('confirmemail')){error+='<li>Your email and confirmation address don\'t match.</li>';highlightErrorField('email');highlightErrorField('confirmemail');}else{deHighlightErrorField('email');deHighlightErrorField('confirmemail');}
checkField('comments','','<li>You must enter comments or a question.</li>');if(error==''){$('contactform').submit();}else{$('errorContainer').innerHTML="<h3>An Error Occurred With Your Submission</h3><ul>"+error+"</ul>";location.hash='errorHash';new Effect.Highlight('errorContainer');}}
function verifyEnhancedSearch(){if($('f1').value==''&&$('f2').value==''&&$('f3').value==''){$('enhancedsearcherror').innerHTML="<p>Please choose an option.</p>";new Effect.Highlight('enhancedsearcherror');}else{$('enhancedsearchform').submit();}}
function verifyEmailFormat(str){if(str=='')return true;var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if(filter.test(str))
return true;else
return false;}
function checkField(field,value,errorMessage)
{if($F(field)==value)
{error+=errorMessage;highlightErrorField(field);return true;}
else
{deHighlightErrorField(field);return false;}}
function highlightErrorField(field){try{$(field).className=errClr;}catch(e){}}
function deHighlightErrorField(field){$(field).className='text';}
function getElementsByTagNames(list,obj){if(!obj)var obj=document;var tagNames=list.split(',');var resultArray=new Array();for(var i=0;i<tagNames.length;i++)
{var tags=obj.getElementsByTagName(tagNames[i]);for(var j=0;j<tags.length;j++)
{resultArray.push(tags[j]);}}
var testNode=resultArray[0];if(testNode.sourceIndex)
{resultArray.sort(function(a,b){return a.sourceIndex-b.sourceIndex;});}
else if(testNode.compareDocumentPosition)
{resultArray.sort(function(a,b){return 3-(a.compareDocumentPosition(b)&6);});}
return resultArray;}
function createPopUp(){var div1=document.createElement('div');div1.innerHTML='<div class="bkPopup" id="bkPopupDiv" style=\'display:none\'></div>';document.body.appendChild(div1.firstChild);divObj=document.getElementById('bkPopupDiv');xwidthx=document.body.clientWidth;xheightx=document.body.clientHeight;divObj.style.width=xwidthx+'px';divObj.style.height=xheightx+'px';divObj.style.display='block';popUpCode='<div class="popUp">'+'<br>';popUpCode+="<dl>";popUpCode+="<dd style='color:red;'><b>Delivery Availability:</b></dd>";popUpCode+="<dd class=\"medium\" style='color:red;'>The item you have selected will be delivered Priority mail within 3-5 business days from the day you placed the order with us. </dd>";popUpCode+="<dd class=\"medium\"><b>Same day service does not apply for the Item you have selected.</b></dd><br />";popUpCode+="<input type='hidden' name='f_delDate' id='f_delDate'>";popUpCode+="</dl>";popUpCode+='<button onclick="this.parentNode.parentNode.removeChild(this.parentNode);closeBkPopup();">'+'	Close'+'</button>'+'</div>';var div=document.createElement('div');div.innerHTML=popUpCode;document.body.appendChild(div.firstChild);}
function closeBkPopup(){divObj=document.getElementById('bkPopupDiv');divObj.style.display='none';}
