<!-- Hide From the old browsers
// to validate the file extensions
function File_Extentsion_Validate(ctrl,msg)	
			{ //alert('image');
				if(trimAll(ctrl.value) != "")	
				{
					var strarr = ctrl.value.split(".");
					var len = strarr.length;
					var type = strarr[len-1].toLowerCase();								
					if (type!='pdf' && type !='doc') {							
						alert("Please only upload the following formats: PDF ,DOC  for "+msg);
						//ctrl.select();
						return false;
					}						
				}
}
function trimAll(sString)
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}
function TextValidate(txtCtrl,val)
{
	var ctrName = val;
	//Remove_Spaces(txtCtrl);
	if (trimAll(txtCtrl.value) == "")
	{
		alert("Please enter " + ctrName);
		txtCtrl.focus();
		return false;		
	}
	/*if(txtCtrl.value.indexOf("'") > -1)
	{
		alert("Please Don't enter ' in " + ctrName + ".");		
		txtCtrl.focus();   	
		return false;		
	}*/			
}
function TextAreaValidate(txtCtrl, val) 
{
	var ctrName	= val;
	//str = txtCtrl.value;
 	//Remove_Spaces(txtCtrl);	
	var str = trimAll(txtCtrl.value);
	if(str.length == 0)
	{
		alert("Please enter " + ctrName + ".");
		txtCtrl.focus();	   	
		return false;
	}		
	/*if(trimAll(txtCtrl.value).indexOf("'") > -1)
	{
		alert("Please Don't enter ' in " + ctrName + ".");		
		txtCtrl.focus();
		return false;		
	}*/			
}
// Req field
function EmailValidate(txtCtrl, val) 
{
	var ctrName = val;
	if (trimAll(txtCtrl.value).indexOf("@") < 1 || trimAll(txtCtrl.value).indexOf(".") < 0) 
	{
		alert("Please enter valid " + ctrName + ".\t\n eg: username@domainname.com");
		txtCtrl.focus();	   	
		txtCtrl.select();
		return false;
	}		
	if(trimAll(txtCtrl.value).indexOf("'") > -1)
	{
		alert("Please Don't enter ' in " + ctrName + ".");		
		txtCtrl.focus();   	
		return false;		
	}			
}
// Req
function SelValidate(selCtrl) 
{
	if (selCtrl.value == "" || selCtrl.value == "0" || selCtrl.value == "-1" || selCtrl.value.indexOf("Please") != -1) 
	{
		alert("Please select an option in the list.");
		selCtrl.focus();	   	
		return false;
	}		
}

function SelectValidate(selCtrl,msg) 
{
	if (selCtrl.value == "" || selCtrl.value == "0" || selCtrl.value == "-1" || selCtrl.value.indexOf("Please") != -1) 
	{
		alert("Please select " + msg +".");
		selCtrl.focus();	   	
		return false;
	}		
}
// Function for Compare Two passwords
function Comparetextboxes(txtCtrl1, txtCtrl2) 
{
	//Find length
	if(trimAll(txtCtrl1.value).length < 5)
	{
		alert("The new password should be atleast 5 characters !");
		txtCtrl1.focus();	
		return false;
	}
	// Find length
	if(trimAll(txtCtrl2.value).length <5)
	{
		alert("The confirm password should be atleast 5 characters !");
		txtCtrl2.focus();	
		return false;
	}		

	if (trimAll(txtCtrl1.value) != trimAll(txtCtrl2.value) )
	{
		alert("The new password and confirmation password do not match !");
		txtCtrl1.focus();	   	
		return false;
	}
}
