function validateSignin(f) {
	var j;
	j= f("username").value;
	var st="";
	if ( j.length == 0 ) {
		st = "Please enter username..";
		f("username").focus();
	}

	j= f("password").value;
	if ( j.length == 0 ) {
		st = st  + "\nPlease enter password..";
		f("password").focus();
	}

	if ( st.length != 0 ) {
		alert(st);
	return false;
	}
	
return true;
}
function validatefields(f) {
	
	var j;
	j= f("fname").value;
	var st="";
	if ( j.length == 0 ) {
		st = "Please enter firstname..";
		f("fname").focus();
	}


	j = f("lname").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter lastname..";
		f("lname").focus();
	}


	j = f("gender").value;
	if ( j == "0" ) {
		st = st + "\nPlease select gender..";
		f("gender").focus();
	}



	j = f("id").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter id..";
		f("id").focus();
	}

	j = f("password").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter password value..";
		f("password").focus();
	}

	j = f("rpassword").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter re-type password value..";
		f("rpassword").focus();
	}
	
	j = f("companyname").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter company name..";
		f("companyname").focus();
	}
	
	j = f("sanswer").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter security question answer..";
		f("sanswer").focus();
	}
	

	j = f("month").value;
	if ( j == "0"  ) {
		st = st + "\nPlease select a month..";
		f("month").focus();
	}


	j = f("date").value;
	if ( j == "0" ) {
		st = st + "\nPlease enter date value..";
		f("date").focus();
	} else if ( ! (IsNumeric(j))) {
		st = st + "\nPlease enter numeric date value only..";
		f("date").focus();
	}

	j = f("year").value;
	if ( j == "0" ) {
		st = st + "\nPlease enter year value..";
		f("year").focus();
	} else if ( ! (IsNumeric(j))) {
		st = st + "\nPlease enter numeric year value only..";
		f("year").focus();
	}

	j = f("contactno").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter contact no..";
		f("contactno").focus();
	}


	j = f("country").value;
	if ( j == "0" ) {
		st = st + "\nPlease select country value..";
		f("country").focus();
	}


	j = f("zip").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter zip\postal code value..";
		f("zip").focus();
	}

	if ( st.length != 0 ) {
		alert(st);
	return false;
	} else if ( f("password").value != f("rpassword").value ) {
		alert("Password and Re-type password is not matching..");
		return false;
	}



	var i= f("emailid").value;
	var a=0;
	var b=0;
	var c = i.length;
	for(j=0; j<c; j++)	{
		if(i.charAt(j)=='@')		{
			a=j;	
			
		}
		if(i.charAt(j)=='.')		{
			b=j;
		}
	}
	if(a==0 || b==0 || b-a<=1)	{
		alert("Invalid email entry..");
		f("emailid").focus();
		f("emailid").value="";
		return false;
    }
return true;
}


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function clearField(f){
	f.focus();
	f.value = "";
}


function validateFeedback(f)	{

	var j;


	j= f("cname").value;
	var st="";
	if ( j.length == 0 ) {
		st = "Please enter name..";
		f("cname").focus();
	}

	j = f("contactno").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter contact no..";
		f("contactno").focus();
	}

	j = f("compname").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter Company name..";
		f("compname").focus();
	}

	j = f("country").value;
	if ( j == "0" ) {
		st = st + "\nPlease select country value..";
		f("country").focus();
	}

	j = f("comments").value;
	if ( j.length == 0 ) {
		st = st + "\nPlease enter value in comment box..";
		f("comments").focus();
	}

	if ( st.length != 0 ) {
		alert(st);
		return false;
	}

	var i= f("emailid").value;
	var a=0;
	var b=0;
	var c = i.length;

	for(j=0; j<c; j++) {
		if( i.charAt(j) == '@' ) {
			a=j;
		}
		if(i.charAt(j)=='.'){
			b=j;
		}
	}

	if(a==0 || b==0 || b-a<=1) {
		alert("Invalid email entry..");
		f("emailid").focus();
		f("emailid").value="";
		return false;
	}
return true;

}
