	function fnFormatMAddr(strAddr1,strAddr2, strAddr3, strCountry, strState, strCity,strPostal, objMAddr)
		{
			var strMAddr;
			
			strMAddr=strAddr1+"\r\n";
						
			
			if (strAddr2!="")
				strMAddr+=strAddr2+"\r\n";
				
			if (strAddr3!="")
				strMAddr+=strAddr3+"\r\n";
			
			if (strCountry.toLowerCase()!="singapore")
			{
			    if (strState!="")
				    strMAddr+=strState+"\r\n";				
			
			    if (strCity!="")
				    strMAddr+=strCity+"\r\n";								
            }				    

							
			if (strCountry!="")
			{
				if (strCountry.toLowerCase()=="singapore")
				{
					if (strPostal!="")
						strMAddr+="Singapore " +strPostal+"\r\n";	
				}else
				{
					if (strPostal!="")
						strMAddr+=strPostal+"\r\n";	
					strMAddr+=strCountry+"\r\n";
				}
			}
				
											
						
			objMAddr.value=strMAddr;	
		}
		
		function fnFormatMAddrObj(objAddr1,objAddr2, objAddr3,objCountry, objState, objCity,objPostal, objMAddr)
		{
			var strMAddr;
			
			if (objAddr1!=null)
			{
				strMAddr=objAddr1.value+"\r\n";
			}
						
			if (objAddr2!=null)
			{
				if (objAddr2.value!="")
				strMAddr+=objAddr2.value+"\r\n";
			}
		
				
			if (objAddr3!=null)
			{
				if (objAddr3.value!="")
				strMAddr+=objAddr3.value+"\r\n";
			}
		
			
			if (objCity!=null)
			{
				if (objCity.value!="")
				strMAddr+=objCity.value+"\r\n";		
			}
			
			if (objState!=null)
			{
				if (objState.value!="")
				strMAddr+=objState.value+"\r\n";			
			}
				
			
							
			if (objCountry!=null)							
			{
				if (objCountry.options[objCountry.selectedIndex].text!="")
				{
					if (objCountry.options[objCountry.selectedIndex].text.toLowerCase()=="singapore")
					{
						if (objPostal!=null)
						{
							if (objPostal.value!="")
								strMAddr+="Singapore "+objPostal.value+"\r\n";						
						}
					}else
					{
						if (objPostal!=null)
						{
							if (objPostal.value!="")
								strMAddr+="Postal Code "+objPostal.value+"\r\n";						
							strMAddr+=objCountry.options[objCountry.selectedIndex].text+"\r\n";
						}
					
						
					}
				}
			}															
						
			objMAddr.value=strMAddr;	
		}
		
		function fnFormatFullname(strFormatType, strSurname, strGivenname, objFullname)
		{
			
			if (strFormatType=="SG")
			{
				objFullname.value=strSurname+" "+strGivenname;
			}else
			{
				objFullname.value=strGivenname+" "+strSurname;
			}
		}
		
		function fnOpenCalendar(strFieldDD,strFieldMM,strFieldYY, strWndName )
			{
				window.open('/eShop/Component/DatePicker.aspx?fieldDD=' + strFieldDD+'&fieldMM=' + strFieldMM+'&fieldYY=' + strFieldYY+"",strWndName,'width=300,height=260,resizable=yes,scrollbars=1');
			}
			
			
		function fnOpenFECalendar(strFieldDD,strFieldMM,strFieldYY, strWndName )
			{
				window.open('/eShop/Component/DatePicker.aspx?fieldDD=' + strFieldDD+'&fieldMM=' + strFieldMM+'&fieldYY=' + strFieldYY+"",strWndName,'width=300,height=260,resizable=yes,scrollbars=1');
			}

		function fnOpenProdSearchExt(strField, strPostBackFunc, strWndName)
		{
				window.open('frmProdSearchExt.aspx?strField='+strField+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}
		
		function fnOpenProdWLabelSearchExt(strField, strFieldLabel, strPostBackFunc, strWndName)
		{
				window.open('frmProdSearchExt.aspx?strField='+strField+'&strFieldLabel='+strFieldLabel+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}

		function fnOpenProdFeatSearchExt(strProdID, strField, strFieldLabel, strPostBackFunc, strWndName)
		{
			window.open('frmProdFeatSearchExt.aspx?strProdID='+strProdID+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}

		function fnOpenProdSearchMulExt(strField, strPostBackFunc, strRetFormat , strWndName)
		{
				window.open('frmProdSearchMulExt.aspx?strField='+strField+'&strRetFormat='+strRetFormat+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}

		function fnOpenCountrySearchExt(strField, strPostBackFunc, strWndName)
		{
				window.open('frmCountrySearchExt.aspx?strField='+strField+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}
		
		function fnOpenProdCatSearchMulExt(strField, strPostBackFunc, strRetFormat , strWndName)
		{
				window.open('frmProdCatSearchMulExt.aspx?strField='+strField+'&strRetFormat='+strRetFormat+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}
		
		function fnOpenPriceSchemeSearchMulExt(strField, strPostBackFunc, strRetFormat , strWndName)
		{
				window.open('frmPriceSchemeSearchMulExt.aspx?strField='+strField+'&strRetFormat='+strRetFormat+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}
		
		function fnOpenAffProfileSearchMulExt(strField, strPostBackFunc, strRetFormat , strWndName)
		{
				window.open('frmAffProfileSearchMulExt.aspx?strField='+strField+'&strRetFormat='+strRetFormat+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
		}
		
		function fnOpenCustProfileSearchExt(strField, strPostBackFunc, strWndName)
		{
				var newwin;
				
				newwin=window.open('frmCustProfileSearchExt.aspx?strField='+strField+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
				newwin.focus();
		}
		
		function fnOpenProdDetPopUp(strID, strWndName)
		{
				var newwin;
				newwin=window.open('ProdDetPopUp.aspx?strID='+strID,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
				newwin.focus();
		}
		function fnOpenOrderIDSample()
		{		var newwin;
				newwin=window.open('Statics/OrderIDSample.htm','OrderIDSample','width=600,height=200,resizable=yes,scrollbars=1');		
		        newwin.focus();
		}
		
		function fnOpenProdVolDiscPopUp(strID, strWndName)
		{
				var newwin;
				newwin=window.open('ProdVolDiscTablePopUp.aspx?strID='+strID,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
				newwin.focus();
		}
		
		function fnOpenProdSKUSearchExt(strField, strProdID, strPostBackFunc, strWndName)
		{
            window.open('frmProdSKUSearchExt.aspx?strProdID='+strProdID+'&strField='+strField+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');						    
		}
			
		
		function fnAutoCompleteShipInfo()
		{
			
			if ((this.form.ctl00$ContentPlaceHolder1$cboShipSal!=null)&&(this.form.ctl00$ContentPlaceHolder1$cboSal!=null))
			{
			this.form.ctl00$ContentPlaceHolder1$cboShipSal.selectedIndex=this.form.ctl00$ContentPlaceHolder1$cboSal.selectedIndex; 
			}								
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipSurname!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtSurname!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipSurname.value=this.form.ctl00$ContentPlaceHolder1$txtSurname.value;
			}								
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipGivenname!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtGivenname!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipGivenname.value=this.form.ctl00$ContentPlaceHolder1$txtGivenname.value;
			}								
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipFullname!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtFullname!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipFullname.value=this.form.ctl00$ContentPlaceHolder1$txtFullname.value;
			}								
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipCo!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtCo!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipCo.value=this.form.ctl00$ContentPlaceHolder1$txtCo.value;
			}	
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipDesign!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtDesign!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipDesign.value=this.form.ctl00$ContentPlaceHolder1$txtDesign.value;
			}	
			
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipTel!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtTel!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipTel.value=this.form.ctl00$ContentPlaceHolder1$txtTel.value;
			}	
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipMobile!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtMobile!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipMobile.value=this.form.ctl00$ContentPlaceHolder1$txtMobile.value;
			}	
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipFax!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtFax!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipFax.value=this.form.ctl00$ContentPlaceHolder1$txtFax.value;
			}	
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipEMail!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtEMail!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipEMail.value=this.form.ctl00$ContentPlaceHolder1$txtEMail.value;
			}	
							
			
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipAddr1!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtAddr1!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipAddr1.value=this.form.ctl00$ContentPlaceHolder1$txtAddr1.value;
			}								
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipAddr2!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtAddr2!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipAddr2.value=this.form.ctl00$ContentPlaceHolder1$txtAddr2.value; 
			}	
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipAddr3!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtAddr3!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipAddr3.value= this.form.ctl00$ContentPlaceHolder1$txtAddr3.value;
			}
			if ((this.form.ctl00$ContentPlaceHolder1$cboShipCountry!=null)&&(this.form.ctl00$ContentPlaceHolder1$cboCountry!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$cboShipCountry.selectedIndex=this.form.ctl00$ContentPlaceHolder1$cboCountry.selectedIndex; 
			}
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipState!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtState!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipState.value= this.form.ctl00$ContentPlaceHolder1$txtState.value; 
			}
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipCity!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtCity!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipCity.value=this.form.ctl00$ContentPlaceHolder1$txtCity.value;
			}
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipPostal!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtPostal!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipPostal.value=this.form.ctl00$ContentPlaceHolder1$txtPostal.value;
			}
			if ((this.form.ctl00$ContentPlaceHolder1$txtShipMAddr!=null)&&(this.form.ctl00$ContentPlaceHolder1$txtMAddr!=null))
			{
				this.form.ctl00$ContentPlaceHolder1$txtShipMAddr.value= this.form.ctl00$ContentPlaceHolder1$txtMAddr.value;
			}
		}
		
		function fnOpenRecipientSearchExt(strField, strPostBackFunc, strWndName)
		{
				var newwin;
				
				newwin=window.open('frmRecipientSearchExt.aspx?strField='+strField+'&strPostBackFunc=' + strPostBackFunc,strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
				newwin.focus();
		}
		
		
		function fnRefreshPaymentCal()
		{
			var dblTender 
			var dblChange
			
			dblTender=0
			dblChange=0
			
			//alert(this.form.ctl00$ContentPlaceHolder1$txtCashAmt.value);
			if (this.form.ctl00$ContentPlaceHolder1$txtCashAmt!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtCashAmt.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtCashAmt.value)*1.00;
				} 
			 }
			 if (this.form.ctl00$ContentPlaceHolder1$txtCCardAmt1!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtCCardAmt1.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtCCardAmt1.value)*1.00;
				} 
			 }
			  if (this.form.ctl00$ContentPlaceHolder1$txtCCardAmt2!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtCCardAmt2.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtCCardAmt2.value)*1.00;
				} 
			 }
			 
			 if (this.form.ctl00$ContentPlaceHolder1$txtChequeAmt1!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtChequeAmt1.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtChequeAmt1.value)*1.00;
				} 
			 }
			  if (this.form.ctl00$ContentPlaceHolder1$txtChequeAmt2!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtChequeAmt2.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtChequeAmt2.value)*1.00;
				} 
			 }
			 
			 if (this.form.ctl00$ContentPlaceHolder1$txtNETSAmt!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtNETSAmt.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtNETSAmt.value)*1.00;
				} 
			 }
			
			
			if (this.form.ctl00$ContentPlaceHolder1$txtCNoteAmt1!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtCNoteAmt1.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtCNoteAmt1.value)*1.00;
				} 
			 }
			 
			 if (this.form.ctl00$ContentPlaceHolder1$txtCNoteAmt2!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtCNoteAmt2.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtCNoteAmt2.value)*1.00;
				} 
			 }
			
			if (this.form.ctl00$ContentPlaceHolder1$txtTTAmt2!=null)
			 {
				if (this.form.ctl00$ContentPlaceHolder1$txtTTAmt2.value!="")
				{
					
					dblTender+=(this.form.ctl00$ContentPlaceHolder1$txtTTAmt2.value)*1.00;
				} 
			 }
						
			//alert(dblTender);
			this.form.ctl00$ContentPlaceHolder1$txtTenderAmt.value=dblTender;
		}
				
		function fnOpenPrtCatalogueExt(strWndName)
		{
				var newwin;
				
				newwin=window.open('frmPrtCatalogueExt.aspx',strWndName,'width=800,height=600,resizable=yes,scrollbars=1');		
				newwin.focus();
		}
				
		function fnOpenUploadMedia(strPostbackFunc, strField, strFieldLabel, strMediaID,  strRefID, strRefTypeID, strMediaTypeID, strUseID, strSizeID, strFolder, strFolderURL, strFilename)
        {   
            var strWndName;        
            if (strRefID=="")
            {
                alert("Missing ID! Please enter the ID before uploading.");
            }else
            {
                strWndName="WndMediaUpload";
                //alert('frmUploadMedia.aspx?strPostbackFunc='+strPostbackFunc+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strRefID='+strRefID+'&strRefTypeID='+strRefTypeID+'&strMediaTypeID='+strMediaTypeID+'&strUseID='+strUseID+'&strFolder='+strFolder+'&strFolderURL='+strFolderURL+'&strFilename='+strFilename);
                window.open ('frmMediaUpload.aspx?strPostbackFunc='+strPostbackFunc+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strMediaID='+strMediaID+'&strRefID='+strRefID+'&strRefTypeID='+strRefTypeID+'&strMediaTypeID='+strMediaTypeID+'&strUseID='+strUseID+'&strSizeID='+strSizeID+'&strFolder='+strFolder+'&strFolderURL='+strFolderURL+'&strFilename='+strFilename,strWndName,'width=800,height=600,resizable=yes,scrollbars=1')
                }
        }
        
        function fnOpenFEUploadMedia(strPostbackFunc, strField, strFieldLabel,  strMediaID,  strRefID, strRefTypeID, strMediaTypeID, strUseID, strSizeID, strFolder, strFolderURL, strFilename)
        {   
            var strWndName;        
            if (strRefID=="")
            {
                alert("Missing ID! Please enter the ID before uploading.");
            }else
            {
                strWndName="WndMediaUpload";
                //alert('frmUploadMedia.aspx?strPostbackFunc='+strPostbackFunc+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strRefID='+strRefID+'&strRefTypeID='+strRefTypeID+'&strMediaTypeID='+strMediaTypeID+'&strUseID='+strUseID+'&strFolder='+strFolder+'&strFolderURL='+strFolderURL+'&strFilename='+strFilename);
                window.open ('MediaUpload.aspx?strPostbackFunc='+strPostbackFunc+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strMediaID='+strMediaID+'&strRefID='+strRefID+'&strRefTypeID='+strRefTypeID+'&strMediaTypeID='+strMediaTypeID+'&strUseID='+strUseID+'&strSizeID='+strSizeID+'&strFolder='+strFolder+'&strFolderURL='+strFolderURL+'&strFilename='+strFilename,strWndName,'width=800,height=600,resizable=yes,scrollbars=1')
                }
        }
        
        function fnOpenUploadMediaImg(strPostbackFunc, strField, strFieldLabel, strMediaID, strRefID, strRefTypeID, strMediaTypeID, strUseID, strSizeID, strFolder, strFolderURL, strFilename)
        {   
            var strWndName;        
            strWndName="WndMediaUploadImg";
            //alert('frmUploadMedia.aspx?strPostbackFunc='+strPostbackFunc+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strRefID='+strRefID+'&strRefTypeID='+strRefTypeID+'&strMediaTypeID='+strMediaTypeID+'&strUseID='+strUseID+'&strFolder='+strFolder+'&strFolderURL='+strFolderURL+'&strFilename='+strFilename);
            window.open ('frmMediaImgUpload.aspx?strPostbackFunc='+strPostbackFunc+'&strField='+strField+'&strFieldLabel='+strFieldLabel+'&strMediaID='+strMediaID+'&strRefID='+strRefID+'&strRefTypeID='+strRefTypeID+'&strMediaTypeID='+strMediaTypeID+'&strUseID='+strUseID+'&strSizeID='+strSizeID+'&strFolder='+strFolder+'&strFolderURL='+strFolderURL+'&strFilename='+strFilename,strWndName,'width=800,height=600,resizable=yes,scrollbars=1')
        }
	
	
	    function getElementsByStyleClass (className) 
	    {
            var all = document.all ? document.all :
            document.getElementsByTagName('*');
            var elements = new Array();
            for (var e = 0; e < all.length; e++)
            if (all[e].className == className)
                elements[elements.length] = all[e];
            return elements;
        }
        
        function getElementsCountByID (strIDName) 
	    {
            var all = document.all ? document.all :
            document.getElementsByTagName('*');
            var intElements =0;
            for (var e = 0; e < all.length; e++)
            if (all[e].id.indexOf(strIDName)>-1)
                intElements+=1
                
            return intElements;
        }
        
        function validateProdAttrSel(strIDName)
        {
        
           //alert("2");
            var all = document.all ? document.all :
            document.getElementsByTagName('*');
            var intElements =0;
           
            for (var e = 0; e < all.length; e++)
            {
            //alert(all[e].id);
                if (all[e].id.indexOf(strIDName)>-1)
                {
              //  alert("4");
                    if ((all[e].options[all[e].selectedIndex].value=="")||(all[e].options[all[e].selectedIndex].value=="NA"))
                    {
                //    alert("5");
                        alert(all[e].options[0].text);
                        return false;
                    }
                }
            }    
            return true;
        }


    function SelectAllCheckboxes(spanChk)
	{
		
		// Added as ASPX uses SPAN for checkbox 
		var xState=spanChk.checked;
		var theBox=spanChk;
		
		// Old code for VS 2002 / .NET framework 1.0 code
		//-----------------------------------------------
		// In .NET 1.0 ASP.NET was using SPAN tag with
		// CheckBox control. 
		//
		//var oItem = spanChk.children;
		//var theBox=oItem.item(0)
		//xState=theBox.checked;	
		//-----------------------------------------------
		
		elm=theBox.form.elements;
		for(i=0;i<elm.length;i++)
		if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
		{
			//elm[i].click();
			if(elm[i].checked!=xState)
			elm[i].click();
			//elm[i].checked=xState;
		}
	}	
	
	function testjs()
	{
	    alert("Testing javascript ok!");
	}
	
	
	function testjsobjval(val)
	{
	    alert(val);
	}