/* cvs $Revision: 333 $ */
/* cvs $Date: 2008-03-28 19:14:51 -0300 (Fri, 28 Mar 2008) $ */
/* cvs $Author: javier $ */

function LoadActualFontSize() {
	tempArray = document.cookie.split(";");

	for (tA = 0; tA < tempArray.length; tA++) {
		if (tempArray[tA].indexOf('Pag12FontSize') > -1) {
			fontSizeValue = tempArray[tA].split("=");
			ACTUAL_FONTSIZE = parseInt(fontSizeValue[1]);
		}
	}
}

function SaveActualFontSize() {
	var expire = new Date();
	expire.setTime (expire.getTime() + (6000 * 24 * 3600000));
	expire = expire.toGMTString();
	document.cookie = "Pag12FontSize=" + ACTUAL_FONTSIZE + "; path=/; expires=" + expire;
}


function txt_more() {
	if (ACTUAL_FONTSIZE < LARGEST_FONTSIZE) {
		ACTUAL_FONTSIZE++;
		var cuerpo = new get_obj('contenidoindex');
		cuerpo.style.fontSize = ACTUAL_FONTSIZE + "px";
		SaveActualFontSize();
	}
}

function txt_less() {
	if (ACTUAL_FONTSIZE > SMALLEST_FONTSIZE) {
		ACTUAL_FONTSIZE--;
		var cuerpo = new get_obj('contenidoindex');
		cuerpo.style.fontSize = ACTUAL_FONTSIZE + "px";
		SaveActualFontSize();
	}
}

function txt_equal() {
	if (ACTUAL_FONTSIZE != 12) {
		ACTUAL_FONTSIZE = 12;
		var cuerpo = new get_obj('contenidoindex');
		cuerpo.style.fontSize = ACTUAL_FONTSIZE + "px";
		SaveActualFontSize();
	}
}

function mail(from) {
	var xmail = new get_obj('xmail');

	if (xmail.style.display != 'none' ) {
		if (from!=0) xmail.style.display = 'none';
	}
	else {
		if (user.get_user()) document.formu.tuemail.value = user.get_user();
		if (user.get_name()) document.formu.nombre.value = user.get_name();
		xmail.style.display = '';
	}
	if (from==0) {
		location.href = '#formu_mail';
	}
}

/* verifica los campos para el envio de notas por email */
function check_enviar_nota() {
	
	with (document.formu) {
		var errores = '';
		var str_reg_exp = "^[A-Za-z0-9][A-Za-z0-9_\.-]*@([A-Za-z0-9][A-Za-z0-9_-]*\.)+[A-Za-z]{2,3}$";
		
		if (!amigoemail.value) errores += 'Falta el E-Mail de su amigo.\n';
		else {
			var reg = new RegExp (str_reg_exp,"g");
			if (!reg.test(amigoemail.value)) errores += '( ' + amigoemail.value + ' )' + ' El E-Mail de su amigo no tiene una sintáxis válida.\n';
		}
		
		if (!nombre.value) errores += 'Falta su nombre.\n';
		if (nombre.value.length > 30) errores += 'El nombre es demasiado largo (Máximo 30 caracteres).\n';
		
		if (!tuemail.value) errores += 'Falta su E-Mail.\n';
		else {
			reg = new RegExp (str_reg_exp,"g");
			if (!reg.test(tuemail.value)) errores += '( ' + tuemail.value + ' )' + ' Su E-Mail no tiene una sintáxis válida.\n';
		}

		if (comentario.value.length > 150) errores += 'El comentario es demasiado largo (Máximo 150 caracteres).\n';
	
	}
	
	if (errores) {
		alert(errores);
		return false;
	} else {
		return true;
	}

}


var ACTUAL_FONTSIZE = 12;
LoadActualFontSize();
var SMALLEST_FONTSIZE = 10;
var LARGEST_FONTSIZE = 18;

