<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
  	x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document;
  if(d.images){ 
  	if(!d.MM_p) d.MM_p=new Array();
	
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments;  
		for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ 
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
		}
	}
}

function MM_findObj(n, d) { //v4.01
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n);
	return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x;			
			if(!x.oSrc) x.oSrc=x.src;
				x.src=a[i+2];
				indice=a[i+4];
				}	
	showit(indice);
}

function MM_swapImgRestore_icon() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages_icon() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages_icon.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj_icon(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj_icon(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage_icon() { //v3.0
  var i,j=0,x,a=MM_swapImage_icon.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj_icon(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function showit(which){
	clear_delayhide()
	thecontent=(which==-1)? "" : submenu[which]
	if (document.getElementById||document.all)
		menuobj.innerHTML=thecontent
	else if (document.layers){
		menuobj.document.write(thecontent)
		menuobj.document.close()
	}
}

function resetit(e){
	if (document.all&&!menuobj.contains(e.toElement))
		delayhide=setTimeout("showit(-1)",delay_hide)
	else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
	if (window.delayhide)
		clearTimeout(delayhide)
}

function contains_ns6(a, b) {
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
		return false;
}

function cambiarDisplay(id,estado) {
	if (!document.getElementById) return false;
	fila = document.getElementById(id);
	if (estado!=true) {
		fila.style.display = ""; //mostrar fila	
	}else {
		fila.style.display = "none"; //ocultar fila
	}	
}

function cargarestado(t){
	var d1,contenedor,todos,t;
	todos=t;
	contenedor = document.getElementById('contenedor');	
	d1 = document.QForm.pais.options[document.QForm.pais.selectedIndex].value;
	if (d1==100) {
		contenedor.innerHTML="<select id='estado' name='estado' class='verdana_12_rojo' disabled='disabled'/><option value='-99'>Seleccione un Estado</option></select>";
		cambiarDisplay('tabla_pais',true);
		cambiarDisplay('espacio_tabla',true);		
	} else {
		if (d1==200) {				
			contenedor.innerHTML="<input id='estado2' name='estado2' type='text' size='38' class='verdana_12_rojo'/>";
			cambiarDisplay('tabla_pais',false);
			cambiarDisplay('espacio_tabla',false);		
		} else {
					
			ajax=nuevoAjax();
			if (todos!='0'){
				ajax.open("GET", "./funciones/procesos.php?pais="+d1+"&todos="+todos,true);
			} else {
				ajax.open("GET", "./funciones/procesos.php?pais="+d1,true);
			}			
			ajax.onreadystatechange=function() {
				if (ajax.readyState==4) {
					contenedor.innerHTML = ajax.responseText;
					cambiarDisplay('tabla_pais',true);
					cambiarDisplay('espacio_tabla',true);
				}
				else {
					contenedor.innerHTML="<img src='./imagenes/cargando.gif'>";
					cambiarDisplay('tabla_pais',true);
					cambiarDisplay('espacio_tabla',true);
				}			
			}
			ajax.send(null);							
		}
	}	
}

//comprobar correo y guardar datos 
function comprobar_email(mail,contenedor,usu_id) {
	
	var mail1,contenedor2,usu_id1;		
	contenedor2 = document.getElementById(contenedor);	
	//mail1 = document.getElementById('email1').value;
	//mail2 = document.getElementById('email2').value;
	usu_id1=usu_id;
	mail1=mail;
	ajax=nuevoAjax();
	ajax.open("GET", "./funciones/add_formulario.php?id="+usu_id1+"&email="+mail1,true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor2.innerHTML = ajax.responseText;
		}	
	}
	ajax.send(null);		
}

function enviar_password(email) {
	var mail,contenedor;		
	contenedor = document.getElementById('tabla');
	mail=email;
	ajax=nuevoAjax();
	ajax.open("POST", "./funciones/enviar_pass.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("email="+mail);
}

function enviar_comentario(id_sec,id_item,comenta) {
	
	var contenedor;			
	contenedor = document.getElementById('tabla_comentario');
		
	ajax=nuevoAjax();
	ajax.open("POST", "./funciones/enviar_comentario.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("id_sec="+id_sec+"&id_item="+id_item+"&comenta="+comenta);	
}

function enviar_clasificado(categoria,titulo,descripcion,precio,foto,usuario) {	
	var categoria1,titulo1,descripcion1,precio1,foto1,usuario1,contenedor;

	contenedor	= document.getElementById('tabla');
	categoria1	= categoria;
	titulo1		= titulo;
	descripcion1= descripcion;
	precio1		= precio;
	foto1		= foto;
	usuario1	= usuario;		
	ajax		= nuevoAjax();
	ajax.open("POST", "./funciones/enviar_clasificados.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("cat="+categoria1+"&tit="+titulo1+"&des="+descripcion1+"&pvp="+precio1+"&fot="+foto1+"&usu="+usuario1);		
}

function enviar_chatbox(mensaje,user_id) {	
	var mensaje,user_id,contenedor;

	contenedor	= document.getElementById('tabla');
	mensaje1	= mensaje;
	user_id1	= user_id;
	ajax		= nuevoAjax();
	ajax.open("POST", "./funciones/enviar_chatbox.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("mensaje="+mensaje1+"&user_id="+user_id1);
}


function iniciar_sesion(mail,pass) {	
	var password,contenedor,email;	
	contenedor = document.getElementById('tabla_form');
	email=mail;
	password=pass;

	ajax=nuevoAjax();
	ajax.open("POST", "./funciones/iniciar_sesion.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("mail="+email+"&pass="+password);	
}

function recomendar_amigo (mailr,nomr,maild,nomd,url) {	
	var contenedor,jmailr,jnomr,jmaild,jnomd,jurl;
	
	contenedor = document.getElementById('tabla');
	jmailr=mailr;
	jnomr=nomr;
	jmaild=maild;
	jnomd=nomd;
	jurl=url;

	ajax=nuevoAjax();
	ajax.open("POST", "./funciones/enviar_amigo.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("mailr="+jmailr+"&nomr="+jnomr+"&maild="+jmaild+"&nomd="+jnomd+"&url="+jurl);
}

function enviar_voto(encuesta,respuesta,usuario,ip,tipo) {	
	var contenedor;
	
	contenedor	= document.getElementById('tabla_enc');
	
	ajax=nuevoAjax();
	ajax.open("POST", "./funciones/votar_encuesta.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
		}	
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("&encuesta="+encuesta+"&respuesta="+respuesta+"&usuario="+usuario+"&ip="+ip+"&tipo="+tipo);
}

function validar_mail1(usu_id) {

	var txterrores='';
	var error = false;
    var ind1, ind2, ind3, email;	
	
	//email=mail1 = document.getElementById('email1').value;
	email= document.QForm.email1.value;
	ind1 = document.QForm.email1.value.indexOf('@');
	ind2 = document.QForm.email1.value.lastIndexOf('.');
	ind3 = document.QForm.email1.value.lastIndexOf('@');
	
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La direccion de E-mail es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
	} else {
		comprobar_email(email,'contenedor2',usu_id);
	}	
	return;
}

function validar_mail2(usu_id) {

	var txterrores='';
	var error = false;
    var ind1, ind2, ind3, email;	
	
	//email=mail1 = document.getElementById('email2').value;
	email= document.QForm.email2.value;
	ind1 = document.QForm.email2.value.indexOf('@');
	ind2 = document.QForm.email2.value.lastIndexOf('.');
	ind3 = document.QForm.email2.value.lastIndexOf('@');
	
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La direccion de E-mail es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
	} else {
		comprobar_email(email,'contenedor3',usu_id);
	}	
	return;
}

function validar_email() {

	var txterrores='';
	var error = false;
    var ind1, ind2, ind3, email;	
	
	//email= document.getElementById('email').value;
	email= document.QForm.email.value;
	ind1 = document.QForm.email.value.indexOf('@');
	ind2 = document.QForm.email.value.lastIndexOf('.');
	ind3 = document.QForm.email.value.lastIndexOf('@');
	
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		return false;
	} else {
		enviar_password(email);
		return false;
	}	
	return false;
}

function validar_comentario() {

	var txterrores='';
	var error = false;
	var comenta, idcont,tcont;	
	
	id_sec=document.comentario_form.id_sec.value;
	id_item=document.comentario_form.id_item.value;
	comenta= document.comentario_form.limitedtextarea.value;
	
		
	if(document.comentario_form.limitedtextarea.value==''){		
		txterrores+='- Debe escribir su comentario\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.comentario_form.limitedtextarea.focus();
		return false;	
	} else {		
		enviar_comentario(id_sec,id_item,comenta);
		return false;
	}		
	return false;
}

function validar_clasificados() {
	var txterrores='';
	var error = false;
	var categoria,titulo,descripcion,precio,foto,usuario;
	//netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');

	alert(document.getElementById('foto').value);
	
	categoria	= document.QForm.categoria.value;
	titulo		= document.QForm.titulo.value;
	descripcion	= document.QForm.descripcion.value;
	precio		= document.QForm.precio.value;
	foto		= document.QForm.foto.caption;
	usuario		= document.QForm.usuario.value;

	if(document.QForm.titulo.value==''){		
		txterrores+='- Debe escribir el titulo del anuncio\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.titulo.focus();
		return false;	
	} else {
		if(document.QForm.descripcion.value==''){		
			txterrores+='- Debe escribir la descripción del anuncio\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.QForm.descripcion.focus();
			return false;	
		} else {	
			if(document.QForm.precio.value==''){		
				txterrores+='- Debe escribir el precio del anuncio\n';
				alert('Error al procesar el Formulario: \n'+txterrores);
				document.QForm.precio.focus();
				return false;	
			} else {		
				enviar_clasificado(categoria,titulo,descripcion,precio,foto,usuario);				
				return false;
			}
		}		
	}
	return false;
}

function validar_chatbox() {
	var txterrores='';
	var error = false;
	var mensaje;
	
	mensaje=document.QForm.limitedtextarea.value;
	usuario_id=document.QForm.user_id.value;	
	
	if(document.QForm.limitedtextarea.value.length<=0){		
		txterrores+='- Debe escribir su mensaje\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.limitedtextarea.focus();
		return false;	
	} else {
		enviar_chatbox(mensaje,usuario_id);				
		return false;		
	}
	return false;
}

function validar_contrasena() {
	var txterrores='';
	var error = false;
	var cla1,cla2;

	cla1 = document.QForm.password1.value;
	cla2 = document.QForm.password2.value;
	
	if(document.QForm.password1.value=='') {
		txterrores+='- Debe especificar la Contraseña\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.password1.focus();	
		return false;
	}
	else
	{
		if(document.QForm.password2.value=='')
	 	{
			txterrores+='- Debe Repetir la Contraseña\n';
			alert('Error al procesar el Formulario: \n'+txterrores);			
			return false;
		}
		else
		{
			if(cla1 != cla2)
			{
				txterrores+='- Las Contraseñas no son iguales\n';
				alert('Error al procesar el Formulario: \n'+txterrores);
				document.QForm.password1.focus();
				return false;
			}
		}
	}
	
}

function ComprobarEncuesta() { 
	var i;		
	for (i=0;i<document.QForm_enc.opciones.length;i++){
		if (document.QForm_enc.opciones[i].checked){
			respuesta  = document.QForm_enc.opciones[i].value;			
			enviar_voto (document.QForm_enc.encuesta.value,document.QForm_enc.opciones[i].value,document.QForm_enc.usuario.value,document.QForm_enc.ip.value,document.QForm_enc.tipo.value);			
			return false;
		}
    }    	
	return false;
}

function ComprobarForm() {  
	var txterrores='';
	var error = false;
    var ind1, ind2, ind3, ind4;
	var cla1,cla2;
	var mai1,mai2;
	
	if(document.QForm.nombre.value==''){
		txterrores+='- Debe indicar su Nombre\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.nombre.focus();
		return false;	}		
	if(!isNaN(document.QForm.nombre.value)){
		txterrores+='- El Nombre no puede ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.nombre.focus();
		return false;	}	
		
	if(document.QForm.apellido.value=='') {
		txterrores+='- Debe indicar su Apellido\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.apellido.focus();
		return false;	}		
	if(!isNaN(document.QForm.apellido.value)){
		txterrores+='- El Apellido no puede ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.apellido.focus();
		return false;	}
		
	if(document.QForm.cedula.value==''){
		txterrores+='- Debe indicar su Documento de Identidad\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.cedula.focus();
		return false;	}
	if(document.QForm.cedula.value==''){
		txterrores+='- El Documento de Identidad debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.cedula.focus();
		return false;	}
	
	if(document.QForm.dia.value=='null') {
		txterrores+='- Debe indicar su dia de nacimiento\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.dia.focus();
		return false; }
	if(document.QForm.mes.value=='null') {
		txterrores+='- Debe indicar su mes de nacimiento\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.mes.focus();
		return false; }
	if(document.QForm.ano.value=='null') {
		txterrores+='- Debe indicar año de nacimiento\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.ano.focus();
		return false; }		
		
	
	if(!document.QForm.sexo[0].checked && !document.QForm.sexo[1].checked) {
		txterrores+='- Debe especificar su Sexo\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		return false; 	}

	if(document.QForm.pais.value=='100') {
		txterrores+='- Debe especificar el País\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.pais.focus();
		return false; }

	if(document.QForm.pais.value=='200') {	
		if(document.QForm.pais2.value=='') {
			txterrores+='- Debe especificar el País\n';
			alert('Error al procesar el Formulario: \n'+txterrores);	
			document.QForm.pais2.focus();
			return false; }
		
	/*	if(document.QForm.estado2.value=='') {
			txterrores+='- Debe especificar el estado\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.QForm.estado2.focus();
			return false; }	*/
	}	


	
	if(document.QForm.ciudad.value=='') {
		txterrores+='- Debe indicar su ciudad de residencia\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.ciudad.focus();
		return false;	}		
	if(!isNaN(document.QForm.ciudad.value)){
		txterrores+='- Su ciudad de residencia no puede ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.ciudad.focus();
		return false;	}
		
	if(document.QForm.direccion.value=='') {
		txterrores+='- Debe indicar su direccion de residencia\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.direccion.focus();
		return false;	}		
	if(!isNaN(document.QForm.direccion.value)){
		txterrores+='- Su direccion de residencia no puede ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.direccion.focus();
		return false;	}
	
	if(document.QForm.telf.value=='') {
		txterrores+='- Debe indicar su teléfono de residencia\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.telf.focus();
		return false;	}		
	if(isNaN(document.QForm.telf.value)){
		txterrores+='- Su teléfono de residencia debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.telf.focus();
		return false;	}
	
	if(document.QForm.movil.value=='') {
		txterrores+='- Debe indicar su teléfono móvil\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.movil.focus();
		return false;	}		
	if(isNaN(document.QForm.movil.value)){
		txterrores+='- Su teléfono móvil debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.movil.focus();
		return false;	}
		
	ind1 = document.QForm.email1.value.indexOf('@');
	ind2 = document.QForm.email1.value.lastIndexOf('.');
	ind3 = document.QForm.email1.value.lastIndexOf('@');		
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.email1.focus();
		return false;
	}
		
	ind1 = document.QForm.email2.value.indexOf('@');
	ind2 = document.QForm.email2.value.lastIndexOf('.');
	ind3 = document.QForm.email2.value.lastIndexOf('@');		
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo secundaria es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.email2.focus();
		return false;
	}

	mai1 = document.QForm.email1.value;
	mai2 = document.QForm.email2.value;
	
	if(mai1 == mai2)
	{
		txterrores+='- Las direcciones de correos son iguales\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.email1.focus();
		return false;
	}
		
	if(document.QForm.login.value=='') {
		txterrores+='- Debe indicar su nombre de usuario\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.login.focus();
		return false;	}		
	ind4 = document.QForm.login.value.indexOf(' ');	
	if (ind4>=0){
		txterrores+='- El Nombre de Usuario no debe tener espacios en blancos\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.login.focus();
		return false;	}
	
	cla1 = document.QForm.password1.value;
	cla2 = document.QForm.password2.value;
	
	if(document.QForm.password1.value=='') {
		txterrores+='- Debe especificar la Contraseña\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.password1.focus();	
		return false;
	}
	else
	{
		if(document.QForm.password2.value=='')
	 	{
			txterrores+='- Debe Repetir la Contraseña\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.QForm.password2.focus();			
			return false;
		}
		else
		{
			if(cla1 != cla2)
			{
				txterrores+='- Las Contraseñas no son iguales\n';
				alert('Error al procesar el Formulario: \n'+txterrores);
				document.QForm.password1.focus();
				return false;
			}
		}
	}
	
	if(document.QForm.captcha.value=='') {
		txterrores+='- Debe indicar el código de seguridad\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.captcha.focus();
		return false; }	
	
 /*	cap1 = document.QForm.captcha_img.value;
	cap2 = document.QForm.captcha.value;
	
	if(cap1 != cap2) {
		txterrores+='- El código de seguridad no coincide\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.captcha.focus();
		return false;
	} */	
	
	//comprobar_email(mail,contenedor,usu_id);
	return true;
}

function inicio_sesion() { 
	var txterrores='';
	var error = false;

	if(document.form.email.value==''){
		txterrores+='- Debe ingresar su correo electrónico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.form.email.focus();
		return false;
	}	
	if(document.form.password.value=='') {
		txterrores+='- Debe ingresar su Contraseña\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.form.password.focus();	
		return false;
	}
	return true;
}

function inicio_sesion2() {
	var txterrores='';
	var error = false;
	var mail,pass,ind1,ind2,ind3;
	
	mail = document.form_sesion.email.value;
	pass = document.form_sesion.password.value;
	ind1 = document.form_sesion.email.value.indexOf('@');
	ind2 = document.form_sesion.email.value.lastIndexOf('.');
	ind3 = document.form_sesion.email.value.lastIndexOf('@');		
	
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.form_sesion.email.focus();
		return false;
	} else {
		if(document.form_sesion.password.value==''){		
			txterrores+='- Debe escribir su contraseña\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.form_sesion.password.focus();
			return false;	
		} else {		
			iniciar_sesion(mail,pass);
			return false;
		}
	}		
	return false;
}

function enviar_amigo() {
	var txterrores='';
	var error = false;
	var mailr,nomr,maild,nomd,ind1,ind2,ind3,url;

	nomr  = document.QForm.nomr.value;
	mailr = document.QForm.mailr.value;
	nomd  = document.QForm.nomd.value;
	maild = document.QForm.maild.value;	
	url   = document.QForm.url.value;	

	ind1  = document.QForm.mailr.value.indexOf('@');
	ind2  = document.QForm.mailr.value.lastIndexOf('.');
	ind3  = document.QForm.mailr.value.lastIndexOf('@');	
	
	
	if (document.QForm.nomr.value==''){
		txterrores+='- Debe indicar el nombre del remitente\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.nomr.focus();
		return false;
	} else {
		if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
			txterrores+='- La dirección de correo del remitente es invalida\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.QForm.mailr.focus();
			return false;
		} else {
			if (document.QForm.nomd.value==''){
				txterrores+='- Debe indicar el nombre del destinatario\n';
				alert('Error al procesar el Formulario: \n'+txterrores);
				document.QForm.nomd.focus();
				return false;
			} else { 
				ind1  = document.QForm.maild.value.indexOf('@');
				ind2  = document.QForm.maild.value.lastIndexOf('.');
				ind3  = document.QForm.maild.value.lastIndexOf('@');
				if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
					txterrores+='- La dirección de correo del destinatario es invalida\n';
					alert('Error al procesar el Formulario: \n'+txterrores);
					document.QForm.maild.focus();
					return false;	
				} else {		
					recomendar_amigo(mailr,nomr,maild,nomd,url);					
					return false;
				}
			}
		}
	}
	return false;	
}

function ComprobarForm_club(tipo) {  
	var txterrores='';
	var error = false;
    var ind1, ind2, ind3, ind4;
	var cla1,cla2;
	var mai1,mai2;

	if(document.QForm.nombrec.value==''){
		txterrores+='- Debe indicar el Nombre del Club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.nombrec.focus();
		return false;	}							
	
	if(document.QForm.pais.value=='100') {
		txterrores+='- Debe especificar el País\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.pais.focus();
		return false; }

	if(document.QForm.pais.value=='200') {	
		if(document.QForm.pais2.value=='') {
			txterrores+='- Debe especificar el País\n';
			alert('Error al procesar el Formulario: \n'+txterrores);	
			document.QForm.pais2.focus();
			return false; }
		
	/*	if(document.QForm.estado2.value=='') {
			txterrores+='- Debe especificar el estado\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.QForm.estado2.focus();
			return false; }	*/
	}	
	
	if(document.QForm.ciudad.value=='') {
		txterrores+='- Debe indicar la ciudad de fundación\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.ciudad.focus();
		return false;	}		
	if(!isNaN(document.QForm.ciudad.value)){
		txterrores+='- Su ciudad de fundación no puede ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.ciudad.focus();
		return false;	}
	
	ind1 = document.QForm.email1.value.indexOf('@');
	ind2 = document.QForm.email1.value.lastIndexOf('.');
	ind3 = document.QForm.email1.value.lastIndexOf('@');		
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo del Club es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.email1.focus();
		return false;
	}

	if(document.QForm.personas.value=='') {
		txterrores+='- Debe indicar la cantidad de personas que participan en su club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.personas.focus();
		return false; }		
	if(isNaN(document.QForm.personas.value)){
		txterrores+='- La cantidad de personas debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.personas.focus();
		return false; }
	
	if(document.QForm.carros.value=='') {
		txterrores+='- Debe indicar la cantidad de vehículos que participan en su club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.carros.focus();
		return false; }		
	if(isNaN(document.QForm.carros.value)){
		txterrores+='- La cantidad de vehículos debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.carros.focus();
		return false; }

	if(document.QForm.fundacion.value=='') {
		txterrores+='- Debe indicar el año de fundación de su club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.fundacion.focus();
		return false; }		
	if(isNaN(document.QForm.fundacion.value)){
		txterrores+='- El año de fundación de su club debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.fundacion.focus();
		return false; }

	if (tipo=='a'){
		if(document.QForm.archivo.value=='') {
			txterrores+='- Debe adjuntar el Logo del Club\n';
			alert('Error al procesar el Formulario: \n'+txterrores);
			document.QForm.archivo.focus();
			return false; 
		}
	}
		
	if(document.QForm.resena.value=='') {
		txterrores+='- Debe indicar una amplia reseña de su Club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.resena.focus();
		return false;	}	

	
	if(document.QForm.nombrep.value==''){
		txterrores+='- Debe indicar el Nombre del Presidente Club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.nombrep.focus();
		return false;	}

	if(document.QForm.telfp.value=='') {
		txterrores+='- Debe indicar el teléfono del Presidente del Club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.telfp.focus();
		return false;	}		
	if(isNaN(document.QForm.telfp.value)){
		txterrores+='- El teléfono del Presidente del Club debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.telfp.focus();
		return false;	}
	
	ind1 = document.QForm.emailp.value.indexOf('@');
	ind2 = document.QForm.emailp.value.lastIndexOf('.');
	ind3 = document.QForm.emailp.value.lastIndexOf('@');		
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo del Presidente del Club es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.emailp.focus();
		return false;
	}

	if(document.QForm.nombrev.value==''){
		txterrores+='- Debe indicar el Nombre del Vicepresidente Club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.nombrev.focus();
		return false;	}

	if(document.QForm.telfv.value=='') {
		txterrores+='- Debe indicar el teléfono del Vicepresidente del Club\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.telfv.focus();
		return false;	}		
	if(isNaN(document.QForm.telfv.value)){
		txterrores+='- El teléfono del Vicepresidente del Club debe ser numérico\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.telfv.focus();
		return false;	}
	
	ind1 = document.QForm.emailv.value.indexOf('@');
	ind2 = document.QForm.emailv.value.lastIndexOf('.');
	ind3 = document.QForm.emailv.value.lastIndexOf('@');		
	if ((ind1<=0) || (ind2<ind1) || (ind3 != ind1)){
		txterrores+='- La dirección de correo del Vicepresidente del Club es invalida\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.emailv.focus();
		return false;
	}
	
	if(document.QForm.captcha.value=='') {
		txterrores+='- Debe indicar el código de seguridad\n';
		alert('Error al procesar el Formulario: \n'+txterrores);
		document.QForm.captcha.focus();
		return false; }	

	return true;
}

function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}