function isNumberKey(evt,type) {
	//Check for a decimal or integer
	if(!type) type = 'decimal';
	var typeResult = 1;
	var charCode = (evt.which) ? evt.which : event.keyCode;
	if(type == 'decimal' && charCode == 46) return true;
	if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
	return true;
}

function isValidInt(s) {
	//Check for a valid integer
	var valid = false;
	if (s != null && s != "" && !isNaN(s)) valid = parseInt(s, 10) == s;
	return valid;
}

function roundNumber(number,decimals) {
	//if(!decimals) decimals = 2;
	if(typeof decimals == "undefined") decimals = 2;
	var newString;// The new rounded number
	decimals = Number(decimals);
	if (decimals < 1) {
		newString = (Math.round(number)).toString();
	} else {
		var numString = number.toString();
		if (numString.lastIndexOf(".") == -1) {// If there is no decimal point
			numString += ".";// give it one at the end
		}
		var cutoff = numString.lastIndexOf(".") + decimals;// The point at which to truncate the number
		var d1 = Number(numString.substring(cutoff,cutoff+1));// The value of the last decimal place that we'll end up with
		var d2 = Number(numString.substring(cutoff+1,cutoff+2));// The next decimal, after the last one we want
		if (d2 >= 5) {// Do we need to round up at all? If not, the string will just be truncated
			if (d1 == 9 && cutoff > 0) {// If the last digit is 9, find a new cutoff point
				while (cutoff > 0 && (d1 == 9 || isNaN(d1))) {
					if (d1 != ".") {
						cutoff -= 1;
						d1 = Number(numString.substring(cutoff,cutoff+1));
					} else {
						cutoff -= 1;
					}
				}
			}
			d1 += 1;
		} 
		newString = numString.substring(0,cutoff) + d1.toString();
	}
	if (newString.lastIndexOf(".") == -1) {// Do this again, to the new string
		newString += ".";
	}
	var decs = (newString.substring(newString.lastIndexOf(".")+1)).length;
	for(var i=0;i<decimals-decs;i++) newString += "0";
	var newNumber = Number(newString);// make it a number
	//document.roundform.roundedfield.value = newString; // Output the result to the form field (change for your purposes)

	return newNumber;
}

/* Overlay */

function showOverlay (itemID,i) {
	if (1 == 2){
		var objectName = 'ol' + itemID + '_' + i;
		var thisID = document.getElementById(objectName);	
		thisID.style.display = 'block';
		
	} else {
	var objectName = 'ol' + itemID + '_' + i;
	new Effect.Opacity(objectName, { from: 0, to: 1, duration:0.3, queue: { position: 'end', scope: objectName } });}
}

function hideOverlay (itemID,i) {
	if (1 == 2){
		var objectName = 'ol' + itemID + '_' + i;
		var thisID = document.getElementById(objectName);	
		thisID.style.display = 'none';
		
	} else {
	var objectName = 'ol' + itemID + '_' + i;
	new Effect.Opacity(objectName, { from: 1, to: 0, duration:0.3, queue: { position: 'end', scope: objectName } });}
}

function showHideContent(thisID,show_hide){
	var thisID = document.getElementById( thisID );		
	thisID.style.display = show_hide;

}