<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->


// JavaScript Document

function isNumeric(pccharinput) {  // 1) this allows the numbers 0-9
	return(pccharinput>="0" && pccharinput<="9")
}

function isAlphabetic(pccharinput) { // 2) this allows the letters A-Z & a-z
	return((pccharinput>="A" && pccharinput<="Z") || 
		(pccharinput>="a" && pccharinput<="z"))
}

function isAlphaNumeric(pccharinput) { //  3) this allows 1) & 2) from above to be put together
	return (isAlphabetic(pccharinput) || isNumeric(pccharinput))
}

function isEmpty(pccharinput) { // checks for any empty fields in the HTML form
	if (pccharinput=="" || pccharinput==" ")
	return true
	else return false
	}


//////////////////////////////////////////////////////////////////////////


function isNameChar(pccharinput) {  // this is all the alphabet and the special characters for the name
	return (isAlphabetic(pccharinput) || isNameSpecialChar(pccharinput))
}

//alert(isNameChar("michelle'hgf"))
function isNameSpecialChar(pccharinput) {  // these are the special characters allowed for the name
	return (pccharinput=="'" || pccharinput=="-" || pccharinput==" ")
}


function isNameString(pcstrInput) {  

	var w, lvintapostrophepos, lvintdashpos, lvintspacepos
	
	lvintapostrophepos=pcstrInput.indexOf("'")
	lvintdashpos=pcstrInput.indexOf("-")
	lvintspacepos=pcstrInput.indexOf(" ")
	
	for (w=0; w<pcstrInput.length; w++) {
	
		if (!isNameChar (pcstrInput.charAt(w)))
		{ 
			return false
		}
	}
	
	if (lvintapostrophepos==0)  // if ' is at postion 0 it's false
		return false
	if (lvintdashpos==0) // if - is at postion 0 it's false
		return false
	if (lvintspacepos==0) // if there is a space at 0 it's wrong
		return false
	if (isEmpty(pcstrInput))  // if the text field is empty it will return false
		return false
	return true
} 

///////////////////////////////////////////////////////////

function isEmailSpecialChar(pccharinput) {
	return (pccharinput=="@" || pccharinput=="-" || pccharinput=="_" || pccharinput==".")
}

function isEmailChar(pccharinput) {  // allows numbers, alphabets and the special email characters from above.
	return (isAlphaNumeric(pccharinput) || isEmailSpecialChar(pccharinput))
}

function isEmailString (pcstrInput) { 

	var w, lvintlength, lvintlastpos, lvintatpos, lvintatlastpos, lvintfirstpos

	lvintlength=pcstrInput.length
	lvintlastpos=pcstrInput.lastIndexOf(".")
	lvintatpos=pcstrInput.indexOf("@")
	lvintfirstpos=pcstrInput.indexOf(".")
	lvintatlastpos=pcstrInput.lastIndexOf("@")
	
	
	for (w=0; w<pcstrInput.length; w++) 
	{ 
		if (!isEmailChar (pcstrInput.charAt(w)))
		{ 
			return false
		} 
	} 	

	if(lvintatpos==0) // if @ is = 0 it's false.
		return false

	if (lvintlastpos==0) // if last . is = 0 it's wrong
		return false

	if (lvintfirstpos==0) // if . is = to 0 it's wrong
		return false

	if (lvintatlastpos==-1) // there is no @ in the email address
		return false

	if (lvintfirstpos==-1) // there is no . in the email address
		return false

	if (pcstrInput.indexOf("@.")!=-1) // this means the @. are not = to -1 (basically if there is @ and. together it returns false.)
		return false
		
	if (pcstrInput.indexOf(".@")!=-1) //there are .@ together
		return false
		
	if (pcstrInput.indexOf("@@")!=-1) // two @@ together
		return false
		
	if (pcstrInput.indexOf("..")!=-1) // this means the two .. are not = to -1 (basically if there are 2 .. it returns false.)
		return false

	if(lvintlength-lvintlastpos<2) // there are not two letters after the last .
		return false
	 
	return true
} 

//////////////////////////////////////////////////////////////////////////////////
function isCurrencyChar(pccharInput) {  // allows numbers and dots in the currency
	return (isNumeric(pccharInput) || pccharInput==".")
}

function isCurrencyString(pcstrInput) { 

	var i
	for (i=0; i<pcstrInput.length; i++) 
	{  
		if (!isCurrencyChar (pcstrInput.charAt(i)))  
		{  
			return false
		}  
	} 
	return true
}  

function isCurrencyFormat(pcstrInput) {   
 	var lvintlength, lvintdotpos
 
 	lvintlength=pcstrInput.length
	lvintdotpos=pcstrInput.lastIndexOf(".")
	
	//if(lvintdotpos!=-1 && lvintlength-lvintdotpos>5) // there can only be 4 numbers after the last dot.
	if (lvintlength-lvintdotpos>3) // there can only be 2 digits after the last decimal place
		//alert("There can only be two digits after the last decimal number")
		return false
	return true
}

function currency(pcstrInput) {  // if it is not isCurrencyString, isCurrencyFormat & isEmpty make this false
 	if (isCurrencyString(pcstrInput) && isCurrencyFormat(pcstrInput) && (!isEmpty(pcstrInput)))
		return true
	else return false
}

//////////////////////////////////////////////////////////////////////////
	
function isSelect(pcobjElem){  // if the dropdown box is at selected index 0 then it returns false (this is only used for the country)
	if(pcobjElem.selectedIndex == 0)
		return false
	else
		return true
}

///////////////////////////////////////////////////////////////////////////////////

function isDateChar(pccharinput) { // checks that only numbers and the - can be used
	return (isNumeric(pccharinput) || pccharinput=="-")
}


function isDateString(pcstrInput) {  

	var i, lvintlength, lvintdashpos, lvintlastdashpos, lvintSpacepos
	
	lvintlength=pcstrInput.length
	lvintdashpos=pcstrInput.indexOf("-")
	lvintlastdashpos=pcstrInput.lastIndexOf("-")
	lvintSpacepos=pcstrInput.indexOf(" ")
	
	for (i=0; i<pcstrInput.length; i++) 
	{  
		if (!isDateChar (pcstrInput.charAt(i)))
		{  
			return false
			
	if(lvintdashpos==-1) {  //there is no - in the text field
		//alert("There is no dash in the feild. Please enter again.")
		return false
		}
	else if (lvintSpacepos!=-1) {  // no spaces are allowed
		//alert("No spaces are allowed. Please try again")
		return false
		}
	
	else if(lvintlastdashpos!=5) {  //There's no - in No. 5 of the date
		return false
		}
		
	else if(lvintdashpos!=2) {  //There's no - in No. 2 of the date
		return false
		}
	}  
} 
	return true
}  				



function isLeapYear(yyyy) {  
	return (yyyy%100!=0 && yyyy%4==0 || yyyy%400==0)
}
	
function isValidDate(pcstrDate) {  
	
	var dd=pcstrDate.substr(0, 2)
	var mm=pcstrDate.substr(3, 2)
	var yyyy=pcstrDate.substr(6, 4)
	var monthAmountArray=new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
	var monthArray=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
	//var monthNoArray=new Array("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12") 
	
if (!((mm>=1) && (mm<=12))){  
		alert("There are only 12 months in a year.")						
		return false
		}
else if ((mm==04 || mm==06 || mm==09 || mm==11) && !(dd>=1 && dd<=30)) { 
		alert("There are only 30 days in " + monthArray[mm-1])
		return false
		}
else if ((mm==01 || mm==03 || mm==05 || mm==07 || mm==08 || mm==10 || mm==12) && !(dd>=1 && dd<=31)) {
		alert("There are only 31 days in " + monthArray[mm-1])
		return false
		}
else if (mm==02){
		if (isLeapYear(yyyy)) {
			if(!(dd>=1 && dd<=29)) {
				alert("Feburary has 29 days in the year " + yyyy)
				return false
				}
		}
		else if(!(dd>=1 && dd<=28)) {
			alert("Feburary has 28 days in the year " + yyyy)
			return false
		}
	}
 return true
} 
	
function isDate(pcstrDate) {   // if the text field is empty, is not the datestring and is not the vaild date it's wrong
	
	if (isEmpty(pcstrDate)) {
		return false
	}
	
	else if (!isDateString(pcstrDate)) {
		return false
		}
			
	else if (!isValidDate(pcstrDate)) {
		return false
		}	
	
	else return true
}

//////////////////////////////////////////////////////////////////

function isSubmit() {  // this validates the add user form.
	
	if (!isNameString(window.document.AddUser.FName.value)) {
		alert("Please enter a correct first name. This first name is invalid.")
		window.document.AddUser.FName.focus();
		window.document.AddUser.FName.select();
		return false;
		}

	if (!isNameString(window.document.AddUser.LName.value)) {
		alert("Please enter a correct last name. This last name is invalid.")
		window.document.AddUser.LName.focus();
		window.document.AddUser.LName.select();
		return false;
		}

	if (!isNameString(window.document.AddUser.UserName.value)) {
		alert("Please enter a correct UserName. This UserName is invalid.")
		window.document.AddUser.UserName.focus();
		window.document.AddUser.UserName.select();
		return false;
		}
		
	if (!isNameString(window.document.AddUser.Password.value)) {
		alert("You can only enter alphabetic characters for the password")
		window.document.AddUser.Password.focus();
		window.document.AddUser.Password.select();
		return false;
		}
	
		
	if (!isEmailString(window.document.AddUser.Email.value)) {
		alert("Please enter a correct email address. This email is invalid.")
		window.document.AddUser.Email.focus();
		window.document.AddUser.Email.select();
		return false;
		}

	//else {
		window.document.AddUser.submit();
	//}
}
////////////////////////


function isUpdateUser() {  // this validates the update user form.
	
	if (!isNameString(window.document.updateUser.FName.value)) {
		alert("Please enter a correct first name. This first name is invalid.")
		window.document.updateUser.FName.focus();
		window.document.updateUser.FName.select();
		return false;
		}

	else if (!isNameString(window.document.updateUser.LName.value)) {
		alert("Please enter a correct last name. This last name is invalid.")
		window.document.updateUser.LName.focus();
		window.document.updateUser.LName.select();
		return false;
		}

	else if (!isNameString(window.document.updateUser.UserName.value)) {
		alert("Please enter a correct user name.")
		window.document.updateUser.UserName.focus();
		window.document.updateUser.UserName.select();
		return false;
		}
		
	else if (!isNameString(window.document.updateUser.Password.value)) {
		alert("Please enter a correct password")
		window.document.updateUser.Password.focus();
		window.document.updateUser.Password.select();
		return false;
		}
	
		
	else if (!isEmailString(window.document.updateUser.Email.value)) {
		alert("Please enter a correct email address. This email is invalid.")
		window.document.updateUser.Email.focus();
		window.document.updateUser.Email.select();
		return false;
		}
		window.document.updateUser.submit()
}

function isUpdateQty(obj, frm) {
	//window.alert("here")
	//alert(obj.value)
	if (!isNumeric(obj.value)) {
		alert("Please enter a quantity to continue")
		obj.focus();
		obj.select();
		return false;
	}
	frm.submit()
}


function isAddToCart(obj, frm) {  // this checks there is a number in the qty
	//alert (obj.value)
	if (!isNumeric(obj.value)) {
		alert("Please enter a quantity to continue")
		obj.focus();
		obj.select();
		return false;
	}
		
		//frm.submit()
}




		
		
function openpopup(url){

winpops=window.open(url,"","width=400,height=338,status,")
}


 function isAddProductFrom() {
	if(window.document.addProductForm.ProductGroupId.value == 0 && window.document.addProductForm.GroupName.value=="") {
		alert("Please enter a product group")
		window.document.addProductForm.ProductGroupId.focus();
		return false;
	}
		
	if (window.document.addProductForm.ProductGroupId.value != 0 && window.document.addProductForm.GroupName.value !="") {
		alert("You can only choose from the drop down list or add a new product group. \n\n Please try again.")
		window.document.addProductForm.GroupName.focus();
		window.document.addProductForm.GroupName.select();
		return false;
	}
	
		
	if (window.document.addProductForm.Name.value==0) {
		alert("Please enter a product name")
		window.document.addProductForm.Name.focus();
		return false;
		}

	if (window.document.addProductForm.SellPrice.value==0) {
		alert("Please enter a price")
		window.document.addProductForm.SellPrice.focus();
		return false;
		}
		
	if (!currency(window.document.addProductForm.SellPrice.value)) {
		alert("There can only be two digits after the last decimal number")
		window.document.addProductForm.SellPrice.focus();
		window.document.addProductForm.SellPrice.select();
		return false;
		}
		
	if (window.document.addProductForm.LgDesc.value==0) {
		alert("Please enter a description for the product")
		window.document.addProductForm.LgDesc.focus();
		return false;
		}
		
	if (window.document.addProductForm.File1.value==0) {
		alert("Please add an image")
		window.document.addProductForm.File1.focus();
		return false;
		}
	return true
		
 }
 
 function isUpdateProductFrom() {
	 	if(window.document.addProductForm.ProductGroupId.value == 0 && window.document.addProductForm.GroupName.value=="") {
		alert("Please enter a product group")
		window.document.addProductForm.ProductGroupId.focus();
		return false;
	}
		
	if (window.document.addProductForm.ProductGroupId.value != 0 && window.document.addProductForm.GroupName.value !="") {
		alert("You can only choose from the drop down list or add a new product group. \n\n Please try again.")
		window.document.addProductForm.GroupName.focus();
		window.document.addProductForm.GroupName.select();
		return false;
	}
	
		
	if (window.document.addProductForm.Name.value==0) {
		alert("Please enter a product name")
		window.document.addProductForm.Name.focus();
		return false;
		}

	if (window.document.addProductForm.SellPrice.value==0) {
		alert("Please enter a price")
		window.document.addProductForm.SellPrice.focus();
		return false;
		}
		
	if (!currency(window.document.addProductForm.SellPrice.value)) {
		alert("There can only be two digits after the last decimal number")
		window.document.addProductForm.SellPrice.focus();
		window.document.addProductForm.SellPrice.select();
		return false;
		}
		
	if (window.document.addProductForm.LgDesc.value==0) {
		alert("Please enter a description for the product")
		window.document.addProductForm.LgDesc.focus();
		return false;
		}
		return true
 }
 
 function isCustomer() {
 	if (!isEmailString(window.document.LoginForm.Email.value)) {
		alert("Please enter a correct email address.")
		window.document.LoginForm.Email.focus();
		window.document.LoginForm.Email.select();
		return false;
		}
		
	if (isEmpty(window.document.LoginForm.Password.value)) {
		alert("Please enter a password.")
		window.document.LoginForm.Password.focus();
		return false;
		}
 }
 
 
 function isAddAppForm() {
	 
	 if (document.register.Company.value=="") {
		alert("Please enter your company name.")
		document.register.Company.focus();
		return false;
	 }
	 
	 if (document.register.Company_Position.value=="") {
		alert("Please enter your position in the company.")
		document.register.Company_Position.focus();
		return false;
	 }
	 
	 if (document.register.FName.value=="") {
		alert("Please enter your first name.")
		document.register.FName.focus();
		return false;
		}
		
	if (isEmpty(document.register.LName.value)) {
		alert("Please enter your last name.")
		document.register.LName.focus();
		return false;
		}
	
 	if (!isEmailString(document.register.Email.value)) {
		alert("Please enter a correct email address.")
		document.register.Email.focus();
		document.register.Email.select();
		return false;
		}	
		
	if (document.register.Phone.value=="") {
		alert("Please enter a phone number.")
		document.register.Phone.focus();
		return false;
		}
		
		 if (document.register.Directors.value=="") {
		alert("Please enter the directors of the company.")
		document.register.Directors.focus();
		return false;
	 }
	 
	if (document.register.TradeCompany1.value=="") {
		alert("Please enter a trade company name.")
		document.register.TradeCompany1.focus();
		return false;
		}
		
		if (document.register.TradeContact1.value=="") {
		alert("Please enter a trade contact name.")
		document.register.TradeContact1.focus();
		return false;
		}
		
		if (document.register.TradePhone1.value=="") {
		alert("Please enter a trade phone number.")
		document.register.TradePhone1.focus();
		return false;
		}
		
		if (document.register.TradeCompany2.value=="") {
		alert("Please enter a trade company name.")
		document.register.TradeCompany2.focus();
		return false;
		}
		
		if (document.register.TradeContact2.value=="") {
		alert("Please enter a trade contact name.")
		document.register.TradeContact2.focus();
		return false;
		}
		
		if (document.register.TradePhone2.value=="") {
		alert("Please enter a trade phone number.")
		document.register.TradePhone2.focus();
		return false;
		}
		
		if (document.register.TradeCompany3.value=="") {
		alert("Please enter a trade company name.")
		document.register.TradeCompany3.focus();
		return false;
		}
		
		if (document.register.TradeContact3.value=="") {
		alert("Please enter a trade contact name.")
		document.register.TradeContact3.focus();
		return false;
		}
		
		if (document.register.TradePhone3.value=="") {
		alert("Please enter a trade phone number.")
		document.register.TradePhone3.focus();
		return false;
		}
	

	 
	 
		
	if (window.document.register.BillingStreet.value=="") {
		alert("Please enter a street or PO Box number.")
		window.document.register.BillingStreet.focus();
		return false;
		}
  	//if (window.document.register.BillingSuburb.value=="") {
		//alert("Please enter a billing suburb.")
		//window.document.register.BillingSuburb.focus();
		//return false;
		//}
		
  	if (window.document.register.BillingCity.value=="") {
		alert("Please enter a city for the postal address.")
		window.document.register.BillingCity.focus();
		return false;
		}
  	if (window.document.register.BillingCountry.value=="") {
		alert("Please enter a country for the postal address.")
		window.document.register.BillingCountry.focus();
		return false;
		}
	
	if (document.register.Terms.checked==false) {
		alert("You must agree to Bijou's Terms and Conditions to continue with your account.");
		return false
	}
		
	
	return true
 }
 
 function isRegisterForm() {
	 
	if (document.register.Company.value=="") {
		alert("Please enter your company name.")
		document.register.Company.focus();
		return false;
	 }
	 
	if (document.register.Company_Position.value=="") {
		alert("Please enter your position in the company.")
		document.register.Company_Position.focus();
		return false;
	 }
	 
	 if (document.register.PurchaseNo.value=="") {
		alert("Please enter a purchase order number.")
		document.register.PurchaseNo.focus();
		return false;
	 }
	
	 
 	if (document.register.FName.value=="") {
		alert("Please enter your first name.")
		document.register.FName.focus();
		return false;
		}
		
	if (isEmpty(document.register.LName.value)) {
		alert("Please enter your last name.")
		document.register.LName.focus();
		return false;
		}
	
 	if (!isEmailString(document.register.Email.value)) {
		alert("Please enter a correct email address.")
		document.register.Email.focus();
		document.register.Email.select();
		return false;
		}	
		
	if (document.register.Password.value=="") {
		alert("Please enter a password.")
		document.register.Password.focus();
		return false;
		}

	
	if (document.register.Phone.value=="") {
		alert("Please enter a phone number.")
		document.register.Phone.focus();
		return false;
		}
		
	if (document.register.Street.value=="") {
		alert("Please enter a street address.")
		document.register.Street.focus();
		return false;
		}
		
		
	if (document.register.City.value=="") {
		alert("Please enter a city for the billing details.")
		document.register.City.focus();
		return false;
		}
		
	if (document.register.Country.value=="") {
		alert("Please enter a country for the billing details.")
		document.register.Country.focus();
		return false;
		}
	
	return true
 }
 
 
 
 function isRegisterAddForm() {
	 
	if (document.register.Company.value=="") {
		alert("Please enter your company name.")
		document.register.Company.focus();
		return false;
	 }
	 
	if (document.register.Company_Position.value=="") {
		alert("Please enter your position in the company.")
		document.register.Company_Position.focus();
		return false;
	 }
	 
	 if (document.register.PurchaseNo.value=="") {
		alert("Please enter a purchase order number.")
		document.register.PurchaseNo.focus();
		return false;
	 }
	
	 
 	if (document.register.FName.value=="") {
		alert("Please enter your first name.")
		document.register.FName.focus();
		return false;
		}
		
	if (isEmpty(document.register.LName.value)) {
		alert("Please enter your last name.")
		document.register.LName.focus();
		return false;
		}
	
 	if (!isEmailString(document.register.Email.value)) {
		alert("Please enter a correct email address.")
		document.register.Email.focus();
		document.register.Email.select();
		return false;
		}	
		
	if (document.register.Password.value=="") {
		alert("Please enter a password.")
		document.register.Password.focus();
		return false;
		}

	if (document.register.Phone.value=="") {
		alert("Please enter a phone number.")
		document.register.Phone.focus();
		return false;
		}
	
	return true
 }
 
 
 
 function isCustomerForm() {
	 if (document.register.FName.value=="") {
		alert("Please enter your first name.")
		document.register.FName.focus();
		return false;
		}
		
	if (isEmpty(document.register.LName.value)) {
		alert("Please enter your last name.")
		document.register.LName.focus();
		return false;
		}
	
 	if (!isEmailString(document.register.Email.value)) {
		alert("Please enter a correct email address.")
		document.register.Email.focus();
		document.register.Email.select();
		return false;
		}	
		
	
	//if (document.register.Password.value != document.register.ConfirmPassword.value) {
		//alert("Your password must match.")
		//document.register.ConfirmPassword.focus();
		//return false;
		//}
	
	if (document.register.Phone.value=="") {
		alert("Please enter a phone number.")
		document.register.Phone.focus();
		return false;
		}
 }
 
 function isAddAddress() {
  	if (isEmpty(window.document.addAddress.BillingStreet.value)) {
		alert("Please enter a billing address.")
		window.document.addAddress.BillingStreet.focus();
		window.document.addAddress.BillingStreet.select();
		return false;
		}
  	if (isEmpty(window.document.addAddress.BillingSuburb.value)) {
		alert("Please enter a billing suburb.")
		window.document.addAddress.BillingSuburb.focus();
		window.document.addAddress.BillingSuburb.select();
		return false;
		}
  	if (isEmpty(window.document.addAddress.BillingCity.value)) {
		alert("Please enter a billing city.")
		window.document.addAddress.BillingCity.focus();
		window.document.addAddress.BillingCity.select();
		return false;
		}
  	if (isEmpty(window.document.addAddress.BillingCountry.value)) {
		alert("Please enter a billing country.")
		window.document.addAddress.BillingCountry.focus();
		window.document.addAddress.BillingCountry.select();
		return false;
		}
 }
 
 function isUpdateOrAddDetails() {
	var d = new Date();
	var day = d.getDate();
	var month = d.getMonth()+1;
	var year = d.getFullYear();
	var fullDate = day + "-" + month + "-" + year;
	var radio_choice = false;
	//alert(fullDate)
	 
    if (isEmpty(window.document.updateDetails.AddressFName.value)) {
		alert("Please enter a first name for the recipient.")
		window.document.updateDetails.AddressFName.focus();
		return false;
	}
	
	 if (isEmpty(window.document.updateDetails.AddressLName.value)) {
		alert("Please enter a last name for the recipient.")
		window.document.updateDetails.AddressLName.focus();
		return false;
		}
   
   if (isEmpty(window.document.updateDetails.Street.value)) {
		alert("Please enter a street address.")
		window.document.updateDetails.Street.focus();
		window.document.updateDetails.Street.select();
		return false;
	}
		
   //	if (isEmpty(window.document.updateDetails.Suburb.value)) {
		//alert("Please enter a suburb.")
		//window.document.updateDetails.Suburb.focus();
		//window.document.updateDetails.Suburb.select();
		//return false;
		//}
		
   	if (isEmpty(window.document.updateDetails.City.value)) {
		alert("Please enter a city.")
		window.document.updateDetails.City.focus();
		window.document.updateDetails.City.select();
		return false;
		}
		
   	if (isEmpty(window.document.updateDetails.Country.value)) {
		alert("Please enter a country.")
		window.document.updateDetails.Country.focus();
		window.document.updateDetails.Country.select();
		return false;
		}
		
	
	
	if (isEmpty(document.updateDetails.Deliver.value)) {
		alert("Please enter a delivery date.")
		window.document.updateDetails.Deliver.focus();
		window.document.updateDetails.Deliver.select();
		return false;
	}
	
	if (isEmpty(document.updateDetails.message.value)) {
		alert("Please enter your personal message.")
		window.document.updateDetails.message.focus();
		window.document.updateDetails.message.select();
		return false;
	}
	
	return radio_button_checker();
	
	return true;
	
	//if (document.updateDetails.Deliver.value < fullDate)  {
		//alert(document.updateDetails.Deliver.value +" : "+ fullDate)
		//alert ("The date you have entered:" + document.updateDetails.Deliver.value + " is before todays date. \n\nPlease try again")
		
		//document.updateDetails.Deliver.focus();
		//document.updateDetails.Deliver.select();
		//return false;
	//}
	
 }

function radio_button_checker() {
	var radio_choice = false;
	for (counter = 0; counter < updateDetails.freightId.length; counter++) {
		// If a radio button has been selected it will return true
		// (If not it will return false)
		if (updateDetails.freightId[counter].checked)
		radio_choice = true; 
	}
	
	if (!radio_choice) {
		// If there were no selections made display an alert box 
		alert("Please select your preferred freight option.")
		return (false);
	}
	return (true);
}



function isLogin() {
 	if (!isEmailString(document.Login.Email.value)) {
		alert("Please enter a correct email address.")
		document.Login.Email.focus();
		document.Login.Email.select();
		return false;
		}
		
	if (document.Login.Password.value=="") {
		alert("Please enter a password")
		document.Login.Password.focus();
		document.Login.Password.select();
		return false;
		}	
		
 }	
 

function isdateFrom() {
	if(document.DateForm.Interest.value=="") {
		alert("Please enter a name for the date");
		document.DateForm.Interest.focus();
		return false;
	}
	
	if (!isDate(document.DateForm.date.value)) {
		alert("Please enter a correct date");
		document.DateForm.date.focus();
		document.DateForm.date.select();
		return false;
	}
}


function isProdGroupFrom() {
	if(document.ProdGroup.Groupname.value=="") {
		alert("Please enter a product group");
		document.ProdGroup.Groupname.focus();
		return false;
	}
}

function isContactForm() {
	if (document.enquiry.name.value=="") {
		alert("Please enter your name.");
		document.enquiry.name.focus();
		return false;
	}
	
	if (document.enquiry.Email.value=="") {
		alert("Please enter your email address.");
		document.enquiry.Email.focus();
		return false;
	}
	
	if (!isEmailString(document.enquiry.Email.value)) {
		alert("Please enter a valid email address.");
		document.enquiry.Email.focus();
		document.enquiry.Email.select();
		return false;
	}
}

function isAddPassword() {
	
	if (document.addPassword2Applicant.password.value=="") {
		alert("A password is required");
		document.addPassword2Applicant.password.focus();
		return false;
	}
	return true
	
}

function isNewsletter() {
	if (!isEmailString(document.newsletter.Email.value)) {
		alert("Your email address is required.");
		document.newsletter.Email.focus();
		document.newsletter.Email.select();
		return false;
	}
}

function isNewsletterSingup() {
	if (document.newsletter.Name.value=="") {
		alert("Please enter your name.");
		document.newsletter.Name.focus();
		return false;
	}
	
	if (document.newsletter.email.value=="") {
		alert("Please enter an email address to register for the Christmas catalouge.");
		document.newsletter.email.focus();
		return false;
	}
	
	if (!isEmailString(document.newsletter.email.value)) {
		alert("Please enter a valid email address.");
		document.newsletter.email.focus();
		document.newsletter.email.select();
		return false;
	}
}



function confirmSubmit() {
		
	var agree=confirm("By clicking OK you authorise Bijou to invoice your company $" + document.submitform.OrderTotal.value+ "\n\nPayment of this order is due 14 days from the date of delivery.");
	if (agree)
		return true ;
	else
		return false ;
}

function validateUsers() {
	//alert(document.frmUsers.Counter.value)
	for(var i=1; i < document.frmUsers.Counter.value+1; i++){
		with(document.frmUsers){
			
			if(eval("AddressFName" + i + ".value == ''")){
				alert("Please enter the first name for item number " + i);
				eval("AddressFName" + i + ".focus()");
				return false;
			}
			
			if(eval("AddressLName" + i + ".value == ''")){
				alert("Please enter the last name for item number " + i);
				eval("AddressLName" + i + ".focus()");
				return false;
			}
			
			if(eval("Street" + i + ".value == ''")){
				alert("Please enter a street address for item number " + i);
				eval("Street" + i + ".focus()");
				return false;
			}
			
			//if(eval("Suburb" + i + ".value == ''")){
				//alert("Please enter a suburb for gift number " + i);
				//eval("Suburb" + i + ".focus()");
				//return false;
			//}
			
			if(eval("City" + i + ".value == ''")){
				alert("Please enter a city for item number " + i);
				eval("City" + i + ".focus()");
				return false;
			}
			
			if(eval("Country" + i + ".value == ''")){
				alert("Please enter a country for item number " + i);
				eval("Country" + i + ".focus()");
				return false;
			}
			
			if(eval("Deliver" + i + ".value == ''")){
				alert("Please enter a delivery date for item number" + i);
				eval("Deliver" + i + ".focus()");
				return false;
			}

			if(eval("freightId" + i + ".value == '0'")){
				alert("Please choose a freight option for item number " + i);
				eval("freightId" + i + ".focus()");
				return false;
			}
			
			if(eval("message" + i + ".value == ''")){
				alert("Please enter a message for item number " + i);
				eval("message" + i + ".focus()");
				return false;
			 }
		}
	}
	return true;
}

