/*
*Esta libreria es una libreria AJAX creada por Javier Mellado con la inestimable
*colaboracion de Beatriz Gonzalez.
*descargada del portal AJAX Hispano http://www.ajaxhispano.com
*contacto javiermellado@gmail.com
*
*Puede ser utilizada, pasada, modificada pero no olvides mantener 
*el espiritu del software libre y respeta GNU-GPL
*/

function creaAjax(){
  var objetoAjax=false;
  try {
   /*Para navegadores distintos a internet explorer*/
   objetoAjax = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
   try {
     /*Para explorer*/
     objetoAjax = new ActiveXObject("Microsoft.XMLHTTP");
     } 
     catch (E) {
     objetoAjax = false;
   }
  }

  if (!objetoAjax && typeof XMLHttpRequest!='undefined') {
   objetoAjax = new XMLHttpRequest();
  }
  return objetoAjax;
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function envia_pass(){
	var login = document.getElementById('txtlogin').value;
	var pass = document.getElementById('txtpass').value;
	if(login == ""){
		alert ('introduce tu login...');
		return false;
	}
	if(pass == ''){
		alert('introduce tu password...');
		return false;
	}
	/*var datos = 'log='+login+'&pass='+pass;
	var url = 'login/chk_login.php?log='+login+'&pass='+pass;
	location.href = url;*/
	document.login.submit();
	//FAjax('../upfiles/login/chk_login.php', 'area_forms', datos, 'POST');
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////// Usuarios ////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function blanquito(){
	FAjax('../blanquito.php', 'area_forms', '', 'POST');
}
function sub_menu(t){
	var datos = 'tipo='+t;
	blanquito();
	FAjax('../menus/sub_menu_users.php', 'sub_menu_g', datos, 'POST');
}
function frm_user(){
	FAjax('../usuarios/frm_usuarios.php', 'area_forms', '', 'POST');	
}
function frm_admuser(){
	FAjax('../usuarios/frm_buscouser.php', 'area_forms', '', 'POST');
}
function cambia_pass(){
	FAjax('../usuarios/tds_pass_chance.php', 'chance_pass', '', 'POST');	
}
function save_usuario(){
	var nom = document.getElementById('txt_nom_usuario').value;
	var ap = document.getElementById('txt_apaterno').value;
	var am = document.getElementById('txt_amaterno').value;
	var login = document.getElementById('txt_login').value;
	var pass = document.getElementById('txt_pass').value;
	var pass2 = document.getElementById('txt_pass2').value;
	var email = document.getElementById('txt_email').value;
	
	g=new Array();
	c=0;
	var valt = 0;
	for(i=0;i<document.getElementsByName('chk_sec').length;i++){
       if(document.getElementsByName('chk_sec')[i].checked){
            g[c]=document.getElementsByName('chk_sec')[i].value; 
			valt = parseInt(valt) + parseInt(g[c]);
			c++;
		}
    }
	if(valt<=0){
		alert('selecciona una seccion...');
		return false;
	}
	
	if(nom == ''){
		alert('Favor de ingresar un nombre...');
	}
	if(ap == ''){
		alert('Favor de ingresar un Apellido Paterno...');
	}
	if(login == ''){
		alert('Favor de ingresar un Login...');
	}
	if(pass == ''){
		alert('Favor de ingresar un Password...');
	}
	if(pass2 == 'Favor de confirmar Password...'){
		alert('');
	}
	if(pass != pass2){
		alert('el password esta diferente... vuelve a introducirlo');
		return false;
	}
	var datosu = 'nom='+nom+'&ap='+ap+'&am='+am+'&login='+login+'&pass='+pass+'&email='+email+'&perfil='+valt;
	var url = '../usuarios/save_user.php';
	FAjax(url, 'area_forms', datosu, 'POST');
}
function mod_usuario(){
	var id = document.getElementById('txt_id').value;	
	var nom = document.getElementById('txt_nom_usuario').value;
	var ap = document.getElementById('txt_apaterno').value;
	var am = document.getElementById('txt_amaterno').value;
	var login = document.getElementById('txt_login').value;
	var pass1 = document.getElementById('txt_pass1').value;
	var pass2 = document.getElementById('txt_pass2').value;
	var email = document.getElementById('txt_email').value;
	
	if(nom == '' || ap == '' || login == ''){
		alert('faltan datos...');
	}
	
	g=new Array();
	c=0;
	var valt = 0;
	for(i=0;i<document.getElementsByName('chk_sec').length;i++){
       if(document.getElementsByName('chk_sec')[i].checked){
            g[c]=document.getElementsByName('chk_sec')[i].value; 
			valt = parseInt(valt) + parseInt(g[c]);
			c++;
		}
    }
	if(valt<=0){
		alert('selecciona una seccion...');
		return false;
	}
	
	if(document.getElementsByName('chk_pass')[0].checked){
		chk_pass = 1;
		if(pass1 == '' || pass2 == ''){
			alert('Ingresa un password valido...');
			return false;
		}else if(pass1 != pass2){
			alert('El password no coincide...');			
			return false;
		}
	}else{
		chk_pass = 0;
	}
	var datos = 'id='+id+'&nom='+nom+'&ap='+ap+'&am='+am+'&login='+login+'&pass1='+pass1+'&pass2='+pass2+'&email='+email+'&valt='+valt+'&pass='+chk_pass;
	url = '../usuarios/mod_user.php';
	FAjax(url, 'area_forms', datos, 'POST');
	
	
}
function buscar_id(){
	var id_user = document.getElementById('txt_id').value;
	if(id_user == ''){
		alert('Introduce un ID valido...');
	}
	var dato = 'idsu='+id_user;
	//alert(id_user);
	FAjax('../usuarios/frm_admuser.php', 'res_usuarios', dato, 'POST');
}
function ds(){
	if (document.getElementById('chk_pass').checked == true){
		document.getElementById('txt_pass1').disabled = false;
		document.getElementById('txt_pass2').disabled = false;
	}else{
		document.getElementById('txt_pass1').disabled = true;
		document.getElementById('txt_pass2').disabled = true;
	}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////// secciones ///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frm_secciones(){
	FAjax('../secciones/frm_secciones.php', 'area_forms', '', 'POST');
}
function save_seccion(){
	var nom_sec = document.getElementById('txt_nom_sec').value;
	var valor = document.getElementById('txt_val_sec').value;
	var carpeta = document.getElementById('txt_nom_car').value;
	var categoria = document.getElementById('sel_categoria').value;
	if(categoria == 0){
		alert('selecciona una categoria...');
		return false;
	}else if(categoria == 'noticias'){
		if(carpeta == ''){
			alert('ingresa un nombre de carpeta...');
			return false;
		}
	}
	if(nom_sec == ''){
		alert('Ingresa un nombre de seccion...');
		document.frm_seccion.txt_nom_sec.focus;
		return false;
	}
	if(valor == ''){
		alert ('Ingresa un valor valido...');
		return false;
	}
	var datos = 'nom_sec='+nom_sec+'&valor='+valor+'&carpeta='+carpeta+'&categoria='+categoria;
	FAjax('../secciones/save_seccion.php', 'area_forms', datos, 'POST');
}
function numeros(evt){
	var nav4 = window.Event ? true : false;
	// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57
	var key = nav4 ? evt.which : evt.keyCode;
	return (key <= 13 || (key >= 48 && key <= 57 || key==46));	
	/*var key=window.event.keyCode;
	if (key < 48 || key > 57){
		window.event.keyCode=0;
	}*/
}
function res(c){
		if(c=='1'){
			FAjax('../secciones/frm_secciones.php', 'area_forms', '', 'POST');	
		}else if(c=='3'){
			FAjax('../secciones/frm_sub_secciones.php', 'area_forms', '', 'POST');
		}else if(c=='5'){
			FAjax('../usuarios/frm_usuarios.php', 'area_forms', '', 'POST');
		}else if(c=='7'){
			FAjax('../usuarios/frm_buscouser.php', 'area_forms', '', 'POST');
		}else if(c=='2' || c=='4' || c=='6'){
			FAjax('../blanquito.php', 'area_forms', '', 'POST');
		}
}

///////////////////////////sub_secciones//////////////////////////////////////////

function frm_subsec(){
	FAjax('../secciones/frm_sub_secciones.php', 'area_forms', '', 'POST');
}
function save_subsec(){
	var id_sec = document.getElementById('sel_sec').value;
	var nsubsec = escape(document.getElementById('txt_nom_subsec').value);
	var fphp = escape(document.getElementById('txt_fphp').value);
	if(id_sec == 0){
		alert('Selecciona una seccion...');
		return false;
	}
	if(nsubsec == ''){
		alert ('Ingresa una subseccion...');
		return false;
	}
	var datos = 'id_sec='+id_sec+'&nsubsec='+nsubsec+'&fphp='+fphp;
	//alert(datos);
	FAjax('../secciones/save_subsec.php', 'area_forms', datos, 'POST');
	
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////Noticias////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function  frm_notas(){
	FAjax('frm_notas.php', 'area_forms', '', 'POST');
}
function frm_delnotas(){
	FAjax('frm_delnota.php', 'area_forms', '', 'POST');
}
function frm_modnotas(){
	FAjax('frm_modnotas.php', 'area_forms', '', 'POST');
}
function show_visi(div, chk){
	//alert(ctrl);
	var elemento = document.getElementById(div);
	if(document.getElementsByName(chk)[0].checked){
		//elemento visible
		elemento.style.display = '';
	}else{
		//elemento oculto
		elemento.style.display = 'none'; 
		//document.getElementById(id).style.visibility = 'visible';
		chk_pass = 0;
	}
	
}
function show_subsec(){
	subsec = document.getElementById('sel_seccion').value;
	//alert(subsec);
	if(subsec == 0){
		return false;
	}else{
		dato = 'subsec='+subsec;//+'&nocache='+Math.random();
		FAjax('subsec.php', 'div_subsec', dato, 'POST');
		//Fajax('../blanquito.php', 'div_relacion', '', 'POST');
	}
}
function confirmar(){
	var sec = document.getElementById('sel_seccion').value;
	var tit = document.getElementById('txt_titulo').value;
	var nota = document.getElementById('txt_nota').value;
	var rel = document.getElementById('txt_relacion').value;
	var rels = document.getElementById('sel_word').value; 
	if(document.getElementsByName('chk_foto')[0].checked){
		var pie = document.getElementById('txt_pie').value;
		var agen = document.getElementById('txt_agencia').value;
		var ffoto = document.getElementById('f_foto').value;
		if(pie == '' || agen == '' || ffoto == ''){
			alert('faltan datos de la foto...');
			return false;
		}
	}
	if(document.getElementsByName('chk_video')[0].checked){
		var codvid = document.getElementById('txt_video').value;
		if(codvid == ''){
			alert('falta el codigo para el video...');
			return false;
		}
	}
	if(document.getElementsByName('chk_audio')[0].checked){
		var faudio = document.getElementById('f_audio').value;
		alert(faudio);
		if(faudio == ''){
			alert('Introduce una ruta de un archivo de audio...');
			return false;
		}
	}
	if(sec == '' || tit == '' || nota == ''){
		alert('faltan datos por completar....');
		return false;
	}
	if(rel == '' && rels == 0){
		alert('falta clave de relacion...');
		return false;
	}
	if (confirm('¿Deseas ingresar esta noticia?')){
		document.frm_notas.submit();
	}
}
function word_rel(){
	seccion = document.getElementById('sel_seccion').value;
	subsec = document.getElementById('sel_subsec').value;	
	//alert(subsec);
	if(seccion == 0){
		alert('selecciona una sección...');	
		return false;
	}
	dato = 'seccion='+seccion+'&subsec='+subsec;
	url = 'word_rel.php';
	FAjax(url,'div_relacion',dato,'POST');
}
function confsavenota(r, f, idn){
	if(r == 1){
		document.getElementById('txt_titulo').value="";
		document.getElementById('txt_balazo').value="";
		document.getElementById('txt_nota').value="";
		document.getElementById('txt_pie').value="";
		document.getElementById('txt_agencia').value="";
		document.getElementById('f_foto').value="";
		document.getElementById('txt_videocomen').value="";
		document.getElementById('txt_video').value="";
		document.getElementById('f_audio').value="";
		document.getElementById('txt_relacion').value="";
		document.getElementById('txt_autor').value="";
		document.getElementById('chk_foto').checked=false;
		document.getElementById('chk_video').checked=false;
		document.getElementById('chk_audio').checked=false;
				
		alert('La nota se guardo con exito...');
		if(f==1){
			dato = 'idnota='+idn;
			FAjax('acomoda_foto.php','area_forms',dato,'POST');
			return;
		}
	}else if(r == 0){
		alert('La nota no se guardo...');
		return false;
	}else if(r == 2){
		alert('La foto no es valida, sobrepasa el tamaño permitido o su formato no es valdio....');
		return false;
	}else if(r == 3){
		alert('La foto se modifico con exito...');
		if(f==1){
			dato = 'idnota='+idn;
			FAjax('acomoda_foto.php','area_forms',dato,'POST');
			return;
		}
	}
}
function act_foto_aco(idnota){
	arriba = document.getElementById('txt_arriba').value;
	datos = 'arriba='+arriba+'&idnota='+idnota;
	//alert(datos);
	FAjax('acomoda_foto2.php', 'div_acomodafoto', datos, 'POST');
}
function save_foto_aco(idnota){	
	arriba = document.getElementById('txt_arriba').value;
	if(arriba == ''){
		arriba = 1;
	}
	datos = 'arriba='+arriba+'&idnota='+idnota;	
	//alert(datos);
	FAjax('save_acomoda_foto.php', 'area_forms', datos, 'POST');
}
function confaddfoto(r, f, idn){
	if(r == 1){
		document.getElementById('txt_pie').value="";
		document.getElementById('txt_agencia').value="";
		document.getElementById('f_foto').value="";
						
		alert('La foto se guardo con exito...');
		if(f==1){
			dato = 'idnota='+idn;
			FAjax('acomoda_foto.php','area_forms',dato,'POST');
			return;
		}
	}else if(r == 0){
		alert('La nota no se guardo...');
		return false;
	}else if(r == 2){
		alert('La foto no es valida, sobrepasa el tamaño permitido o su formato no es valdio....');
		return false;
	}else if(r == 3){
		alert('La foto se modifico con exito...');
		if(f==1){
			dato = 'idnota='+idn;
			FAjax('acomoda_foto.php','area_forms',dato,'POST');
			return;
		}
	}
}
/************************* Borrar Notas *************************************/
function del_nota(){
	var id = document.getElementById('txt_idnota').value;
	if(id == ''){
		alert('Introduce un Id de nota...');	
		return false;
	}
	dato = 'idnota='+id;
	url = 'delnota.php';
	FAjax(url, 'div_delnota', dato, 'POST');	
}
function backid(){
	frm_delnotas();
	FAjax('../blanquito.php', 'div_delnota', '', 'POST');
}
function delnotad(idnota){
	dato = 'idnota='+idnota;
	FAjax('delnotad.php', 'div_delnota', dato, 'POST');		
}
function avdelnota(v, idnota){
	if(v == 1){
		document.getElementById('txt_idnota').value = "";
		aviso = 'La nota: '+idnota+' fue borrada...';
		alert(aviso);
		backid();
		
	}else if(v == 2){
		aviso = 'La nota: '+idnota+' NO se borro...';
		alert(aviso);
		backid();
	}
}
/************************** Modificar ****************************************/
function modnotas(){
	idnota = document.getElementById('txt_idnota').value;
	sel = document.getElementById('sel_modifica').value;
	if(idnota == ''){
		alert('Introduce un ID de nota...');
		return false;
	}
	if(sel == 0){
		alert('Falta seleccion a modifica...');
		return false;
	}
	dato = 'idnota='+idnota;
	if(sel == 1){
		url = 'modifica_nota.php';	
	}
	if(sel == 2){
		url = 'modifica_foto.php';
	}
	if(sel == 3){
		url = 'modifica_video.php';
	}
	if(sel == 4){
		url = 'modifica_audio.php';
	}
	if(sel == 5){
		url = 'agrega_foto.php';
	}
	FAjax(url, 'area_forms', dato, 'POST');
}
function save_mn(idnota){
	titulo = escape(document.getElementById('txt_titulo').value);
	balazo = escape(document.getElementById('txt_balazo').value);
	nota = escape(document.getElementById('txt_nota').value);
	tipo = document.getElementById('sel_tipo').value;
	autor = escape(document.getElementById('txt_autor').value);
	foto = document.getElementById('txt_foto').value;
	
	datofoto = '';
	if(foto == 1){
		pie = escape(document.getElementById('txt_pie').value);
		agencia = escape(document.getElementById('txt_agencia').value);
		alto = document.getElementById('txt_arriba').value;
		if(pie == '' || agencia == '' || alto == ''){
			alert('Faltan datos de la foto...');
			return false;
		}
		datofoto = '&pie='+pie+'&agencia='+agencia+'&alto='+alto;
	}
	if(titulo == '' || nota == ''){
		alert('Faltan datos...');
		return false;
	}
	datos = 'idnota='+idnota+'&titulo='+titulo+'&balazo='+balazo+'&nota='+nota+'&tipo='+tipo+'&autor='+autor+'&foto='+foto+datofoto;
	url = 'save_mod_nota.php';
	FAjax(url, 'area_forms', datos, 'POST');
	
}
function cancel_mn(){
	FAjax('frm_modnotas.php', 'area_forms', '', 'POST');
}
function notasmc(v){
	if(v==1){
		alert('La noticia se modifico correctamente...');
		cancel_mn;
	}else if(v==2){
		alert('La noticia NO se modifico...');
		return false;
	}
}
/************************* modifica fotos ************************************/
function save_cf(idnota){
	pie = document.getElementById('txt_pie').value;
	agencia = document.getElementById('txt_agencia').value;
	dirfoto = document.getElementById('f_foto').value;
	if(pie == '' || agencia == '' || dirfoto == ''){
		alert('Faltan datos de la foto....');
		return false;
	}
	if(confirm('¿Deseas cambiar esta foto?')){
		document.frm_modificafoto.submit();
	}else{
		return false;
	}	
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////// Encuestas ///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frmencuesta(){
	FAjax('../encuesta/frm_encuesta.php', 'area_forms', '', 'POST');
}
function send_encuesta(){
	p = escape(document.getElementById('txt_pregunta').value);
	opt1 = escape(document.getElementById('txt_opt1').value);
	opt2 = escape(document.getElementById('txt_opt2').value);
	opt3 = escape(document.getElementById('txt_opt3').value);
	opt4 = escape(document.getElementById('txt_opt4').value);
	opt5 = escape(document.getElementById('txt_opt5').value);
	opt6 = escape(document.getElementById('txt_opt6').value);
	opt7 = escape(document.getElementById('txt_opt7').value);
	opt8 = escape(document.getElementById('txt_opt8').value);
	opt9 = escape(document.getElementById('txt_opt9').value);
	opt10 = escape(document.getElementById('txt_opt10').value);
	tipo = escape(document.getElementById('sel_tipo').value);
	prioridad = document.getElementById('sel_prioridad').value;
	//alert(prioridad);
	if(document.getElementsByName('chk_activa')[0].checked){
		activa = 1;
	}else{
		activa = 0;
	}
	if(p == '' && opt1 == '' && opt2 == ''){
		alert('Debes ingresar al menos una pregunta y dos opciones..');		
		return false;
	}
	if(tipo == 0){
		alert('Selecciona un tipo de encuesta...');
		return false;
	}
	if(prioridad == 0){
		alert('Selecciona una prioridad para la encuesta...');
		return false;
	}
	datos = 'p='+p+'&opt1='+opt1+'&opt2='+opt2+'&opt3='+opt3+'&opt4='+opt4+'&opt5='+opt5+'&opt6='+opt6+'&opt7='+opt7+'&opt8='+opt8+'&opt9='+opt9+'&opt10='+opt10+'&tipo='+tipo+'&activa='+activa+'&prioridad='+prioridad;
	url = '../encuesta/save_encuesta.php';
	FAjax(url, 'area_forms', datos, 'POST');
	
	//alert(activa);
}
function verencu(periodo, divencuesta){
	opcionn = 'opcion'+periodo;
	opc = document.getElementsByName(opcionn);
	for(i=0;i<opc.length;i++){
    	if(opc[i].checked){
	   		var opcion = document.getElementsByName(opcionn)[i].value;
			break;
	   	}
    }
	//alert(opcion);
	var datos = 'opcion='+opcion;
	var url = '../encuesta/verencuesta.php?t='+periodo;
	var div = divencuesta;
	//if(periodo == 'diaria'){
	//div = 'encuesta_diaria_1';
	//}else if(periodo == 'semanal'){
		//div = 'encuesta_semanal';		
	//}
	FAjax(url, div, datos, 'POST');
	//alert (opcion);

}
function show_priori(){
	tipo = document.getElementById('sel_tipo').value;
	if(tipo == 0){
		return false;
	}else{
		dato = 'tipo='+tipo;
		FAjax('../encuesta/prioridad.php', 'div_prioridad', dato, 'POST');		
	}
}
//////////////////////////////////////////////////////////////////////////////
/////////////////////////// Galerias /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frmgaleria(){
	FAjax('../galerias/frm_galeria.php', 'area_forms', '', 'POST');
}
function frmagregafoto(){
	FAjax('../galerias/frm_agregafoto.php', 'area_forms', '', 'POST');
}
function save_agrega(){
	nomgal = escape(document.getElementById('txt_nomgal').value);
	titgal = escape(document.getElementById('txt_titgal').value);
	if(document.getElementsByName('chk_actgal')[0].checked){
		actgal = 1;
	}else{
		actgal = 0;
	}
	if(nomgal == "" || titgal == ""){
		alert('Faltan datos de la galeria...');
		return false;
	}
	url = '../galerias/save_galeria.php';
	datos = 'nom='+nomgal+'&tit='+titgal+'&actgal='+actgal;
	FAjax(url, 'area_forms', datos, 'POST');
}
function save_foto(){
	pie = document.getElementById('txt_pie').value;
	agencia = document.getElementById('txt_agencia').value;
	dirfoto = document.getElementById('f_fotog').value;
	if(pie == '' || agencia == '' || dirfoto == ''){
		alert('Faltan datos de la foto...');
		return false;
	}
	if (confirm('¿Deseas ingresar esta foto?')){
		document.frm_fotogal.submit();
	}
}
function savefoto(r, id){
	if(r == 1){
		document.getElementById('txt_idgal').value = id;
		document.getElementById('txt_pie').value = '';
		document.getElementById('txt_agencia').value = '';
		document.getElementsByName('f_fotog').value = '';
		alert('Foto Guardada...');
	}else if(r == 0){
		alert('La foto no se guardo...');
	}
	
}
function iraddgal(){
	idgal = document.getElementById('sel_gal').value;
	if(idgal == 0){
		alert('selecciona una galeria...');
		return false;
	}
	datos = 'idgal='+idgal+'&agrega=1';
	url = '../galerias/save_galeria.php';
	FAjax(url, 'area_forms', datos, 'POST');
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////// Videos /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frm_videos(){
	FAjax('../videos/frm_video.php', 'area_forms', '', 'POST');
}
function save_video(){
	codigo = escape(document.getElementById('txt_codigo').value);
	comentario = escape(document.getElementById('txt_comentario').value);
	if(codigo == ''){
		alert('Falta de ingresar el codigo del video...');
		return false;
	}
	if (confirm('¿Deseas ingresar este video?')){
		document.frm_video.submit();
	}
	/*datos = 'cod='+codigo+'&comen='+comentario;
	url = '../videos/save_video.php';
	FAjax(url, 'area_forms', datos, 'POST');*/
}
function csavevideo(r){
	if(r == 1){
		document.getElementById('txt_codigo').value = '';
		document.getElementById('txt_comentario').value = '';
		document.getElementById('fvideo').value = '';
		alert ('El video se guardo satisfactoriamente...');
	}else if( r == 0){
		alert ('El video no se guardo');
	}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////// Cortes //////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frm_cortes(){
	FAjax('../cortes/frm_cortes.php', 'area_forms', '', 'POST');
}
function save_corte(){
	comentario = document.getElementById('txt_comentario').value;
	filecorte = document.getElementById('f_corte').value;
	if(comentario == '' || filecorte == ''){
		alert('Falta de introducir datos...');
		return false;
	}
	if (confirm('¿Deseas ingresar este corte?')){
		document.frm_cortes.submit();
	}
}
function confsavecorte(r){
	if(r == 1){
		document.getElementById('txt_comentario').value = '';
		document.getElementsByName('f_corte').value = '';
		alert('El corte se guardo correctamente...');
	}else{
		alert('El corte no se guardo...');
	}
		
}

//////////////////////////////////////////////////////////////////////////////
//////////////////////// PDF /////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frm_pdf(){
	FAjax('../pdf/frm_pdf.php', 'area_forms', '', 'POST');
}
function save_pdf(){
	f = document.getElementById('txt_fecha').value;
	filepdf = document.getElementById('f_pdf').value;
	tipo = document.getElementById('sel_pdf').value;
	var expreg = /^([0-9]{4})\-([0-9]{2})\-([0-9]{2})$/;
	if((f != '') && (document.getElementById('txt_fecha').value.match(expreg))){
		if(filepdf == '' || tipo == 0){
			alert('Falta de introducir datos...');
			return false;
		}
		if (confirm('¿Deseas ingresar este corte?')){
			document.frm_pdf.submit();
		}
	}else{
		alert('La fecha es invalida...');
		return false;
	}
}
function confsavepdf(r){
	if(r == 1){
		document.getElementById('txt_fecha').value = '';
		document.getElementsByName('f_pdf').value = '';
		alert('El pdf se guardo correctamente...');
	}else if(r == 0){
		alert('El pdf no se guardo...');
	}
		
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////Top Ten ///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frm_topten(){
	FAjax('../topten/frm_topten.php', 'area_forms', '', 'POST');
}
function save_top(){
	semana = document.getElementById('sel_semana').value;
	anno = document.getElementById('sel_anno').value;
	datos = 'sem='+semana+'&anno='+anno;
	url = '../topten/save_top.php';
	FAjax(url, 'area_forms', datos, 'POST');
}
function save_topten(idtop){
	r=escape(document.getElementById('txt_r').value);
	c=escape(document.getElementById('txt_c').value);
	i=escape(document.getElementById('txt_i').value);
	s=escape(document.getElementById('txt_s').value);	
	v=escape(document.getElementById('txt_v').value);
	if(r == '' || c == '' || i == '' || s == ''){
		alert('faltan datos por completar ... ');
		return false;
	}
	datos = 'r='+r+'&c='+c+'&i='+i+'&s='+s+'&v='+v+'&idtop='+idtop;
	url = '../topten/save_topten.php';
	FAjax(url, 'area_forms', datos, 'POST');
}
function agrega(idtop){
	dato = 'idtop='+idtop;
	url = '../topten/save_top.php';
	FAjax(url, 'area_forms', dato, 'POST');
}
function nomas(){
	Fajax('../blanquito.php', 'area_forms', '', 'POST');
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////// Comentarios ///////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function send_comentario(idnota){
	comentario = escape(document.getElementById('txt_comentario').value);
	nick = escape(document.getElementById('txt_nick').value);
	mail = escape(document.getElementById('txt_mail').value);
	codigo = document.getElementById('code').value;
	ip_priv = document.getElementById('txt_ip_priv').value;
	ip_pub = document.getElementById('txt_ip_pub').value;
	ip_xxx = document.getElementById('txt_ip_xxx').value;
	//alert('ip_priv'+ip_priv+'<br>ip_pub'+ip_pub+'<br>ipxx'+ip_xxx);
	
	expremail = /[\w-\.]{3,}@([\w-]{2,}\.)*([\w-]{2,}\.)[\w-]{2,4}/;
	if((mail != '') && (document.getElementById('txt_mail').value.match(expremail))){
		if(comentario == '' || nick == '' || codigo == ''){
			alert('Faltan algunos datos para que tu comentario sea procesado....');	
			return false;
		}
	}else{
		alert('Tu correo electronico es invalido...');
		return false;
	}
	datos = 'comen='+comentario+'&nick='+nick+'&mail='+mail+'&codigo='+codigo+'&idnota='+idnota+'&ippri='+ip_priv+'&ippub='+ip_pub+'&ipxxx='+ip_xxx;
	url = '../captcha-code/captcha-verify.php';
	document.getElementById('txt_nick').value = '';
	document.getElementById('txt_mail').value = '';
	FAjax(url, 'comentarios', datos, 'POST');
	
}

/*********************** Administrar Comentarios *****************************/
function frm_delcomen(){
	url = '../comentarios/frm_delcomentario.php';
	FAjax(url,'area_forms', '', 'POST');
}
function frm_vercomen(){
	url = '../comentarios/frm_vercomentario.php';
	FAjax(url, 'area_forms', '', 'POST');
}
function del_comentario(){
	idnota = document.getElementById('txt_idnota').value;
	url = '../comentarios/lst_delcomentarios.php';
	dato = 'idnota='+idnota;
	FAjax(url, 'div_delcomentario', dato, 'POST');
}
function delcomsel(idcom){
	url = '../comentarios/delcomsel.php';
	divcom = 'msg_delcom'+idcom;
	dato = 'idcom='+idcom;
	if(confirm('¿Deseas borrar este comentario ('+idcom+')?')){
		FAjax(url, divcom, dato, 'POST');
	}else{
		return false;
	}
}
function ver_comentario(){
	for(i=0;i<=document.frm_vercom.rdo_tipo.length;i++){
		if(document.frm_vercom.rdo_tipo[i].checked){
			tipo = document.frm_vercom.rdo_tipo[i].value;
			break;
		}
	}
	//alert(tipo);
	if(tipo == 1){
		idnota = document.getElementById('txt_idnota').value;
		if(idnota == ''){
			alert('Falta de introducir el ID de la nota...');
			return false;
		}else{
			datos = 'idnota='+idnota+'&tipo='+tipo;
		}
	}else if(tipo == 2){
		limit = document.getElementById('txt_last').value;
		if(limit == ''){
			alert('Falta de introducir el numero de comentarios que se desea ver...');
			return false;
		}else{
			datos = 'limit='+limit+'&tipo='+tipo;
		}
	}else if(tipo == 3){
		fecha = document.getElementById('txt_pfecha').value;
		if(fecha == ''){
			alert('Introduce una fecha valida...');
			return false;
		}else{
			datos = 'fecha='+fecha+'&tipo='+tipo;
		}
	}
	url = '../comentarios/show_comentarios.php';
	FAjax(url, 'div_vercomentario', datos, 'POST');
}
function rdo_chkd(val){
	for(i=0;i<=document.frm_vercom.rdo_tipo.length;i++){
		vali = document.frm_vercom.rdo_tipo[i].value;
		if(vali == val){
			document.frm_vercom.rdo_tipo[i].checked = true;		
			break;
		}
	}
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////// imagenes Horoscopos ///////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function add_imghoros(){
	url = '../horoscopos/frm_imghoros.php';
	FAjax(url,'area_forms', '', 'POST');
}
function frm_horoscopos(){
	url = '../horoscopos/frm_horoscopos.php';
	FAjax(url,'area_forms', '','POST');
}
function save_imghoros(){
	signo = document.getElementById('sel_horos').value;
	periodo = document.getElementById('txt_periodo').value;
	file = document.getElementById('fhoros').value;
	grupo = document.getElementById('sel_grupo').value;
	if(signo == '' || file == ''){
		alert('Falta de introducir datos...');
	}
	if(periodo == 0 || grupo == 0){
		alert('Falta de seleccionar alguna opcion');
		return false;
	}
	if (confirm('¿Deseas ingresar esta imagen?')){
		document.frm_imghoros.submit();
	}
}
function csaveimgh(v){
	if(v == 1){
		document.getElementById('txt_periodo').value = '';
		document.getElementsByName('fhoros').value = '';
		alert('La imagen se guardo correctamente...');
	}else if(v == 0){
		alert('La imagen no se guardo...');
	}
}
/*************************************************************************/
function save_horoscopo(){
	horos = document.getElementById('sel_horos').value;
	pre = document.getElementById('txt_prediccion').value;
	f = document.getElementById('txt_fecha').value;
	gpo = document.getElementById('sel_grupo').value;
	
	var expreg = /^([0-9]{2})\-([0-9]{2})\-([0-9]{4})$/;
	if((f != '') && (document.getElementById('txt_fecha').value.match(expreg))){
		if(horos == 0 || pre == '' || gpo == 0){
			alert('Faltan algunos datos...');
			return false;
		}
	}else{
		alert('Fecha invalida...');
		return false;
	}
	if (confirm('¿Deseas guardar este horoscopo?')){
		document.frm_horoscopo.submit();
	}
}
function csavehoros(r){
	if(r==1){
		document.getElementById('txt_prediccion').value = '';
		//document.getElementById('txt_fecha').value = '';
		alert('El horoscopo se a agregado correctamente...');
		return false;
	}else if(r==0){
		alert('El horoscopo no se agrego...');
		return false;
	}else if(r==2){
		document.getElementById('txt_fecha').value = '';
		alert('La fecha no es valida...');
		return false;
	}else if(r==3){
		document.getElementById('txt_prediccion').value = '';
		alert('Prediccion de este horoscopo ya existe para la fecha seleccionada...');
		return false;
	}
}
//////////////////////////////////////////////////////////////////////////////
////////////////////////// Valora ////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function vota(idnota, v){
	//alert(v);
	datos = 'idnota='+idnota+'&v='+v;
	url = '../upfiles/valora/vota.php';
	FAjax(url, 'imagenes_vota', datos, 'POST');
}

function show_encuestar(idencu, divencu){
	div = escape(divencu);
	datos = 'd='+idencu+'&divencu='+div;
	FAjax('/encuesta/resultados.php', div, datos, 'POST');
}
function show_encuestae(idencu, divencu){
	div = escape(divencu);
	datos = 'd='+idencu+'&divencu='+div;
	FAjax('/encuesta/encuesta.php', div, datos, 'POST');
}

//////////////////////////////////////////////////////////////////////////////
////////////////////// Ventanas //////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
<!--
function Abrir_Ventana(el_url) {
var especificaciones="top=0, left=0, toolbar=no, location=no, status=no, menubar=no,scrollbars=no,resizable=no,width=450,height=450";
var titulo="Video";
window.open(el_url,titulo,especificaciones);
}
function Abrir_Ventana_v(el_url, w, h, t) {
var especificaciones="top=0, left=0, toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+w+", height="+h;
var titulo=t;
window.open(el_url,titulo,especificaciones);
}


//-->
//////////////////////////////////////////////////////////////////////////////
///////////////////////// favoritos //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

function agregar_fav(){
//Para internet explorer
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {

var url="http://www.aguasdigital.com/"; //Cambia esta dirección por la de tu web
var titulo="aguasdigital.com - El diario Joven de Aguascalientes"; //Cambia esta nombre por el de tu web
window.external.AddFavorite(url,titulo);

}
//Para Netscape y Firefox
else {
if(navigator.appName == "Netscape")
alert ("Presione Crtl+D para agregar a este sitio en sus Bookmarks");  //Puedes personalizar este mensaje
}
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////minuto x minuto ////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function frm_mxm(){
	url = '../minxmin/frm_minxmin.php';
	FAjax(url, 'area_forms', '', 'POST');
}
function irmxmopc(){
	opc = document.getElementById('sel_mxm').value;
	if(opc == 0){
		return false;
	}
	if(opc == 1){
		url = '../minxmin/bgame.php';
	}
	if(opc == 2){
		url = '../minxmin/frm_comentario.php';		
	}
	if(opc == 3){
		url = '../minxmin/addesc.php';
	}
	if(opc == 5){
		url = '../minxmin/frm_actdes.php';
	}
	if(opc == 6){
		url = '../minxmin/frm_players.php';
	}
	if(opc == 7){
		url = '../minxmin/frm_alineaciones.php';
	}
	FAjax(url, 'area_forms', '', 'POST');
}
function save_esc(){
	cat = document.getElementById('sel_cat').value;
	nom = document.getElementById('txt_nom').value;
	zona = document.getElementById('sel_zona').value;
	pais = document.getElementById('sel_pais').value;
	escudo = document.getElementById('f_esc').value;
		
	if(cat == 0 || nom == '' || zona == 0 || pais == 0 || escudo == ''){
		alert('Faltan algunos datos de completar...');
		return false;
	}
	if (confirm('¿Deseas ingresar este escudo?')){
		document.frm_addesc.submit();
	}
}
function saveesc(r){
	if(r == 1){
		document.getElementById('txt_nom').value = '';
		//document.getElementById('txt_pais').value = '';
		alert('El escudo se guardo correctamente...');
	}else{
		alert('El escudo no se guardo...');
	}	
}
function ir_pais(valor, vol){
	url = '../minxmin/sel_pais.php';
	zona = valor; //document.getElementById('sel_zona').value;
	if(zona == 0){
		alert('Selecciona una zona valida...');
		return false;
	}
	if(vol == 'l'){
		div = 'div_paisl';
	}
	if(vol == 'v'){
		div = 'div_paisv';
	}
	dato = 'zona='+zona+'&vol='+vol;
	FAjax(url, div, dato, 'POST');
}
function ir_categoria(zona, valor, vol){
	url = '../minxmin/sel_categoria.php';
	pais = valor;
	if(vol == 'l'){
		div = 'div_categorial';
	}
	if(vol == 'v'){
		div = 'div_categoriav';
	}
	dato = 'zona='+zona+'&pais='+pais+'&vol='+vol;
	FAjax(url, div, dato, 'POST');
}
function ir_team(zona, pais, categoria, vol){
	url = '../minxmin/sel_team.php';
	if(vol == 'l'){
		div = 'div_teaml';
	}
	if(vol == 'v'){
		div = 'div_teamv';
	}
	dato = 'zona='+zona+'&pais='+pais+'&categoria='+categoria+'&vol='+vol;
	FAjax(url, div, dato, 'POST');
}
function new_pais(zona){
	url = '../minxmin/new_pais.php';
	dato = 'zona='+zona;
	div = 'div_new_pais';
	FAjax(url, div, dato, 'POST');
}
function save_juego(){
	zonal = document.getElementById('sel_zonal').value;
	zonav = document.getElementById('sel_zonav').value;
	paisl = document.getElementById('sel_paisl').value;
	paisv = document.getElementById('sel_paisv').value;
	catl = document.getElementById('sel_catl').value;
	catv = document.getElementById('sel_catv').value;
	teaml = document.getElementById('sel_teaml').value;
	teamv = document.getElementById('sel_teamv').value;
	paisc = escape(document.getElementById('txt_pais').value);
	ciudad = escape(document.getElementById('txt_cd').value);
	estadio = escape(document.getElementById('txt_estadio').value);
	fechaj = document.getElementById('txt_cal').value;
	hr = document.getElementById('sel_hora').value;
	minutos = document.getElementById('sel_min').value;
	if(document.getElementById('chk_act').checked == true){
		estado = 1;
	}else{
		estado = 0;
	}
	
	hora = hr+':'+minutos;
	if(teaml == 0 || teamv == 0 || paisc == 0 || ciudad == 0 || estadio == 0 || fechaj == ''){
		alert ('Faltan de completar algunos datos....');
		return false;
	}
	datos = 'tl='+teaml+'&tv='+teamv+'&paisc='+paisc+'&ciudad='+ciudad+'&estadio='+estadio+'&fecha='+fechaj+'&hora='+hora+'&estado='+estado;
	url = '../minxmin/save_game.php';
	div = 'area_forms';
	FAjax(url, div, datos, 'POST');
}
function save_com(){
	idjuego = document.getElementById('sel_game').value;
	tipo = document.getElementById('sel_tipo').value;
	periodo = document.getElementById('sel_per').value;
	minuto = document.getElementById('txt_minuto').value;
	comentario = escape(document.getElementById('txt_com').value);
	if(idjuego == 0 || tipo == 0 || periodo == 0 || minuto == 0 || comentario == ''){
		alert('faltan algunos datos por completar...');
		return false;
	}
	if(tipo >= 3 && tipo <= 5){
		equipo = document.getElementById('sel_team').value;
		jugador = document.getElementById('sel_player').value;
		if(equipo == 0 || jugador == ''){
			alert('faltan algunos datos por completar...');
			return false;
		}
	}else if(tipo == 6){
		equipo = document.getElementById('sel_team').value;
		entra = document.getElementById('sel_playerin').value;
		sale = document.getElementById('sel_playerout').value;
		if(equipo == 0 || entra == '' || sale == ''){
			alert('faltan algunos datos por completar');
			return false;
		}
		if(entra == sale){
			alert('No se puede seleccionar al mismo jugador para el cambio...');
			return false;
		}
	}
	document.frm_addcom.submit();
	/*datos = 'idjuego='+idjuego+'&tipo='+tipo+'&periodo='+periodo+'&minuto='+minuto+'&comentario='+comentario;
	url = '../minxmin/save_com.php';
	div = 'area_forms';
	metodo = 'POST';
	FAjax(url, div, datos, metodo);*/
}
function add_comentario(){
	url = '../minxmin/frm_comentario.php';
	div = 'area_forms'
	datos = '';
	metodo = 'POST';
	FAjax(url, div, datos, metodo);
}
function show_status(){
	gstatus = document.getElementById('sel_game').value;
	if(gstatus == 3){
		alert('Selecciona una accion para mostrar...');
		return false;
	}
	if(gstatus != 3){
		datos = 'gstatus='+gstatus;
	}
	div = 'games_show';
	url = '../minxmin/game_desact.php';
	metodo = 'POST';
	FAjax(url, div, datos, metodo);
}
function change_st(statusg){
	idgame = document.getElementById('sel_gamea').value;
	if(statusg==0){
		estado = 0;
		msg = 'juego desactivado '+idgame;
	}else if(statusg == 1){
		estado = 1;
		msg = 'juego activado'+idgame;
	}else if(statusg == 2){
		estado = 2;
		msg = 'juego finalizado'+idgame;
	}
	url = '../minxmin/change_st.php';
	div = 'games_show';
	metodo = 'POST';
	datos = 'estado='+estado+'&idjuego='+idgame;
	FAjax(url, div, datos, metodo);
	//alert(msg);
}
function savecom_r(r){
	if(r == 't'){
		document.getElementById('txt_minuto').value = '';
		document.getElementById('txt_com').value = '';
		alert('El comentario se agrego...');
	}else{
		alert('el comentario no se guardo...');
	}
}
function tipocom(idtipo){
	idgame = document.getElementById('sel_game').value;
	if(idgame == 0){
		alert('Debes seleccionar primero un juego...');
		return false;
	}
	datos = 'idtipo='+idtipo+'&idgame='+idgame;
	url = '../minxmin/tipo_com.php';
	div = 'comentario_tipo';
	metodo = 'POST';
	FAjax(url, div, datos, metodo);
}
function show_lstplay(idteam, idgame){
	if(idteam == 0){
		return false;
	}
	datos = 'idteam='+idteam+'&idgame='+idgame;
	url = '../minxmin/sel_plantilla.php';
	metodo = 'POST';
	div = 'div_seljugador';
	FAjax(url, div, datos, metodo);
}
function cambios(idteam, idgame){
	if(idteam == 0){
		return false;
	}	
	datos = 'idteam='+idteam+'&idgame='+idgame;
	url = '../minxmin/sel_cambios.php';
	metodo = 'POST';
	div = 'div_selcambio';
	FAjax(url, div, datos, metodo);
}
function save_plantilla(){
	idteam = document.getElementById('sel_team').value;
	fileexcel = document.getElementById('file_archivo').value;
	if(idteam == 0 || fileexcel == ''){
		alert('Faltan algunos datos...');
		return false;
	}
	document.frm_jugadores.submit();
}
function ir_plantillas(){
	selval = document.getElementById('sel_game').value;
	if(selval == 0){
		return false;
	}else{
		url = '../minxmin/lst_plantilla.php'
		div = 'plantillas';
		datos = 'idgame='+selval;
		metodo = 'POST';
		FAjax(url, div, datos, metodo);
	}
}
function down_formacion(t, idjuego, idequipo){
	if(t=='1'){
		sel = "lst_alinl";
		div = 'local_titular';
	}else if(t=='2'){
		sel = "lst_alinv";
		div = 'visita_titular';
	}
	g=new Array();
	c=0;
	for(i=0;i<eval("document.frm_lstplan."+sel+".length");i++){
       if(eval("document.frm_lstplan."+sel+"[i].selected")){
            g[c]=eval("document.frm_lstplan."+sel+"[i].value"); 
			//alert (g[c]); 
			c++;
		}
    }
	if(g<=0 || c != 11){
		alert('selecciona 11 jugadores...');
		return false;
	}
	datos = 'array='+g+'&divse='+div+'&idjuego='+idjuego+'&idequipo='+idequipo;
	metodo='POST';
	url = '../minxmin/formacion_titular.php';
	FAjax(url, div, datos, metodo);
}
function save_titulares(divse, idjuego, idequipo, arrplayers){
	if(divse == 'local_titular'){
		document.getElementById('btn_downl').disabled=true;
	}else if(divse == 'visita_titular'){
		document.getElementById('btn_downv').disabled=true;
	}
	datos = 'idjuego='+idjuego+'&idequipo='+idequipo+'&arrplayers='+arrplayers;
	url= '../minxmin/save_titulares.php';
	metodo = 'POST';
	div = divse;
	FAjax(url, div, datos, metodo);
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function FAjax (url,capa,valores,metodo)
{
   var ajax=creaAjax();
   var capaContenedora = document.getElementById(capa);
		
/*Creamos y ejecutamos la instancia si el metodo elegido es POST*/
 if(metodo.toUpperCase()=='POST'){
        document.write="cotizacion";
    ajax.open ('POST', url, true);
    ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                 capaContenedora.innerHTML="Cargando.......";
         }
         else if (ajax.readyState==4){//0=no inicializada, 1=leyendo, 2=leido, 3=interactiva, 4=completo
            if(ajax.status==200)//200=ok, recibido bien
            {
				cadena = unescape(ajax.responseText);
				cadenafinal = cadena.replace(/\+/gi," ");
                document.getElementById(capa).innerHTML=cadenafinal; 
            }
            else if(ajax.status==404)//404=archivo no encontrado, 500=(internal Server Error)
                 {

                     capaContenedora.innerHTML = "La direccion no existe";
                 }
             else if(ajax.status==500)
                 {
                     capaContenedora.innerHTML = "Error: ".ajax.status;
                 }
        }
    }
	//ajax.setRequestHeader('Content-Type','application/x-javascript; charset:ISO-8859-1');
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded;' );
    ajax.send(valores);
    return;
}
/*Creamos y ejecutamos la instancia si el metodo elegido es GET*/
if (metodo.toUpperCase()=='GET'){

    ajax.open ('GET', url, true);
    ajax.onreadystatechange = function() {
         if (ajax.readyState==1) {
                 capaContenedora.innerHTML="Cargando.......";
         }
         else if (ajax.readyState==4){
            if(ajax.status==200){ 
                 document.getElementById(capa).innerHTML=ajax.responseText; 
            }
            else if(ajax.status==404)
                 {

                     capaContenedora.innerHTML = "La direccion existe";
                 }
                 else
                 {
                     capaContenedora.innerHTML = "Error: ".ajax.status;
                 }
        }
    }
    ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    ajax.send(null);
    return;
}
}


