// browser detection:
var ua = navigator.userAgent;
var ie = (navigator.appName.toLowerCase().indexOf("internet explorer")!=-1)?1:0;
var ns = (navigator.appName.toLowerCase().indexOf("netscape")!=-1)?1:0;
var ns4 = (document.layers)?1:0;
var ns6 = (document.getElementById && ns)?1:0;
var mac = (ua.toLowerCase().indexOf("mac")!=-1)?1:0;
var macie4 = (mac && !ns && parseInt(ua.substr(ua.indexOf("MSIE")+4,2)) <= 4)?1:0;
var macie = (mac && !ns)?1:0;
var opera = (ua.toLowerCase().indexOf("opera")!=-1)?1:0;

// Trim leading and trailing spaces
function Trim(strToTrim) {
	while(strToTrim.charAt(0)==' '){strToTrim = strToTrim.substring(1,strToTrim.length);}
	while(strToTrim.charAt(strToTrim.length-1)==' '){strToTrim = strToTrim.substring(0,strToTrim.length-1);}
	return strToTrim;
}

// Validate email address
function emailAddressIsValid(str){
	var emailAddressFormat = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,3}$/;
	if (!(emailAddressFormat.test(str))){
		return false;
	}
	return true;
}

function isPositiveInt(myvalue){
	if(myvalue.search(/^[0-9]+$/) != -1){
		return true;
	}else{
		return false;
	}
}