	//VARIABLES GLOBALES
	var usuarios = new Array(500);
	var emails = new Array(500);
	var filter=/^[A-Za-z][A-Za-z0-9_.-]*@[A-Za-z0-9_.-]+\.[A-Za-z0-9_.-]+[A-za-z]$/;
	var continuar;
	var tope;
	e_roja = new Image
	e_gris = new Image
	e_blan = new Image
	e_medi = new Image
	e_roja.src = "images/estrella_roja.jpg";
	e_gris.src = "images/estrella_gris.jpg";
	e_blan.src = "images/estrella_blanca.jpg";
	e_medi.src = "images/estrella_mitad.jpg";	


	//CREAR SWF INTRO DEFAULT.ASP
	function creaswf(archivo) { 
		  var ancho = 0
		  var alto = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			ancho = window.innerWidth;
			alto = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			ancho = document.documentElement.clientWidth;
			alto = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			ancho = document.body.clientWidth;
			alto = document.body.clientHeight;
		  }	 
		  //alert('ancho: '+ancho+'');
		  //alert('alto: '+alto+'');
		  //alert('archivo: '+archivo+'');
		  
         document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=9,0,28,0" width='+ancho+' height='+alto+'>\n');
         document.write('<param name="movie" value='+archivo+'>\n');
         document.write('<param name="quality" value=high>\n');
		 document.write('<embed src='+archivo+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+'></embed>');
         document.write('</object>');    	
	}; //CREA_SWF
	
	//FUNCIONES PARA DERECHO.ASP
	function creaswf_banners(archivo,anc,alt) { 
		 var ancho = parseInt(anc);
		 var alto = parseInt(alt);		  
         document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=9,0,28,0" width='+ancho+' height='+alto+'>\n');
         document.write('<param name="movie" value='+archivo+'>\n');
         document.write('<param name="quality" value=high>\n');
         document.write('<param name="wmode" value="opaque"/>\n');		 			 
         document.write('<embed src='+archivo+' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+' wmode="opaque"></embed>');
         document.write('</object>');    	
	}; 	//funcion para crear los banners
	
	//FUNCIOONES PARA INDEX.ASP	
	function check_login(){
		continuar = false;
		check_usuario()
		if(continuar == false){return false}		
		check_password()
		if(continuar == false){return false}
		
		return true
	};	//FUNCION CHECK_LOGIN
	function check_usuario(){
		if(document.form_login.usuario.value.length == ""){
			alert("El nombre de usuario no puede ir vacio");		
			document.form_login.usuario.style.border = "1px solid #FF0000";
			document.form_login.usuario.focus();
			continuar = false;
		}else{
			continuar = true;
			document.form_login.usuario.style.border = "1px solid #CCCCCC";
		}
	};	//FUNCION CHECK_USUARIO		
	function check_password(){
		if(document.form_login.password.value.length == ""){
			alert("El password no puede ir vacio");
			document.form_login.password.style.border = "1px solid #FF0000";
			document.form_login.password.focus();
			continuar = false;
		}else{
			continuar = true;
			document.form_login.password.style.border = "1px solid #CCCCCC";
		}				
	}; //FUNCION CHECK_PASSWORD
	function wrongpassword(){
		if(document.form_login.wrongpassword.value =="1"){
			alert('El nombre de usuario o password no son correctos');
		}else{
			document.form_buscar.busqueda.focus();
		}
	}; //FUNCION WRONG PASSWORD
	function abrir_porta(id){
		
		document.manda_portafolio.id_portafolio.value = id
		document.manda_portafolio.submit();
	}; // FUNCION ABRIR_PORTA
	function fotodia(){
		document.frm_fotodia.submit();	
	}; //funcion FOTODIA
	function gotopage(page){
		var qpage = parseInt(page);
		document.form_buscar.pagina.value = qpage;
		document.form_buscar.busqueda.value = document.form_buscar.bsqueda.value;		
		document.form_buscar.submit();
	}//FUNCION SIGUIENTE PAGINA
	function suscribirse(){
		continuar = false;
		check_email_v2();
		if(continuar==true){			
			document.registro.email.value;			
			top.frames['guarda_supscripcion'].location.href='suscribete.asp?qmail='+document.registro.email.value+'';
			document.registro.email.style.border = "1px solid #000000";
			alert('Te damos las gracias por suscribirte');
		}
	};//FUNCION SUSCRIBIRSE
	function check_email_v2(){	
		var email
		//alert('email');
		email = document.registro.email.value;	
		if(email.length==""){
			alert("Es necesario que nos proporciones una direccion de correo");
			document.registro.email.style.border = "1px solid #FF0000";
			document.registro.email.focus();
			continuar = false;
		}else{			
			if (!filter.test(email))
				{
					document.registro.email.style.border = "red";
					alert("La dirección de correo que ingresastes no es válida");
					document.registro.email.style.border = "1px solid #FF0000";
					document.registro.email.focus();					
					continuar = false;
				}else{						
					document.registro.email.style.border = "1px solid #000000";						
					continuar = true;									
				}	
		}					
	};//FUNCION CHECKMAIL SOLO PARA CABECERA
	function show(){
		qhacer = document.fr_mostrar.seses.value;
		if(qhacer=="0"){
			x = document.getElementById('signin_menu2');
			x.style.display = '';
			document.fr_mostrar.seses.value = '1';
		}else{		
			x = document.getElementById('signin_menu2');
			x.style.display = 'none';
			document.fr_mostrar.seses.value = '0';		
		}
	};//FUNCION PARA MOSTRAR Y DESAPARECER EL CUADRO LOGIN
		
	//FUNCIONES PARA REGISTRO.ASP
	function validar()
		{	
		//alert('validar');
		continuar = false;	
		edad = document.registro.edad.value;
		profesion = document.registro.profesion.value;
		pais = document.registro.pais.value;
		if(document.registro.hayusers.value=="true"){
			check_nick();
			if(continuar==false){return false}
		}
		
		check_pass();
		if(continuar==false){return false}
		check_email();
		if(continuar==false){return false}
		check_nombre();	
		if(continuar==false){return false}					
		if (edad=='0'){
			alert('Es necesario que selecciones en que rango pertece tu edad');
			document.registro.edad.style.border = "1px solid #FF0000";
			document.registro.edad.focus();			
			return false
		}else{
			document.registro.edad.style.border = "1px solid #000000";
		}		
		if (profesion=='0'){
			alert('Es necesario que selecciones alguna de las opciones que más se asemejen a tu profesion');
			document.registro.profesion.style.border = "1px solid #FF0000";
			document.registro.profesion.focus();			
			return false
		}else{
			document.registro.profesion.style.border = "1px solid #000000";
		}
		if (pais=='0'){
			alert('Es necesario que selecciones a que pais perteneces');
			document.registro.pais.style.border = "1px solid #FF0000";
			document.registro.pais.focus();			
			return false
		}else{			
			document.registro.pais.style.border = "1px solid #000000";
		}
		if (document.registro.check.checked){
			document.registro.notificar.value = "SI";
		}else{
			document.registro.notificar.value = "NO";
		}		
		return true
		}; //FUNCION VALIDAR
	function check_nick(){
		if (document.registro.nick.value.length == ""){
			alert('Es necesario que nos proporciones tu nombre de usuario');
			document.registro.nick.style.border= "1px solid #FF0000";
			document.registro.nick.focus();			
			continuar = false;
		}else{								
			for(i=0;i<=tope-1;i++){
				//alert('usuario'+usuarios[i]+'='+document.registro.nick.value+'?');
				if(usuarios[i]==document.registro.nick.value){
					alert('El nombre de usuario que has elegido no se encuentra disponible, elige otro nombre de usuario');		
					document.registro.nick.style.border= "1px solid #FF0000";								
					document.registro.nick.focus();	
					var nic = document.getElementById("id_nick");
					nic.style.display = 'none';						
					continuar = false;		
					break;				
				}else{
					document.registro.nick.style.border = "1px solid #000000";	
					var nic = document.getElementById("id_nick");
					nic.style.display = '';								
					continuar = true;									
				}
			}
		}
	}; //FUNCION CHECK_NICK
	function check_pass(){	
		var pass1 = document.registro.password1.value;	
		if (pass1.length==""){
			alert('Es neceario que proporciones un password');
			document.registro.password1.style.border = "1px solid #FF0000";	
			document.registro.password2.style.border = "1px solid #FF0000";	
			document.registro.password1.focus();	
			var id = document.getElementById("id_pass1");
			var id2 = document.getElementById("id_pass2");
			id.style.display = 'none';
			id2.style.display = 'none';						
			continuar = false;	
		}else{					
			if(document.registro.password1.value!=document.registro.password2.value){
				document.registro.password1.style.border = "1px solid #FF0000";		
				document.registro.password2.style.border = "1px solid #FF0000";							
				alert('los passwords no coinciden, favor de verificar');	
				document.registro.password1.focus();
				var id = document.getElementById("id_pass1");
				var id2 = document.getElementById("id_pass2");
				id.style.display = 'none';
				id2.style.display = 'none';				
				continuar = false;										
			}else{
				document.registro.password1.style.border = "1px solid #000000";		
				document.registro.password2.style.border = "1px solid #000000";	
				var id = document.getElementById("id_pass1");
				var id2 = document.getElementById("id_pass2");
				id.style.display = '';
				id2.style.display = '';
				continuar = true;						
			}
		}
	}; //FUNCION CHECK_PASS
	function check_email(){	
		var email
		//alert('email');
		email = document.registro.email.value;	
		if(email.length==""){
			alert("Es necesario que nos proporciones una direccion de correo");
			document.registro.email.style.border = "1px solid #FF0000";
			document.registro.email.focus();
			continuar = false;
		}else{			
			if (!filter.test(email))
				{
					document.registro.email.style.border = "red";
					alert("La dirección de correo que ingresastes no es válida");
					document.registro.email.style.border = "1px solid #FF0000";
					document.registro.email.focus();
					var em = document.getElementById("id_email");
					em.style.display = 'none';						
					continuar = false;
				}else{
					//for(i=0;i<=tope-1;i++){				
					//	var mail = document.registro.email.value.toUpperCase();
						//if(emails[i]==mail){																
						//	alert('El e-mail que proporcionas ya ha sido registrado anteriormente. puedes recuperar tus datos de acceso en la seccion recuperar password');		
						//	document.registro.email.style.border = "1px solid #FF0000";
						//	document.registro.email.focus();
						///	var em = document.getElementById("id_email");
						//	em.style.display = 'none';							
						//	continuar = false;		
						//	break;				
						//}else{							
							document.registro.email.style.border = "1px solid #000000";;
							var em = document.getElementById("id_email");
							em.style.display = '';							
							continuar = true;								
						//}
					//}		

				}	
		}					
	};	//FUNCION CHECK_MAIL
	function check_nombre(){
		//alert('dentro de check_nombre');
		nombre = document.registro.nombre.value;
		if (nombre.length ==""){
			alert('Es necesario que nos proporciones tu nombre');
			document.registro.nombre.style.border = "1px solid #FF0000";
			document.registro.nombre.focus();	
			var namae = document.getElementById("id_nombre");
			namae.style.display = 'none';					
			continuar = false;
		}else{
			continuar = true;
			document.registro.nombre.style.border = "1px solid #000000";
			var namae = document.getElementById("id_nombre");
			namae.style.display = '';				
			
			}
	};	//FUNCION CHECK_NOMBRE		


	//FUNCIONES PARA RECUPERA.ASP
	function check_campo(){
			campo = document.registro.T1.value;
		if (campo.length ==""){
			alert('Es necesario que escribas tu nombre de usuario o tu correo electronico');
			document.registro.T1.focus();		
			return false;
		}
		return true;
	};	//FUNCION CHECA_CAMPO

	
	//FUNCIONES PARA MICUENTA.ASP
	function validar2()
		{	
		continuar = false;	
		edad = document.registro.edad.value;
		profesion = document.registro.profesion.value;
		pais = document.registro.pais.value;
		
		check_pass();
		if(continuar==false){return false}
		check_nombre();	
		if(continuar==false){return false}			
		check_email();
		if(continuar==false){return false}				
		if (edad=='0'){
			document.registro.edad.style.border = "1px solid #FF0000";			
			alert('Es necesario que selecciones en que rango pertece tu edad');				
			document.registro.edad.focus();			
			return false
		}else{
			document.registro.edad.style.border = "1px solid #000000";		
		}
		if (profesion=='0'){
			document.registro.profesion.style.border = "1px solid #FF0000";	
			alert('Es necesario que selecciones alguna de las opciones que más se asemejen a tu profesion');
			document.registro.profesion.focus();				
			return false
		}else{
			document.registro.profesion.style.border = "1px solid #000000";	
		}
		if (pais=='0'){
			document.registro.pais.style.border = "1px solid #FF0000";
			alert('Es necesario que selecciones a que pais perteneces');
			document.registro.pais.focus();		
				
			return false
		}else{
			document.registro.pais.style.border = "1px solid #000000";	
		}

		if (document.registro.check.checked){
			document.registro.notificar.value = "SI";
		}else{
			document.registro.notificar.value = "NO";
		}		
		return true	
		}; //FUNCION VALIDAR PARA MICUENTA.ASP


	//FUNCIONES PARA CONTACTANOS.ASP	
	function validar3(){

		check_nombre();	
		if(continuar==false){return false}	
		check_email();	
		if(continuar==false){return false}	
		check_asunto();	
		if(continuar==false){return false}	
		check_mensaje();	
		if(continuar==false){return false}	
		check_codigo();	
		if(continuar==false){return false}		
		
		
		return true;
	};	//FUNCION VALIDAR3
	function check_asunto(){
		asunto = document.registro.asunto.value;
		if (asunto.length ==""){
			alert('Es necesario que proporciones el asunto del mensaje');
			document.registro.asunto.style.border = "1px solid #FF0000";	
			document.registro.asunto.focus();		
			var namae = document.getElementById("id_asunto");
			namae.style.display = 'none';					
			continuar = false;
		}else{
			continuar = true;
			document.registro.asunto.style.border = "1px solid #000000";	
			var namae = document.getElementById("id_asunto");
			namae.style.display = '';				
			
			}
	}; //FUNCION CHECK_ASUNTO
	function check_mensaje(){
		mensaje = document.registro.mensaje.value;
		if (mensaje.length ==""){
			document.registro.mensaje.style.border = "1px solid #FF0000";	
			alert('Es necesario que proporciones el mensaje');
			document.registro.mensaje.focus();		
			var namae = document.getElementById("id_mensaje");
			namae.style.display = 'none';					
			continuar = false;
		}else{
			continuar = true;
			document.registro.mensaje.style.border = "1px solid #000000";	
			var namae = document.getElementById("id_mensaje");
			namae.style.display = '';				
			
			}
	}; //FUNCION CHECK_MENSAJE
			

	//FUNCIONES PORTAFOLIO.ASP
	function switch_color(id){				
		ima = document.getElementById('img_'+id+'');
		ima.style.border = "2px solid #FFFF00";
		ima.style.cursor = "hand";
	};// FUNCION SWITCH COLOR
	function switch_color2(id){
		ima = document.getElementById('img_'+id+'');
		ima.style.border = "2px solid #FFFFFF"			
	};// FUNCION SWITCH COLOR2
	function abrir_foto(id){
		document.portafolio_form.id_foto.value = id
		document.portafolio_form.submit();
		};// FUNCION ABRIR FOTO
	function guarda_fotosemana(qid){
		document.frm_prt.id_foto.value = qid;
		document.frm_prt.submit();
	};//FUNCION GUARDAR LA FOTO DE LA SEMANA
	function guarda_boletin(qid){
		document.frm_bole.id_foto.value = qid;
		document.frm_bole.submit();
	};//FUNCION GUARDAR EL BOLETIN	

	//FUNCIONE PARA FOTO.ASP
	function switch_star(qestrella) {
		hasta = parseInt(qestrella);
		for(k_estrella=1;k_estrella<=hasta;k_estrella++){
			document.images['ima_'+k_estrella+''].src=e_blan.src;
		}
		gris = 5 - hasta;
		if(gris>0){
			for(k_gris=1;k_gris<=gris;k_gris++){
				k_estrella = k_gris + hasta;
			document.images['ima_'+k_estrella+''].src=e_gris.src;	
			}
		}
		ima = document.getElementById('ima_'+qestrella+'');
		ima.style.cursor = "hand";
		txt = document.getElementById('vota');
		
		switch(hasta){
			case 1:
				txt.innerHTML = '<b>Sin chiste</b>';
				break;
			case 2:
				txt.innerHTML = '<b>Aceptable</b>';
				break;
			case 3:
				txt.innerHTML = '<b>Buena</b>';
				break;
			case 4:
				txt.innerHTML = '<b>Muy buena</b>';				
				break;
			case 5:
				txt.innerHTML = '<b>Obra de arte</b>';			
				break;
		}
	}; // FUNCION SWITCH_STAR	
	function switch_normal(estrella1,estrella2,estrella3,estrella4,estrella5){
		var cualestrella = new Array(5)
		cualestrella[1] = estrella1;
		cualestrella[2] = estrella2;
		cualestrella[3] = estrella3;
		cualestrella[4] = estrella4;
		cualestrella[5] = estrella5;		
		for(k_estrella=1;k_estrella<=5;k_estrella++){
			color = cualestrella[k_estrella];
			switch(color){
				case "rojo":
					document.images['ima_'+k_estrella+''].src=e_roja.src;
					break;
				case "gris":
					document.images['ima_'+k_estrella+''].src=e_gris.src;
					break;
				case "medio":
					document.images['ima_'+k_estrella+''].src=e_medi.src;
					break;
			}//end switch		
		}//end for
		txt = document.getElementById('vota');
		txt.innerHTML = 'Vota esta fotograf&iacute;a';
	};// FUNCION SWITCH_NORMAL
	function votar(kestrella,votos,id_foto){		
		var qestrella = parseInt(kestrella);
		var cuantosvotos = parseInt(votos);
		var hasta = parseInt(kestrella);	
		var id = parseInt(id_foto)
		var estrellas;
		var gris;		
		cuantosvotos = cuantosvotos + 1;
		estrellas = '';
				
		for(k_estrella=1;k_estrella<=hasta;k_estrella++){
			estrellas = estrellas + '<img src="images/estrella_blanca.jpg" width="20px" height="17px"/>';
		}
		gris = 5 - hasta;
		if(gris>0){
			for(k_gris=1;k_gris<=gris;k_gris++){				
				estrellas = estrellas + '<img src="images/estrella_gris.jpg" width="20px" height="17px"/>';				
			}
		}				
		txt = document.getElementById('votos');
		txt.innerHTML = '<b>'+cuantosvotos+' Votos</b>';		
		div = document.getElementById('estrellas1');
		div.style.display = 'none';		
		div2 = document.getElementById('estrellas2');
		div2.style.display = '';
		div2.innerHTML = estrellas;		
		div3 = document.getElementById('vota');
		div3.style.display = 'none';		
		div4 = document.getElementById('vota2');
		div4.style.display = '';
		
		top.frames['guardavoto'].location.href='votar.asp?estrellas='+qestrella+'&id_foto='+id+'';

	};// FUNCION VOTAR
	function validar_comento(){
		continuar = false;	
		check_nombre();	
		if(continuar==false){return false}					
		check_comentario();
		if(continuar==false){return false}
		check_codigo();
		if(continuar==false){return false}
		return true
		};// VALIDAR COMENTARIO
	function check_comentario(){
		comentario = document.registro.comentario.value;
		if (comentario.length ==""){
			document.registro.comentario.style.border = "1px solid #FF0000";	
			alert('Es necesario que el comentario no este vacio');
			document.registro.comentario.focus();		
			var namae = document.getElementById("id_comentario");
			namae.style.display = 'none';					
			continuar = false;
		}else{
			continuar = true;
			document.registro.comentario.style.border = "1px solid #000000";	
			var namae = document.getElementById("id_comentario");
			namae.style.display = '';							
		}
	};// FUNCION CHECK_COMENTARIO
	function check_codigo(){
		var code_digitado = document.registro.codigo.value.toUpperCase();
		var code = document.registro.codigo_oculto.value.toUpperCase();
		if(code==code_digitado){
			continuar = true;			
			document.registro.codigo.style.border = "1px solid #000000";	
			var namae = document.getElementById("id_codigo");
			namae.style.display = '';					
		}else{
			document.registro.codigo.style.border = "1px solid #FF0000";	
			alert('El codigo no es correcto');
			document.registro.codigo.focus();		
			var namae = document.getElementById("id_codigo");
			namae.style.display = 'none';					
			continuar = false;			
		}
		
	};// FUNCION CHECK_CODIGO
	function cambiar(id){
		var ide = parseInt(id);
		document.forma_cambiar.id_foto.value = ide;
		document.forma_cambiar.submit();	
	}//funcion para ir adelanta o atras
	function buscacatego(qid){
		document.form_buscar.busqueda.value = qid;
		document.form_buscar.submit();
	}//manda a buscar la categoria

	
	//FUNCIONES PARA CABECERA.ASP
	function valida_bsq(){
		continuar = false
		check_bsq();
		if(continuar==false){return false}
		return true
	};//FUNCION VALIDA_BSQ
	function check_bsq(){
		if(document.form_buscar.busqueda.value.length==""){
			document.form_buscar.busqueda.style.border = "1px solid #FF0000";	
			alert('la busqueda no puede ir vacia');
			document.form_buscar.busqueda.focus();		
			continuar = false;				
		}else{
			continuar = true;			
			document.form_buscar.busqueda.style.border = "1px solid #000000";				
		}			
	};//FUNCION CHECK_BSQ
	
	//FUNCIONES PARA HISTORICO.ASP
	function abrir_mes(q_mes){
		document.mes_form.qmes.value = q_mes
		document.mes_form.submit();
		} //FUNCION PARA ABRIR EL MES

	function abrir_mes2(q_mes,q_anio){
		document.mes_form.qmes.value = q_mes;
		document.mes_form.qanio.value = q_anio;		
		document.mes_form.submit();
		} //FUNCION PARA ABRIR EL MES


	function gotopage2(page){
		var qpage = parseInt(page);
		document.historico_form.pagina.value = qpage;		
		document.historico_form.submit();
	}//FUNCION SIGUIENTE PAGINA	
	
	
	//FUNCIONES PRA PEDIDOS.ASP
	function elimina_item(qid){
		document.frm_eliminar.id_foto.value = qid;
		document.frm_eliminar.submit();
	} // ELIMINA_ITEM	
	function cancelar_pedido(){
		document.frm_eliminar.id_foto.value = 'todos';
		document.frm_eliminar.submit();			
	} //CANCELAR PEDIDO
	
	//FUNCIONS PARA ADMIN_FOTOSEMANA
	function gotopage3(page){
		var qpage = parseInt(page);
		document.bsq_foto.pagina.value = qpage;
		document.bsq_foto.submit();
	}//FUNCION GOTO PAGE	
	function guardar_fotosemana(qid){
		document.bsq_foto.q_id.value= qid;
		document.bsq_foto.submit();	
	} // GUARDAR_FOTOSEMANA
	
	//FUNCIONES PARA PEDIDOS2.ASP
	function validar_pedido2(){	
		continuar = false;	
		check_nombre();	
		if(continuar==false){return false}			
		check_email();
		if(continuar==false){return false}				
		return true
	};	//FUNCION VALIDAR_PEDIDO2
		
	//FUNCIONES PARA  PORTAFOLIOS_AUTOR
	function gotopage3(page){
		var qpage = parseInt(page);
		document.autor_form.pagina.value = qpage;		
		document.autor_form.submit();
	}//FUNCION SIGUIENTE PAGINA	
	function abrir_autor(id){		
		document.manda_autor.id_autor.value = id
		document.manda_autor.submit();
	}; 	
	

	