/******************************SOME IMPORTANT COMMON FUNCTIONS INCLUDED BELOW*************************************/
//function replace_space added by Sam S K - For replacing all spaces with %20 before passing as a query string in url via ajax.

function replace_space(string){
	var newString = string.split(" ");
	return newString.join('%20');
}

function replace_ampersand(string){
	var newString = string.split("&");
	return newString.join('%26');
}

function Common_Validations(dom,title){
		if(document.getElementById(dom).value==""){
			return "\n"+title
		}else{
			return "";
		}
}

function NAN_Validation(dom,title){
	if(document.getElementById(dom).value){
		if(isNaN(document.getElementById(dom).value)){
				document.getElementById(dom).value="";
			return "\n"+title
		}else{
			return "";
		}
	}else{
		return "";
	}		
}

function Email_Validation(emailString,title) {
	if(emailString){
		splitVal = emailString.split('@');

		if(splitVal.length <= 1) {
			return "\n"+title
		}
		if(splitVal[0].length <= 0 || splitVal[1].length <= 0) {
			return "\n"+title
		}

		splitDomain = splitVal[1].split('.');
		if(splitDomain.length <= 1) {
			return "\n"+title
		}
		if(splitDomain[0].length <= 0 || splitDomain[1].length <= 1) {
			return "\n"+title
		}
		return "";
	}else{
		return "";
	}
}



