<!--
function TextValidate(txtCtrl,val) {
	var ctrName = val;
	if (txtCtrl.value == "") {
		alert("Please enter the " + ctrName + ".");
		txtCtrl.focus();	
		return false;		
	}
	if(txtCtrl.value.indexOf("'") > -1)
	{
		alert("Please Don't enter ' in " + ctrName + ".");		
		txtCtrl.focus();   	
		return false;		
	}			
}



// To validate the text area
function TextAreaValidate(txtCtrl,val) {
	var ctrName = val;
	
	if (txtCtrl.value == "") {
		alert("Please enter the " + ctrName + ".");
		txtCtrl.focus();	
		return false;		
	}
	//if(txtCtrl.value.indexOf("'") > -1)
//	{
//		alert("Please Don't enter ' in " + ctrName + ".");		
//		txtCtrl.focus();   	
//		return false;		
//	}			
}

function redirect_me(url) {
	if(url != "") {
		window.location.href = url;
	} else {
		alert("Wrong redirection function calling");
	}
}

// Not req, but check format - use onblur
function NumberValidateCheck(txtCtrl) {
	
	Remove_Spaces(txtCtrl);
	var fLength = txtCtrl.value.length;	
	if (fLength == 0) {		
 		return true;
	}	
	// Required but check Empty
	if (txtCtrl.value == "" || isNaN(txtCtrl.value)){ 	
			alert("Please enter numeric values!");		
			txtCtrl.value="";
			txtCtrl.focus();			
			txtCtrl.select();
			return false;	
	}		
}

// Req field
function EmailValidate(txtCtrl, val) {
	var ctrName = val;

	if (txtCtrl.value == "") {
		alert("Please enter the " + ctrName + ".");
		txtCtrl.focus();
		txtCtrl.select();
		return false;
	}
	if (txtCtrl.value.indexOf("@") < 1 ||txtCtrl.value.indexOf(".") < 0) {
		alert("Please enter the valid Email" );
		txtCtrl.focus();
		txtCtrl.select();
		return false;
	}
	if(txtCtrl.value.indexOf("'") > -1) {
		//alert("To check");
		alert("Please Don't enter ' in " + ctrName + ".");		
		txtCtrl.focus();   	
		return false;		
	}			

}

function Remove_Spaces(txtCtrl){
  txtCtrl.value = txtCtrl.value.replace(/\r/g, " ");

  txtCtrl.value = txtCtrl.value.replace(/[^ A-Za-z0-9`~!@#\$%\^&\*\(\)-_=\+\\\|\]\[\}\{'";:\?\/\.>,<]/g, "");

  txtCtrl.value = txtCtrl.value.replace(/'/g, "");

  txtCtrl.value = txtCtrl.value.replace(/ +/g, " ");

  txtCtrl.value = txtCtrl.value.replace(/^\s/g, "");

  txtCtrl.value = txtCtrl.value.replace(/\s$/g, "");
  
  if (txtCtrl.value == ' '){	
	 txtCtrl.value = '';
   }
 
 }
