// JavaScript Document
function getElement(e,f){
	
    if(document.layers){
        f=(f)?f:self;
        if(f.document.layers[e]) {
            return f.document.layers[e];
        }
        for(W=0;i<f.document.layers.length;W++) {
            return(getElement(e,fdocument.layers[W]));
        }
    }
    if(document.all) {
        return document.all[e];
    }
    return document.getElementById(e);
}

function Valida_Forma_Completa(forma)
{
    var variables;
	variables 	= "";
	total 		= forma.elements.length;
    
	for(i=0;i<total;i++)
		{
			 if( forma.elements[i].value=="")
			 	{
					alert("\nEl campo  * " +  forma.elements[i].name + " *  debe contener un valor");
					forma.elements[i].focus();
					return false;
			    }
			
			 //Se verifica la direcion de correo
			if(forma.elements[i].name=="correo")
			  	{
					temp =  Valida_Email(forma.elements[i].value);
					if(temp==false)
						{
							forma.elements[i].focus();
							return false;
						}
				}
		}

return true;
}

function oculta_muestra(cual)
{
	if(getElement(cual).style.display == 'none')
		getElement(cual).style.display = 'block';
	else
		getElement(cual).style.display = 'none';	
	
}

function f_H2(CabActual){
 CabH3=eval(CabActual.id+"H3")
 with (CabH3.style) 
 if (display=="none")
    display="" 
   else 
    display="none" 
}

function f_H3(CabActual){
 CabH4=eval(CabActual.id+"H4")
 with (CabH4.style) 
 if (display=="none")
    display="" 
   else 
    display="none" 
}

function eliminar(reg,tipo,opc)
{
	switch(tipo)
		{
			case 1://banner
				direccion = "ban.php?elimina=" + reg;
				break;
			case 2://publicidad
				direccion = "publicidad.php?elimina=" + reg;
				break;
			case 3://televisor
				direccion = "televisor.php?elimina=" + reg;
				break;
			case 4://musica
				direccion = "musica.php?elimina=" + reg;
				break;
			case 10:
				direccion = "scroll.php?elimina=" + reg;
				break;
			case 11:
				direccion = "notas.php?elimina=" + reg;
				break;
			case 12:
				direccion = "logo.php?elimina=" + reg;
				break;
			case 20://elimina los años en evento
				direccion = "eventoanio.php?elimina=" + reg;
				break;
			case 21://elimina cirujano
				direccion = "cirujano.php?elimina=" + reg;
				break;	
			case 22://elimina estetica dental
				direccion = "edental.php?elimina=" + reg;
				break;
			case 23://elimina peluqeuria
				direccion = "peluqueria.php?elimina=" + reg;
				break;
			case 24://elimina gimnasio
				direccion = "gimnasio.php?elimina=" + reg;
				break;
			case 25://elimina equipos y productos
				direccion = "equipo.php?elimina=" + reg;
				break;
			case 26://elimina revistas
				direccion = "revista.php?elimina=" + reg;
				break;
			case 27://musica en eventos
				direccion = "eventomusica.php?elimina=" + reg;
				break;
			case 28://swf principal en eventos
				direccion = "eventoswf.php?elimina=" + reg;
				break;
			case 29://banner en eventos
				direccion = "eventoswf.php?elimina=" + reg;
				break;
			case 30://banner en estetica y belleza
				direccion = "esteticaban.php?elimina=" + reg+"&tipon="+opc;
				break;
			case 31://banner en  lomejor
				direccion = "sentidosban.php?elimina=" + reg+"&tipo="+opc;
				break;
			case 32://Eliminar noticia de skhala
				direccion = "skhala_temas.php?elimina=" + reg + "&menu_id=" + opc;
				break;											
			case 33://banner en estetica y belleza
				direccion = "skhala_ban.php?elimina=" + reg + "&id_ban=" + opc;
				break;		
			case 34://eliminar menu de novia
				direccion = "novias_menu.php?eliminaN=" + reg;
				break;	
			case 35://eliminar menu  enlace de menu novia
				direccion = "novias_enlaces.php?eliminaN=" + reg + "&idMenuNovia=" + opc;
				break;	
			case 36://banner en novias
				direccion = "novias_banner.php?elimina=" + reg;
				break;
			case 37://Diseñador
				direccion = "disenadores.php?elimina=" + reg;
				break;	
			case 38://elimina medicina estetica
				direccion = "medicina.php?elimina=" + reg;
				break;	
			case 39:// VER DETALLES CUENTA
				caracteristicas = "top=10,left=10,width=420,height=600,scrollbars=yes";
				url = reg;
				vent="detalleCliente";		
				alert(0);
				break;		
					
		}

if (confirm("¿Esta seguro de eliminar este Registro?")) {
		location.replace(direccion);
	}

}

function eliminarE(reg,ano,tipo,opc)
{
   switch(tipo)
		{
			case 1://Elimina mes
				direccion = "eventomes.php?elimina=" + reg + "&idanio=" + ano;
				break;
			case 2://eliminar foto de eventos
				direccion = "eventofotodet.php?elimina=" + ano + "&id=" + reg + "&mes=" + opc;
				break;
			case 3://eliminar evento
				direccion = "evento.php?elimina=" + reg + "&mes=" + ano;
				break;
			case 4://elimina noticias de estetica y belleza
				direccion = "noticiasdet.php?elimina=" + reg + "&tipon=" + ano;
				break;
			case 5://eliminar foto de noticias en estetica y belleza
				direccion = "noticiafotodet.php?elimina=" + ano + "&idnoticia=" + reg + "&tipo=" + opc;
				break;
			case 6://elimina noticias seccion lo mejor
				direccion = "sentidos.php?elimina=" + reg + "&tipo=" + ano;
				break;
			case 7://eliminar foto de noticias de skhala
				direccion = "skhala_foto.php?elimina=" + ano + "&idnoticia=" + reg + "&tiposk=" + opc;
				break;
		
							
		}		

if (confirm("¿Esta seguro de eliminar este Registro?")) {
		location.replace(direccion);
	}

}

function abrir()
{
//no hace nada. Funcion de enmascaramiento
}

function click()
{
 if (event.button==2) 
 	{
    	alert("Opción no disponible.");
			//window.status="Desactivado";
 	}
}
function valida_email(email)
{
   if (email.indexOf('@',0)==-1 || email.indexOf('@',0)== 0 || email.indexOf('.',0)==-1) 
	   		{
				alert("\nDirección de correo inválida.");
				//document.jsform.email.select()
				//document.jsform.email.focus()
				return false;
			}
	return true;		
}

function nuevo(tipo,cual,type)
{	
	var ventana;
	switch(tipo)
		{
			case 1://nota
				caracteristicas = "width=460,height=280,scrollbars=no";
				url = "notasnew.php";
				vent="notas";				
				break;
			case 2://logo
				caracteristicas = "width=460,height=260,scrollbars=no";
				url = "logonew.php";
				vent = "logo";
				break;
			case 3://swf
				url = "swfnew.php?tipo=" + cual;
				caracteristicas = "width=480,height=230,scrollbars=no";
				vent = "swf";
				break;
			case 4://Televisor imagen jpg
				url = "telenew.php?idTelevisor=" + cual;
				caracteristicas = "top=1,left=1,width=750,height=400,scrollbars=no";
				vent = "Televisor";
				break;
			case 10://evento nuevo
				url = "eventonew.php?nuevo=true&mes=" + cual;
				caracteristicas = "width=380,height=470,scrollbars=yes";
				vent = "Evento";
				break;
			case 11://evento modificar
				url = "eventonew.php?event=" + cual;
				caracteristicas = "width=380,height=470,scrollbars=yes";
				vent = "Evento_mod";
				break;
			case 12://nueva foto en evento
				url = "eventofotonew.php?idevento=" + cual;
				caracteristicas = "width=450,height=233,scrollbars=no";
				vent = "nueva_foto";
				break;
			case 13://fotos grandes en eventos
				url = "../eventos/fotogrande.php?idfoto=" + cual;
				caracteristicas = "width=401,height=531,scrollbars=no";
				vent = "Foto_grande";
				break;
			case 14://Modificar fotos de eventos
				url = "eventofotonew.php?mod=" + cual;
				caracteristicas = "width=450,height=233,scrollbars=no";
				vent = "Modificar_foto";
				break;
			case 15://Chat totalchoice para colombianfashion
				url = "http://www.colombianfashion.net/colombianf_chat/phpMyChat.php3" ;
				caracteristicas = "width=540,height=430,scrollbars=yes,status=yes";
				vent = "";
				break;
			case 16://nuevo menu en estetica
				url = "esteticanew.php?tip=" + cual ;
				caracteristicas = "width=360,height=155,scrollbars=no";
				vent = "Estetica";
				break;
			case 17://Modificar menu estetica
				url = "esteticanew.php?edit=" + cual + "&tip=" + type;
				caracteristicas = "width=360,height=155,scrollbars=no";
				vent = "Estetica";
				break;
			case 18://Nueva noticia de estetica
				url = "noticianew.php?tipo=" + cual ;
				caracteristicas = "width=360,height=370,scrollbars=no";
				vent = "Nueva_noticia";
				break;
			case 19://Modificar noticia en estetica
				url = "noticianew.php?edit=" + cual ;
				caracteristicas = "width=360,height=370,scrollbars=no";
				vent = "Modificar_noticia";
				break;
			case 20://nueva foto en noticia de estetica y belleza
				url = "noticiafotonew.php?idnoticia=" + cual;
				caracteristicas = "width=510,height=280,scrollbars=no";
				vent = "Nueva_foto";
				break;
			case 21://Modificar fotos en noticia de estetica y belleza
				url = "noticiafotonew.php?mod=" + cual;
				caracteristicas = "width=510,height=280,scrollbars=no";
				vent = "Modificar_foto";
				break;
			case 22://fotos grandes en noticias de estetica y belleza
				url = "../estetica/fotogrande.php?idfoto=" + cual;
				caracteristicas = "width=401,height=531,scrollbars=no";
				vent = "Foto_grande";
				break;
			case 23://swf en home de estetica y belleza
				url = "noticiaswfedit.php";
				caracteristicas = "width=480,height=230,scrollbars=no";
				vent = "swf_edit";
				break;
			case 24://Chat totalchoice para modacolombiana
				url = "http://www.colombianfashion.net/modachat/" ;
				caracteristicas = "width=540,height=430,scrollbars=yes,status=yes";
				vent = "";
				break;
			case 25://Nuevo skhala
				url = "skhala_new_nota.php?tipodiv=" + cual ; 
				caracteristicas = "width=325,height=230,scrollbars=no,status=no";
				vent = "Skhala";
				break;
			case 26://Modificar skhala
				url = "skhala_new_nota.php?edit=" + cual + "&tipodiv=" + type ; 
				caracteristicas = "width=325,height=230,scrollbars=no,status=no";
				vent = "Skhala";
				break;
			case 27://nueva foto en noticia de estetica y belleza
				url = "skhala_fotonew.php?idnoticia=" + cual;
				caracteristicas = "width=510,height=280,scrollbars=no";
				vent = "Nueva_fotosk";
				break;
			case 28://Modificar fotos en noticia de estetica y belleza
				url = "skhala_fotonew.php?mod=" + cual;
				caracteristicas = "width=510,height=280,scrollbars=no";
				vent = "Modificar_foto";
				break;
			case 29://fotos grandes en noticias de estetica y belleza
				url = "../skhala/fotogrande.php?idfoto=" + cual;
				caracteristicas = "width=401,height=531,scrollbars=no";
				vent = "Foto_grande";
				break;
			case 30://ventana skhala
				url = "http://" + cual;
				caracteristicas = "";
				vent = "";
				break;
			case 31://swf en home de skhala
				url = "skhala_swf.php";
				caracteristicas = "width=480,height=230,scrollbars=no";
				vent = "swf_edit";
				break;
			case 32://Ventana registro planetaTV en eventos
				url = "http://colombianfashion.planetatv.com/signup/default.asp";
				caracteristicas = "";
				vent = "registroPlaneta";
				break;
			case 33://Ventana registro skhala
				url = "../skhala/inscripcion.php";
				caracteristicas = "width=400,height=470,scrollbars=no";
				vent = "registroSkhala";
				break;
			case 34://Televisor imagen jpg-editar
				url = "telenew.php?editarTel=" + cual;
				caracteristicas = "width=480,height=330,scrollbars=no";
				vent = "TelevisorEdit";
				break;	
			case 35://menu novias
				url = "novias_menu_edit.php?menuId=" + cual;
				caracteristicas = "width=350,height=120,scrollbars=no";
				vent = "MenuNovias";
				break;		
			case 36://menu enlace de novias
				url = "novias_enlaces_edit.php?menuId=" + cual + "&menuNovia=" + type;
				caracteristicas = "width=350,height=250,scrollbars=no";
				vent = "EnlacesNovias";
				break;		
			case 37://nota
				caracteristicas = "width=460,height=280,scrollbars=no";
				url = "notasnew.php?idNoticiaEdit=" + cual;
				vent="notaEdit";				
				break;
			case 38://Como pautar presentacion
				caracteristicas = "width=800,height=650,top=1,left=1,scrollbars=no";
				url = "http://www.colombianfashion.com/comopautar/pautar.html";
				vent="Pautar";				
				break;
			case 39://Chat colombianfashion flash
				caracteristicas = "width=500,height=400,top=1,left=1,scrollbars=no,resizable=no";
				url = "http://www.colombianfashion.net/chat_colombianfashion/usuario_portal.php?menu=7&cirujano=32&tienda=www.colombianfashion.com-" + cual; 
				vent="Pautar";				
				break;
			case 40://Nuevo/editar diseñador
				caracteristicas = "width=590,height=380,top=1,left=1,scrollbars=no,resizable=no";
				url = "http://www.colombianfashion.net/home/admin/nuevo_disenador.php?idDisenador=" + cual; 
				vent="Disenador";				
				break;	
		}

ventana = window.open(url,vent,caracteristicas);

}

function valida(forma)
{
    var variables;
	variables = "";
	total =forma.elements.length;
    //alert(total);
	for(i=0;i<total;i++)
		{
			 if( forma.elements[i].value=="")
			 	{
					alert("El campo  * "  +  forma.elements[i].name + " * debe contener un valor");
					return false;
			   }
			//alert(forma.elements[i].name);
			if(forma.elements[i].name=="email")
				{	temp = valida_email(forma.elements[i].value);
					if(temp==false)
						return false;
				}
		}
	
		
return true;
}

function valida_cirujano()
{
    //total =forma.elements.length;
    //alert(total);
	n = document.forma.nombre.value;
	a = document.forma.ano.value;
	m = document.forma.mes.value;
	d = document.forma.dia.value;
	
	mail = document.forma.email.value;
	t = document.forma.telefono.value;
	c = document.forma.celular.value;
	p = document.forma.pais.value;
	ciud = document.forma.ciudad.value;
	coment = document.forma.comentarios.value;
	
	if(n=="" || a=="" || d=="" || m=="" || mail=="" || d=="" || m=="" || t=="" || c=="" || p=="" || ciud=="" || coment=="" )
		{
			alert("Todos los campos marcados (*) son requeridos.");
			return false;
		}
		
	if(valida_email(mail)==false)	
		return false;
	
		
return true;
}

function salida()
{
	//window.opener.location.reload();
	window.close();
	//location.href = 
}

ie4 = ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )) 
ns4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 )) 

if (ns4) { 
layerRef="document.layers"; 
styleRef=""; 
} else { 
layerRef="document.all"; 
styleRef=".style"; 
}
