
// popUp.js

function popUp(url, width, height, namearg) {
	/*var name = 'win';
	if (namearg != '') {
		name = namearg;
	}
	PopWindow = window.open(url, name,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width=' + width + ',innerWidth=' + width + ',height=' + height + ',innerHeight=' + height);
*/
  popup(url,width,height);
}

function popup(u,w,h) {
  window.open(u+'&w='+(w-100)+'&h='+h, '', 'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,width='+w+',height='+h+'');
}

function toggleT(_w,_h) {
	if (_h=='s') {
		document.getElementById(_w).style.visibility='visible';
	}
	if (_h=='h') {
		document.getElementById(_w).style.visibility='hidden';
	}
}

function isANumber(number, message) {
	//example <INPUT TYPE="text" NAME="numberOrdered" VALUE="" SIZE=10 onChange="if(this.value) {if (!(isANumber(this.value, 'number of brains'))) {this.focus();}}">
	answer = 1;
	//First, we check to make sure the entered value starts with a number. If so, we set the answer variable equal to 1 and move on.
	if (!parseFloat(number)) {
		//the first digit wasn't numeric
		answer = 0;
		alert('Please enter a numeric value	for the ' + message + ' field.');
	} 
	//If the JavaScript function parseFloat() does not return true (meaning that the user didn't enter a number), the function displays a warning message to the user. If the first digit is numeric, the function continues.
	else {
		//the first digit was numeric, so check the rest
		for (var i=0; i<number.length; i++) {
			if ((number.charAt(i) != '0')
				&& (!parseFloat(number.charAt(i)))) {
				answer = 0;
				alert('Please enter a numeric value for the ' + message + ' field.');
				break;
			}
		}
	}
	return answer;
} 

function isValidHour(hour) {
	var isValid = true;
	if (parseFloat(hour)) {
		if ((hour < 1) || (hour > 12)) {
			isValid = false;
			alert('Please enter a valid hour between 1 and 12 for the Hour field.');	
		}
	}	
	else {
		isValid = false;
		alert('Please enter a valid hour between 1 and 12 for the Hour field.');	
	}	
	return isValid;
}

function isValidMinute(minute) {
	var isValid = true;
	if (minute != '00') {
		if (parseFloat(minute)) {
			if (minute > 59) {
				isValid = false;
				alert('Please enter a valid minute between 1 and 59 for the Minute field.');	
			}
		}
		else {
			isValid = false;
			alert('Please enter a valid minute between 1 and 59 for the Minute field.');	
		}	
	}
	return isValid;
}

function Property(name, value) {
	this.name = name;
	this.value = value;
}
