var win = null;
var urlConfidencial = "http://www.noticiascastillayleon.com";
//var urlConfidencial = "http://localhost/noticiasCyL/html";
var uriConfidencial = "";
//var uriConfidencial = "/noticiasCyL/html";

function docId(id) {
	return document.getElementById(id);
}

function escribeCorreo(name, domain, clase, br) {
	var cadena = "<a class=\""+clase+"\" href=\"mailto:" + name + "@" + domain + "\">"+name + "@" + domain + "</a>";
	if (br != '') cadena += "<br />";
	document.write(cadena);
}

function imprimirNoticia(noticia, provincia, seccion){
	var w = 680;
	var h = 500;
	var scroll = "yes";
	var leftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var topPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var page = urlConfidencial+"/web/imprimirNoticia.asp?noticia="+noticia+"&provincia="+provincia+"&seccion"+seccion;
	var settings='height='+h+',width='+w+',top=20,left=380,scrollbars='+scroll+',resize=no'
	win = window.open(page,'',settings)
}

function ampliarFoto(noticia){
	var w = 680;
	var h = 400;
	var scroll = "yes";
	var leftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var topPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var page = urlConfidencial+"/web/ampliarFoto.asp?noticia="+noticia;
	var settings='height='+h+',width='+w+',top=20,left=380,scrollbars='+scroll+',resize=no'
	win = window.open(page,'',settings)
}

function condicionesDeUso(){
	var w = 680;
	var h = 400;
	var scroll = "yes";
	var leftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	var topPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var page = urlConfidencial+"/web/condicionesUso.asp";
	var settings='height='+h+',width='+w+',top=20,left=380,scrollbars='+scroll+',resize=no'
	win = window.open(page,'',settings)
}

function restaurarValoracion() {
	for (var i=1; i<=5; i++) {
		docId("votar"+i).src = urlConfidencial+"/web/img/votar.gif";
	}
}

function valorar(valor) {
	for (var i=1; i<=valor; i++) {
		docId("votar"+i).src = urlConfidencial+"/web/img/votar_a.gif";
	}
}

function iluminaLetra(tamano) {
	docId("imgLetra"+tamano).src = urlConfidencial+"/web/img/letra"+tamano+"_a.png";
}

function restauraLetra(tamano, src) {
	docId("imgLetra"+tamano).src = urlConfidencial+"/web/img/letra"+tamano+src+".png";
}

function restauraLetras() {
	for (var i=1; i<=3; i++) {
		docId("imgLetra"+i).src = urlConfidencial+"/web/img/letra"+i+".png";
	}
}

function cambiarTamano(tamano) {
	var textoNoticia = docId("textoNoticia");
	restauraLetras();
	iluminaLetra(tamano);
	if (tamano == "1") {
		textoNoticia.className = "oscuro fuente11";
	} else if (tamano == "2") {
		textoNoticia.className = "oscuro fuente14";	
	} else if (tamano == "3") {
		textoNoticia.className = "oscuro fuente16";
	}
}

function resetForm(pos) {
	var form = document.forms[pos];
	if (form) {
		var elementos = form.elements;
		for (var i=0; i<elementos.length; i++) {
			if (elementos[i].type=="text" || elementos[i].type=="textarea" 
			|| elementos[i].type=="select-one") elementos[i].value = "";
			else if (elementos[i].type=="checkbox") elementos[i].checked = false;
		}
	}
}

function votarNoticia(valor, noticia) {
	var url = uriConfidencial+"/web/votarNoticia.asp?c_noticia="+noticia+"&i_valoracion="+valor;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseVotar;
		enProceso = true;
		http.send(null);
	} // if	
}

function votarVideo(valor, video) {
	var url = uriConfidencial+"/web/votarVideo.asp?c_video="+video+"&i_valoracion="+valor;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseVotar;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseVotar() {
	var valorado = docId("valorado");
	var valoracion = docId("valoracion");
	var celdaValorada = docId("celdaValorada");
	var celdaValorar = docId("celdaValorar");
	var numVotos = docId("numVotos");
	var celdaVisible = (document.all?'block':'table-cell');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				celdaValorar.style.display = "none";
				celdaValorada.style.display = celdaVisible;
				if (results[0] != "-1") {
					valorado.src = urlConfidencial+"/web/img/valor"+results[1]+".gif";
					numVotos.innerHTML = results[2];
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseVotar

function votarEncuesta(opc, enc, pro) {
	var url = uriConfidencial+"/web/votarEncuesta.asp?opc="+opc+"&enc="+enc+"&pro="+pro;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseVotarEncuesta;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseVotarEncuesta() {
	var frameEncuesta = docId("frameEncuesta");
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				frameEncuesta.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseVotar

function votarComentario(comentario, valor) {
	var url = uriConfidencial+"/web/votarComentario.asp?c_comentario="+comentario;
	if (valor == "1") url += "&i_favor=1";
	else if (valor == "-1") url += "&i_contra=1";
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseValorar;
		enProceso = true;
		http.send(null);
	} // if	
}

function votarComentarioVideo(comentario, valor) {
	var url = uriConfidencial+"/web/votarComentarioVideo.asp?c_comentario="+comentario;
	if (valor == "1") url += "&i_favor=1";
	else if (valor == "-1") url += "&i_contra=1";
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseValorar;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseValorar() {
	var celdaVisible = (document.all?'block':'table-cell');
	var clase = "resultadoVoto ";
	var valor;
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					var graciasComent = docId("graciasComent"+results[1]);
					var coment = docId("coment"+results[1]);
					var comentar = docId("comentar"+results[1]);
					var votos = docId("votos"+results[1]);
					comentar.style.display = "none";
					graciasComent.style.display = celdaVisible;
					coment.innerHTML = results[2];
					valor = parseInt(results[2]);
					if (valor > 0) coment.className=clase + "resultadoVotoMas";
					else if (valor < 0) coment.className=clase + "resultadoVotoMenos";
					else coment.className=clase + "resultadoVotoNor";
					votos.innerHTML = results[3];
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseVotar

function votarForo(comentario, valor) {
	var url = uriConfidencial+"/web/votarForo.asp?c_comentario="+comentario;
	if (valor == "1") url += "&i_favor=1";
	else if (valor == "-1") url += "&i_contra=1";
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseValorar;
		enProceso = true;
		http.send(null);
	} // if	
}

function votarBlog(comentario, valor) {
	var url = uriConfidencial+"/web/votarBlog.asp?c_comentario="+comentario;
	if (valor == "1") url += "&i_favor=1";
	else if (valor == "-1") url += "&i_contra=1";
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseValorar;
		enProceso = true;
		http.send(null);
	} // if	
}

function abusoComentario(tipo, noticia, comentario) {
	var url = uriConfidencial+"/web/abusoComentario.asp?tipo="+tipo+"&c_noticia="+noticia+"&c_comentario="+comentario;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseAbusoComentario;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseAbusoComentario() {
	var celdaVisible = (document.all?'block':'table-cell');
	var clase = "resultadoVoto ";
	var valor;
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					var graciasAbuso = docId("graciasAbuso"+results[1]);
					var abuso = docId("abuso"+results[1]);
					abuso.style.display = "none";
					graciasAbuso.style.display = celdaVisible;
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseAbusoComentario

function votarForo(comentario, valor) {
	var url = uriConfidencial+"/web/votarForo.asp?c_comentario="+comentario;
	if (valor == "1") url += "&i_favor=1";
	else if (valor == "-1") url += "&i_contra=1";
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseValorar;
		enProceso = true;
		http.send(null);
	} // if	
}

function votarBlog(comentario, valor) {
	var url = uriConfidencial+"/web/votarBlog.asp?c_comentario="+comentario;
	if (valor == "1") url += "&i_favor=1";
	else if (valor == "-1") url += "&i_contra=1";
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseValorar;
		enProceso = true;
		http.send(null);
	} // if	
}

function abusoComentario(tipo, noticia, comentario) {
	var url = uriConfidencial+"/web/abusoComentario.asp?tipo="+tipo+"&c_noticia="+noticia+"&c_comentario="+comentario;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseAbusoComentario;
		enProceso = true;
		http.send(null);
	} // if	
}

function validarEnvio() {
	var ok = true;
	var form = document.forms["formEnviarNoticia"];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm("formEnviarNoticia", "textLong");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text") {
			estilo = "textLongError";
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name.indexOf("d_email") != -1 && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var nombreOrigen = form.nombreOrigen.value;
		var d_email_origen = form.d_email_origen.value;
		var nombreDestino = form.nombreDestino.value;
		var d_email_destino = form.d_email_destino.value;	
		var captcha = form.captcha.value;	
		var noticia = form.noticia.value;	
		var seccion = form.seccion.value;	
		enviarNoticia(nombreOrigen, d_email_origen, nombreDestino, d_email_destino, captcha, noticia, seccion);
	}
} // validarEnvio 

function enviarNoticia(nombreOrigen, d_email_origen, nombreDestino, d_email_destino, captcha, noticia, seccion) {	
	var filaComentar9 = docId("filaComentar9");
	var filaComentar10 = docId("filaComentar10");
	var filaComentar11 = docId("filaComentar11");
	var filaComentar12 = docId("filaComentar12");
	var filaComentar13 = docId("filaComentar13");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var	url = uriConfidencial+"/web/enviaNoticia.asp?noticia="+noticia+"&seccion="+seccion+
						"&nombreOrigen="+nombreOrigen+"&d_email_origen="+d_email_origen+
						"&nombreDestino="+nombreDestino+"&d_email_destino="+d_email_destino+
						"&captcha="+captcha;
	var visible = (document.all?'block':'table-row');
	filaComentar9.style.display = "none";
	filaComentar10.style.display = "none";
	filaComentar11.style.display = "none";
	filaComentar12.style.display = "none";
	filaComentar13.style.display = visible;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseEnviarNoticia;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseEnviarNoticia() {
	var filaComentar4 = docId("filaComentar4");
	var filaComentar6 = docId("filaComentar6");
	var filaComentar13 = docId("filaComentar13");
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {				
				results = http.responseText.split(",");
				filaComentar13.style.display = "none";
				if (results[0] == "0") {
					filaComentar4.style.display = visible;
				} else {
					filaComentar6.style.display = visible;
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseEnviarNoticia


function validarComentarioNoticia() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea" 
		|| elementos[i].type=="select-one" || elementos[i].type=="checkbox") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].type!="textarea" &&!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "c_aceptar" && elementos[i].checked == false) {
				campoError("Debe aceptar las condiciones de uso para poder mandar su comentario", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_comentario = form.d_comentario.value;
		var d_captcha = form.d_captcha.value;
		var c_noticia = form.c_noticia.value;
		enviarComentarioNoticia(c_noticia, d_email, d_comentario, d_captcha, d_nombre); 
	} // if
} // validarComentario

function enviarComentarioNoticia(c_noticia, d_email, d_comentario, d_captcha, d_nombre) {
	var filaComentar  = docId("filaComentar");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var filaComentar13 = docId("filaComentar13");
	var visible = (document.all?'block':'table-row');
	var	url = uriConfidencial+"/web/comentarNoticia.asp?c_noticia="+c_noticia+
						"&d_email="+d_email+"&d_comentario="+d_comentario+
						"&d_captcha="+d_captcha+"&d_nombre="+d_nombre;
	filaComentar.style.display = "none";
	filaRotuloComentar.style.display = "none";
	filaComentar13.style.display = visible;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseEnviarComentario;
		enProceso = true;
		http.send(null);
	} // if	
}

function validarComentarioVideo() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea" 
		|| elementos[i].type=="select-one" || elementos[i].type=="checkbox") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].type!="textarea" &&!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "c_aceptar" && elementos[i].checked == false) {
				campoError("Debe aceptar las condiciones de uso para poder mandar su comentario", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_comentario = form.d_comentario.value;
		var d_captcha = form.d_captcha.value;
		var c_video = form.c_video.value;
		enviarComentarioVideo(c_video, d_email, d_comentario, d_captcha, d_nombre); 
	} // if
} // validarComentario

function enviarComentarioVideo(c_video, d_email, d_comentario, d_captcha, d_nombre) {
	var filaComentar  = docId("filaComentar");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var filaComentar13 = docId("filaComentar13");
	var visible = (document.all?'block':'table-row');
	var	url = uriConfidencial+"/web/comentarVideo.asp?c_video="+c_video+
						"&d_email="+d_email+"&d_comentario="+d_comentario+
						"&d_captcha="+d_captcha+"&d_nombre="+d_nombre;	

	filaComentar.style.display = "none";
	filaRotuloComentar.style.display = "none";
	filaComentar13.style.display = visible;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseEnviarComentario;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseEnviarComentario() {
	var celdaComentarios = docId('celdaComentarios');
	var filaComentar13 = docId("filaComentar13");
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				filaComentar13.style.display = "none";
				celdaComentarios.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseEnviarComentario

function validarComentarioForo() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea" 
		|| elementos[i].type=="select-one" || elementos[i].type=="checkbox") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].type!="textarea" &&!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			}
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_comentario = form.d_comentario.value;
		var d_captcha = form.d_captcha.value;
		var c_tema = form.c_tema.value;
		enviarComentarioForo(c_tema, d_email, d_comentario, d_captcha, d_nombre); 
	} // if
} // validarComentarioForo

function enviarComentarioForo(c_tema, d_email, d_comentario, d_captcha, d_nombre) {
	var filaComentar  = docId("filaComentar");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var filaComentar13 = docId("filaComentar13");
	var visible = (document.all?'block':'table-row');
	var	url = uriConfidencial+"/web/comentarForo.asp?c_tema="+c_tema+
						"&d_email="+d_email+"&d_comentario="+d_comentario+
						"&d_captcha="+d_captcha+"&d_nombre="+d_nombre;	

	filaComentar.style.display = "none";
	filaRotuloComentar.style.display = "none";
	filaComentar13.style.display = visible;
	if (!enProceso && http) {
		//alert(url);
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseEnviarComentario;
		enProceso = true;
		http.send(null);
	} // if	
}

function validarComentarioPost() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea" 
		|| elementos[i].type=="select-one" || elementos[i].type=="checkbox") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].type!="textarea" &&!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			}
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_comentario = form.d_comentario.value;
		var d_captcha = form.d_captcha.value;
		var c_post = form.c_post.value;
		enviarComentarioPost(c_post, d_email, d_comentario, d_captcha, d_nombre); 
	} // if
} // validarComentarioPost

function enviarComentarioPost(c_post, d_email, d_comentario, d_captcha, d_nombre) {
	var filaComentar  = docId("filaComentar");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var filaComentar13 = docId("filaComentar13");
	var visible = (document.all?'block':'table-row');
	var	url = uriConfidencial+"/web/comentarPost.asp?c_post="+c_post+
						"&d_email="+d_email+"&d_comentario="+d_comentario+
						"&d_captcha="+d_captcha+"&d_nombre="+d_nombre;
	filaComentar.style.display = "none";
	filaRotuloComentar.style.display = "none";
	filaComentar13.style.display = visible;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseEnviarComentario;
		enProceso = true;
		http.send(null);
	} // if	
}

function nuevoTema() {
	var filaNuevoTema  = docId("filaNuevoTema");
	var filaComentar = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaComentar4 = docId("filaComentar4");
	var filaBuscar  = docId("filaBuscar");
	var form = document.forms[2];
	var visible = (document.all?'block':'table-row');
	filaBuscar.style.display = "none";
	filaNuevoTema.style.display  = visible;
	filaComentar.style.display = visible;
	filaComentar2.style.display = visible;
	filaComentar3.style.display = "none";
	filaComentar4.style.display = "none";
	form.d_tema.value = "";
	form.d_texto.value = "";
	form.d_tema.focus();
}

function nuevaCategoria() {
	var filaNuevoTema  = docId("filaNuevoTema");
	var filaComentar = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaComentar4 = docId("filaComentar4");
	var filaBuscar  = docId("filaBuscar");
	var form = document.forms[2];
	var visible = (document.all?'block':'table-row');
	filaBuscar.style.display = "none";
	filaNuevoTema.style.display  = visible;
	filaComentar.style.display = visible;
	filaComentar2.style.display = visible;
	filaComentar3.style.display = "none";
	filaComentar4.style.display = "none";
	form.d_categoria.value = "";
	form.d_texto.value = "";
	form.d_categoria.focus();
}

function cerrarNuevo() {
	var filaNuevoTema  = docId("filaNuevoTema");
	var filaComentar = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaComentar4 = docId("filaComentar4");
	var filaBuscar  = docId("filaBuscar");
	var visible = (document.all?'block':'table-row');
	filaBuscar.style.display = visible;
	filaNuevoTema.style.display  = "none";
	filaComentar.style.display = "none";
	filaComentar2.style.display = "none";
	filaComentar3.style.display = visible;
	filaComentar4.style.display = visible;
}

function altaTema() {
	var form = document.forms[2];
	var ok = true;
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(2, "textBusquedaLong");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textBusquedaLongError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} // if 
		} // if 
	} // for
	if (ok) {
		var d_tema = form.d_tema.value;
		var d_texto = form.d_texto.value;
		var c_categoria = form.c_categoria.value;
		enviarAltaTema(c_categoria, d_tema, d_texto);
	}
}

function enviarAltaTema(c_categoria, d_tema, d_texto) {
	var	url = uriConfidencial+"/web/altaTema.asp?c_categoria="+c_categoria+"&d_tema="+d_tema+"&d_texto="+d_texto;						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseAltaTema;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseAltaTema() {
	var filaComentar  = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaComentar4 = docId("filaComentar4");
	var filaNuevoTema = docId("filaNuevoTema");
	var filaBuscar 		= docId("filaBuscar");
	var temasForo = docId("temasForo");
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				filaNuevoTema.style.display  = "none";
				filaComentar.style.display = "none";
				filaComentar2.style.display = "none";
				filaComentar3.style.display = visible;
				filaComentar4.style.display = visible;
				filaBuscar.style.display = visible;
				temasForo.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseAltaUsuario 

function altaCategoria() {
	var form = document.forms[2];
	var ok = true;
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(2, "textBusquedaLong");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textBusquedaLongError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} // if 
		} // if 
	} // for
	if (ok) {
		var d_categoria = form.d_categoria.value;
		var d_texto = form.d_texto.value;
		enviarAltaCategoria(d_categoria, d_texto);
	}
}

function enviarAltaCategoria(d_categoria, d_texto) {
	var	url = uriConfidencial+"/web/altaCategoria.asp?d_categoria="+d_categoria+"&d_texto="+d_texto;						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseAltaTema;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarTemas(categoria, tema, pag) {
	var	url = uriConfidencial+"/web/mostrarTemas.asp?c_categoria="+categoria+"&d_tema="+tema+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarTemas;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseMostrarTemas() {
	var temasForo = docId("temasForo");
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				temasForo.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseMostrarTemas

function mostrarCategorias(categoria, pag) {
	var	url = uriConfidencial+"/web/mostrarCategorias.asp?d_categoria="+categoria+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarTemas;
		enProceso = true;
		http.send(null);
	} // if	
}

function buscarForo() {
	var form = document.forms[1];
	var d_busqueda = form.d_busqueda.value;
	var c_categoria = form.c_categoria.value;
	var	url = uriConfidencial+"/web/mostrarTemas.asp?pag=1&c_categoria="+c_categoria+"&d_tema="+d_busqueda;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseBuscarForo;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseBuscarForo() {
	var temasForo = docId("temasForo");
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				temasForo.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseBuscarForo

function buscarCategoriasForo() {
	var form = document.forms[1];
	var d_busqueda = form.d_busqueda.value;
	var	url = uriConfidencial+"/web/mostrarCategorias.asp?pag=1&d_categoria="+d_busqueda;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseBuscarForo;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarBlogs(pag, prov) {
	var	url = uriConfidencial+"/web/mostrarBlogs.asp?pag="+pag+"&prov="+prov;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarTemas;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseMostrarTemas() {
	var temasForo = docId("temasForo");
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				temasForo.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseMostrarTemas

function abrirRecordar() {
	var filaRecordar  = docId("filaRecordar");
	var filaRecordar2  = docId("filaRecordar2");
	var filaRecordar3  = docId("filaRecordar3");
	var filaComentar2  = docId("filaComentar2");
	var form = document.forms[2];
	var visible = (document.all?'block':'table-row');
	filaRecordar.style.display = visible;
	filaRecordar2.style.display = visible;
	filaRecordar3.style.display = "none";
	filaComentar2.style.display = "none";
	form.d_email_rec.value = "";
	form.d_email_rec.focus();
}

function recordarPass() {
	var form = document.forms[2];
	var d_email_rec = form.d_email_rec.value;
	var	url = uriConfidencial+"/web/recordarPass.asp?d_email="+d_email_rec;						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseRecordarPass;
		enProceso = true;
		http.send(null);
	} // if	
} 

function handleHttpResponseRecordarPass() {
	var filaRecordar  = docId("filaRecordar");
	var filaRecordar3 = docId("filaRecordar3");
	var form = document.forms[2];
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					filaRecordar.style.display  = "none";
					filaRecordar3.style.display = visible;
				} else if (results[1] == "-1") {
					campoError("El correo electrónico es incorrecto", form.d_email_rec, "textError");
				} else if (results[1] == "1") {
					campoError("No existe ningún usuario dado de alta con los datos facilitados", form.d_email_rec, "textError");
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseRecordarPass 

function iniciarSesion() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="password") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var d_email = form.d_email.value;
		var d_password = form.d_password.value;
		var d_captcha = form.d_captcha.value;
		var c_recordar = (form.c_recordar.checked==true?"S":"N");
		enviarInicioSesion(d_email, d_password, d_captcha, c_recordar); 
	} // if
} // iniciarSesion

function enviarInicioSesion(d_email, d_password, d_captcha, c_recordar) {
	var	url = uriConfidencial+"/web/iniciarSesion.asp?d_email="+d_email+"&d_password="+d_password+"&c_recordar="+c_recordar+"&d_captcha="+d_captcha;
						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseIniciarSesion;
		enProceso = true;
		http.send(null);
	} // if	
} 

function handleHttpResponseIniciarSesion() {
	var filaComentar  = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaRecordar  = docId("filaRecordar");
	var filaRecordar2  = docId("filaRecordar2");
	var filaRecordar3 = docId("filaRecordar3");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var formSalida = docId('formSalida');
	var nombreUsuario = docId('nombreUsuario');
	var user = docId('user');
	var visible = (document.all?'block':'table-row');
	var form = document.forms[1];
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					filaComentar.style.display  = "none";
					filaComentar2.style.display = "none";
					filaComentar3.style.display = "none";
					filaRecordar.style.display  = "none";
					filaRecordar2.style.display = "none";
					filaRecordar3.style.display = "none";
					filaRotuloComentar.style.display = "none";
					formSalida.style.display = visible;
					nombreUsuario.innerHTML = results[1];
					user.innerHTML = results[2];
				} else if (results[1] == "-1") {
					campoError("Todos los datos son obligatorios", form.d_email, "textError");
				} else if (results[1] == "-2") {
					campoError("La secuencia de caracteres introducida es incorrecta", form.d_captcha, "textError");
				} else if (results[1] == "0") {
					campoError("El correo electrónico es incorrecto", form.d_email, "textError");
				} else if (results[1] == "1") {
					campoError("No existe ningún usuario dado de alta con los datos facilitados", form.d_email, "textError");
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseIniciarSesion 

function cerrarSesion() {
	var	url = uriConfidencial+"/web/logout.asp";
	resetForm(1)
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseCerrarSesion;
		enProceso = true;
		http.send(null);
	} // if	
} 

function handleHttpResponseCerrarSesion() {
	var filaComentar  = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var formSalida = docId('formSalida');
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				filaComentar.style.display  = visible;
				filaComentar2.style.display = visible;
				filaComentar3.style.display = visible;
				filaRotuloComentar.style.display = visible;
				formSalida.style.display = "none";
				enProceso = false;
			}
		}
	}
} // handleHttpResponseCerrarSesion 

function altaUsuario() {
	var ok = true;
	var form = document.forms["formAltaUsuario"];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm("formAltaUsuario", "textS");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="password" || elementos[i].type=="checkbox") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textSError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "c_aceptar" && elementos[i].checked == false) {
				campoError("Debe aceptar las condiciones de uso para poder darse de alta", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_captcha = form.d_captcha.value;
		var c_provincia = form.c_provincia.value;
		var c_aceptar = (form.c_aceptar.checked==true?"S":"N");
		enviarAltaUsuario(d_nombre, d_email, d_captcha, c_provincia, c_aceptar); 
	} // if
} // altaUsuario

function completarAltaUsuario() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="password" || elementos[i].type=="checkbox") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textCortoError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (!isAlphaNumeric(elementos[i].value)) {
				campoError("Solo se permiten letras y dígitos en este campo", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			}  
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_captcha = form.d_captcha.value;
		var d_password = form.d_password.value;
		enviarCompletarAltaUsuario(d_nombre, d_password, d_captcha); 
	} // if
} // completarAltaUsuario

function enviarAltaUsuario(d_nombre, d_email, d_captcha, c_provincia, c_aceptar) {
	var	url = uriConfidencial+"/web/altaUsuario.asp?d_nombre="+d_nombre+"&d_email="+d_email+"&d_captcha="+d_captcha+"&c_provincia="+c_provincia+"&c_aceptar="+c_aceptar;	
						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseAltaUsuario;
		enProceso = true;
		http.send(null);
	} // if	
} 

function enviarCompletarAltaUsuario(d_nombre, d_password, d_captcha) {
	var	url = uriConfidencial+"/web/completarAltaUsuario.asp?d_nombre="+d_nombre+"&d_captcha="+d_captcha+"&d_password="+d_password;	
						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseCompletarAltaUsuario;
		enProceso = true;
		http.send(null);
	} // if	
} 

function handleHttpResponseAltaUsuario() {
	var filaComentar  = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var formPdte = docId('formPdte');
	var nombreUsuario = docId('nombreUsuario');
	var form = document.forms[1];
	var nombreUsuario = docId('nombreUsuario');
	var user = docId('user');
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					filaComentar.style.display  = "none";
					filaComentar2.style.display = "none";
					filaComentar3.style.display = "none";
					filaRotuloComentar.style.display = "none";
					formPdte.style.display = visible;
					nombreUsuario.innerHTML = "<strong>"+results[1]+"</strong>";
					user.innerHTML = results[2];
				} else if (results[1] == "-1") {
					campoError("Todos los datos son obligatorios", form.d_email, "textError");
				} else if (results[1] == "0") {
					campoError("El correo electrónico es incorrecto", form.d_email, "textError");
				} else if (results[1] == "1") {
					campoError("Ya existe un usuario pendiente de alta con este nombre o correo electrónico", form.d_email, "textError");
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseAltaUsuario 

function handleHttpResponseCompletarAltaUsuario() {
	var filaComentar  = docId("filaComentar");
	var filaComentar2 = docId("filaComentar2");
	var filaComentar3 = docId("filaComentar3");
	var filaRotuloComentar = docId("filaRotuloComentar");
	var formSalida = docId('formSalida');
	var nombreUsuario = docId('nombreUsuario');
	var form = document.forms[1];
	var nombreUsuario = docId('nombreUsuario');
	var user = docId('user');
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					filaComentar.style.display  = "none";
					filaComentar2.style.display = "none";
					filaComentar3.style.display = "none";
					filaRotuloComentar.style.display = "none";
					formSalida.style.display = visible;
					nombreUsuario.innerHTML = "<strong>"+results[1]+"</strong>";
					user.innerHTML = results[2];
				} else if (results[1] == "-1") {
					campoError("Todos los datos son obligatorios", form.d_nombre, "textError");
				} else if (results[1] == "0") {
					campoError("El correo electrónico es incorrecto", form.d_nombre, "textError");
				} else if (results[1] == "1") {
					campoError("No existe ningún usuario pendiente de alta con ese nombre", form.d_nombre, "textError");
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseCompletarAltaUsuario 

function consultarTarifas() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="password") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_captcha = form.d_captcha.value;
		enviarConsultaTarifas(d_nombre, d_email, d_captcha); 
	} // if
} //consultarTarifas

function enviarConsultaTarifas(d_nombre, d_email, d_captcha) {
	var	url = uriConfidencial+"/web/consultaTarifas.asp?d_nombre="+d_nombre+"&d_email="+d_email+"&d_captcha="+d_captcha;
	var filaRotuloComentar  = docId("filaRotuloComentar");
	var filaComentar = docId("filaComentar");
	var filaComentar13 = docId("filaComentar13");
	var visible = (document.all?'block':'table-row');
	if (!enProceso && http) {
		filaRotuloComentar.style.display  = "none";
		filaComentar.style.display = "none";
		filaComentar13.style.display = visible;
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseConsultaTarifas;
		enProceso = true;
		http.send(null);
	} // if	
} 

function handleHttpResponseConsultaTarifas() {
	var filaRecordar3 = docId("filaRecordar3");
	var filaComentar13 = docId("filaComentar13");
	var form = document.forms[1];
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				filaComentar13.style.display = "none";
				if (results[0] != "-1") {
					filaRecordar3.style.display = visible;
				} else if (results[1] == "-1") {
					campoError("El correo electrónico es incorrecto", form.d_email, "textError");
				} else if (results[1] == "1") {
					campoError("Todos los datos son obligatorios", form.d_email, "textError");
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseConsultaTarifas

function enviarConsulta() {
	var ok = true;
	var form = document.forms[1];
	var elementos = form.elements;
	var estilo = "";
	inicializaForm(1, "text");
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea") {
			estilo = (elementos[i].type=="checkbox"?"checkError":"textError");
			if (elementos[i].value == "")  {
				campoError("Todos los campos son obligatorios", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_email" && !isEmail(elementos[i].value)) {
				campoError("La dirección de correo electrónico introducida es incorrecta", elementos[i], estilo);
				ok = false;
				break;
			} else if (elementos[i].name == "d_captcha" && elementos[i].value != captcha) {
				campoError("La secuencia de caracteres introducida no coincide con la mostrada", elementos[i], estilo);
				ok = false;
				break;
			} 
		} // if 
	} // for 
	if(ok) {
		var d_nombre = form.d_nombre.value;
		var d_email = form.d_email.value;
		var d_captcha = form.d_captcha.value;
		var d_comentario = form.d_comentario.value;
		enviarConsultaContacto(d_nombre, d_email, d_comentario, d_captcha); 
	} // if
} //consultarTarifas

function enviarConsultaContacto(d_nombre, d_email, d_comentario, d_captcha) {
	var	url = uriConfidencial+"/web/consultaContacto.asp?d_nombre="+d_nombre+"&d_email="+d_email+"&d_captcha="+d_captcha+"&d_comentario="+d_comentario+"&c_provincia="+emailde;						
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseConsultaContacto;
		enProceso = true;
		http.send(null);
	} // if	
} 

function handleHttpResponseConsultaContacto() {
	var filaRotuloComentar  = docId("filaRotuloComentar");
	var filaComentar = docId("filaComentar");
	var filaRecordar3 = docId("filaRecordar3");
	var form = document.forms[1];
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				results = http.responseText.split(",");
				if (results[0] != "-1") {
					filaRotuloComentar.style.display  = "none";
					filaComentar.style.display = "none";
					filaRecordar3.style.display = visible;
				} else if (results[1] == "-1") {
					campoError("El correo electrónico es incorrecto", form.d_email, "textError");
				} else if (results[1] == "1") {
					campoError("Todos los datos son obligatorios", form.d_email, "textError");
				}
				enProceso = false;
			}
		}
	}
} // handleHttpResponseConsultaContacto 

function mostrarComentariosNoticia(c_noticia, pag) {
	var	url = uriConfidencial+"/web/mostrarComentarios.asp?c_noticia="+c_noticia+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarComentarios;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarComentariosVideos(c_video, pag) {
	var	url = uriConfidencial+"/web/mostrarComentariosVideos.asp?c_video="+c_video+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarComentarios;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarClasificados(pro, fam, sec, tip, ord, pag) {
	var	url = uriConfidencial+"/web/mostrarClasificados.asp?provincia="+pro+"&familia="+fam+"&seccion="+sec+"&categoria="+tip+"&orden="+ord+"&pag="+pag;
	$("#famClas"+fam).slideDown("slow");
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarComentarios;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseMostrarComentarios() {
	var celdaComentarios = docId('celdaComentarios');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				celdaComentarios.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseMostrarComentarios

function mostrarComentariosForo(c_tema, pag) {
	var	url = uriConfidencial+"/web/mostrarComentariosForo.asp?c_tema="+c_tema+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarComentarios;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarComentariosPost(c_post, pag) {
	var	url = uriConfidencial+"/web/mostrarComentariosBlog.asp?c_post="+c_post+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarComentarios;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarResultados(cadena, f_inicio, f_fin, pag) {
	var	url = uriConfidencial+"/web/mostrarResultados.asp?d_busqueda="+cadena+"&pag="+pag+"&f_inicio="+f_inicio+"&f_fin="+f_fin;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarResultados;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseMostrarResultados() {
	var tablaResultados = docId('tablaResultados');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				tablaResultados.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseMostrarResultados

function mostrarVentana(cat, saltar, pag) {
	var	url = uriConfidencial+"/web/mostrarVentana.asp?c_tipo_ventana="+cat+"&b_saltar="+saltar+"&pag="+pag;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarResultados;
		enProceso = true;
		http.send(null);
	} // if	
}

function inicializaForm(form, clase) {
	var elementos = document.forms[form].elements;
	for (var i=0; i<elementos.length; i++) {
		if (elementos[i].type=="text" || elementos[i].type=="textarea" || 
				elementos[i].type=="select-one") {
			elementos[i].className=clase;
		} else if (elementos[i].type=="checkbox") {
			elementos[i].className="check";
		}// if
	} // for
} // inicializaForm

function campoError(error, campo, estilo) {
	alert(error);
	campo.focus();
	campo.className = estilo;
} // campoError

function buscar() {
	var form = document.forms[0];
	if (form.d_busqueda.value == "") {
		campoError("Por favor, introduzca un texto para buscar", form.d_busqueda, "buscadorError");
	} else if (form.d_busqueda.value.indexOf(" ") < 0) {
		campoError("Por favor, escriba varias palabras como texto de búsqueda", form.d_busqueda, "buscadorError");		
	} else if (form.d_busqueda.value.length < 12) {
		campoError("Por favor, escriba varias palabras como texto de búsqueda", form.d_busqueda, "buscadorError");		
	} else {
		form.action = urlConfidencial+"/web/parametroBusqueda.asp";
		form.method = "POST";
		form.submit();
	}
}

function isAlphaNumeric(val) {
	var correcto = true;
	if (!val.match(/^[a-zA-Z0-9.-_áéíóúüÁÉÍÓÚÜçÇ ]+$/)) correcto = false;
	return correcto;
} // isAlphaNumeric

function buscarAvanzado() {
	var form = document.forms[1];
	var cadena = form.d_busqueda;
	var f_inicio = form.f_inicio;
	var f_fin = form.f_fin;
	cadena.className = "textBusqueda";
	f_inicio.className = "textCalendario";
	f_fin.className = "textCalendario";	
	
	if (form.f_inicio.value != "" && !isFecha(form.f_inicio.value)) {
		campoError("La fecha desde es incorrecta", form.f_inicio, "textCalendarioError");
	} else if (form.f_fin.value != "" && !isFecha(form.f_fin.value)) {
		campoError("La fecha hasta es incorrecta", form.f_inicio, "textCalendarioError");
	} else if (form.f_fin.value != "" && !isFecha(form.f_fin.value)) {
		campoError("La fecha hasta es incorrecta", form.f_inicio, "textCalendarioError");
	} else if (form.f_fin.value != "" && form.f_inicio.value != "" && form.f_inicio.value > form.f_fin.value) {
		campoError("La fecha desde no puede ser postarior a la fecha hasta", form.f_inicio, "textCalendarioError");
	} else if (form.d_busqueda.value == "") {
		campoError("Debe escribir una cadena de búsqueda", form.d_busqueda, "textBusquedaError");
	} else {
		var txtBuscar = cadena.value.replace("&", "-amp-");
		mostrarResultados(txtBuscar, f_inicio.value, f_fin.value, 1);
	}
}

function filtrarVideos() {
	var form = document.forms[1];
	var d_titular = form.d_titular.value;
	var c_seccion_id = form.c_seccion_id.value;
	var c_provincia = form.c_provincia.value;
	mostrarVideos(d_titular, c_seccion_id, c_provincia, 1);
}

function mostrarVideos(d_titular, c_seccion_id, c_provincia, pag) {
	var	url = uriConfidencial+"/web/mostrarVideos.asp?d_titular="+d_titular+"&pag="+pag+"&c_seccion_id="+c_seccion_id+"&c_provincia="+c_provincia;
	if (!enProceso && http) {
		//alert(url);
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarVideos;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseMostrarVideos() {
	var tablaResultados = docId('tablaResultados');
	if (http.readyState == 4) {
		//alert(http.status);
		//alert(http.responseText);
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				tablaResultados.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseMostrarVideos

function mostrarNoticiasProv(c_provincia, c_seccion_id, pag) {
	var local = docId("d_localidad") ? docId("d_localidad").options[docId("d_localidad").selectedIndex].value : "";
	var	url = uriConfidencial+"/web/mostrarNoticiasProv.asp?c_seccion_id="+c_seccion_id+"&pag="+pag+"&c_provincia="+c_provincia+"&localidad="+local;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarNoticiasProv;
		enProceso = true;
		http.send(null);
	} // if	
}

function mostrarPostsProv(c_provincia, c_blog, pag) {
	var	url = uriConfidencial+"/web/mostrarPostsProv.asp?c_blog="+c_blog+"&pag="+pag+"&c_provincia="+c_provincia;
	if (!enProceso && http) {
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseMostrarNoticiasProv;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseMostrarNoticiasProv() {
	var tablaResultados = docId('tablaResultados');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				tablaResultados.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseMostrarVideos

function verMasVotadas(ini, fin) {
	var notMasLeidas = docId("notMasLeidas");
	var notMasVotadas = docId("notMasVotadas");
	var notMasComentadas = docId("notMasComentadas");
	var visible = (document.all?'block':'table-row');

	for (var i=ini;i<=fin;i++) {
		if (docId("filaMasVotadaA"+i)) docId("filaMasVotadaA"+i).style.display = visible;
		if (docId("filaMasVotadaB"+i)) docId("filaMasVotadaB"+i).style.display = visible;
		if (docId("filaMasLeidaA"+i)) docId("filaMasLeidaA"+i).style.display = "none";
		if (docId("filaMasLeidaB"+i)) docId("filaMasLeidaB"+i).style.display = "none";
		if (docId("filaMasComentadaA"+i)) docId("filaMasComentadaA"+i).style.display = "none";
		if (docId("filaMasComentadaB"+i)) docId("filaMasComentadaB"+i).style.display = "none";
	}
	notMasVotadas.style.display = visible;
	notMasLeidas.style.display = "none";
	notMasComentadas.style.display = "none";
}

function verMasLeidas(ini, fin) {
	var notMasLeidas = docId("notMasLeidas");
	var notMasVotadas = docId("notMasVotadas");
	var notMasComentadas = docId("notMasComentadas");
	var visible = (document.all?'block':'table-row');

	for (var i=ini;i<=fin;i++) {
		if (docId("filaMasVotadaA"+i)) docId("filaMasVotadaA"+i).style.display = "none";
		if (docId("filaMasVotadaB"+i)) docId("filaMasVotadaB"+i).style.display = "none";
		if (docId("filaMasLeidaA"+i)) docId("filaMasLeidaA"+i).style.display = visible;
		if (docId("filaMasLeidaB"+i)) docId("filaMasLeidaB"+i).style.display = visible;
		if (docId("filaMasComentadaA"+i)) docId("filaMasComentadaA"+i).style.display = "none";
		if (docId("filaMasComentadaB"+i)) docId("filaMasComentadaB"+i).style.display = "none";
	}

	notMasVotadas.style.display = "none";
	notMasLeidas.style.display = visible;
	notMasComentadas.style.display = "none";
}

function verMasComentadas(ini, fin) {
	var notMasLeidas = docId("notMasLeidas");
	var notMasVotadas = docId("notMasVotadas");
	var notMasComentadas = docId("notMasComentadas");
	var visible = (document.all?'block':'table-row');

	for (var i=ini;i<=fin;i++) {
		if (docId("filaMasVotadaA"+i)) docId("filaMasVotadaA"+i).style.display = "none";
		if (docId("filaMasVotadaB"+i)) docId("filaMasVotadaB"+i).style.display = "none";
		if (docId("filaMasLeidaA"+i)) docId("filaMasLeidaA"+i).style.display = "none";
		if (docId("filaMasLeidaB"+i)) docId("filaMasLeidaB"+i).style.display = "none";
		if (docId("filaMasComentadaA"+i)) docId("filaMasComentadaA"+i).style.display = visible;
		if (docId("filaMasComentadaB"+i)) docId("filaMasComentadaB"+i).style.display = visible;
	}

	notMasVotadas.style.display = "none";
	notMasLeidas.style.display = "none";
	notMasComentadas.style.display = visible;
}

function cargaCalendario(url) {
	var cargaCalen = docId("cargaCalendario");
	var filaCalendario = docId("filaCalendario");
	var visible = (document.all?'block':'table-row');
	if (!enProceso && http) {
		filaCalendario.style.display = "none";
		cargaCalen.style.display = visible;
		http.open("GET", url, true);
		http.onreadystatechange = handleHttpResponseCalendario;
		enProceso = true;
		http.send(null);
	}
}

function handleHttpResponseCalendario() {
	var cargaCalen = docId("cargaCalendario");
	var filaCalendario = docId("filaCalendario");
	var calendario = document.getElementById("calendario");
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				cargaCalen.style.display = "none";
				filaCalendario.style.display = visible;
				calendario.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
}

function cargaAgenda(dia, mes, ano, prov) {
	var url = uriConfidencial+"/web/mostrarAgenda.asp?dia="+dia+"&mes="+mes+"&ano="+ano+"&prov="+prov;
	var filaNoticias = docId("filaCalendario");
	var cargaNotis = docId("cargaCalendario");
	var visible = (document.all?'block':'table-row');
	if (!enProceso && http) {
		//filaNoticias.style.display = "none";
		//cargaNotis.style.display = visible;
		http.open('GET', url, true);
		http.onreadystatechange = handleHttpResponseCargaAgenda;
		enProceso = true;
		http.send(null);
	} // if	
}

function handleHttpResponseCargaAgenda() {
	var cargaNotis = docId("cargaCalendario");
	var filaNoticias = docId("filaCalendario");
	var textoSusc = docId("celdaCalendario");
	var visible = (document.all?'block':'table-row');
	if (http.readyState == 4) {
		if (http.status == 200) {
			if (http.responseText.indexOf('invalid') == -1) {
				//cargaNotis.style.display = "none";
				//filaNoticias.style.display = visible;
				textoSusc.innerHTML = http.responseText;
				enProceso = false;
			}
		}
	}
} // handleHttpResponseCargaAgenda

function volver() {
	history.back();
}

function isEmail(mail) {
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$/;
	return emailPattern.test(mail);
} // isEmail

function esDigito(sChr){
	var sCod = sChr.charCodeAt(0);
	return ((sCod > 47) && (sCod < 58));
}

function valSep(oTxt){
	var bOk = false;
	bOk = bOk || ((oTxt.charAt(2) == "-") && (oTxt.charAt(5) == "-"));
	bOk = bOk || ((oTxt.charAt(2) == "/") && (oTxt.charAt(5) == "/"));
	return bOk;
}

function finMes(oTxt){
	var nMes = parseInt(oTxt.substr(3, 2), 10);
	var nRes = 0;
	switch (nMes){
		case 1: nRes = 31; break;
		case 2: nRes = 29; break;
		case 3: nRes = 31; break;
		case 4: nRes = 30; break;
		case 5: nRes = 31; break;
		case 6: nRes = 30; break;
		case 7: nRes = 31; break;
		case 8: nRes = 31; break;
		case 9: nRes = 30; break;
		case 10: nRes = 31; break;
		case 11: nRes = 30; break;
		case 12: nRes = 31; break;
	}
	return nRes;
}

function valDia(oTxt){
	var bOk = false;
	var nDia = parseInt(oTxt.substr(0, 2), 10);
	bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt)));
	return bOk;
}

function valMes(oTxt){
	var bOk = false;
	var nMes = parseInt(oTxt.substr(3, 2), 10);
	bOk = bOk || ((nMes >= 1) && (nMes <= 12));
	return bOk;
}

function valAno(oTxt){
	var bOk = true;
	var nAno = oTxt.substr(6);
	bOk = bOk && ((nAno.length == 2) || (nAno.length == 4));
	if (bOk){
		for (var i = 0; i < nAno.length; i++) {
			bOk = bOk && esDigito(nAno.charAt(i));
		}
	}
	return bOk;
}

function isFecha(oTxt) { 
	var bOk = true;
	if (oTxt != "") {
		bOk = bOk && (valAno(oTxt));
		bOk = bOk && (valMes(oTxt));
		bOk = bOk && (valDia(oTxt));
		bOk = bOk && (valSep(oTxt));
		return bOk;
	}
}

function isInteger (s) {
	var i;

	if (isEmpty(s))
	if (isInteger.arguments.length == 1) return 0;
	else return (isInteger.arguments[1] == true);

	for (i = 0; i < s.length; i++) 	{
		 var c = s.charAt(i);
		 if (!isDigit(c)) return false;
	}
	return true;
}

function isEmpty(s) {
	return ((s == null) || (s.length == 0))
}

function isDigit (c) {
	return ((c >= "0") && (c <= "9"))
}

function irNoticias(provincia, seccion, dseccion) {
	window.location = urlConfidencial+"/secciones/?d="+dseccion+"&seccion="+seccion+"&provincia="+provincia+"&localidad="+docId("d_localidad").options[docId("d_localidad").selectedIndex].value;
}

function openCareta() {
	$("#careta").css("display", "inline");
}

function closeCareta() {
	$("#careta").css("display", "none");
}

function getHTTPObject() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) { xmlhttp = false; }
	}
	@else
	xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) { 
			xmlhttp = false; 
		}
	}
	return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest

function LoadVideoBar() {
	var videoBar;
	var barContainer = document.getElementById("videoBar");
	var options = {
		largeResultSet : false,
		horizontal: true,
		autoExecuteList : {
			cycleTime : GSvideoBar.CYCLE_TIME_MEDIUM,
			cycleMode : GSvideoBar.CYCLE_MODE_LINEAR,
			executeList : [ "ytfeed:most_viewed.today", "ytfeed:top_rated.today" ]
		}
	}
	if (barContainer) videoBar = new GSvideoBar(barContainer, GSvideoBar.PLAYER_ROOT_FLOATING, options);
}
GSearch.setOnLoadCallback(LoadVideoBar);

function GAD_doit(firstTime){
	getScripts(firstTime); 
	setTimeout('GAD_doit(false)', 3600000); 
}

function GAD_callback_html(GAD_html){ con2 = document.getElementById('GADcontent'); 
	domOmni = window.location.href; 
	try {
		domOmni = window.parent.location.href;
	} catch(e) {  
	}
	try {
		GAD_html=GAD_html.replace(/&r=/i,'&r='+escape(domOmni));
	} catch(e){
	} 
	con2.innerHTML = GAD_html; 
} 

function getIFrame() {
	var divFB = document.getElementById('facebookPlugin');
	var sc = document.createElement('iframe');
	sc.src = "http://www.facebook.com/plugins/activity.php?site=noticiascastillayleon.com&width=300&height=270&header=false&colorscheme=light&font=georgia&border_color=white&recommendations=false";
	sc.id = "frameFB";
	sc.scrolling = "no";
	sc.frameBorder = "0";
	sc.allowTransparency = true;
	if (divFB) divFB.parentNode.replaceChild(sc, divFB); 
}

function getScripts(firstTime) { 
	getHTML(); 
	if(false || firstTime) { 
		getJavascript();
	} 
	if(false || firstTime) {
		getStyle();
	}
}

function getHTML() { 
	var sc = document.getElementById('GAD_getHtml'); 
	var con = document.getElementById('GADcontentScript'); 
	if(sc && con) {
		con.removeChild(sc); 
	}
	sc = document.createElement('script'); 
	sc.id = 'GAD_getHtml'; 
	con = document.getElementById('GADcontentScript'); 
	if (con) con.appendChild(sc);
	sc.src = 'http://www.loteriasyapuestas.es/index.php/mod.widgets/mem.widgets/LAPR.LAPR/EMIL.EMIL/BONO.BONO/ELGR.ELGR/LAQU.LAQU/QGOL.QGOL/LOTU.LOTU/QUPL.QUPL/LONA.LONA/idioma.idioma//langWidget.es';
}

function getJavascript() {
	var con = document.getElementsByTagName('head')[0];
	var sc = document.getElementById('GAD_getScript');
	if(sc && con){ 
		con.removeChild(sc);
	} 
	sc = document.createElement('script');
	sc.id = 'GAD_getScript'; 
	if (con) con.appendChild(sc); 
	sc.src = 'http://www.loteriasyapuestas.es/MODULOS/widgets/publico/interfaces/web/default/js/js.js';
}
	
function getStyle() { 
	var sc;
	if(document.createStyleSheet) { 
		if(!document.styleSheets.length > 0 || document.styleSheets(0).href.indexOf('http://www.loteriasyapuestas.es/MODULOS/widgets/publico/interfaces/web/default/css/widgets.css') < 0){
			sc = document.createStyleSheet('http://www.loteriasyapuestas.es/MODULOS/widgets/publico/interfaces/web/default/css/widgets.css', 0);
		} else {
			document.styleSheets(0).href = 'http://www.loteriasyapuestas.es/MODULOS/widgets/publico/interfaces/web/default/css/widgets.css'; 
		}
	} else { 
		sc = document.getElementById('GAD_getStyle'); 
		if(sc) {
			sc.parentNode.removeChild(sc);
		} 
		sc = document.createElement('link'); 
		sc.id = 'GAD_getStyle'; 
		sc.rel='stylesheet'; 
		sc.type='text/css'; 
		document.getElementsByTagName('head')[0].appendChild(sc); 
		sc.href='http://www.loteriasyapuestas.es/MODULOS/widgets/publico/interfaces/web/default/css/widgets.css';
	}
}

function GAD_callback_resize(){ }

function imgBack(obj, img) {
	$(obj).css({background: "url("+img+")"});
}

jQuery(document).ready(function($) {
	/*if ($("#facebox").length <= 0) {
		$('a[rel*=facebox]').facebox({
			loadingImage : urlConfidencial+'/web/img/loadingFb.gif',
			closeImage   : urlConfidencial+'/web/img/closelabelFb.png'
		});
	}*/
	
	$("a.fancy, a[rel*=facebox]").fancybox({
		'transitionIn': 'elastic',
		'transitionOut': 'elastic',
		'speedIn': 600, 
		'speedOut': 200, 
		'overlayShow': true,
		'hideOnContentClick': false,
		'titlePosition': 'over'
	});
	
	//getIFrame();
	GAD_doit(true);
	openCareta();
	$("#closeSplash").bind("click", closeCareta)
});
