function MM_swapImgRestore(){var a,b,c=document.MM_sr;for(a=0;c&&a<c.length&&(b=c[a])&&b.oSrc;a++)b.src=b.oSrc}function MM_preloadImages(){var a=document;if(a.images){if(!a.MM_p)a.MM_p=[];var b,c=a.MM_p.length,d=MM_preloadImages.arguments;for(b=0;b<d.length;b++)if(d[b].indexOf("#")!=0){a.MM_p[c]=new Image;a.MM_p[c++].src=d[b]}}}
function MM_findObj(a,b){var c,d;b||(b=document);if((c=a.indexOf("?"))>0&&parent.frames.length){b=parent.frames[a.substring(c+1)].document;a=a.substring(0,c)}if(!(d=b[a])&&b.all)d=b.all[a];for(c=0;!d&&c<b.forms.length;c++)d=b.forms[c][a];for(c=0;!d&&b.layers&&c<b.layers.length;c++)d=MM_findObj(a,b.layers[c].document);if(!d&&b.getElementById)d=b.getElementById(a);return d}
function MM_swapImage(){var a,b=0,c,d=MM_swapImage.arguments;document.MM_sr=[];for(a=0;a<d.length-2;a+=3)if((c=MM_findObj(d[a]))!=null){document.MM_sr[b++]=c;if(!c.oSrc)c.oSrc=c.src;c.src=d[a+2]}}function popup(a,b,c){window.open(a,"_blank","width="+b+",height="+c+",toolbar=0,location=0,directories=0,resizable=1,status=0,menubar=0,scrollbars=0")}
function popup2(a,b,c,d){window.open(a,"_blank","width="+b+",height="+c+",toolbar=0,location=0,directories=0,resizable=1,status=0,menubar=0,scrollbars="+d)}function popupLarge(a,b){window.open(a,b)}function openwin(a,b,c,d){var e=window.screen.availWidth,f=window.screen.availHeight;a=window.open(a,b,"screenX=0,screenY=0,left="+(e-c)/2+",top=0,width="+c+",height="+d+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");a.focus()}
function body_img_onload(){MM_preloadImages("","")}function find_PosX(a){var b=0;if(a.offsetParent)for(;a.offsetParent;){b+=a.offsetLeft;a=a.offsetParent}else if(a.x)b+=a.x;return b}function find_PosY(a){var b=0;if(a.offsetParent)for(;a.offsetParent;){b+=a.offsetTop;a=a.offsetParent}else if(a.y)b+=a.y;return b}
function xstooltip_show(a,b,c){c=document.getElementById(c);a=document.getElementById(a);var d=a.width,e=a.height;if(b){c.innerHTML=b;c.style.top=find_PosY(a)+"px";c.style.left=find_PosX(a)+d+6+"px";c.style.visibility="visible"}}function xstooltip_hide(a){a=document.getElementById(a);a.style.visibility="hidden"}
function getBrowserHeight(){var a=0;a=0;if(typeof window.innerWidth=="number")a=window.innerHeight;else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))a=document.documentElement.clientHeight;else if(document.body&&(document.body.clientWidth||document.body.clientHeight))a=document.body.clientHeight;return a}
function alertSize(){var a=0,b=0;if(typeof window.innerWidth=="number"){a=window.innerWidth;b=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){a=document.documentElement.clientWidth;b=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){a=document.body.clientWidth;b=document.body.clientHeight}window.alert("Width = "+a);window.alert("Height = "+b)}
function textCounter(a,b){if(a.value.length>b)a.value=a.value.substring(0,b)}function getCustomerState(a){var b="get_customer_state_combo.php?country_code="+a;a=new Ajax.Request(b,{method:"post",parameters:a,onComplete:getCustomerStateResponse})}function getCustomerStateResponse(a){var b=$("customer_state");b.innerHTML=a.responseText}function getDeliveryState(a,b){b+=a;a=new Ajax.Request(b,{method:"post",parameters:a,onComplete:getDeliveryStateResponse})}
function getDeliveryStateResponse(a){var b=$("delivery_state");b.innerHTML=a.responseText}function deleteAddress(a,b){var c=document.form1;if(b==1){alert("You can not delete the default address.");return false}if(confirm("Do you want to delete this address record?")){c.delete_id.value=a;c.set_default.value="";c.submit()}else return false}function setDefault(){var a=document.form1;a.delete_id.value="";a.set_default.value="1";a.submit()}function addNew(a){location.href=a}
function clear_cart(a){if(confirm("Are you sure to clear your cart?"))document.location.href=a}function showCreditCard(){var a=$("creditcard_block");if(a)a.style.display="inline"}function hideCreditCard(){var a=$("creditcard_block");if(a)a.style.display="none"}function getCustomerState(a,b){if(b)b+=a;else b="get_customer_state_combo.php?country_code="+a;a=new Ajax.Request(b,{method:"post",parameters:a,onComplete:getCustomerStateResponse})}
function getCustomerStateResponse(a){var b=$("customer_state");b.innerHTML=a.responseText}function selectAddressBook(a){popup2(a,800,300,1)}function getDeliveryAddress(a){var b=document.frmShipping;b.submit_value.value="";b.get_delivery.value="1";b.delivery_id.value=a;b.submit()}function getshippingAddress(a){var b=document.frmShipping;b.submit_value.value="";b.get_shipping.value="1";b.shipping_id.value=a;b.submit()}
function cancelOrder(){var a=document.frmCancel;a.submit_value.value="1";a.submit()}function acceptCancelOrder(){var a=document.frmCancel;a.accept_cancel.value="1";a.submit()}function check_submit(a){var b=document.frmSearch,c=b.keyword.value;a=a?a:window.event;a=a.which?a.which:a.keyCode;if(a==13)if(c==""){alert("Please input keyword to search !");b.keyword.focus();return false}else b.submit()}
function search_keyword(){var a=document.frmSearch,b=a.keyword.value;if(b==""){alert("Please input keyword to search !");a.keyword.focus()}else a.submit()}function showForm(a){if(a=document.getElementById(a))a.style.display=a.style.display=="none"?"inline":"none"}
function doCopy(a){var b=document.frmUpdate;if(b.chk_copy.checked==true){b.delivery_name.value=b.customer_billing_name.value;b.delivery_street_address.value=b.customer_address.value;b.delivery_city.value=b.customer_city.value;b.delivery_zipcode.value=b.customer_zipcode.value;b.delivery_country.selectedIndex=b.customer_country.selectedIndex;a+="state_code="+b.customer_state.value+"&country_code=";getDeliveryState(b.delivery_country.value,a);b.delivery_phone.value=b.customer_phone.value}else{b.delivery_name.value=
"";b.delivery_street_address.value="";b.delivery_city.value="";b.delivery_zipcode.value="";b.delivery_country.selectedIndex=0;getDeliveryState(b.delivery_country.value,a);b.delivery_phone.value=""}}
function withVase(a,b,c){a=new Ajax.Request(a,{method:"post",parameters:b,onComplete:withVaseResponse});a=document.getElementById("subtotal");var d=document.frmItem;d=d.selectShipping;b=parseFloat(b);if(d)if(d.length)for(i=0;i<d.length;i++)if(d[i].selected==true){var e=d.value+"_shipping_id";if(e=document.getElementById(e))if(e.value)b+=parseFloat(e.value)}a.innerHTML="Sub Total : AUD"+b.toFixed(2);setOptionID(c)}
function withVaseResponse(a){var b=$("optionvase_block");b.innerHTML=a.responseText}
function addPrice(a,b){var c=document.getElementById("subtotal"),d=document.frmItem,e=d.option_id,f=d.selectShipping;a=parseFloat(a);if(e)if(e.length)for(i=0;i<e.length;i++){if(e[i].checked==true)a+=parseFloat(e[i].value)}else a+=parseFloat(e.value);if(f)if(f.length)for(i=0;i<f.length;i++)if(f[i].selected==true){e=f.value+"_shipping_id";if(e=document.getElementById(e))if(e.value)a+=parseFloat(e.value)}d.option_vase_id.value=b;c.innerHTML="Sub Total : AUD"+a.toFixed(2)}
function selectAddSubTotal(a){var b=document.getElementById("subtotal"),c=document.frmItem,d=c.option_id,e=c.vase_id;c=0;if(d)if(d.length)for(i=0;i<d.length;i++){if(d[i].checked==true)c+=parseFloat(d[i].value)}else c+=parseFloat(d.value);if(e)if(e.length)for(i=0;i<e.length;i++){if(e[i].checked==true)c+=parseFloat(e[i].value)}else c+=parseFloat(e.value);a="shipping_id_"+a;if(a=document.getElementById(a))if(a.value)c+=parseFloat(a.value);if(b)b.innerHTML="Sub Total : AUD"+c.toFixed(2)}
function setOptionID(a){var b=document.frmItem,c=b.option_id;if(a)b.item_option_id.value=a}function orderGift(){var a=document.frmItem;a.submit()}function focusVase(a){alert(a);a=document.frmItem;(a=a.vase_id)&&a.length&&alert(a.length)}function checkFrom(){var a=document.frm_comment;if(a.review_content.value==""){alert("Please enter a comment.");a.review_content.focus()}else a.submit()}
function openwin_withscroll(a,b,c,d){var e=window.screen.availWidth,f=window.screen.availHeight;a=window.open(a,b,"screenX=0,screenY=0,left="+(e-c)/2+",top="+(f-d)/2+",width="+c+",height="+d+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");a.focus()}function viewDescription(a){openwin_withscroll(a,"title",690,550)}
function ordergift_addPrice(a,b){var c=document.frmGift,d=c.gift_id,e=parseFloat(c.total_gift_price.value);e||(e=parseFloat("0"));if(d)if(d.length)for(i=0;i<d.length;i++)if(d[i].checked==true){if(parseInt(d[i].value)==parseInt(a)){e+=parseFloat(b);d=a+"_gift_id";if(d=document.getElementById(d))d.checked=true}}else{if(parseInt(d[i].value)==parseInt(a)){e-=parseFloat(b);d=a+"_gift_id";if(d=document.getElementById(d))d.checked=false}}else if(d.checked==true){e+=parseFloat(b);d=a+"_gift_id";if(d=document.getElementById(d))d.checked=
true}else{e-=parseFloat(b);d=a+"_gift_id";if(d=document.getElementById(d))d.checked=false}c.total_gift_price.value=e.toFixed(2);a=parseFloat(c.flower_sub_total.value)+e;a="&#36;"+a.toFixed(2);b=document.getElementById("order_sub_total");c=document.getElementById("basket_order_sub_total");b.innerHTML=a;e="&#36;"+e.toFixed(2);if(a=document.getElementById("gift_sub_total"))a.innerHTML=e}function postError(a){var b=document.frmGift;b.action=a;b.submit()}
function selectShipping(a){popup2(a,800,300,1)}function selectDeliveryDate(a){openwin(a,"",300,210)}function getDeliveryDate(){location.reload()}function navigate(a){var b=document.frmList;b.page.value=a;b.submit()}
function press_checkFrom(){var a=document.frm_comment;if(a.your_name.value==""){alert("Please enter Your name.");a.your_name.focus()}else if(a.your_email.value==""){alert("Please enter Email address.");a.your_email.focus()}else if(a.comment.value==""){alert("Please enter a comment.");a.comment.focus()}else if(a.security_code.value==""){alert("Please enter Security Code.");a.security_code.focus()}else a.submit()}
function authorize_checkForm(){var a=document.frm_authorize,b=new Date,c=b.getMonth()+1;b=b.getYear();var d=a.cc_month.value,e=a.cc_year.value,f=d.substr(0,1),h=d.substr(1,2);d=f=="0"?h:d;if(a.cc_number.value==""){alert("Please enter your credit card number.");a.cc_number.focus()}else{if(a.cc_number.value!=""&&a.cc_number.value.length<15){alert("Please enter valid card number.");return false}if(a.cc_cvv.value==""){alert("Please enter secure code.");a.cc_cvv.focus()}else{if(e<b){alert("select correct year.");
a.cc_year.focus();return false}if(e<=b)if(d<c){alert("select correct month.");a.cc_month.focus();return false}if(a.payment_opt.value==1)(c=Mod10())&&a.submit();else{a.poffline.value=1;a.action="";a.submit()}}}}function housepay_checkForm(){var a=document.frm_hacc;if(a.acc_number.value==""){alert("Please enter your account number.");a.acc_number.focus()}else{if(a.payment_opt.value!=1){a.poffline.value=1;a.action=""}a.submit()}}
function pay_offline(a){var b=document.frm_authorize;b.action=a;b.submit()}function trim(a){if(a.length>0){re=/ +$/g;newval=a.replace(re,"");re=/^ +/g;return newvala=newval.replace(re,"")}return""}
function Mod10(){var a=document.frm_authorize,b=a.cc_number.value,c="0123456789",d=b.length,e=parseInt(b),f=b.toString();f=f.replace(/^\s+|\s+$/g,"");b=0;for(var h=true,g=false,k,j=0;j<d;j++){k=""+f.substring(j,j+1);if(c.indexOf(k)=="-1")h=false}h||(g=false);if(d==0&&g)g=false;else if(d>=15){for(d=d;d>0;d--){c=parseInt(e)%10;c=parseInt(c);b+=c;d--;e/=10;c=parseInt(e)%10;c*=2;switch(c){case 10:c=1;break;case 12:c=3;break;case 14:c=5;break;case 16:c=7;break;case 18:c=9;break;default:c=c}e/=10;b+=c}g=
b%10==0?true:false}if(!g){alert("This is NOT a valid Credit Card Number!");a.cc_number.focus();return false}return true};
