//Created By Shibu Thomas

//....................Functions For Form Validation....................//

function emailok()
 	{
		var str = document.form1.email.value;
		var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/; // valid
		if (!reg1.test(str) && reg2.test(str))
		{
					return true;
		}
		alert("\"" + str + "\" is an invalid e-mail!");
		document.form1.email.focus();
		return false;
	 }//	End of function emailok()

	 
	 
function txtValidate(txtname,msgname)
	{
		var txt=document.getElementById(txtname);
		if(txt.value.length==0)
			{
				alert("Please Enter "+msgname);
				txt.focus();
				return false;
			}
		return true;
	}//		End of function txtValidate()
	 	
function selValidate(selname,msgname)
	{
		var sel=document.getElementById(selname);
		if(sel.value==0)
			{
				alert("Please Select "+msgname);
				sel.focus();
				return false;
			}
		return true;
	}//		End of function selValidate()
	
function CheckNumeric(){
	a=event.keyCode;
	if ((a>=48) && (a<=57)){      
		event.returnValue=true;
	}
	else{
		event.returnValue=false;
	}
}

function replaceChars(entry)
	{
	out = "a"; // replace this
	add = "z"; // with this
	temp = "" + entry; // temporary holder
	while (temp.indexOf(out)>-1) 
		{
			pos= temp.indexOf(out);
			temp = "" + (temp.substring(0, pos) + add + 
			temp.substring((pos + out.length), temp.length));
		}
	//document.subform.text.value = temp;
	return temp;
	}

//Shibu Thomas	