var pic=new Array(9);var image=0;function selectCategory(c){var a=generateCatalogCategoryData(c);var b=getAjaxRequest();b.open("POST","/control/catalogcategory",false);b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(a);document.getElementById("category").innerHTML=b.responseText}function generateCatalogCategoryData(b){var a="CURRENT_CATALOG_ID="+b.CURRENT_CATALOG_ID.value+"&CURRENT_CATEGORY_ID="+b.CURRENT_CATEGORY_ID.value+"\n\n";return(a)}function showCategory(c){var a="CURRENT_CATALOG_ID="+c.CURRENT_CATALOG_ID.value+"&CURRENT_CATEGORY_ID=selectCategory_\n\n";var b=getAjaxRequest();b.open("POST","/control/catalogcategory",false);b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(a);document.getElementById("category").innerHTML=b.responseText}function submitCatalogForm(b){var d="";if(b.sendQueryString){var a=b.sendQueryString.value;var e=a.indexOf("mainDecoratorLocation=component%3A//puf/webapp/puf/affiliates/")+62;if(a!=""&&e>=62){d="/eshop/"+a.substring(e,a.indexOf("/",e))}}catalog=b.CURRENT_CATALOG_ID.value;occasion=b.CURRENT_CATEGORY_ID.value;if(occasion.lastIndexOf("_")!=-1){occasion=occasion.substring(0,occasion.lastIndexOf("_"))}if(catalog=="selectCatalog"){alert("Please select country");return false}if(occasion=="selectCategory"){alert("Please select category");return false}var c="http://"+window.location.host+d;if(occasion=="featured"){window.location=c+"/send-flowers-to-"+catalog}else{if(occasion==catalog){window.location=c+"/florists-"+occasion+"-florist"}else{window.location=c+"/send-"+occasion+"-flowers-to-"+catalog}}b.submit();b.CURRENT_CATALOG_ID.selectedIndex;return false}var shouldValidateForm=true;var isDebugOn=false;var itemValue="";function selectTab(a){itemValue=a;if(isDebugOn){alert("function called"+a)}document.getElementById("visiblepanel").innerHTML=document.getElementById("panel"+a).innerHTML}function send(c,e){var a=getAjaxRequest();var d="";if(isDebugOn){alert("Recieved Request to post to "+c)}try{if(isDebugOn){alert("Posting Data to: "+e.action)}a.open("POST",e.action,true);a.setRequestHeader("Content-Type","application/x-www-form-urlencoded");if(c.indexOf("/control/mailservice")>=0){d=generateTellAFriendData(e)}else{if(c.indexOf("/control/minipoll")>=0){d=generateSurveyData(e)}}if(isDebugOn){alert("Posting Data:\r\n"+d)}a.send(d);if(isDebugOn){alert("Done. Posting")}if(c.indexOf("/control/minipoll")>=0){document.getElementById("surveydiv").innerHTML="Thank You for rating us"}}catch(b){if(isDebugOn){displayDebugError("Error communicating with PageEventListener:\n",b)}}}function getAjaxRequest(){var a;try{a=new XMLHttpRequest();return a}catch(b){try{a=new ActiveXObject("Microsoft.XMLHTTP");return a}catch(b){if(isDebugOn){displayDebugError("Error creating AJAX request:\n",b)}return null}}}function responseContent(a){if(a.readyState==4){if(isDebugOn){alert(a.readyState)}alert(a.status);if(a.status==200){if(isDebugOn){alert(a.responseText)}document.getElementById("visiblepanel").innerHTML=a.responseText}else{if(isDebugOn){alert("There was a problem with the request.")}}}}function setBlank(a){if(a.value==a.defaultValue){a.value="";a.style.color="#000000"}else{a.style.color="#000"}}function setDefault(a){if(a.value==""){a.value=a.defaultValue;a.style.color="#000000"}else{a.style.color="#000"}}function changeTextColor(a){a.style.color="#000"}function selectCatalogPrice(a){if(a.productCatalogPrice.value=="selectcountry"){alert("please select a country")}else{var b=a.productCatalogPrice.value;a.product_id.value=b.substring(0,b.indexOf("@"));a.add_product_id.value=b.substring(0,b.indexOf("@"));a.category_id.value=b.substring(b.indexOf("@")+1,b.length)}}function submitBuyNow(a){if(a.productCatalogPrice.value=="selectcountry"){alert("please select a country");return false}return true}function selectOtherCatalog(a){if(a.otherCountry.value=="selectcountry"){alert("please select a country")}else{var e=a.otherCountry.value;var b=e.substring(0,e.indexOf("@"));var d=e.substring(e.indexOf("@")+1,e.length);d=d.substring(0,d.indexOf("_"));var c=b.substring(b.indexOf("_")+1,b.length);b=b.substring(0,b.indexOf("_"));a.action="/"+d+"/send-"+b+"-to-"+c}}var openRequestForCache;function loadDynamicContent(a){if(window.location.protocol=="http:"){var b="http://"+window.location.host;openRequestForCache=getAjaxRequest();openRequestForCache.onreadystatechange=changeHTMLArea;openRequestForCache.open("POST",b+a,true);openRequestForCache.setRequestHeader("Content-Type","application/x-www-form-urlencoded");openRequestForCache.send(null)}}function changeHTMLArea(){if(openRequestForCache.readyState==4){if(openRequestForCache.status==200){var a=document.getElementById("websitetoolbar").innerHTML=openRequestForCache.responseText}}}var openRequestForContent;function updateContent(a,c,d){var b="http://"+window.location.host;openRequestForContent=getAjaxRequest();openRequestForContent.onreadystatechange=c;openRequestForContent.elementToChange=d;openRequestForContent.open("POST",b+a,true);openRequestForContent.setRequestHeader("Content-Type","application/x-www-form-urlencoded");openRequestForContent.send(null)}function changeHTMLContent(){if(openRequestForContent.readyState==4){if(openRequestForContent.status==200){document.getElementById(openRequestForContent.elementToChange).innerHTML=openRequestForContent.responseText}}}function open_support_win(a){if(typeof(newwindow)=="undefined"||newwindow.closed==true){newwindow=window.open("http://www.adriti.com/livechat/beginCustomerChat.do?q="+a,"LiveChat","left=300, top=150, width=500,height=450,menubar=no,toolbar=no,titlebar=no, directories=no,location=no,scrollbars=no,resizable=yes,status=no")}if(window.focus){if(newwindow!=null){newwindow.focus()}}return false}function showDropDownMenu(a,b,c,d){document.getElementById("dropmenudiv").style.marginLeft=d;dropdownmenu(a,b,c,"160px")}function updateAffiliateVisits(){if(window.location.protocol=="http:"){var d=window.location.toString().substring(window.location.toString().indexOf("eshop/")+6);var c=d.substring(0,d.indexOf("/"));if(c!=""){var a="trackingCodeId="+c;var b=getAjaxRequest();b.open("POST","/ezoz/control/updateAffilateVisits",false);b.setRequestHeader("Content-Type","application/x-www-form-urlencoded");b.send(a)}}getSupplierDeliveryNote()}function daysInmonth(a,b){var c=new Array(0,31,28,31,30,31,30,31,31,30,31,30,31);if(((a%4==0)&&(a%100!=0))||(a%400==0)){c[2]=29}return daysInmonth[b]}function shipmentMethodDeliveryDates(){var a;var b=new Array()}var shipmentMethodArray=new Array();function getDeliveryDatesForShipmentMethod(k){var j=checkShipMethWithNoLeadDays(document.getElementById("shipping_method").value);if(j==false){var e=k.value;var c=k.form.add_product_id.value;var b=24*60*60*1000;e=e.substring(0,e.indexOf("@"));var a=0;deliveryDates=[];if(e!=""){if(shipmentMethodArray.length>0){var h=[];for(d=0;d<shipmentMethodArray.length;d++){shipmentMethod=shipmentMethodArray[d];if(e==shipmentMethod.shipmentMethodTypeId){deliveryDates=shipmentMethod.deliveryDates;if(shipmentMethod.deliveryDates.length>0){dt=shipmentMethod.deliveryDates[0];a=shipmentMethod.deliveryDates.length}}}}if(deliveryDates.length==0){var l=getAjaxRequest();var g="/ezoz/control/shipmentMethodSpecificDeliveryDates?shipmentMethodTypeId="+e+"&productId="+c;l.open("GET",g,false);l.send(null);if(l.readyState==4){if(l.status==200){var m=l.responseXML.documentElement;var f=m.getElementsByTagName("deliveryDate");a=f.length;if(a>0){deliveryDates=new Array(a);for(var d=0;d<a;d++){deliveryDates[d]=new Date(f[d].childNodes[0].nodeValue)}shipmentMethodType=new shipmentMethodDeliveryDates();shipmentMethodType.shipmentMethodTypeId=e;shipmentMethodType.deliveryDates=deliveryDates;shipmentMethodArray[shipmentMethodArray.length]=shipmentMethodType}}}}if(deliveryDates.length>0){makeDeliveryCalendar(deliveryDates)}}}}function checkShipMethWithNoLeadDays(c){var a=document.getElementsByName("methodWithNoLeadDays");var b=false;for(var d=0;d<a.length;d++){if(a[d].value==c){b=true;break}}return b}function prepareDeliveryCalendar(c){var a=new Array();if(c!=null&&c.length){for(var b=0;b<c.length;b++){a[b]=formatDate(c[b],"MM/dd/yyyy")}}}function makeDeliveryCalendar(a){deliveryDates=a;cal18=new CalendarPopup("testdiv1");var e=new Date(a[0]);dt=a[0];var c=a.length;e=formatDate(firstDayOfMonth(e),"MM/dd/yyyy");var d=new Date(a[c-1]);d=formatDate(lastDayOfMonth(d),"MM/dd/yyyy");cal18.addDisabledDates(null,formatDate(previousDay(a[0]),"MM/dd/yyyy"));for(var b=0;b<a.length-1;b++){cal18.addDisabledDates(formatDate(nextDay(a[b]),"MM/dd/yyyy"),formatDate(previousDay(a[b+1]),"MM/dd/yyyy"))}cal18.addDisabledDates(formatDate(nextDay(a[c-1]),"MM/dd/yyyy"),d);cal18.setCssPrefix("TEST")}function hidedeliveryDate(){document.getElementById("hidetr1").style.display="none"}function showdeliveryDate(){document.getElementById("hidetr1").style.display="block"}function setDeliveryDates(a){deliveryDates=a}function loadDeliveryDateCalendar(a){return false}function radioClicked(){dt=null;document.getElementById("shippingMethodError").style.display="none"}function validateShipmentMethodSelection(){var a=document.getElementById("shipping_method");if(a.value==""){document.getElementById("shippingMethodError").style.display="block";document.getElementById("shippingMethodError").innerHTML="Please choose a shipping option before selecting the delivery date.";return false}else{cal18.select(document.getElementById("deliveryDate"),"anchor18","E, dd/NNN/yyyy");return true}}function validateCartShipmethSelection(){var a=document.getElementById("shipping_method");if(a.value==""){document.getElementById("deliveryDateError").style.display="block";document.getElementById("deliveryDateError").innerHTML="Please choose a shipping option before selecting the delivery date.";return false}else{cal18.select(document.getElementById("deliveryDate"),"anchor18","E, dd/NNN/yyyy");return true}}function formatDeliveryDate(){if(document.getElementById("deliveryDate")){var a=document.getElementById("deliveryDate").value;if(a!=""){var b=formatDate(prepareDate(a),"dd/NNN/yyyy");if(document.getElementById("setDD")){document.getElementById("setDD").value=b}else{document.getElementById("deliveryDate").value=b}}return true}}function prepareDate(e){var b=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var a=new Array();a=e.split("/");for(var d=0;d<b.length;d++){if(a[1]==b[d]){a[1]=d+1;break}}if(e.length>12){var c=a[0].substring(5,a[0].length);dt=new Date(a[1]+"/"+c+"/"+a[2])}else{dt=new Date(a[1]+"/"+a[0]+"/"+a[2])}return dt}function showHideDeliveryDateCalendar(){var a=document.getElementById("shipping_method").value;var b=checkShipMethWithNoLeadDays(a);if(b==true){hidedeliveryDate();var c=getShipAttrsForShipMeth(a);document.getElementById("hidetr3").style.display="block";if(c.length>0){document.getElementById("hidetr3").innerHTML=getShippingNote(c)}else{document.getElementById("hidetr3").style.display="none"}}else{document.getElementById("hidetr3").style.display="none";showdeliveryDate()}}function chooseShipmentMethod(a){if(document.getElementById("validateError")){document.getElementById("validateError").style.display="none"}document.getElementById("shippingMethodError").style.display="none";showHideDeliveryDateCalendar();getDeliveryDatesForShipmentMethod(a);if(a.value==""){document.getElementById("deliveryDate").value="";document.getElementById("surchargemsg").style.display="none"}else{if(!checkShipMethWithNoLeadDays(document.getElementById("shipping_method").value)){document.getElementById("deliveryDate").value=formatDate(dt,"E, dd/NNN/yyyy");validateSurCharge()}}showSplDayShipCost(document.getElementById("shipping_method"))}function changeShipCosts(a){document.getElementById("deliveryDate").value="";document.getElementById("shippingMethodError").style.display="none";document.getElementById("hidetr3").style.display="none";document.getElementById("shipping_method").value="";showHideDeliveryDateCalendar()}var dflag=true;function validatePurchase(){var c=document.getElementById("deliveryDate").value;var b=checkShipMethWithNoLeadDays(document.getElementById("shipping_method").value);if(b==true){c=new Date()}var d=document.getElementById("shipping_method").value;var a="";if(c==""||d==""){a="Please select a";if(d==""){a=a+" shipping method"}if(c==""&&d==""){a=a+" and the"}if(c==""){a=a+" delivery date"}if(dflag==true){dflag=false;document.getElementById("buynow").innerHTML="<div id='validateError' class='error' style='margin-bottom:10px;'>"+a+"</div>"+document.getElementById("buynow").innerHTML}else{document.getElementById("validateError").style.display="block"}return false}else{return formatDeliveryDate()}}function cartChooseShipMeth(e){var b=e.value;var c=checkShipMethWithNoLeadDays(b);if(c==true){document.getElementById("deliveryDate").value="";document.getElementById("setDD").value="";document.getElementById("shippingMethodError").style.display="none";hidedeliveryDate();if(document.getElementById("standardShipNote")){var f=getShipAttrsForShipMeth(b);if(f.length>0){document.getElementById("standardShipNote").innerHTML=getShippingNote(f)}document.getElementById("standardShipNote").style.display="block"}}else{if(b==""){document.getElementById("surchargemsg").style.display="none";document.getElementById("deliveryDate").value="";document.getElementById("setDD").value="";document.getElementById("standardShipNote").style.display="none";document.getElementById("deliveryDateError").style.display="none";showdeliveryDate()}else{document.getElementById("deliveryDateError").style.display="none";showdeliveryDate();var a=b.split("@")[0];var d=[];if(shipmentMethodArray.length>0){for(index=0;index<shipmentMethodArray.length;index++){shipmentMethod=shipmentMethodArray[index];if(a==shipmentMethod.shipmentMethodTypeId){d=shipmentMethod.deliveryDates;if(d.length>0){listSize=d.length}}}}if(d.length>0){makeDeliveryCalendar(d)}document.getElementById("deliveryDate").value=formatDate(dt,"E, dd/NNN/yyyy");document.getElementById("setDD").name=b+"_deliveryDate";radioClicked();if(document.getElementById("standardShipNote")){document.getElementById("standardShipNote").style.display="none"}validateSurCharge()}}showSplDayShipCost(e);return true}function showSplDayShipCost(d){if(typeof shipMethSplDay!="undefined"){var a=d.value;for(var c=0;c<shipMethSplDay.length;c++){if(shipMethSplDay[c].substring(0,a.length)==a){var b=shipMethSplDay[c].substring(a.length+1,shipMethSplDay[c].length);if(b.length>1&&document.getElementById("shipping_method").value!=""){document.getElementById("splDayNote").innerHTML="("+b+")"}else{document.getElementById("splDayNote").innerHTML=""}}}}}var shipMethAttrArray=new Array();function shipMethDelAttrs(){var a;var b=new Array()}function getShippingNote(a){var b="";if((a[0]==0&&a[1]==0)&&(a[2]>-1&&a[3]!=0)){b="This product will be delivered in "+a[2]+" - "+a[3]+" business days."}else{if((a[2]==0&&a[3]==0)&&(a[0]!=0&&a[1]!=0)){b="This product will be shipped in "+a[0]+" - "+a[1]+" business days."}else{if(a[2]==0&&a[3]==0&&a[0]==0&&a[1]==0){b="This product will be delivered in x - x business days."}else{b="This product will be shipped in "+a[0]+" - "+a[1]+" business days and it will be delivered in "+a[2]+" - "+a[3]+" business days from the day of shipment."}}}return b}function getShipAttrsForShipMeth(a){var b=new Array();if(shipMethAttrArray.length>0){for(index=0;index<shipMethAttrArray.length;index++){shipmentMethod=shipMethAttrArray[index];if(a==shipmentMethod.shipmentMethodTypeId){b=shipmentMethod.attrList}}}return b}function validateSurCharge(){if(document.getElementById("surChrgDD")){var c=document.getElementById("surChrgDD").value;var b=new Date(c);var a=prepareDate(document.getElementById("deliveryDate").value);if((b.getDate()==a.getDate())&&(b.getMonth()==a.getMonth())&&(b.getFullYear()==a.getFullYear())){document.getElementById("surchargemsg").style.display="block"}else{document.getElementById("surchargemsg").style.display="none"}}}function getCategoriesAndDates(a,j,h){if(a!="selectCatalog"||a!=""){removeOptionSelected(j);removeOptionSelected(h);var l=getAjaxRequest();var d="/ezoz/control/findCategories?catalogId="+a;l.open("GET",d,false);l.send(null);if(l.readyState==4){if(l.status==200){var m=l.responseXML.documentElement;var f=m.getElementsByTagName("Id");var k=m.getElementsByTagName("Name");listSize=f.length;if(listSize>0){for(var b=0;b<listSize;b++){var g=document.createElement("option");g.text=k[b].childNodes[0].nodeValue;g.value=f[b].childNodes[0].nodeValue;try{j.add(g,null)}catch(e){j.add(g)}}}var c=m.getElementsByTagName("DeliveryDate");datelistSize=c.length;if(datelistSize>0){for(var b=0;b<datelistSize;b++){var g=document.createElement("option");g.text=c[b].childNodes[0].nodeValue.replace(" ",", ");g.value=c[b].childNodes[0].nodeValue.split(" ")[1];try{h.add(g,null)}catch(e){h.add(g)}}}}}}else{removeOptionSelected(j);removeOptionSelected(h)}}function removeOptionSelected(b){var a;for(a=b.length-1;a>=0;a--){if(b[a].value!="select"){b.remove(a)}}}function selectTheValueFromList(c,a){var b;for(b=0;b<(c.length-1);b++){if(c.options[b].value==a){c.selectedIndex=b;break}}}function getSupplierDeliveryNote(){var a="";a=a+window.location;var e=a.indexOf("/products/");if(e!=-1){var h=new Array();h=a.split("/products/");var g=new Array();g=h[1].split("/");if(g[1].indexOf("?")!=-1){g[1]=g[1].split("?")[0]}var c=g[1]+"_"+g[0];var j=getAjaxRequest();var d="/ezoz/control/showSupplierDeliveryNote?productId="+c;j.open("POST",d,false);j.send(null);if(j.readyState==4){if(j.status==200){if(j.responseText!=""){var b=document.getElementById("buynow").parentNode.parentNode;var i=b.insertRow(b.rows.length);newCell=i.insertCell(0);newCell.setAttribute("colspan","3");var f="";f=f+j.responseText;newCell.innerHTML=f;i.appendChild(newCell)}}}}}function getSupplierDeliveryNote(){var a="";a=a+window.location;var e=a.indexOf("/products/");if(e!=-1){var h=new Array();h=a.split("/products/");var g=new Array();g=h[1].split("/");if(g[1].indexOf("?")!=-1){g[1]=g[1].split("?")[0]}var c=g[1]+"_"+g[0];var j=getAjaxRequest();var d="/ezoz/control/showSupplierDeliveryNote?productId="+c;j.open("POST",d,false);j.send(null);if(j.readyState==4){if(j.status==200){if(j.responseText!=""){var b=document.getElementById("buynow").parentNode.parentNode;var i=b.insertRow(b.rows.length);newCell=i.insertCell(0);newCell.setAttribute("colspan","3");var f="";f=f+j.responseText;newCell.innerHTML=f;i.appendChild(newCell)}}}}};
