function IsDecimal(sText) { var regex = /^-?\d+(\.\d+)?$/ return regex.test(sText); } function IsPositiveDecimal(sText) { var regex = /^\d+(\.\d+)?$/ return regex.test(sText); } function IsInteger(sText) { var regex = /^-?\d+$/; // ^\d+$ any string containing one or more digits return regex.test(sText); } function IsPositiveInteger(sText) { var regex = /^\d+$/; // ^\d+$ any string containing one or more digits return regex.test(sText); } function IsFloat(sText) { return sText.length>0 && !(/[^0-9.]/).test(sText) && (/\.\d/).test(sText); } function IsPositiveFloat(sText) { if (IsFloat(sText) || IsInteger(sText)) if (Number(sText) >= 0) return true; return false; } function addToBasket(productid, qty, departmentid, productcatalogueid, productsubtypeid, promoCode, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=addtobasket'; redirecturl += '&productid=' + productid; redirecturl += '&departmentid=' + departmentid; redirecturl += '&productcatalogueid=' + productcatalogueid; redirecturl += '&qty=' + qty; redirecturl += '&productsubtypeid=' + productsubtypeid; redirecturl += '&promotioncode=' + promoCode; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function addMembershipToBasket(productid, qty, departmentid, productcatalogueid, membershiptypeid, promoCode, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=addmembershiptobasket'; redirecturl += '&productid=' + productid; redirecturl += '&departmentid=' + departmentid; redirecturl += '&productcatalogueid=' + productcatalogueid; redirecturl += '&qty=' + qty; redirecturl += '&membershiptypeid=' + membershiptypeid; redirecturl += '&promotioncode=' + promoCode; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function addTicketToBasket(eventid, eventscheduleid, departmentid, productqtylist, promoCode, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=addtickettobasket'; redirecturl += '&eventid=' + eventid; redirecturl += '&eventscheduleid=' + eventscheduleid; redirecturl += '&departmentid=' + departmentid; redirecturl += '&productqtylist=' + productqtylist; redirecturl += '&promotioncode=' + promoCode; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function addEventSeriesToBasket(eventseriesid, departmentid, eventstr, productqtylist, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=addeventseriestobasket'; redirecturl += '&eventseriesid=' + eventseriesid; redirecturl += '&departmentid=' + departmentid; redirecturl += '&eventstr=' + eventstr; redirecturl += '&productqtylist=' + productqtylist; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function addPackageToBasket(productpackageid, qty, departmentid, productcatalogueid, productpackagesubtypeid, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=addpackagetobasket'; redirecturl += '&productpackageid=' + productpackageid; redirecturl += '&departmentid=' + departmentid; redirecturl += '&productcatalogueid=' + productcatalogueid; redirecturl += '&qty=' + qty; redirecturl += '&productpackagesubtypeid=' + productpackagesubtypeid; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function addDonationToBasket(productid, qty, departmentid, productcatalogueid, amount, recurringperiod, productsubtypeid, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=adddonationtobasket'; redirecturl += '&productid=' + productid; redirecturl += '&departmentid=' + departmentid; redirecturl += '&productcatalogueid=' + productcatalogueid; redirecturl += '&qty=' + qty; redirecturl += '&amount=' + amount; redirecturl += '&recurringperiod=' + recurringperiod; redirecturl += '&productsubtypeid=' + productsubtypeid; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function configureMembership(ordersessionproductid,debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=configuremembership'; redirecturl += '&ordersessionproductid=' + ordersessionproductid; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function removeFromBasket(ordersessionproductid, ispackage) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; if (ispackage == 1) { redirecturl += '?op=removepackagefrombasket'; redirecturl += '&ordersessionproductpackageid=' + ordersessionproductid; } else { redirecturl += '?op=removefrombasket'; redirecturl += '&ordersessionproductid=' + ordersessionproductid; } location.href = redirecturl; } function removePackageFromBasket(ordersessionproductpackageid) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=removepackagefrombasket'; redirecturl += '&ordersessionproductpackageid=' + ordersessionproductpackageid; location.href = redirecturl; } function productGroupChanged(selProductGroup, departmentid, productcatalogueid, producttypeid, productsubtypeid, fromlandingpage, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; var productgroupid = selProductGroup.options[selProductGroup.selectedIndex].value; redirecturl += '?op=productgroupchanged'; if (productgroupid != "") redirecturl += '&productgroupid=' + productgroupid; if (departmentid != "") redirecturl += '&departmentid=' + departmentid; if (productcatalogueid != "") redirecturl += '&productcatalogueid=' + productcatalogueid; if (producttypeid != "") redirecturl += '&producttypeid=' + producttypeid; if (productsubtypeid != "") redirecturl += '&productsubtypeid=' + productsubtypeid; if (fromlandingpage != "") redirecturl += '&fromlandingpage=' + fromlandingpage; if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function ibtnSearchClicked(debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; if (document.getElementById("txtKeyword").value == "" || document.getElementById("txtKeyword").value == strDefaultText) { alert("Please enter one or more keywords with ; or , between them."); document.getElementById("txtKeyword").focus(); document.getElementById("txtKeyword").select(); return false; } if (document.getElementById("ddlSearchOptions")) var strSearchValue = document.getElementById("ddlSearchOptions").options[document.getElementById("ddlSearchOptions").selectedIndex].value; else var strSearchValue = "All-272f1d66c82967de"; redirecturl += '?op=search'; redirecturl += "&searchtype=" + strSearchValue; redirecturl += "&searchvalue=" + CleanQueryString(document.getElementById("txtKeyword").value); if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; return false; } function ibtnAdvancedSearchClicked(debug) { if (isWhitespace(document.advancedSearchForm.txtWithAnyOfTheWords.value) && isWhitespace(document.advancedSearchForm.txtWithAllOfTheWords.value) && isWhitespace(document.advancedSearchForm.txtWithTheExactPhrase.value) && isWhitespace(document.advancedSearchForm.txtWithout.value)) { alert('Please enter at least one word or phrase in one of the fields below.'); document.advancedSearchForm.txtWithAnyOfTheWords.select(); document.advancedSearchForm.txtWithAnyOfTheWords.focus(); return false; } var strSearchType = document.getElementById("ddlAdvancedSearchOptions").options[document.getElementById("ddlAdvancedSearchOptions").selectedIndex].value; var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=advancedsearch'; redirecturl += "&searchtype=" + strSearchType; if (!isWhitespace(document.advancedSearchForm.txtWithAnyOfTheWords.value)) redirecturl += '&searchwithany=' + CleanQueryString(document.advancedSearchForm.txtWithAnyOfTheWords.value); if (!isWhitespace(document.advancedSearchForm.txtWithAllOfTheWords.value)) redirecturl += '&searchwithall=' + CleanQueryString(document.advancedSearchForm.txtWithAllOfTheWords.value); if (!isWhitespace(document.advancedSearchForm.txtWithTheExactPhrase.value)) redirecturl += '&searchwithexact=' + CleanQueryString(document.advancedSearchForm.txtWithTheExactPhrase.value); if (!isWhitespace(document.advancedSearchForm.txtWithout.value)) redirecturl += '&searchwithout=' + CleanQueryString(document.advancedSearchForm.txtWithout.value); if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; return false; } function addBlogComment(blogentryid, name, email, comment, debug) { var redirecturl = 'http://shop.hht.net.au/historichouses/scripts/doaction.aspx'; redirecturl += '?op=addblogcomment'; redirecturl += '&blogentryid=' + blogentryid; redirecturl += '&name=' + name; redirecturl += '&email=' + email; redirecturl += '&comment=' + RemoveNewLines(comment); if (debug == 1) redirecturl += '&debug=1'; location.href = redirecturl; } function txtKeywordOnFocus() { document.getElementById("txtKeyword").value = ""; } function CleanQueryString(strRawString) { return strRawString.replace(",","%2C").replace("&","%26").replace(" ","%20"); } function RemoveNewLines(strRawString) { return strRawString.replace("\n", "_|_"); } function validateMandatoryPositiveIntegerGreaterThanZero(fieldId,message) { // ensures that an integer >0 is entered into a text field if (document.getElementById(fieldId).value == "") { alert(message); document.getElementById(fieldId).select(); document.getElementById(fieldId).focus(); return false; } if (!IsPositiveInteger(document.getElementById(fieldId).value)) { alert(message); document.getElementById(fieldId).select(); document.getElementById(fieldId).focus(); return false; } if (document.getElementById(fieldId).value == 0) { alert(message); document.getElementById(fieldId).select(); document.getElementById(fieldId).focus(); return false; } return true; }