// Trim functions

	function Trim(TRIM_VALUE){
		if(TRIM_VALUE.length < 1){
			return"";
		}
		TRIM_VALUE = RTrim(TRIM_VALUE);
		TRIM_VALUE = LTrim(TRIM_VALUE);
		if(TRIM_VALUE==""){
			return "";
		}else{
			return TRIM_VALUE;
		}
	} //End Function

	function RTrim(VALUE){
		var w_space = String.fromCharCode(32);
		var v_length = VALUE.length;
		var strTemp = "";
		if(v_length < 0){
			return"";
		}
		var iTemp = v_length -1;

		while(iTemp > -1){
			if(VALUE.charAt(iTemp) == w_space){
			}else{
				strTemp = VALUE.substring(0,iTemp +1);
				break;
			}
			iTemp = iTemp-1;
		}

		return strTemp;

	}

	function LTrim(VALUE){
		var w_space = String.fromCharCode(32);
		if(v_length < 1){
			return"";
		}
		var v_length = VALUE.length;
		var strTemp = "";
		var iTemp = 0;

		while(iTemp < v_length){
			if(VALUE.charAt(iTemp) == w_space){
			}else{
				strTemp = VALUE.substring(iTemp,v_length);
				break;
			}
			iTemp = iTemp + 1;
		}

		return strTemp;
	}

// End Trim functions

// Start check e-mail function

	function verify_email(em){
		arroba=false;
		punto=false;
		right=false;
		for (var i=1;i<em.length-3;i++){
			if (em.substring(i,i+1)=='@'){
				pos=i
				arroba=true;
				break;
			}
		}
		if (arroba){
			for (var i=arroba;i<em.length-1;i++){
				if (em.substring(i,i+1)=='.'){
					right=true;
					punto=true;
					break;
				}
			}
		}
		return right;
	}

// End check e-mail function

// Start check if a date is valid

function is_valid_date(year,month,day){
	var valid_date=false;
	if (year>0){
		if(month>=1 && month<=12){
			if(day>=1 && day<=cant_days_month(month,year)){
				valid_date=true;
			}
		}
	}
	return valid_date;
}

function cant_days_month(month,year){
	cant_days=31;
	if (month==4 || month==6 || month==9 || month==11){
		cant_days=30;
	}else if(month==2){
		if( (parseInt(year/4)==(year/4) && parseInt(year/100)!=(year/100))  ||  parseInt(year/400)==(year/400)  ){
			cant_days=29;
		}else{
			cant_days=28;
		}
	}
	return cant_days;
}
// End check if a date is valid