size = 11;
lineh = 17;
sizeh1 = 14;
sizehx = 0;
function zoomMas() {
	if (size < 18){
		size += 2;
		lineh += 2;
		sizeh1 += 2;
		document.body.style.fontSize = size+'px';
		document.body.style.lineHeight = lineh+'px';

		var titulares=document.getElementsByTagName("h1");
		for(i=0; i < titulares.length; i++){
			//alert(titulares[i].style.fontSize);
			if (titulares[i].style.fontSize == ""){
				titulares[i].style.fontSize = sizeh1+'px';
				titulares[i].style.lineHeight = lineh+'px';
			}else{
				a = titulares[i].style.fontSize;
				a=a.substring(0, a.indexOf('p', 0));
				b = parseInt(a)+2;
				titulares[i].style.fontSize= b+'px';
				titulares[i].style.lineHeight = lineh+'px';
			}

		}
	}
}

function zoomMenos() {
	if (size > 11){
		size -= 2;
		lineh -= 2;
		sizeh1 -= 2;
		document.body.style.fontSize = size+'px';
		document.body.style.lineHeight = lineh+'px';

		var titulares=document.getElementsByTagName("h1");
		for(i=0; i < titulares.length; i++){
			if (titulares[i].style.fontSize == ""){
				titulares[i].style.fontSize = sizeh1+'px';
				titulares[i].style.lineHeight = lineh+'px';
			}else{
				a = titulares[i].style.fontSize;
				a=a.substring(0, a.indexOf('p', 0));
				b = parseInt(a)-2;
				titulares[i].style.fontSize= b+'px';
				titulares[i].style.lineHeight = lineh+'px';
			}

		}
	}
}



//capturamos codigo de teclado para permitir borrar o suprimir en las cajas de comentarios
//document.onkeydown = funDown;
var code;
function funDown(e){ 
	if (e.keyCode) 
		code = e.keyCode;
	else 
		if (e.which) 
			code = e.which;
	//var character = String.fromCharCode(code);
	//alert('Character was ' + code);
	return true;
}

function comentar(obj){
	var a= document.getElementById(obj).style.display;
	//alert(a);
	if (a == "none"){
		document.getElementById(obj).style.display="";
	}else{
		document.getElementById(obj).style.display="none";
	}
}
function overMenu(obj,which){

	switch(which){
		case "1":
			obj.src="http://www.infoesports.com/images/menu/subscripcio_on.gif";
			break;
		case "2":
			obj.src="http://www.infoesports.com/images/menu/contactar_on.gif";
			break;
		case "3":
			obj.src="http://www.infoesports.com/images/menu/hemeroteca_on.gif";
			break;
		case "4":
			obj.src="http://www.infoesports.com/images/menu/inici_on.gif";
			break;
		default:
			break;
	}

}
function outMenu(obj,which){

	switch(which){
		case "1":
			obj.src="http://www.infoesports.com/images/menu/subscripcio_off.jpg";
			break;
		case "2":
			obj.src="http://www.infoesports.com/images/menu/contactar_off.jpg";
			break;
		case "3":
			obj.src="http://www.infoesports.com/images/menu/hemeroteca_off.jpg";
			break;
		case "4":
			obj.src="http://www.infoesports.com/images/menu/inici_off.jpg";
			break;
		default:
			break;
	}
}

function overFutbol(){
	var obj=document.getElementById("optfutbol");
	obj.style.display="";

}
function outFutbol(){
	var obj=document.getElementById("optfutbol");
	obj.style.display="none";
}

function caracteresPermitidos(num){
	var obj=document.getElementById("permesos");
	var op=255-num;
	obj.innerHTML=op;

}

function caracteresPermitidosDown(valor){

	if(valor.length >= 255){ 
			alert(valor.length);
		return false;
	}
	//if(valor.length >= 255){ 
		//alert(window.event.wich);return false;
		//if (code == "8" || code == "46"){
		//	return true;
		//}else{
		//	return false;
		//}
	//}
}

function imprimir(iddoc, cat, subcat){
	width = 520; 
	height = 450; 
	leftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	if (screen.height && (screen.height <= 600)) {
		topPosition = 0;
	} else {
		topPosition = (screen.height) ? (screen.height-height)/2 : 0;
	}
	var settings='width='+width+', height='+height+', left='+leftPosition+', top='+topPosition+', toolbar=0, location=0, directories=0, menubar=0, scrollbars=1, resizable=0, status=0';
	var popup=window.open("http://www.infoesports.com/pop/print/?iddoc="+iddoc+"&cat="+cat+"&subcat="+subcat, 'imprimir', settings);
	popup.focus();
}

function cargaAudio(param){
	document.getElementById("capa_audio").style.display="";
//	document.location.href="#mul";
}
function escondeAudio(param){
	document.getElementById("capa_audio").style.display="none";
//	document.location.href="#mul";
}
function cargaVideo(param){
	document.getElementById("capa_video").style.display="";
//	document.location.href="#mul";
}

function escondeVideo(param){
	document.getElementById("capa_video").style.display="none";
//	document.location.href="#mul";
}

function cargaMultimedia(doc, indice){
	width = 780; 
	height = 500; 
	leftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	if (screen.height && (screen.height <= 600)) {
		topPosition = 0;
	} else {
		topPosition = (screen.height) ? (screen.height-height)/2 : 0;
	}
	var settings='width='+width+', height='+height+', left='+leftPosition+', top='+topPosition+', toolbar=0, location=0, directories=0, menubar=0, scrollbars=0, resizable=0, status=0';
	var popup=window.open("http://www.infoesports.com/pop/multimedia/?iddoc="+doc+"&indice="+indice, 'imprimir', settings);
	popup.focus();
}


function comentar(){
	if (document.getElementById("mod_com").style.display == ""){
		document.getElementById("mod_com").style.display="none";
	}else{
		document.getElementById("mod_com").style.display="";
		document.getElementById("mod_tra").style.display="none";
//		document.location.href="#com";
	}
	
}

function trametre(){
	if (document.getElementById("mod_tra").style.display == ""){
		document.getElementById("mod_tra").style.display="none";
	}else{
		document.getElementById("mod_tra").style.display="";
		document.getElementById("mod_com").style.display="none";
//		document.location.href="#tra";
	}
	
}

function valFormTrametre(frm){
	/*if (!validarEmail(frm.tra_origen.value)){
		alert("Informar el mail origen correctament és obligatori.");
		frm.tra_origen.focus();
		return false;
	}*/
	if (!validarEmail(frm.tra_destino.value)){
		alert("Informar l'email de destí correctament és obligatori.");
		frm.tra_destino.focus();
		return false;
	}

	/*if (frm.tra_comentari.value == ""){
		alert("Informar el comentari és obligatori.");
		frm.tra_comentari.focus();
		return false;
	}*/
	var poststr = "iddoc="+frm.iddoc.value+"&orig="+frm.tra_origen.value+"&dest="+frm.tra_destino.value+"&comentari="+frm.tra_comentari.value+"&numedicion_hmrtc="+frm.numedicion_hmrtc.value;
	//alert(poststr);
	makePostRequest("/proc/trametre.php", 'tra_msg', poststr);

}

function valFormComentaris(frm){
	if (frm.com_nom.value == ""){
		alert("Informar el nom és obligatori.");
		frm.com_nom.focus();
		return false;
	}
	if (!validarEmail(frm.com_email.value)){
		alert("Informar l'email correctament és obligatori.");
		frm.com_email.focus();
		return false;
	}
	if (frm.com_ciutat.value == ""){
		alert("Informar la ciutat és obligatori.");
		frm.com_ciutat.focus();
		return false;
	}
	if (frm.com_comentari.value.length > 255){
		alert("No pot excedir els 255 caràcters per poder enviar el comentari.");
		frm.com_comentari.focus();
		return false;
	}
	//if (frm.com_comentari.length()){
	//}
	if (frm.com_comentari.value == ""){
		alert("Informar el comentario es obligatorio.");
		frm.com_comentari.focus();
		return false;
	}
	var poststr = "iddoc="+frm.iddoc.value+"&nom="+frm.com_nom.value+"&email="+frm.com_email.value+"&ciutat="+frm.com_ciutat.value+"&comentari="+frm.com_comentari.value;
	//alert(poststr);
	makePostRequest("/proc/comentarios.php", 'com_msg', poststr);

}

function changeJornada(idcompeticion, jornada, tipocomp){
	var poststr = "idcompeticion="+idcompeticion+"&jornada="+jornada+"&tipocomp="+tipocomp;
	makePostRequest("/proc/changeJornada.php", 'clasifica', poststr);
}