var entered=false;
function checkRegister(){
  var thisForm = document.subwin;
  var firstname =thisForm.firstname;
  var lastname =thisForm.lastname;
  var username =thisForm.username;
  var password =thisForm.pass;
  var email =thisForm.email;
  var fields = new Array(firstname,lastname,username,password,email);
  
  //don't need to change the following lines 
  var error = false;
  var focusObj = null;
  var color1 = "blue";
  var color2 = "#FFFFFF";
  
  for(i=0;i<fields.length;i++){
  	fields[i].style.background=color2;
	if(fields[i].value==""){
		fields[i].style.background=color1;
		if(!error)
			focusObj = fields[i];
		error=true;		
	}
  }  
  if(error){
  	focusObj.focus();
    alert("Please enter the required info in the highlight field.");
    return false;
  }
  else{  
 	var em = email.value;			
			if(-1==em.indexOf("@")){
				alert("Please enter a valid email address !");
				email.style.background=color1;
				email.focus();
				return false ;
			}
			else if(username.value.length>50){
				alert("The length of username need to be less than or equal to 50 chars !");
				username.style.background=color1;
				username.focus();
				return false ;
			}
			else
				return true;
  
	}
}
function check(){
  var thisForm = document.subwin;
  
  var email =thisForm.email;
  var fields = new Array(email);
  
  //don't need to change the following lines 
  var error = false;
  var focusObj = null;
  var color1 = "blue";
  var color2 = "#FFFFFF";
  
  for(i=0;i<fields.length;i++){
  	fields[i].style.background=color2;
	if(fields[i].value==""){
		fields[i].style.background=color1;
		if(!error)
			focusObj = fields[i];
		error=true;		
	}
  }  
  if(error){
  	focusObj.focus();
    alert("Please enter the required info in the highlight field.");
    return false;
  }
  else{  
 	var em = email.value;			
			if(-1==em.indexOf("@")){
				alert("Please enter a valid email address !");
				email.style.background=color1;
				email.focus();
				return false ;
			}
			
			else
				return true;
  
	}
}
function cls(){	
			v= document.subwin.email;			
			if(!entered){
				v.value=""; 
				entered=true
			}
}
function changeCSS(obj, bgColor, borderColor, fontColor) {
	if (document.getElementById) {
		obj.style.backgroundColor = bgColor;
		obj.style.borderColor = borderColor;
		obj.style.color = fontColor;
	}
}


