if ((screen.width > 800)){
	tama = "big";
} else {
	tama = "small";
}

//function capas(img_tapa,img_ciencia,img_tecno,img_esp,img_encuesta){
function capas(){
	if (tama == "small"){
		document.write ("<tr><td  colspan='2'>")
		document.write ("<div id='miscelan'>")
		document.write ("<table width='100%' border='0' cellspacing='2' cellpadding='2'>")
		
		document.write ("<tr><td width='50%' valign='top'>")
		document.write ("<table width='100%' border='0' cellspacing='3' cellpadding='0'>")
		//if (img_ciencia == "si"){
			document.write ("<tr><td bgcolor='#E2E2E2'>")
			document.write ("<div align='center'><a href=\"ciencia.php\"><img src='img_web/banner_ciencia.jpg' alt='NOTAS DE CIENCIA' border='0' onmouseover=\"window.status='VER NOTAS DE CIENCIA';return true\" onMouseOut=\"window.status='';return true\"></a></div>")
			document.write ("</td></tr>")
		//}
		//if (img_tecno == "si"){
			document.write ("<tr><td bgcolor='#E2E2E2'>")
			document.write ("<div align='center'><a href=\"tecno.php\"><img src='img_web/banner_tecno.jpg' alt='NOTAS DE TECNOLOGIA' border='0' onmouseover=\"window.status='VER NOTAS DE TECNOLOGIA';return true\" onMouseOut=\"window.status='';return true\"></a></div>")
			document.write ("</td></tr>")
		//}
		if (img_esp == "si"){
			document.write ("<tr><td bgcolor='#E2E2E2'>")
			document.write ("<div align='center'><a href=\"esp.php\"><img src='img_web/banner_esp.jpg' alt='NOTAS DE ESPECTACULOS' border='0' onmouseover=\"window.status='VER NOTAS DE ESPECTACULOS';return true\" onMouseOut=\"window.status='';return true\"></a></div>")
			document.write ("</td></tr>")
		}
		
		document.write ("</table>")
		//document.write ("<div align='center'><a href=\"ciencia.php\"><img src='img_web/banner_ciencia.jpg' alt='NOTAS DE CIENCIA' border='0' onmouseover=\"window.status='VER NOTAS DE CIENCIA';return true\" onMouseOut=\"window.status='';return true\"></a></div>")
		document.write ("</td><td width='50%' valign='top'>")
		if (img_encuesta == "si"){
			document.write ("<div align='center'>")
			document.write ("<script language='JavaScript' type='text/javascript' >")
			document.write ("AC_RunFlContent ('allowScriptAccess', 'sameDomain', 'movie', 'encuesta', 'quality', 'high', 'menu', 'false', 'src', 'encuesta', 'width', '216', 'height', '300', 'name', 'foo', 'align', 'middle', 'id', 'encuesta' );")
			document.write ("</script>")
			document.write ("</div>")
		}
		document.write ("</td></tr>")
		//---
		document.write ("<tr><td bgcolor='#666666' width='50%'>")
		document.write ("<div align='center'><span class='txt_publicidad'>USUARIOS REGISTRADOS</span></div>")
		document.write ("</td><td bgcolor='#666666' width='50%'>")
		document.write ("<div align='center'><span class='txt_publicidad'>IMAGEN DE LA EDICIÓN IMPRESA</span></div>")
		document.write ("</td></tr>")
		document.write ("<tr><td width='50%' valign='top'>")
		document.write ("<form id='f_usuarios' name='f_usuarios' method='post' action='perfil_usuarios.php'>")
		document.write ("<table width='100%' border='0' cellspacing='0' cellpadding='2'>")
		document.write ("<tr><td width='50%'>")
		document.write ("<div align='right'>Usuario:</div>")
		document.write ("</td><td width='50%'>")
		document.write ("<div align='left'><input name='f_user' type='text' id='f_user' class='cajaUser'/></div>")
		document.write ("</td></tr>")
		document.write ("<tr><td width='50%'>")
		document.write ("<div align='right'>Contraseña:</div>")
		document.write ("</td><td width='50%'>")
		document.write ("<div align='left'><input name='f_pass' type='password' id='f_pass' class='cajaUser' maxlength='20'/></div>")
		document.write ("</td></tr>")
		document.write ("<tr><td width='50%' valign='center' bgcolor='#E2E2E2'>")
		document.write ("<div align='right'><span class='txt_form'><a href='recup_pass.php'>Olvidó su contraseña?</a></span></div>")
		document.write ("</td><td width='50%' valign='top' bgcolor='#E2E2E2'>")
		document.write ("<div align='left'><input type='submit' name='Submit' value='Ingresar' class='bott'/></div>")
		document.write ("</td></tr>")
		document.write ("<tr><td bgcolor='#E2E2E2' colspan='2'>")
		document.write ("<div align='center'><span class='txt_form'><a href='registro.php'>Registrarse como USUARIO NUEVO</a></span></div>")
		document.write ("</td></tr>")
		document.write ("<tr><td colspan='2'>")
		document.write ("<hr size='1' noshade='noshade'>")
		document.write ("</td></tr>")
		document.write ("<tr><td colspan='2'>")
		document.write ("<div align='center'><a href=\"javascript:void(window.open('radio.htm','radio','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,rezisable=no,width=282,height=270,left=10,top=10'))\"><img src='img_web/banner_radio.jpg' alt='ESCUCHAR LA RADIO EN VIVO !!!' border='0' onmouseover=\"window.status='ESCUCHAR LA RADIO EN VIVO !!!';return true\" onMouseOut=\"window.status='';return true\"></a></div>")
		document.write ("</td></tr>")
		document.write ("</table>")
		document.write ("</form>")
		document.write ("</td><td>")
		if (img_tapa != "no"){
			document.write ("<div align='center'><a href=\"javascript:void(window.open('img_portada.php?img="+img_tapa+"','nombre','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,rezisable=no,width=400,height=530,left=5,top=5'))\"><img src='img_portadas/"+img_tapa.substring(0,6)+"/thumb_"+img_tapa+"' alt='Abrir imagen de Tapa' border='0' onmouseover=\"window.status='IMAGEN DE LA EDICIÓN IMPRESA';return true\" onMouseOut=\"window.status='';return true\"></a></div>")
		}
		document.write ("</td></tr>")
		document.write ("</table>")
		document.write ("</div>")
		document.write ("</td></tr>")
	} else {
		document.write ("<div id='miscelaneas'>")
		llamarasincrono("auxiliar.php", "miscelaneas");
		document.write ("</div>")
	}	
}
var factual = 12;
var fsmallest = 12;
var flargest = 20;
function aumentarFontSize(l){
	factual = (factual >= flargest) ? flargest : factual + 1;
	var lay = document.getElementById(l);
	lay.style.fontSize = factual;
	lay.style.lineHeight = (factual + 3) + "px";
}

function reducirFontSize(l){
	factual = (factual <= fsmallest) ? fsmallest : factual - 1;
	var lay = document.getElementById(l);
	lay.style.fontSize = factual;
	lay.style.lineHeight = (factual + 3) + "px";
}
// ajax
// Documento JavaScript
// Esta función cargará las paginas
function check_form_cont(){
	if(document.getElementById('nombre').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su NOMBRE !!!</span>";
	} else if(document.getElementById('apellido').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su APELLIDO !!!</span>";
	} else if(document.getElementById('localidad').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su LOCALIDAD !!!</span>";
	} else if(document.getElementById('provincia').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su PROVINCIA !!!</span>";
	} else if(document.getElementById('pais').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su PAIS !!!</span>";
	} else if(document.getElementById('email').value.length < 8 || document.getElementById('email').value.indexOf('@')< 2 || document.getElementById('email').value.indexOf('.')< 1){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su E-MAIL !!!</span>";
	} else if(document.getElementById('asunto').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba el ASUNTO de su mensaje !!!</span>";
	} else if(document.getElementById('comentarios').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">No olvide redactar su MENSAJE !!!</span>";
	} else {
		llamarasincrono('envia_datos.php', 'formulario');
	}
}
function check_form_aviso(){
	if(document.getElementById('nombre').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su NOMBRE !!!</span>";
	} else if(document.getElementById('apellido').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su APELLIDO !!!</span>";
	} else if(document.getElementById('localidad').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su LOCALIDAD !!!</span>";
	} else if(document.getElementById('provincia').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su PROVINCIA !!!</span>";
	} else if(document.getElementById('pais').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su PAIS !!!</span>";
	} else if(document.getElementById('email').value.length < 8 || document.getElementById('email').value.indexOf('@')< 2 || document.getElementById('email').value.indexOf('.')< 1){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su E-MAIL !!!</span>";
	} else if(document.getElementById('asunto').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba el ASUNTO de su mensaje !!!</span>";
	} else if(document.getElementById('comentarios').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">No olvide redactar su MENSAJE !!!</span>";
	} else if(document.getElementById('hacer').value == "" || document.getElementById('hacer').value == undefined || document.getElementById('hacer').value == "Seleccionar"){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">SELECCIONE que hacer con su aviso !!!</span>";
	} else if(document.getElementById('categoria').value == "" || document.getElementById('categoria').value == undefined || document.getElementById('categoria').value == "Seleccionar"){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">SELECCIONE la Categoría de su aviso !!!</span>";
	} else {
		llamarasincrono('envia_aviso.php', 'form_clas');
	}
}
function check_form_resp(){
	if(document.getElementById('nombre').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su NOMBRE !!!</span>";
	} else if(document.getElementById('apellido').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su APELLIDO !!!</span>";
	} else if(document.getElementById('localidad').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su LOCALIDAD !!!</span>";
	} else if(document.getElementById('provincia').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su PROVINCIA !!!</span>";
	} else if(document.getElementById('pais').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su PAIS !!!</span>";
	} else if(document.getElementById('email').value.length < 8 || document.getElementById('email').value.indexOf('@')< 2 || document.getElementById('email').value.indexOf('.')< 1){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba correctamente su E-MAIL !!!</span>";
	} else if(document.getElementById('asunto').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">Escriba el ASUNTO de su mensaje !!!</span>";
	} else if(document.getElementById('comentarios').value == ""){
		document.getElementById("resultados").innerHTML="<span class=\"BlancoTH_msg\">No olvide redactar su MENSAJE !!!</span>";
	} else {
		llamarasincrono('envia_resp.php', 'form_resp');
	}
}
function llamarasincrono(url, id_contenedor){
	var pagina_requerida = false
	if (window.XMLHttpRequest) {// Si es Mozilla, Safari etc
		pagina_requerida = new XMLHttpRequest()
	} else if (window.ActiveXObject){ // pero si es IE
		try {
			pagina_requerida = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){ // en caso que sea una versión antigua
			try{
				pagina_requerida = new ActiveXObject("Microsoft.XMLHTTP")
			}
		catch (e){}
		}
	}
	else
	return false
	pagina_requerida.onreadystatechange=function(){ // función de respuesta
		cargarpagina(pagina_requerida, id_contenedor);
	}
	pagina_requerida.open('POST', url, true) // asignamos los métodos open y send
	if (id_contenedor == "miscelaneas"){
		pagina_requerida.send(null);
	} else if (id_contenedor == "formulario"){
		pagina_requerida.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		pagina_requerida.send(retornarRes());
	} else if (id_contenedor == "form_clas"){
		pagina_requerida.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		pagina_requerida.send(retornarAvi());
	} else if (id_contenedor == "form_resp"){
		pagina_requerida.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		pagina_requerida.send(retornarResp());
	} else if (id_contenedor == "clima"){
		var codigo=document.getElementById('clim').value;
		if(codigo != 0){
			cad='codigo='+encodeURIComponent(codigo);
			pagina_requerida.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			pagina_requerida.send(cad);
		}
	} else {
		pagina_requerida.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		pagina_requerida.send(retornarDatos());
	}
}
function retornarDatos(){
  var cad='';
  var dia=document.getElementById('select').value;
  var mes=document.getElementById('select2').value;
  var anio=document.getElementById('select3').value;
  cad='select='+encodeURIComponent(dia)+'&select2='+encodeURIComponent(mes)+'&select3='+encodeURIComponent(anio);
  return cad;
}
function retornarRes(){
  var cad='';
  var nombre=document.getElementById('nombre').value;
  var apellido=document.getElementById('apellido').value;
  var telefono=document.getElementById('telefono').value;
  var localidad=document.getElementById('localidad').value;
  var provincia=document.getElementById('provincia').value;
  var pais=document.getElementById('pais').value;
  var email=document.getElementById('email').value;
  var asunto=document.getElementById('asunto').value;
  var comentarios=document.getElementById('comentarios').value;
  var publicar=document.getElementById('publicar').checked;
  var susc=document.getElementById('news').checked;
  var acttion="save";
  cad='nombre='+encodeURIComponent(nombre)+'&apellido='+encodeURIComponent(apellido)+'&telefono='+encodeURIComponent(telefono)+'&localidad='+encodeURIComponent(localidad)+'&provincia='+encodeURIComponent(provincia)+'&pais='+encodeURIComponent(pais)+'&email='+encodeURIComponent(email)+'&asunto='+encodeURIComponent(asunto)+'&comentarios='+encodeURIComponent(comentarios)+'&publicar='+encodeURIComponent(publicar)+'&susc='+encodeURIComponent(susc)+'&acttion='+encodeURIComponent(acttion);
  //alert(cad);
  return cad;
}
function retornarAvi(){
  var cad='';
  var nombre=document.getElementById('nombre').value;
  var apellido=document.getElementById('apellido').value;
  var telefono=document.getElementById('telefono').value;
  var localidad=document.getElementById('localidad').value;
  var provincia=document.getElementById('provincia').value;
  var pais=document.getElementById('pais').value;
  var email=document.getElementById('email').value;
  var asunto=document.getElementById('asunto').value;
  var comentarios=document.getElementById('comentarios').value;
  var hacer=document.getElementById('hacer').value;
  var categoria=document.getElementById('categoria').value;
  var acttion="save";
  cad='nombre='+encodeURIComponent(nombre)+'&apellido='+encodeURIComponent(apellido)+'&telefono='+encodeURIComponent(telefono)+'&localidad='+encodeURIComponent(localidad)+'&provincia='+encodeURIComponent(provincia)+'&pais='+encodeURIComponent(pais)+'&email='+encodeURIComponent(email)+'&asunto='+encodeURIComponent(asunto)+'&comentarios='+encodeURIComponent(comentarios)+'&hacer='+encodeURIComponent(hacer)+'&categoria='+encodeURIComponent(categoria)+'&acttion='+encodeURIComponent(acttion);
  //alert(cad);
  return cad;
}
function retornarResp(){
  var cad='';
  var nombre=document.getElementById('nombre').value;
  var apellido=document.getElementById('apellido').value;
  var telefono=document.getElementById('telefono').value;
  var localidad=document.getElementById('localidad').value;
  var provincia=document.getElementById('provincia').value;
  var pais=document.getElementById('pais').value;
  var email=document.getElementById('email').value;
  var asunto=document.getElementById('asunto').value;
  var comentarios=document.getElementById('comentarios').value;
  var ema_dest=document.getElementById('ema_dest').value;
  var acttion="save";
  cad='nombre='+encodeURIComponent(nombre)+'&apellido='+encodeURIComponent(apellido)+'&telefono='+encodeURIComponent(telefono)+'&localidad='+encodeURIComponent(localidad)+'&provincia='+encodeURIComponent(provincia)+'&pais='+encodeURIComponent(pais)+'&email='+encodeURIComponent(email)+'&asunto='+encodeURIComponent(asunto)+'&comentarios='+encodeURIComponent(comentarios)+'&ema_dest='+encodeURIComponent(ema_dest)+'&acttion='+encodeURIComponent(acttion);
  return cad;
}

// todo es correcto y ha llegado el momento de poner la información requerida
// en su sitio en la pagina xhtml
function cargarpagina(pagina_requerida, id_contenedor){
	if (pagina_requerida.readyState == 4 && (pagina_requerida.status==200 || window.location.href.indexOf("http")==-1)) {
		document.getElementById(id_contenedor).innerHTML=pagina_requerida.responseText;
	} else {
		if (id_contenedor == "formulario" || id_contenedor == "form_clas" || id_contenedor == "form_resp"){
			document.getElementById("resultados").innerHTML="<span class=\"BlancoTH\">Aguarde un momento por favor...<br>Conectando con la fuente de datos !!!</span>";
		} else if(id_contenedor == "clima"){
			
		} else {
			document.getElementById(id_contenedor).innerHTML="<span class=\"BlancoTH\">Aguarde un momento por favor...<br>Conectando con la fuente de datos !!!</span>";
		}
	}
}
// fin ajax
