function ValidarCamposUsuario()
{
	
	if(document.getElementById('nombre').value=="")
	{
		alert('Por favor indique su nombre completo');
		document.getElementById('nombre').focus(); return;
	}
	
	/*if(document.getElementById('dia').value=="")
	{
		alert('Por favor indique día de su nacimiento');
		document.getElementById('dia').focus(); return;
	}
	
	if(document.getElementById('mes').value=="")
	{
		alert('Por favor indique mes de su nacimiento');
		document.getElementById('mes').focus(); return;
	}
	if(document.getElementById('anio').value=="")
	{
		alert('Por favor indique año de su nacimiento');
		document.getElementById('anio').focus(); return;
	}*/
	/*if(document.getElementById('sexo').value=="")
	{
		alert('Por favor indique si es hombre o mujer');
		document.getElementById('sexo').focus(); return;
	}*/
	
	if(document.getElementById('email').value=="")
	{
		alert('Por favor indique su email');
		document.getElementById('email').focus(); return;
	}
	
	var E=document.getElementById('email').value;
	if(E.value!="")
	{
		var N=E.length;
		var P=E.indexOf("@");

		 if(!((N>0)&&(P>0)&&(P< N-1)))
		{
			alert("Email invalido");
		    document.getElementById('email').focus(); return;
		}
	}
	
	if(E.value!="")
	{
		var descopisicion_email=E.split("@")
		var vec1=descopisicion_email[1];
		var descomp2=vec1.split(".");
		var vec2=descomp2[1];
		
		if(vec2==undefined || descomp2[1]=="")
		{
			alert("Email invalido");
		    document.getElementById('email').focus(); return;
		}
	}
	if(document.getElementById('login').value=="")
	{
		alert('Por favor indique su apado o sobre nombre');
		document.getElementById('login').focus(); return;
	}
	if(document.getElementById('password').value=="")
	{
		alert('Por favor indique su contraseña');
		document.getElementById('password').focus(); return;
	}
	
	if(document.getElementById('v_idpais').value=="")
	{
		alert('Por favor indique su país');
		document.getElementById('v_idpais').focus(); return;
	}
	if(document.getElementById('ciudad').value=="")
	{
		alert('Por favor indique su ciudad');
		document.getElementById('ciudad').focus(); return;
	}
}

function ValidarLoguearse()
{
	if(document.getElementById('usuario').value=="")
	{
		alert('Por favor indique su apado o sobre nombre');
		document.getElementById('usuario').focus(); return;
	}
	if(document.getElementById('passw').value=="")
	{
		alert('Por favor indique su contraseña');
		document.getElementById('passw').focus(); return;
	}		
}

function mostrar_fotos_destacada(obj) 
{
  if(document.getElementById){
    var el = document.getElementById(obj);
    if(el.style.display != "block"){
      el.style.display = "block";
    }else{
      el.style.display = "none";
    }
  }
  
  document.getElementById('tipo_public').value=1;
}

function mostrar_foto_basica(obj) 
{
  if(document.getElementById)
  {
    var el = document.getElementById(obj);
    if(el.style.display == "block")
	{
     el.style.display = "none";
    }
  }
   document.getElementById('tipo_public').value=2;
}

function CalcularElMonto()
{
	var tipo_public=document.getElementById('tipo_public');	
	var tipo_public=tipo_public.value;
	
	
	
	var tiempo=document.getElementById('tiempo');
	var tiempo=tiempo.value;
	var importe_apagar=document.getElementById('importe_apagar');
	if(tipo_public==1)
	{
	var importe_apagar=importe_apagar.value=parseInt(tiempo)*5;
	}
	else
	{
		var importe_apagar=importe_apagar.value=parseInt(tiempo)*2;
	}
}

function ValidarCamposArticulos()
{		
		if(document.getElementById('hijo').value=="")
		{
				alert('Elija una categoría');
				document.getElementById('hijo').focus(); return;
		}
		
		if(document.getElementById('v_titulo').value=="")
		{
				alert('Inserte el título del anuncio');
				document.getElementById('v_titulo').focus(); return;
		}
	
		if(document.getElementById("descripcion").value=="")
		{
			alert('Inserte el contenido del anuncio');
			document.getElementById('descripcion').focus(); return;
		}
		
		if(document.getElementById("tpalabras").value<35)
		{
			alert('Descripción: tiene que tener mínimo 35 palabras');
			document.getElementById('cpalabras').focus(); return;
		}
		
}

function PasarIdFormaPago(id)
{
		document.getElementById("forma_pago").value=id;
}

function ValidarCamposContacto()
{
	
	if(document.getElementById('nombre').value=="")
	{
		alert('Por favor indique su nombre completo');
		document.getElementById('nombre').focus(); return;
	}
	
	if(document.getElementById('email').value=="")
	{
		alert('Por favor indique su email');
		document.getElementById('email').focus(); return;
	}
	
	var E=document.getElementById('email').value;
	if(E.value!="")
	{
		var N=E.length;
		var P=E.indexOf("@");

		 if(!((N>0)&&(P>0)&&(P< N-1)))
		{
			alert("Email invalido");
		    document.getElementById('email').focus(); return;
		}
	}
	
	if(E.value!="")
	{
		var descopisicion_email=E.split("@")
		var vec1=descopisicion_email[1];
		var descomp2=vec1.split(".");
		var vec2=descomp2[1];
		
		if(vec2==undefined || descomp2[1]=="")
		{
			alert("Email invalido");
		    document.getElementById('email').focus(); return;
		}
	}
	if(document.getElementById('mensaje').value=="")
	{
		alert('Por favor escriba mensaje');
		document.getElementById('mensaje').focus(); return;
	}
}

function MostrarOcultar(obj,enlace)
{
	var el = document.getElementById(obj);
	var treg=document.getElementById('treg');
	
	var enlace=document.getElementById(enlace);
	
	var treg=treg.value;
	for(i=1;i<=treg;i++)
	{
			var enl="enlace"+i;
			var enlac=document.getElementById(enl);

			var id=document.getElementById(i);
			
			/*//Sirve para ocultar y mostrar subcategoria por ahora no ocupo, cuando se ha necesario solo hay que habilitar
			if(id.style.display=="block")
			{
					id.style.display="none";
			}
			if(el.id)
			{
				el.style.display="block";
			}*/
			
			//Para cambiar el color del link activa
			if(enlac.id)
			{
				enlac.style.background="#E8E8E8";
			}
			if(enlace.id)
			{
				enlace.style.background="#E96421";
			}
			
	}
}

/*
//Sirve para cambiar fonfo de link de subcategoria, cuando se ha necesario hay que habilitar por ahora no ocupo

function CambiarFondoLinl(idhijo,obj)
{
	var thijo=document.getElementById('thijo');
	var v=document.getElementById(idhijo);

	var thijo=thijo.value;
	for(i=1;i<=thijo;i++)
	{
				var va="idhijo"+i+obj;
				var ac=document.getElementById(va);
				
				//Para cambiar el color del link activa
				if(ac)
				{
					ac.style.background="#E8E8E8";
				}
				
				if(v.id)
				{
					v.style.background="#FFFFFF";
				}
	}
}
*/
function InterCambiarImagen(valor1,valor2)
{
	var vf1=document.getElementById(valor1);
	var vf2=document.getElementById(valor2);
	
	if(vf1.id)
	{
		vf1.style.display="none";
	}
	
	if(vf2.id)
	{
		vf2.style.display="block"	
	}
	
}

function InterCambiarImagen2(valor1,valor2)
{
	var vf1=document.getElementById(valor1);
	var vf2=document.getElementById(valor2);
	
	if(vf1.id)
	{
		vf1.style.display="block";
	}
	if(vf2.id)
	{
		vf2.style.display="none"	
	}
	
}

function CambiarFondoMenu1(v1,v2,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v2=document.getElementById(v2);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v1.id)
	{
		v1.style.background="url(images/bt_bg.gif)";
		v1.style.color= "#d34124"; 
		v1.style.repeat="no-repeat";
		v1.style.decoration="none";
	}
	if(v2.id)
	{
		v2.style.background="none";
		v2.style.color= "#FFFFFF";
		v2.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu1_1(v1,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v1.id)
	{
		v1.style.background="url(images/bt_bg.gif)";
		v1.style.color= "#d34124"; 
		v1.style.repeat="no-repeat";
		v1.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu2(v1,v2,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v2=document.getElementById(v2);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v2.id)
	{
		v2.style.background="url(images/bt_bg.gif)";
		v2.style.color= "#d34124"; 
		v2.style.repeat="no-repeat";
		v2.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}
function CambiarFondoMenu3(v1,v2,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v2=document.getElementById(v2);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v3.id)
	{
		v3.style.background="url(images/bt_bg.gif)";
		v3.style.color= "#d34124"; 
		v3.style.repeat="no-repeat";
		v3.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v2.id)
	{
		v2.style.background="none";
		v2.style.color= "#FFFFFF";
		v2.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu3_1(v1,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v3.id)
	{
		v3.style.background="url(images/bt_bg.gif)";
		v3.style.color= "#d34124"; 
		v3.style.repeat="no-repeat";
		v3.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu4(v1,v2,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v2=document.getElementById(v2);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v4.id)
	{
		v4.style.background="url(images/bt_bg.gif)";
		v4.style.color= "#d34124"; 
		v4.style.repeat="no-repeat";
		v4.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v2.id)
	{
		v2.style.background="none";
		v2.style.color= "#FFFFFF";
		v2.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu4_1(v1,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v4.id)
	{
		v4.style.background="url(images/bt_bg.gif)";
		v4.style.color= "#d34124"; 
		v4.style.repeat="no-repeat";
		v4.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu5(v1,v2,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v2=document.getElementById(v2);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v5.id)
	{
		v5.style.background="url(images/bt_bg.gif)";
		v5.style.color= "#d34124"; 
		v5.style.repeat="no-repeat";
		v5.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v2.id)
	{
		v2.style.background="none";
		v2.style.color= "#FFFFFF";
		v2.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu5_1(v1,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v5.id)
	{
		v5.style.background="url(images/bt_bg.gif)";
		v5.style.color= "#d34124"; 
		v5.style.repeat="no-repeat";
		v5.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v6.id)
	{
		v6.style.background="none";
		v6.style.color= "#FFFFFF";
		v6.style.decoration="none";
	}
}

function CambiarFondoMenu6(v1,v2,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v2=document.getElementById(v2);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v6.id)
	{
		v6.style.background="url(images/bt_bg.gif)";
		v6.style.color= "#d34124"; 
		v6.style.repeat="no-repeat";
		v6.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	if(v2.id)
	{
		v2.style.background="none";
		v2.style.color= "#FFFFFF";
		v2.style.decoration="none";
	}
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
}
function CambiarFondoMenu6_1(v1,v3,v4,v5,v6)
{
	var v1=document.getElementById(v1);
	var v3=document.getElementById(v3);
	var v4=document.getElementById(v4);
	var v5=document.getElementById(v5);
	var v6=document.getElementById(v6);
	if(v6.id)
	{
		v6.style.background="url(images/bt_bg.gif)";
		v6.style.color= "#d34124"; 
		v6.style.repeat="no-repeat";
		v6.style.decoration="none";
	}
	if(v1.id)
	{
		v1.style.background="none";
		v1.style.color= "#FFFFFF";
		v1.style.decoration="none";
	}
	
	if(v3.id)
	{
		v3.style.background="none";
		v3.style.color= "#FFFFFF";
		v3.style.decoration="none";
	}
	if(v4.id)
	{
		v4.style.background="none";
		v4.style.color= "#FFFFFF";
		v4.style.decoration="none";
	}
	if(v5.id)
	{
		v5.style.background="none";
		v5.style.color= "#FFFFFF";
		v5.style.decoration="none";
	}
}

//TEXTO LUMINOSO
//
//Este script y otros muchos pueden
//descarse on-line de forma gratuita
//en El Código: www.elcodigo.com
 
//control de version del navegador
var ns6 = document.getElementById && !document.all
var ie = document.all
 
//velocidad del tembleque
var velocidad = 180
 
//indice para el array de colores
var salto = 1
var indiceColor = 0
 
//array de colores
//especificar aqui los colores deseados
var color = new Array("#FF0000", "#FF0000", "#000000", "#000000", "#000000")
 
//limites del desplazamiento
var limiteInferior = 0
var limiteSuperior = color.length
 
//contenedor del texto
var objetoTexto
 
//inicia el movimiento
function moverColor() {
 
   //actualiza indice
   indiceColor += salto
 
   //cambio sentido movimiento
   if ( indiceColor == limiteInferior || indiceColor == limiteSuperior )
      salto *= -1
   
   objetoTexto.style.color = color[ indiceColor ]
}
 
function inicia() {
   if (ie)
      objetoTexto = document.all.textoluminoso
   else if (ns6)
      objetoTexto = document.getElementById("textoluminoso")
   else			//no soportado, finaliza ejecucion
   	return
 
   //inicializacion
   objetoTexto.style.color = color[ indiceColor ]
 
   //comienza el movimiento
   setInterval("moverColor()", velocidad)
}
 
//window.onload = inicia


function MostrarMensajeIniciaSession(obj)
{
  if(document.getElementById(obj))
  {
    var el = document.getElementById(obj);
    if(el.style.display != "block")
	{
      el.style.display = "block";
    }
	else
	{
      el.style.display = "none";
    }
  }
}
