
function numVal (checkVal,divId) {
	
	var validnum = new RegExp();
	validnum.compile("^([0-9]*)$"); 

	if (!validnum.test(checkVal)) {
		document.getElementById(divId).innerHTML = 'Enter Valid number';
		return false;
	}  else {
		return true;
	}

}

function ValidEmail(elementName,divId){

	var eValid = new RegExp();
	eValid.compile("^[A-Za-z0-9-._]+@[A-Za-z0-9-._]+.[A-Za-z.]+.[A-Za-z.]+$"); // email validation Regex
	
	if(!eValid.test(elementName)) {
		document.getElementById(divId).innerHTML = 'Enter Valid email';
		return false;
	}  else {
		return true;
	}

}


function checkUrl (elementName,divId) {
					  
	var urlCheck = new RegExp();
//	urlCheck.compile("^([Ww]{3})+\\.[A-Za-z0-9-_%&\?\/.=]+$"); // checks withput http
	//urlCheck.compile("^[http://]+[A-Za-z0-9-_%&\?\/.=]+\\.+[A-Za-z]$"); // checks withput http
	 urlCheck.compile("^[http https]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); 

	
	if (!urlCheck.test(elementName)) {
		document.getElementById(divId).innerHTML = 'Enter Valid URL';
		return false;
	}  else {
		return true;
	}

}


    function validateBanner(file) {
		//alert(file);
		extArray = new Array(".jpg", ".png", ".bmp", ".gif" , ".jpeg");
				
		allowSubmit = false;
		if (!file) return;
		while (file.indexOf("\\") != -1)
		file = file.slice(file.indexOf("\\") + 1);
		//ext = file.slice(file.indexOf(".")).toLowerCase();
		ext = file.slice(file.lastIndexOf(".")).toLowerCase();
		
		//alert('file EXT : '+ext);
		for (var i = 0; i < extArray.length; i++) {
		if (extArray[i] == ext) { allowSubmit = true; break; }
		}
		if (allowSubmit) return true;
		else
		alert("Please only upload files that end in types:  "
		+ (extArray.join("  ")) + "\nPlease select a new "
		+ "file to upload and submit again.");
		return false;
    }
