//// Combo Validation Start
function isZero(elem, helperMsg){

	if(parseFloat(elem.value) == 0){
		alert(helperMsg);

		elem.focus(); // set the focus to this input
		return false;
	}

	return true;
}

function isCombo(combo, helperMsg){
	if(combo.selectedIndex == 0){
		alert(helperMsg);
		combo.focus(); // set the focus to this input
		return false;
	}

	return true;
}
/// Combo Validation end
//***********************************************************//

// is numeric function 

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}
	else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function validatePassword (password1, password2) {
	
	if (password1.value == password2.value)
	{
	alert('true');
		return true
	}else
	{	
		alert();
		password1.focus()
		alert("Your password does not match. Please enter same password twice")
		return false
	}
}



function isDecimal(elem, helperMsg) {
var value = elem.value;
var reg = /^\d+(\.\d+)?$/;
	if(value.indexOf('.')==0) {
		value = '0'+value;
		elem.value = value;
	}
	if (!reg.test(value)) {
		alert(helperMsg);
		elem.focus();
		elem.select();
		return false;
	} else {
		return true;
	}
}

//isEmpty function

//***********************************************************//

function isEmpty(elem, helperMsg){

	if(elem.value.length == '0'){
		alert(helperMsg);

		elem.focus(); // set the focus to this input
		return false;
	}

	return true;
}

//***********************************************************//

//email function

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function RadioValidator(obj, msg) {
	alert(obj.length);
	var RadioValidator_length = obj.length;
	for(i=0; i<RadioValidator_length; i++) {
		if(obj[i].checked)
			return true;
	}
	alert("Please select " + msg);
	obj[0].focus();
	return false;
}

function getSelectedRadio(obj) {
	var RadioValidator_length = obj.length;
	for(i=0; i<RadioValidator_length; i++) {
		if(obj[i].checked)
			return obj[i].value;
	}
}

function windowOpenTime(time_id)
	{
	window.open('../includes/time.php?time_id='+time_id,'remote','scrollbars=no,width=215,height=100,top=100,left=50');
	}