function get_obj(name) {

	if (document.getElementById) {
      		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	}
	else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	}
	else if (document.layers) {
		this.obj = getObjNN4(document,name);
		this.style = this.obj;
	}
}


function getObjNN4(obj,name) {
	var x = obj.layers;
	var foundLayer;
	for (var i = 0; i < x.length; i++) {
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

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

	for (tA = 0; tA < tempArray.length; tA++) {
		if (tempArray[tA].indexOf('SiteFontSize') > -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 = "SiteFontSize=" + ACTUAL_FONTSIZE + "; path=/; expires=" + expire;
}

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

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

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

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

	if (email.style.display == '') {
		var sepa = new get_obj('sepa');
		sepa.style.height = '';
		email.style.display = 'none';
	} else {
		var sepa = new get_obj('sepa');
		sepa.style.height = '10px';
		email.style.display = '';
		if (from) location.href('#inicio');
	}

}

function comment(from) {
	var comment = new get_obj('comment');

	if (comment.style.display == '') {
		var csepa = new get_obj('csepa');
		csepa.style.height = '';
		comment.style.display = 'none';
	} else {
		var csepa = new get_obj('csepa');
		csepa.style.height = '10px';
		comment.style.display = '';
	}

}

function textinfo(from) {
	var textinfo = new get_obj('textinfo');

	if (textinfo.style.display == '') {
		var isepa = new get_obj('isepa');
		isepa.style.height = '';
		textinfo.style.display = 'none';
	} else {
		var isepa = new get_obj('isepa');
		isepa.style.height = '10px';
		textinfo.style.display = '';
	}

}

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