// JavaScript Document
//Funzione per fare il trim di una stringa
function trim(strText) { 
  while (strText.substring(0,1) == ' ') 
    strText = strText.substring(1, strText.length);
  while (strText.substring(strText.length-1,strText.length) == ' ')
    strText = strText.substring(0, strText.length-1);
  return strText;
}

function isEmail(what) {
	return (String(what).match(/(.+)@(.+)\.(.+)/g)==String(what))?true:false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//****** add/remove class value *****//
function hasClass(ele,cls) {
	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
	if (hasClass(ele,cls)) {
		var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
		ele.className=ele.className.replace(reg,' ');
	}
}
//***********************************//