// POPUP PERSONALIZADO

function Popup(url,ancho,largo,barras){

var r_ancho=screen.width;

var r_largo=screen.height;

var top=(r_largo/2)-(largo/2);

var left=(r_ancho/2)-(ancho/2);

var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+barras+",resizable=no,width="+ancho+",height="+largo+",top="+top+"+,left="+left;

window.open(url,"",opciones);

}

// FIN POPUP PERSONALIZADO

// FUNCXIONES DW

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];}

}

// FIN FUNCIONES DW

// FUNCION VALIDAD FORMULARIO LOGIN

function validar(formulario){

  if (formulario.email.value.length < 1)

  {

    alert("ERROR: Debes ingresar la dirección de e-mail\n con la que te registraste en el sitio.");

    formulario.email.focus();

    return (false);

  }

  if (formulario.clave.value.length < 1)  {

    alert("ERROR: No ingresaste tu contraseña.");

    formulario.clave.focus();

    return (false);

  }

  return(true)

}

// FIN FUNCION VALIDAR FORMULARIO LOGIN



// VALIDAR CONTRASEÑA - CAMBIO DE CONTRASEÑA

function validar_contrasenia(form){

 if (form.clave_vieja.value=="")

 {

  alert ("ERROR: Debes ingresar tu contraseña actual.");

  form.clave_vieja.focus();

  return (false); 

 }

 if (form.clave_nueva1.value.length<=5)

 {

  alert ("ERROR: La nueva contraseña debe tener un mínimo de 6 caracteres.");

  form.clave_nueva1.focus();

  return (false); 

 }

 if (form.clave_nueva1.value!=form.clave_nueva2.value)

 {

  alert ("ERROR: La nueva contraseña no coincide con la confirmación.");

  form.clave_nueva2.focus();

  return (false); 

 }

return (true);

}

// FIN VALIDAR CONTRASEÑA - CAMBIO DE CONTRASEÑA



//  VALIDAR USUARIOS - MI PERFIL - PROVINCIA - PAIS

function validar_miperfil(form){

if (form.nombre.value==""){

 alert ("ERROR: El campo nombre es obligatorio.");

 form.nombre.focus();

 return (false);

 }

 if (form.apellido.value==""){

 alert ("ERROR: El campo apellido es obligatorio.");

 form.apellido.focus();

 return (false);

 }

 

 if (form.sexo[0].checked==false && form.sexo[1].checked==false) {

 alert ("ERROR: Debes seleccionar tu sexo.");

 return (false);

 }

 if (form.dia.value=="")

 {

 alert ("ERROR: El día de la fecha de nacimiento es obligatorio.");

 form.dia.focus();

 return (false);

 }

if (form.mes.value=="")

 {

 alert ("ERROR: El mes de la fecha de nacimiento es obligatorio.");

 form.mes.focus();

 return (false);

 }

 if (form.anio.value=="")

 {

 alert ("ERROR: El año de la fecha de nacimiento es obligatorio.");

 form.anio.focus();

 return (false);

 }

 if (form.dni.value=="")

 {

 alert ("ERROR: El campo DNI es obligatorio.");

 form.dni.focus();

 return (false);

 }



  if (form.telefono_fijo1.value=="" && form.celular.value=="")

 {

 alert ("ERROR: Debes ingresar un teléfono fijo y/o un teléfono celular.");

 form.telefono_fijo1.focus();

 return (false);

 }

  if (form.localidad.value=="")

 {

 alert ("ERROR: Tu localidad es obligatoria.");

 form.localidad.focus();

 return (false);

 }

  if (form.direccion.value=="")

 {

 alert ("ERROR: Tu dirección es obligatoria.");

 form.direccion.focus();

 return (false);

 }

 if (form.codpostal.value=="")

 {

 alert ("ERROR: El código postal es obligatorio.");

 form.codpostal.focus();

 return (false);

 }

return (true);

}



function pais_change(){

if(form.pais[form.pais.selectedIndex].value!="ARGENTINA")

 {

  form.provincia.disabled=1;

  form.barrio.disabled=1;

 }

 else

 {

  form.provincia.disabled=0;

  form.barrio.disabled=0;

 }

}





function provincia_change(){

if(form.provincia[form.provincia.selectedIndex].value!="CORDOBA")

 {

  form.barrio.disabled=1;

 }

 else

 {

  form.barrio.disabled=0;

 }

}

// FIN VALIDAR USUARIOS - MI PERFIL - PROVINCIA - PAIS



// VALIDAR USUAIROS MIS-DATOS

function validar_misdatos(form){

if (form.estudia[0].checked==true)

 {

  if (form.lugar_estudia.value=="")

  {

  alert ("ERROR: Debes ingresar el lugar en donde estudias.");

  form.lugar_estudia.focus();

  return (false);

  }

  if (form.carrera_estudia.value=="")

  {

  alert ("ERROR: Debes ingresar la carrera que estudias.");

  form.carrera_estudia.focus();

  return(false)

  }

}



if (form.trabaja[0].checked==true)

 {

  if (form.empresa.value=="")

  {

  alert ("ERROR: Debes ingresar la empresa en donde trabajas.");

  form.empresa.focus();

  return (false);

  }

  if (form.cargo.value=="")

  {

  alert ("ERROR: Debes ingresar el cargo que tienes en tu trabajo.");

  form.cargo.focus();

  return(false)

  }

   if (form.ocupacion.value=="")

  {

  alert ("ERROR: Debes ingresar la ocupación que tienes en tu trabajo.");

  form.ocupacion.focus();

  return(false)

  }

}



if (form.tiene_tarjeta[0].checked==true)

 {

  if (form.nombre_tarjeta.value=="")

  {

  alert ("ERROR: Debes seleccionar una tarjeta de crédito.");

  form.nombre_tarjeta.focus();

  return (false);

 }

}

return (true);

}

// FIN VALIDAR USUARIOS MISDATOS



// VALIDAR REGISTRO

function validar_reg(formulario){

if (formulario.email1.value=="")

{

alert("ERROR: Debes ingresar tu dirección de e-mail.");

formulario.email1.focus();

return (false);

}



if (formulario.email1.value.length > 1)

  {

    if ((formulario.email1.value.indexOf ('@', 0) == -1)||(formulario.email1.value.length < 5)) { 

    alert("ERROR: Debes ingresar una dirección de e-mail válida."); 

    formulario.email1.focus();

    return (false);

	} 

  }

  if (formulario.email1.value != formulario.email2.value)

   {

   alert ("ERROR: La dirección de e-mail que ingresaste no coincide con la confirmación.");

   formulario.email2.focus();

   return (false);

   }

  if (formulario.comentarios.value=="")

   {

   alert("ERROR: Debes ingresar tus comentarios acerca de ilpaparazzi.com.");

   formulario.comentarios.focus();

   return (false);

   }

  return (true);

}

// FIN VALIDAR REGISTRO



// VALIDAR SMS

function validar_sms(form){

 if (form.celular.value.length!=10)

 {

  alert ("ERROR: El número de celular debe ser de la forma cod. de área sin el 0 + número de celular sin el 15 y sin espacios.");

  form.celular.focus();

  return (false); 

 }

 if (form.prestadora[0].checked!=true && form.prestadora[1].checked!=true && form.prestadora[2].checked!=true && form.prestadora[3].checked!=true)

 {

  alert ("ERROR: Debes seleccionar tu empresa prestadora de telefonia celular.");

  return (false);

 }

return (true);

}

// FIN VALIDAR SMS



// VALIDAR CONSULTA

function validar_consulta(){	

	if (form.nombre.value==""){

		alert ("ERROR: Debes ingresar tu nombre.");

		form.nombre.focus();

		return (false);

	}

	

	if (form.apellido.value==""){

		alert ("ERROR: Debes ingresar tu apellido.");

		form.apellido.focus();

		return (false);

	}

	

	if (form.email_f.value==""){

		alert ("ERROR: Debes ingresar tu e-mail.");

		form.email_f.focus();

		return (false);			

	}

	

	if (form.email_f.value.length > 1){

    	if ((form.email_f.value.indexOf ('@', 0) == -1)||(form.email_f.value.length < 5)) { 

    		alert("ERROR: Debes ingresar una dirección de e-mail válida."); 

    		form.email_f.focus();

    		return (false);

		} 

  	}

	

	if (form.consulta.value==""){

		alert("Debes ingresar tu consulta.");

		form.consulta.focus();

		return (false);		

	}

	

return (true);

}



function validar_recomendarNota(){	

	if (form.nombre_r.value==""){

		alert ("ERROR: Debes ingresar tu nombre.");

		form.nombre_r.focus();

		return (false);

	}

		

	if (form.email_r.value==""){

		alert ("ERROR: Debes ingresar tu dirección de e-mail.");

		form.email_r.focus();

		return (false);

	}

	

	

	if (form.email_r.value.length > 1){

    	if ((form.email_r.value.indexOf ('@', 0) == -1)||(form.email_r.value.length < 5)) { 

    		alert("ERROR: La dirección de e-mail qie ingresaste no es una dirección de e-mail válida."); 

    		form.email_r.focus();

    		return (false);

		} 

  	}

	

	if (form.nombre_d.value==""){

		alert ("ERROR: Debes ingresar el nombre de tu amigo.");

		form.nombre_d.focus();

		return (false);

	}

	

	if (form.email_d.value==""){

		alert ("ERROR: Debes ingresar la dirección de e-mail de tu amigo.");

		form.email_d.focus();

		return (false);

	}

	

	if (form.email_d.value.length > 1){

    	if ((form.email_d.value.indexOf ('@', 0) == -1)||(form.email_d.value.length < 5)) { 

    		alert("ERROR: La dirección de e-mail de tu amigo que ingresaste no es válida");

    		form.email_d.focus();

    		return (false);

		} 

  	}	

		

return (true);

}

// FIN VALIDAR CONSULTA

//FOTOS-----------------------------------------------------

function ILP_ampliarFoto(id_foto,start,id_lugar,id_evento,fechaFotos,w,h,amigo){

	var url = 'includes/fotos/player.php?foto_sel='+id_foto+'&id_lugar='+id_lugar+'&id_evento='+id_evento+'&fechaFotos='+fechaFotos+'&start='+start+'&amigo='+amigo;

	Popup(url,500,h,'no');	

}



function ILP_contacto(nombre,apellido,email,consulta){

	var url='includes/comunes/contacto.php?nombre='+nombre+'&apellido='+apellido+'&email='+email+'&consulta='+consulta;

	Popup(url,382,490,'yes');	

}



function ILP_irAFotos(){

	var id=document.form.lugar.value;

	if (id!=""){

		location.href='fotos_verfotos.php?id_lugar='+id;

	}

}

// FIN FOTOS------------------------------------------------



// MICROSITIOS

function ILP_micrositio(id){

	Popup('micrositio.php?id='+id,300,200,'yes');	

}



function ILP_invitaAmigos(id){

	Popup('includes/lqviene/invitar_amigos.php?id='+id,355,250,'no');

}

function ILP_invitaAmigos2(id){

	Popup('includes/lqviene/invitar_amigos2.php?id='+id,355,250,'no');

}





