function Validate(){

	var FieldCheck=true;
	for (x in AllFields) { 
		if (document.getElementById(AllFields[x])){
		var ThisValue=document.getElementById(AllFields[x]).value;
		var ThisField=document.getElementById(AllFields[x]);
		if(ThisValue=="" || ThisValue=='null'){ 
		ThisField.style.backgroundColor="#FF9999";
		FieldCheck=false;
		} 
		else{ 
		ThisField.style.backgroundColor="#FFFFFF";
		} 
		}

		} 
var EmailCheck=true;
EmailCheck=ValidateMailFields();

var PwdCheck=true;
PwdCheck=ValidatePwdFields();

		if(EmailCheck==true && FieldCheck==true && PwdCheck==true){ 
			return true;
			}else{ 
				return false;
			} 
} 
function ValidatePwdFields(){ 
	if(PwdFields[0]==""){ return true;
	} 
	var Pwd1=document.getElementById(PwdFields[0]).value;
	var Pwd2=document.getElementById(PwdFields[1]).value;
	var Pwd1Field=document.getElementById(PwdFields[0]);
	var Pwd2Field=document.getElementById(PwdFields[1]);
	if(Pwd1==""){ Pwd1Field.style.backgroundColor="#FF9999";Pwd2Field.style.backgroundColor="#FF9999";
	return false;
	} 
	if(Pwd1!=Pwd2){ Pwd1Field.style.backgroundColor="#FF9999";
	Pwd2Field.style.backgroundColor="#FF9999";
	return false;
	}else{ 
	Pwd1Field.style.backgroundColor="#FFFFFF";
	Pwd2Field.style.backgroundColor="#FFFFFF";
	return true;
	} 
	} 
function ValidateMailFields(){ 
	if(EmailFields[0]==""){ return true;} 
var Email1=document.getElementById(EmailFields[0]).value;
var Email2=document.getElementById(EmailFields[1]).value;
var Email1Field=document.getElementById(EmailFields[0]);
var Email2Field=document.getElementById(EmailFields[1]);

if(Email1==""){ 
Email1Field.style.backgroundColor="#FF9999";
Email2Field.style.backgroundColor="#FF9999";
return false;
} 
if(Email1!=Email2){ Email1Field.style.backgroundColor="#FF9999";Email2Field.style.backgroundColor="#FF9999";return false;
}else{ Email1Field.style.backgroundColor="#FFFFFF";Email2Field.style.backgroundColor="#FFFFFF";return true;
} 
} 
function Fsubmit(){ 
var MainCheck=Validate();
if(MainCheck==true){ 
	var ThisForm=document.getElementById(FormName);ThisForm.submit();
	var SubmButton=document.getElementById('sbtbtt');
	SubmButton.disabled='disabled';
	} 
}