// JavaScript Document

window.addEvent('domready',function(){
	if($('geolocalizacion')){
		
    swfobject.embedSWF("geolocalizacion","9.0.0","expressInstall.swf");
	
	}
	
	$$('.slide-opcion').addEvent('mouseover',function(){
				var izq = this.getStyle('left');
				izq = izq.replace("px","");
			if(this.get('rel')==2){
				this.fade('in');
				this.setStyle('left',(eval(izq)+80)+"px");
			}
			if(this.get('rel')==3){
					this.fade('in');
					this.setStyle('left',(eval(izq)+100)+"px"); 
			}
			$('imagenslide').set('src','/imagenes/slide'+this.get('rel')+'.png');
		});
		$$('.slide-opcion').each(function(el){
			
			$(el).addEvent('mouseout',function(){
				var izq = this.getStyle('left');
				izq = izq.replace("px","");
				$('imagenslide').set('src','/imagenes/slide1.png');
				if(el.get('rel')==2){
					//el.fade('0.5');
					this.setStyle('left',(eval(izq)-80)+"px"); 
				}
				if(el.get('rel')==3){
					el.fade('0.7');
					this.setStyle('left',(eval(izq)-100)+"px");
				}
			});
		});
	if($('buscar')){
		$('buscar').addEvent('focus',function(){
			if(this.get('value')=="Buscar"){
				this.value='';	
			}
		});
		$('buscar').addEvent('blur',function(){
			if(this.get('value')==""){
				this.value='Buscar';	
			}
		});
	}
	
	if($('btnBuscar')){
		$('btnBuscar').addEvent('click',function(){
			if($('buscar').get('value')!="Buscar" && $('buscar').get('value')!=""){
				document.formBuscar.submit();	
			}else{
				$('buscar').focus();	
			}
		});
	}
	if($('contacto')){
        new FormCheck('contacto');
		$$('.renglon').each(function(el){
			vacio2(el);
		});
	}
	if($('solicitud')){
        new FormCheck('solicitud');
	}

});
 function toolTips(){
	$$('a').each(function(el){
			if(el.get('content')!=null){
				el.tooltip (el.get('content'), { width: 200, style: 'alert', sticky: 0, hook: 1 });
			}
	}); 
 }
 function vacio2(el){
	 el.addEvent('focus',function(){
		if(this.value=="Nombre"){   this.set('value','');        }
		if(this.value=="Correo"){   this.set('value','@');       }
		if(this.value=="Teléfono"){ this.set('value','593-');    }
		if(this.value=="# participantes"){ this.set('value',''); }
	 });
	 el.addEvent('blur',function(){
		if(this.get('name')=="nombre" && this.get('value')==""){ this.set('value','Nombre');         }
		if(this.get('name')=="email" && this.get('value')=="@"){ this.set('value','Correo');         }
		if(this.get('name')=="telefono" && (this.get('value')=="593-" || this.get('value')=="")){ this.set('value','Teléfono'); }
		if(this.get('name')=="empresa" && this.get('value')==""){ this.set('value','Empresa');       }
		if(this.get('name')=="participantes" && this.get('value')==""){ this.set('value','# participantes');       }
	 });
 }
 function vacio(el){
	 var mensaje = "No debe dejar el campo vacio";
	  if(el.value=="Nombre"){
		el.errors.push(mensaje);
        return false;
	  }
	  if(el.value=="Teléfono"){
		el.errors.push(mensaje);
        return false;
	  }
	  if(el.value=="Empresa"){
		el.errors.push(mensaje);
        return false;
	  }
	  if(el.value=="# participantes"){
		el.errors.push(mensaje);
        return false;
	  }
 }
 function MostrarFecha()  
    {  
    var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado")  
    var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")  
   
    var fecha_actual = new Date()  
   
    dia_mes = fecha_actual.getDate()   
    dia_semana = fecha_actual.getDay()
    mes = fecha_actual.getMonth() + 1  
    anio = fecha_actual.getFullYear()  
	$('fecha-hora').set('html',nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio);
//document.write(nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1] + " de " + anio)  
} 
