function validar_tipo(contenido){
	var Err_msg = 0;
	var Txt_msg = '';
	
	if (contenido == ''){
		Err_msg++;
		Txt_msg = Txt_msg + "- Ingrese Contenido.\n";
	}
	
	if (Err_msg == 0){
		document.buscar.submit();
	} else {
		alert('Complete:\n' + Txt_msg)
	}
}
	
function Login(){
	var Nerror = 0;
	var Txt_error = '';
	var user = document.login.username.value;
	var passwd = document.login.password.value;
	
	if (user != ''){
		if (user.length < 5){
			Nerror++;
			Txt_error = Txt_error + "- Largo usuario.\n";
		}
	} else {
		Nerror++;
		Txt_error = Txt_error + "- Usuario.\n";
	}
	
	if (passwd != ''){
		if (passwd.length < 5){
			Nerror++;
			Txt_error = Txt_error + "- Largo contraseņa.\n";
		}
	} else {
		Nerror++;
		Txt_error = Txt_error + "- Contraseņa.\n";
	}
	
	if (Nerror == 0){
		document.login.submit();
	} else {
		alert('Complete o corrija:\n' + Txt_error)
	}
}

 function demo(v){
	alert('VERSION DEMO, OPERACION INHABILITADA!!');
}

function dateDiff(p_Interval, p_Date1, p_Date2, p_firstdayofweek, p_firstweekofyear){
	if(!isDate(p_Date1)){return "invalid date: '" + p_Date1 + "'";}
	if(!isDate(p_Date2)){return "invalid date: '" + p_Date2 + "'";}
	var dt1 = new Date(p_Date1);
	var dt2 = new Date(p_Date2);

	// get ms between dates (UTC) and make into "difference" date
	var iDiffMS = dt2.valueOf() - dt1.valueOf();
	var dtDiff = new Date(iDiffMS);

	// calc various diffs
	var nYears  = dt2.getUTCFullYear() - dt1.getUTCFullYear();
	var nMonths = dt2.getUTCMonth() - dt1.getUTCMonth() + (nYears!=0 ? nYears*12 : 0);
	var nQuarters = parseInt(nMonths/3);	//<<-- different than VBScript, which watches rollover not completion
	
	var nMilliseconds = iDiffMS;
	var nSeconds = parseInt(iDiffMS/1000);
	var nMinutes = parseInt(nSeconds/60);
	var nHours = parseInt(nMinutes/60);
	var nDays  = parseInt(nHours/24);
	var nWeeks = parseInt(nDays/7);


	// return requested difference
	var iDiff = 0;		
	switch(p_Interval.toLowerCase()){
		case "yyyy": return nYears;
		case "q": return nQuarters;
		case "m": return nMonths;
		case "y": 		// day of year
		case "d": return nDays;
		case "w": return nDays;
		case "ww":return nWeeks;		// week of year	// <-- inaccurate, WW should count calendar weeks (# of sundays) between
		case "h": return nHours;
		case "n": return nMinutes;
		case "s": return nSeconds;
		case "ms":return nMilliseconds;	// millisecond	// <-- extension for JS, NOT available in VBScript
		default: return "invalid interval: '" + p_Interval + "'";
	}
}

