<!--

function trim(txt) {
	return txt.replace(/^\s+|\s+$/g,"");
};

function ltrim(txt) {
	return txt.replace(/^\s+/,"");
};

function rtrim(txt) {
	return txt.replace(/\s+$/,"");
};

function checkText(from,to,min,max) {
 from.style.border="1px solid #d4d4d4";
 a=document.getElementById(to);
 txt=from.value;
 
 txt=trim(txt);
 txtLength=txt.length;
 txt=txt.substr(0,max);
 a.innerHTML=txt;
 if (txtLength<min || txtLength>max) {
  from.style.border="1px solid red";
 };
};

function checkEmail(from) {
 from.style.border="1px solid #d4d4d4";
 w = "([a-z0-9]+|[a-z0-9][a-z0-9-]*[a-z0-9])";
 r = '^'+w+'(\\.'+w+')*@'+w+'(\\.'+w+')*\\.[a-z]{2,4}$';
 reg = new RegExp(r);
 if (!from.value.match(reg)) {
  from.style.border="1px solid red";
 }
}

function checkUrl(from) {
 from.style.border="1px solid #d4d4d4";
 w = "([a-z0-9]+|[a-z0-9][a-z0-9-]*[a-z0-9])";
 r = '^https?:\/\/'+w+'(\\.'+w+')*\\.[a-z]{2,4}(.*)$';
 //alert (r);
 reg = new RegExp(r);
 if (!from.value.match(reg)) {
  from.style.border="1px solid red";
 }
}

function checkTags(from,to) {
 
 a=document.getElementById(to);
 from.style.border="1px solid #d4d4d4";
 
 //alert (from.value);
 
 tab=from.value.split(",",10);
 
 
 //alert(tab.length+":"+txt);

 for (i=0; i<=tab.length-1; i++) {
  tab[i]=trim(tab[i]);
 }
 //alert (tab);
 txt=tab.join(",");
 r='^[a-zêó±¶³¿¼æñ]+([a-zêó±¶³¿¼æñ\\s]+){0,3}(,[a-zêó±¶³¿¼æñ]+([a-zêó±¶³¿¼æñ\\s]+){0,3}){1,9}$';

 re = new RegExp(r);
 //aa=from.value.match(re);
 //return 1;
 //if (!txt.match(re)) {
  //from.style.border="2px solid red";
 //};
 a.innerHTML=txt;
};

function size(ob) {
 alert(document.getElementById(ob).value);
};

//-->
