function OpenNewPopupWindow(url,width,height){window.open(url,"_blank","toolbar=no, location=yes, directories=no, status=no, menubar=no, copyhistory=yes, width="+width+", height="+height);}function OpenNewPopupWindow(url){window.open(url,"_blank");}function CheckBrowser(){if(/Firefox/.test(navigator.userAgent)){return"FF";}else{if(/MSIE/.test(navigator.userAgent)){return"IE";}else{if(/Chrome/.test(navigator.userAgent)){return"CH";}else{if(/Safari/.test(navigator.userAgent)){return"SF";}else{if(/Opera/.test(navigator.userAgent)){return"OP";}else{return"ETC";}}}}}}function ValidateMinimumOrderValue(behaviorFadeIn,behaviorMinimumOrder,minimumOrderValue,cartTotal,checkoutPage){if(minimumOrderValue>0&&minimumOrderValue>cartTotal){$find(behaviorFadeIn).get_OnClickBehavior().play();$find(behaviorMinimumOrder).show();return false;}else{if(checkoutPage!=""){window.location.href=checkoutPage;return false;}else{return true;}}}function IsEnterPressed(e){e=e||window.event;var code=e.keyCode||e.which;if(code==13){return true;}else{return false;}}function LimitLengthInTextBox(txt,maxLength){if(txt.value.length>maxLength){txt.value=txt.value.substring(0,maxLength);}}function GetPricePrefix(){return document.getElementById("ctl00_hidPricePrefix").value;}function GetTotalPrefix(){return document.getElementById("ctl00_hidTotalPrefix").value;}function PriceWithCurrency(num){return NumberToCurrency(num,GetPricePrefix());}function TotalWithCurrency(num){return NumberToCurrency(num,GetTotalPrefix());}function NumberToCurrency(num,currencySymbol){num=num.toString().replace(/\$|\,/g,"");if(isNaN(num)){num="0";}sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);cents=num%100;num=Math.floor(num/100).toString();if(cents<10){cents="0"+cents;}for(var i=0;i<Math.floor((num.length-(1+i))/3);i++){num=num.substring(0,num.length-(4*i+3))+","+num.substring(num.length-(4*i+3));}sign=(sign||(num+cents=="000"));return(((sign)?"":"-")+currencySymbol+num+"."+cents);}function PriceCurrencyToNumber(num){return CurrencyToNumber(num,GetPricePrefix());}function TotalCurrencyToNumber(num){return CurrencyToNumber(num,GetTotalPrefix());}function CurrencyToNumber(num,currencySymbol){if(num==null){return ParseFloat(0);}else{num=num.replace(currencySymbol,"");return ParseFloat(num.replace(/[%,+]+/g,""));}}function TaxAmount(totalAmount,taxRate){if(taxRate==0){return 0;}return totalAmount-TaxExclusive(totalAmount,taxRate);}function TaxExclusive(totalAmount,taxRate){return totalAmount/(1+(taxRate/100));}function ParseFloat(str){return(isNaN(parseFloat(str)))?0:parseFloat(str);}function ParseInt(str){return(isNaN(parseInt(str)))?0:parseInt(str);}function Round(num,dec){var result=Math.round(Math.round(num*Math.pow(10,dec+1))/Math.pow(10,1))/Math.pow(10,dec);return result;}String.format=function(){if(arguments.length==0){return null;}var str=arguments[0];for(var i=1;i<arguments.length;i++){var re=new RegExp("\\{"+(i-1)+"\\}","gm");str=str.replace(re,arguments[i]);}return str;};String.prototype.format=function(){var str=this;for(var i=0;i<arguments.length;i++){var re=new RegExp("\\{"+(i)+"\\}","gm");str=str.replace(re,arguments[i]);}return str;};function GetScreenResolution(){var pos={w:0,h:0};if(window.innerHeight){pos.h=window.innerHeight;pos.w=window.innerWidth;}else{if((document.documentElement)&&(document.documentElement.clientHeight)){pos.h=document.documentElement.clientHeight;pos.w=document.documentElement.clientWidth;}else{if(document.body.clientHeight){pos.h=document.body.clientHeight;pos.w=document.body.clientWidth;}}}return pos;}function ShowPopupContent(mpeBehaviorId,HTMLEditorId){$find(mpeBehaviorId).show();if(HTMLEditorId!=null&&HTMLEditorId!=""){if(oUtil.setEdit){oUtil.setEdit();}eval("oEdit_"+HTMLEditorId+".loadHTML(document.getElementById(HTMLEditorId).value);");setTimeout("eval('oEdit_"+HTMLEditorId+".focus();');",50);}}function PhoneTextValidator(e,sourceID){var unicode=e.charCode?e.charCode:e.keyCode;if(unicode==8||unicode==9||unicode==35||unicode==36||unicode==37||unicode==38||unicode==39||unicode==40||unicode==46){return true;}else{if(unicode<48||unicode>57){if(String.fromCharCode(unicode)==" "||String.fromCharCode(unicode)=="-"||String.fromCharCode(unicode)=="("||String.fromCharCode(unicode)==")"){return true;}else{return false;}}else{return true;}}}function NumericText(e){var unicode=e.charCode?e.charCode:e.keyCode;if(unicode==8||unicode==9||unicode==35||unicode==36||unicode==37||unicode==38||unicode==39||unicode==40||unicode==46){return true;}else{if(unicode<48||unicode>57){return false;}else{return true;}}}function NotAllowedReservedKey(e){var unicode=e.charCode?e.charCode:e.keyCode;return(unicode!=59);}function NotAllowedReservedKeyPostcode(e){var unicode=e.charCode?e.charCode:e.keyCode;return(unicode!=59&&unicode!=44);}function DoPostBack(objID,arg){__doPostBack(objID,arg);}function OpenPostcodeFinderUrl(){var street=escape(document.getElementById(arguments[1]).value),suburb="",city=document.getElementById(arguments[3]).value,finderUrl=arguments[0],ar=arguments[4],addr=new Array();if(street.indexOf("%0D%0A")>-1){addr=street.split("%0D%0A",3);}else{if(street.indexOf("%0A")>-1){addr=street.split("%0A",3);}else{if(street.indexOf("%0D")>-1){addr=street.split("%0D",3);}}}street=unescape(addr[0]);if(addr[1]!=null&&addr[1]!=""){suburb=unescape(addr[1]);}else{suburb=unescape(addr[2]);}switch(ar){case 1:finderUrl=String.format(finderUrl,street+suburb+city);break;case 2:finderUrl=String.format(finderUrl,street+suburb,city);break;case 3:finderUrl=String.format(finderUrl,street,suburb,city);break;case 4:finderUrl=String.format(finderUrl,street.substring(0,street.indexOf(" ")),street.substring(street.indexOf(" ")+1),suburb,city);break;default:break;}window.open(finderUrl,"_blank");}function CreateOnclickTreeNode(treeviewId){var treeview=document.getElementById(treeviewId);if(treeview==null){return;}var treeLinks=treeview.getElementsByTagName("a");for(i=0;i<treeLinks.length;i++){treeLinks[i].onclick=function(){return false;};}}function ShowAddToCartPopup(imgSrc,description,qty,price,isDivQtysVisible,isCheckoutNoticeVisible,elemID){jq14("#"+elemID).css("cursor","pointer").removeAttr("disabled");$addToCartPopupLayer=jq14("#addToCartPopupLayer");if(imgSrc==""){$addToCartPopupLayer.find("#imgStyle").hide();}else{$addToCartPopupLayer.find("#imgStyle").attr("src",imgSrc).show();}$addToCartPopupLayer.find("#lblDescription").text(description.replace("&quot;",'"'));if(isDivQtysVisible){$addToCartPopupLayer.find("#lblQty").text(qty);$addToCartPopupLayer.find("#lblPrice").text(price);$addToCartPopupLayer.find("#divQtys").show();}else{$addToCartPopupLayer.find("#divQtys").hide();}if(isCheckoutNoticeVisible){$addToCartPopupLayer.find("#lnkCheckoutNotice").show();}else{$addToCartPopupLayer.find("#lnkCheckoutNotice").hide();}FadeInLayer("addToCartPopupLayer",elemID);}var timerID;function FadeInLayer(popLayerID,elemID){clearTimeout(timerID);timerID=setTimeout("StartFading('"+popLayerID+"', '"+elemID+"')",25);}function StartFading(popLayerID,elemID){TopOnWindow(popLayerID,elemID);Opacity(popLayerID,1,100,100);clearTimeout(timerID);timerID=setInterval("EndFading('"+popLayerID+"')",3000);}function FadeOutLayer(popLayerID){EndFading(popLayerID);}function EndFading(popLayerID){Opacity(popLayerID,100,0,100);clearTimeout(timerID);}function TopOnWindow(popLayerID,elemID){var popLayer=document.getElementById(popLayerID);if(popLayer){var elem=document.getElementById(elemID);var pos=GetElementPosition(elemID);var scn=GetScreenResolution();var bodyWidth=jq14("body").width();var bodywrapper=GetElementWidth("bodywrapper");var l=pos.x-((GetElementWidth(popLayerID)-GetElementWidth(elemID))/2);var t=pos.y-GetElementHeight(popLayerID)-5;l=(l<0)?0:l;t=(t<0)?0:t;popLayer.style.left=l+"px";popLayer.style.top=t+"px";popLayer.style.visibility="visible";}}function GetElementPosition(elemID){var pos={x:0,y:0};var position=jq14("#"+elemID).position();pos.x=position.left;pos.y=position.top;return pos;}function GetElementWidth(elemID){return jq14("#"+elemID).width();}function GetElementHeight(elemID){return jq14("#"+elemID).height();}function GetObjectPos(obj){var pos={x:0,y:0};if(obj.offsetParent){do{pos.x+=obj.offsetLeft;pos.y+=obj.offsetTop;}while(obj=obj.offsetParent);}else{if(obj.x&&obj.y){pos.x+=obj.x;pos.y+=obj.y;}}return pos;}function GetObjectWidth(elem){var result=0;if(elem){if(elem.offsetWidth){result=elem.offsetWidth;}else{if(elem.clip&&elem.clip.width){result=elem.clip.width;}else{if(elem.style&&elem.style.pixelWidth){result=elem.style.pixelWidth;}}}}return parseInt(result);}function GetObjectHeight(elem){var result=0;if(elem){if(elem.offsetHeight){result=elem.offsetHeight;}else{if(elem.clip&&elem.clip.height){result=elem.clip.height;}else{if(elem.style&&elem.style.pixelHeight){result=elem.style.pixelHeight;}}}}return parseInt(result);}function Opacity(popElemID,opacStart,opacEnd,millisec){var speed=Math.round(millisec/100);var timer=0;if(opacStart>opacEnd){for(i=opacStart;i>=opacEnd;i--){setTimeout("ChangeOpacity("+i+",'"+popElemID+"')",(timer*speed));timer++;}}else{if(opacStart<opacEnd){for(i=opacStart;i<=opacEnd;i++){setTimeout("ChangeOpacity("+i+",'"+popElemID+"')",(timer*speed));timer++;}}}}function ChangeOpacity(opacity,popElemID){var obj=document.getElementById(popElemID);if(obj){var object=obj.style;object.opacity=(opacity/100);object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";if(opacity<=0){object.left="-500px";}}}function GetCurrentScreenResolution(){var pos=GetScreenResolution();var ctl00_hidScreenHeight=document.getElementById("ctl00_hidScreenHeight");if(ctl00_hidScreenHeight){ctl00_hidScreenHeight.value=pos.h;}}window.onload=function(){GetCurrentScreenResolution();};function ElementVisibility(elId,displayValue){var el=document.getElementById(elId);if(el){el.style.display=displayValue;}}function SetCheckoutBlockValues(chk,hidCheckoutBlockStatesID){var hidCheckoutBlockStates=$get(hidCheckoutBlockStatesID);if(hidCheckoutBlockStates!=null){var blockValues=hidCheckoutBlockStates.value;if(blockValues.indexOf(chk.id)<0){hidCheckoutBlockStates.value=blockValues+chk.id+"|"+((chk.checked)?"1":"0")+";";}else{var startIndex=blockValues.indexOf(chk.id);hidCheckoutBlockStates.value=blockValues.replace(blockValues.substr(startIndex,chk.id.length+2),(chk.id+"|"+((chk.checked)?"1":"0")));}}}function RestoreCheckoutBlocks(ctlID){var hidCheckoutBlockStates=document.getElementById(ctlID);if(hidCheckoutBlockStates!=null){var blockValues=hidCheckoutBlockStates.value;var lastIndex=blockValues.indexOf("|1;");while(lastIndex>0){var chkId=blockValues.substr(0,lastIndex),startIndex=chkId.lastIndexOf(";")+1,chk;chkId=chkId.substr(startIndex,lastIndex-startIndex);chk=document.getElementById(chkId);if(chk!=null){chk.checked=true;}blockValues=blockValues.substr(lastIndex+3);lastIndex=blockValues.indexOf("|1;");}}}function TextboxWaterMark(txt,e,enterPrompt){if(txt.value.length==0&&e.type=="blur"){jq14("#"+txt.id).toggleClass("disablewatermark").toggleClass("enablewatermark");txt.value=enterPrompt;}if(txt.value==enterPrompt&&e.type=="focus"){jq14("#"+txt.id).toggleClass("enablewatermark").toggleClass("disablewatermark");txt.value="";}}function ValidCouponCode(txtId,enterPrompt,enterAlert){var txtValue=jq14("#"+txtId).attr("value");if(txtValue==""||txtValue==enterPrompt){alert(enterAlert);jq14("#"+txtId).focus();return false;}return true;}function ValidKeyword(txtId,enterPrompt,enterAlert,redirectUrl){var txtValue=jq14("#"+txtId).attr("value");if(txtValue==""||txtValue==enterPrompt){alert(enterAlert);jq14("#"+txtId).focus();return false;}window.location.href=redirectUrl+"?q="+escape(txtValue);return false;}function SetContinueURL(url){var continueURL=$get("ContinueURL");if(continueURL){continueURL.href=url;}}function SortBy(selectfilter,selectsort,ddlFilterID,slcSortByID,updateURL){if(selectfilter==null){selectfilter=document.getElementById(ddlFilterID);}else{if(selectsort==null){selectsort=document.getElementById(slcSortByID);}}window.location.href=updateURL+"&filterby="+encodeURIComponent(selectfilter.options[selectfilter.selectedIndex].value)+"&sortby="+encodeURIComponent(selectsort.options[selectsort.selectedIndex].value);}function SetLoyaltyPoints(chkJoinLoyalty,divLoyaltyPointsID){var divLoyaltyPoints=$get(divLoyaltyPointsID);if(divLoyaltyPoints){if(chkJoinLoyalty.checked){divLoyaltyPoints.style.display="block";}else{divLoyaltyPoints.style.display="none";}}}function ValidateContactForm(txtPreve_Text_Input){return(jq14("#"+txtPreve_Text_Input).attr("value")=="");}
