function ValidLength(item, len){
	return (item.length >= len);
	}
	
	
function Validate1() {
errfound = false;

if (!IsEmailValid(document.shopper_lookup.shopper_email))
	error(document.shopper_lookup.shopper_email,"Please enter a valid Login name, which is the same as your email address.")
	
if (!ValidLength(document.shopper_lookup.shopper_password.value,4))
	error(document.shopper_lookup.shopper_password,"Please enter a valid password between 4 and 20 characters.");

	
return !errfound;
}

function error(elem, text) {
if (errfound) return;
window.alert(text);
elem.focus();
errfound = true;
}

//to validate email
function IsEmailValid(ElemName)
{
var EmailOk  = true
var Temp     = ElemName
var AtSym    = Temp.value.indexOf('@')
var Period   = Temp.value.lastIndexOf('.')
var Space    = Temp.value.indexOf(' ')
var Length   = Temp.value.length - 1   // Array is from 0 to length-1

if ((AtSym < 1) ||                     // '@' cannot be in first position
    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
    (Period == Length ) ||             // Must be atleast one valid char after '.'
    (Space  != -1))                    // No empty spaces permitted
   {  
      EmailOk = false
   }
return EmailOk
}