Selectors.Pseudo.selected = function(){ 
   return (this.selected && 'option' == this.get('tag')); 
};
Selectors.Pseudo.checked = function() { 
  return ('input' == this.get('tag') && ('radio' == this.get('type') || 'checkbox' == this.get('type')) && this.checked); 
};

var CargandoAjax= new Element('div',{
		id:'AjaxCargando',
		styles:{
			backgroundColor:'white',
			width:'120px',
			height:'35px',
			position:'relative',
			zIndex:900,
			display:'none',
			padding:'5px',
			border:'1px dashed #FFDBA9',
			color:'#FEA106'
		},
		'class':'tproducto',
		html:'<img style="padding-right:5px" src="images/ajax-loader.gif" align="absmiddle"/>Cargando...'
		
	});


Element.implement({ 
	val:function(){
		return this.get("value");
	},
    show: function() { 
      this.setStyle('display','block'); 
	  this.setStyle('visibility','visible'); 
    }, 
    hide: function() { 
      this.setStyle('display','none'); 
	  this.setStyle('visibility','hidden'); 
    },
	html:function(htm){
		this.set("html",htm);
	},
	Imprimir: function() {
		var strName = 'printer-' + (new Date()).getTime(),
		styles = $$('link[type=text/css]').clone(),
		title = document.title,
		that = this,
		iframe = new IFrame({
			name: strName,
			styles: {
				width: 1,
				height: 1,
				position: 'absolute',
				left: -9999
			},
			events: {
				load: function() {
					var doc = this.contentDocument || window.frames[strName].document;
					doc.title = title;
					$(doc.body).adopt(styles, that.clone());
					this.contentWindow.focus(); // IE necesita obtener el foco sino imprime el frame padre.
					this.contentWindow.print();
				}
			}
		}).inject($(document.body));
		iframe.dispose.delay(15000); // Destruimos el iframe luego de 15 segundos.
	},
	PNG:function(){
		if(Browser.Engine.trident4){
			for(var i=0; i<document.images.length; i++){
				  var img = document.images[i];
				  var imgName = img.src.toUpperCase();
				  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
				  {
					 var imgID = (img.id) ? "id='" + img.id + "' " : "";
					 var imgClass = (img.className) ? "class='" + img.className + "' " : "";
					 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
					 var imgStyle = "display:inline-block;" + img.style.cssText ;
					 if (img.align == "left") imgStyle = "float:left;" + imgStyle;
					 if (img.align == "right") imgStyle = "float:right;" + imgStyle;
					 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
					 var strNewHTML = "<span " + imgID + imgClass + imgTitle;
					 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
					 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
					 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" ;
					 img.outerHTML = strNewHTML;
					 i = i-1;
				  }
			 }
			var imgURL = this.getStyle('background-image');
			var imgURLLength = imgURL.length;
			//alert(imgURL);
			if (imgURL.indexOf(".png")!=-1){
				//alert(imgURL);
				//alert(imgURL.substring(4,imgURLLength  - 1));
				this.setStyles({
					background: 'none',
					filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='" + imgURL.substring(5,imgURLLength  - 2) + "')"
				});
			};
		}
		
		
	},
	reflect: function(options) {
		var img = this;
		if (img.get("tag") == "img") {
			options = $extend({
				height: 0.33,
				opacity: 0.5
			}, options);

			img.unreflect();

			function doReflect() {
				var reflection, reflectionHeight = Math.floor(img.height * options.height), wrapper, context, gradient;

				if (Browser.Engine.trident) {
					reflection = new Element("img", {src: img.src, styles: {
						width: img.width,
						height: img.height,
						marginBottom: -img.height + reflectionHeight,
						filter: "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (options.opacity * 100) + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (options.height * 100) + ")"
					}});
				} else {
					reflection = new Element("canvas");
					if (!reflection.getContext) return;
					try {
						context = reflection.setProperties({width: img.width, height: reflectionHeight}).getContext("2d");
						context.save();
						context.translate(0, img.height-1);
						context.scale(1, -1);
						context.drawImage(img, 0, 0, img.width, img.height);
						context.restore();
						context.globalCompositeOperation = "destination-out";

						gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
						gradient.addColorStop(0, "rgba(255, 255, 255, " + (1 - options.opacity) + ")");
						gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
						context.fillStyle = gradient;
						context.rect(0, 0, img.width, reflectionHeight);
						context.fill();
					} catch (e) {
						return;
					}
				}
				reflection.setStyles({display: "block", border: 0});

				wrapper = new Element(($(img.parentNode).get("tag") == "a") ? "span" : "div").injectAfter(img).adopt(img, reflection);
				wrapper.className = img.className;
				img.store("reflected", wrapper.style.cssText = img.style.cssText);
				wrapper.setStyles({width: img.width, height: img.height + reflectionHeight, overflow: "hidden"});
				img.style.cssText = "display: block; border: 0px";
				img.className = "reflected";
			}

			if (img.complete) doReflect();
			else img.onload = doReflect;
		}

		return img;
	},
	unreflect: function() {
		var img = this, reflected = this.retrieve("reflected"), wrapper;
		img.onload = $empty;

		if (reflected !== null) {
			wrapper = img.parentNode;
			img.className = wrapper.className;
			img.style.cssText = reflected;
			img.store("reflected", null);
			wrapper.parentNode.replaceChild(img, wrapper);
		}

		return img;
	},
	enVivo: function(event, selector, fn){
		this.addEvent(event, function(e){
			var t = $(e.target);
			if (!t.match(selector)) return false;
			fn.apply(t, [e]);
		}.bindWithEvent(this, selector, fn));
	},
	fadeTo: function(value,duration){
		(duration=="")? speed=500 : speed=duration;
		var elt = this; 
		 elt = new Fx.Tween(elt, {
			 duration : speed,
			 //transition : Fx.Transitions.Quad.easeIn,
			 wait:true
		 }); 
		elt.start('opacity', value);
	},
	sendAjaxForm:function(fn,validate){
		this.set("send",{
			"onSuccess":fn,
			"onFailure":function(){
				alert("hubo en error el en envio del formulario");
			}
		});
		this.addEvent("submit",function(e){
			e.preventDefault();
			if(validate==true){
				var ret = Spry.Widget.Form.validate(this); //solo para spry
				if(ret){
					this.send();
				}
			}else{
				this.send();
			}
		});
		
		
		return false;
	}

}); 



/****/

var Hola= new Class({
	tipOlvido:"",
	initialize:function(){
	},
	registrarmePromo:function(){
		new Ventana({
			titulo:"",
			url: "registratePromo.php",
			modal:true,
			fondo:"",
			alto:629,
			ancho:500,
			borde:0,
			separacion:0,
			btnCerrar:"close_promo"	
		}).render();
	},
	VerPolo:function(id){
		new Ventana({
			titulo:"",
			url: "pop_polos.php?id="+id,
			modal:true,
			fondo:"",
			alto:739,
			ancho:550,
			borde:0,
			separacion:0,
			btnCerrar:"cerrar"	
		}).render();
	},
	nl2br:function(str, is_xhtml) {
       var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
	   return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
	},
	VerEvento:function(id){
		new Ventana({
			titulo:"",
			url: "pop_eventos.php?id="+id,
			modal:true,
			fondo:"",
			alto:739,
			ancho:550,
			borde:0,
			separacion:0,
			btnCerrar:"cerrar"	
		}).render();
	},
	eventosHolaOla:function(){
		if($('conten_eventos_de-siempre')){
			new ACarrusel("carruselEventosSiempre",{
				avanze:1,
				ver:2,
				anchoItem:443,
				altoItem:365,
				siguiente:'eve-siguiente1',
				anterior:'even-anterior11',
				imgSiguienteDesactivo:'images/eventos_flecha_sgte.png',
				imgAnteriorDesactivo:'images/eventos_flecha.png',
				duracion:0.5
			});
			new ACarrusel("carruselEventosProximos",{
				avanze:1,
				ver:2,
				anchoItem:443,
				altoItem:365,
				siguiente:'even-siguiente2',
				anterior:'even-anterior1',
				imgSiguienteDesactivo:'images/eventos_flecha_sgte.png',
				imgAnteriorDesactivo:'images/eventos_flecha.png',
				duracion:0.5
			});
		}
	},
	polosHolaOla:function(){
		if($('polos_lista')){
			new ACarrusel("carruselPolosEllos",{
				avanze:1,
				ver:3,
				anchoItem:285,
				altoItem:364,
				siguiente:'flecha-siguiente-ellos',
				anterior:'flecha-anterior-ellos',
				imgSiguienteDesactivo:'images/flecha_siguiente_polos_desactivado.png',
				imgAnteriorDesactivo:'images/flecha_anterior_polos_desactivado.png',
				duracion:1.2
			});
			new ACarrusel("carruselPolosEllas",{
				avanze:1,
				ver:3,
				anchoItem:285,
				altoItem:364,
				siguiente:'flecha-siguiente-ellas',
				anterior:'flecha-anterior-ellas',
				imgSiguienteDesactivo:'images/flecha_siguiente_polos_desactivado.png',
				imgAnteriorDesactivo:'images/flecha_anterior_polos_desactivado.png',
				duracion:1.2
			});
		}
	},
	activaAcordeonChef:function(){
		$n=0;
		if($('opciones-recomendacion-chef')){
			$$('.AccordionPanelTab')
			.each(function(e,k){
				$n++;
				e.addEvent("click",function(){
					el=e.getElement("div");
					$$('.acordionActivo').removeClass("acordeon1_abierto").removeClass("acordeon2_abierto").removeClass("acordionActivo");
					(el.hasClass("acordeon1"))?fondo="acordeon1_abierto":fondo="acordeon2_abierto";
					el.addClass(fondo);
					el.addClass("acordionActivo");
				});	
			});
		}
	},
	activaAcordeonGrill:function(){
		$n=0;
		if($('hog-acordion')){
			$$('.AccordionPanelTab')
			.each(function(e,k){
				$n++;
				e.addEvent("click",function(){
					el=e.getElement("div");
					$$('.acordionActivo').removeClass("acordeon1_abierto").removeClass("acordeon2_abierto").removeClass("acordionActivo");
					(el.hasClass("acordeon1"))?fondo="acordeon1_abierto":fondo="acordeon2_abierto";
					el.addClass(fondo);
					el.addClass("acordionActivo");
				});	
			});
		}
		
	},
	verCafe:function($n,$title){
		$$('#fotos_cafeholaola img').fade("out");
		$('img_'+$n).fade("in");
		titulo=$($title).get("text");
		$('title-carta_cafe').set("html",titulo);
		$('title-carta_cafe').tween("opacity",[0,1]);
	},
	verGrill:function($n,$title){
		$$('#img-grande-grill img').fade("out");
		$('nombre_plato').fade("out");
		$('img_'+$n).fade("in");
		titulo=$($title).get("text");
		$('nombre_plato').set("html",titulo);
		$('nombre_plato').tween("opacity",[0,1]);
		
	},
	cambiaImgChef:function($n){
		if($n==1){
			$('imgchef1').fade("in").addClass("activo");
			$('imgchef2').fade("out");
			$('imgchef3').fade("out");
		}else if($n==2){
			$('imgchef1').fade("out");
			$('imgchef2').fade("in");
			$('imgchef3').fade("out");
		}else{
			$('imgchef1').fade("out");
			$('imgchef2').fade("out");
			$('imgchef3').fade("in");
		}
	},
	verFotos:function($id,$type){
		if($('conten_fotos')){
			this.muestraAjax('conten_fotos');
			$('conten_fotos').set("load",{
				onSuccess:function(){
					this.escondeAjax('conten_fotos');
				}.bind(this)
			});
			switch($type){
				case "evento":
					$('conten_fotos').load("fotos_eventos.php?evento="+$id);
					new Request.JSON({
						url:'datos_evento.php?evento='+$id,
						onSuccess:function(e){
							if($defined(e.titulo)){
								$('foto-title-fotos').set("html",e.titulo);
								$('foto-txt-fecha').set("html",e.dia+" de "+e.mes+" del "+ e.anio);
							}else{
								$('foto-title-fotos').set("html","");
								$('foto-txt-fecha').set("html","");
							}
						}
					}).send();
				break;
				case "fecha":
					$('conten_fotos').load("fotos_eventos.php?fecha="+$id);		
					new Request.JSON({
						url:'datos_evento.php?fecha='+$id,
						onSuccess:function(e){
							if($defined(e.titulo)){
								$('foto-title-fotos').set("html",e.titulo);
								$('foto-txt-fecha').set("html",e.dia+" de "+e.mes+" del "+ e.anio);
							}else{
								$('foto-title-fotos').set("html","");
								$('foto-txt-fecha').set("html","");
							}
						}
					}).send();
				break;
				default:
					$('conten_fotos').load("fotos_eventos.php");
					new Request.JSON({
						url:'datos_evento.php',
						onSuccess:function(e){
							if($defined(e.titulo)){
								$('foto-title-fotos').set("html",e.titulo);
								$('foto-txt-fecha').set("html",e.dia+" de "+e.mes+" del "+ e.anio);
							}else{
								$('foto-title-fotos').set("html","");
								$('foto-txt-fecha').set("html","");
							}
						}
					}).send();
				break;
				
			}
			
		}
	},
	cargaFotos:function(url){
		this.muestraAjax('conten_fotos');
		$('conten_fotos').load(url);
	},
	verVideos:function($id,$type){
		if($('div_videos')){
			switch($type){
				case "evento":
					$('div_videos').load("video_eventos.php?evento="+$id);
					new Request.JSON({
						url:'datos_evento.php?evento='+$id,
						onSuccess:function(e){
							if($defined(e.titulo)){
								$('foto-title-fotos').set("html",e.titulo);
								$('foto-txt-fecha').set("html",e.dia+" de "+e.mes+" del "+ e.anio);
							}else{
								$('foto-title-fotos').set("html","");
								$('foto-txt-fecha').set("html","");
							}
						}
					}).send();
				break;
				case "fecha":
					$('div_videos').load("video_eventos.php?fecha="+$id);		
					new Request.JSON({
						url:'datos_evento.php?fecha='+$id,
						onSuccess:function(e){
							if($defined(e.titulo)){
								$('foto-title-fotos').set("html",e.titulo);
								$('foto-txt-fecha').set("html",e.dia+" de "+e.mes+" del "+ e.anio);
							}else{
								$('foto-title-fotos').set("html","");
								$('foto-txt-fecha').set("html","");
							}
						}
					}).send();
				break;
				default:
					$('div_videos').load("video_eventos.php");
					new Request.JSON({
						url:'datos_evento.php',
						onSuccess:function(e){
							if($defined(e.titulo)){
								$('foto-title-fotos').set("html",e.titulo);
								$('foto-txt-fecha').set("html",e.dia+" de "+e.mes+" del "+ e.anio);
							}else{
								$('foto-title-fotos').set("html","");
								$('foto-txt-fecha').set("html","");
							}
						}
					}).send();
				break;
				
			}
			
		}
	},
	verGaleria:function(id){
		new Ventana({
			titulo:"",
			url: "galeria_fotos_pop.php?id="+id,
			modal:true,
			fondo:"",
			alto:550,
			ancho:780,
			borde:0,
			separacion:0,
			btnCerrar:"capa-cerrar"	
		}).render();
	},
	verGaleriaHospedaje	:function(id){
		new Ventana({
			titulo:"",
			url: "galeria_hospedaje_pop.php?id="+id,
			modal:true,
			fondo:"",
			alto:577,
			ancho:700,
			borde:0,
			separacion:0,
			btnCerrar:"capa-cerrar"	
		}).render();
	},
	fadeImagen:function(){
		
	},
	Mover:function($id,$modo){
		$('foto_big').set("tween",{
			onComplete:function(){
					new Request.JSON({
						url:"movefotos.php?id="+$id+"&dir="+$modo,
						onSuccess:function(e){
							$('foto_big').set("src","images/fotos/"+e.imagen);
							if(e.siguiente!=""){
								$('siguiente').set("onclick","Hola.MoverAdelante("+e.siguiente+",\'adelante\')");
								$('anterior').set("onclick","Hola.MoverAtras("+e.anterior+",\'atras\')");
								$('imagen').set("value","images/fotos/"+e.imagen);
							}else{
								$('siguiente').set("onclick","javascript:;");
								$('imagen').set("value","images/fotos/"+e.imagen);
							}
							
							if(e.anterior!=""){
								$('anterior').set("onclick","Hola.Mover("+e.anterior+",\'atras\')");
								$('siguiente').set("onclick","Hola.Mover("+e.siguiente+",\'adelante\')");
								$('imagen').set("value","images/fotos/"+e.imagen);
							}else{
								$('anterior').set("onclick","javascript:;");
								$('imagen').set("value","images/fotos/"+e.imagen);
							}
							$('imagen').set("value","images/fotos/"+e.imagen);
							$('foto_big').fade("in");
							$('idfoto').set("value",e.actual);
						}
					}).send();
			}
		}).tween("opacity",[1,0]);
		
	},
	carruselVideos:function(){
		if($('carruselVideos')){
			new ACarrusel("carruselVideos",{
				avanze:1,
				ver:1,
				siguiente:'video-sgt',
				anterior:'video-ant',
				imgSiguienteDesactivo:'images/flecha_siguiente_videos_desactivado.png',
				imgAnteriorDesactivo:'images/flecha_anterior_videos_desactivado.png',
				duracion:0.5
			});
		}
	},
	cargarVideo:function(url){
		var player=$('ply'); 
		player.sendEvent('LOAD',"videos/"+url);
	},
	activaTrabajo:function(){
		if($('form_CV')){
			$('form_CV')
			.addEvent("submit",function(){
				var Form = $('frm_registro');
				var ret = Spry.Widget.Form.validate(Form);
				if(ret){
					return true;
				}else{
					return false;
				}
			});
		}
	},
	CVOk:function(){
		$('msgCV').set("html","<span style='color:green'>Gracias por enviarnos tus datos.</span>");
		setTimeout(function(){
			window.location.href='index.php';
			return false;
		},3000);
	},
	NoCV:function(){
		$('msgCV').set("html","<span style='color:red'>El archivo no es v&aacute;lido .</span>");
	},
	CVExistente:function(){
		$('msgCV').set("html","<span style='color:black'>Ud ya ha enviado su Cv anteriormente.Gracias</span>");
	},
	PromoOk:function(){
		$('msgPromo').set("html","<span style='color:green'>Gracias por enviarnos tus datos.</span>");
		setTimeout(function(){
			$('VentanaMoo').destroy();
			$('VentanaMooModal').destroy();
		},3000);
	},
	PromoExistente:function(){
		$('msgPromo').set("html","<span style='color:red'>El email ya se encuentra registrado.Gracias.</span>");
		$('form_promos').reset();
	},
	activaFormPromo:function(){
		
		if($('form_promos')){
			$('form_promos')
			.addEvent("submit",function(){
				var Form = $('form_promos');
				var ret = Spry.Widget.Form.validate(Form);
				if(ret){
					return true;
				}else{
					return false;
				}
			});
		
		}
	},
	filtraEvento:function($id){
		
	},
	activaFotosEventos:function($fechas){
		if($('conten_fotos')){
			new MavSelectBox({
				elem: $ ('eventos'),
				onSelect: function(elem) {
					Hola.verFotos($('eventos').get("value"),'evento');
				}.bind(this)
			});	
			
			$('fecha').datePicker({
				diasFestivos:$fechas,
				onShow: function(container){
					container.fade('hide').fade('in');
				},
				onHide: function(container){
					container.fade('out');
				},
				onUpdate: function(){
					Hola.verFotos($('fecha').get("value"),'fecha');
				}
			 });
		}
	},
	activaVideosEvento:function($fechas){
			if($('div_videos')){
				new MavSelectBox({
					elem: $ ('eventos'),
					onSelect: function(elem) {
						Hola.verVideos($('eventos').get("value"),'evento');
					}.bind(this)
				});	
				$('fecha').datePicker({
					diasFestivos:$fechas,
					onShow: function(container){
						container.fade('hide').fade('in');
					},
					onHide: function(container){
						container.fade('out');
					},
					onUpdate: function(){
						Hola.verVideos($('fecha').get("value"),'fecha');
					}
				 });
			}	 
	},
	muestraAjax:function(capa){
		div=$(capa);
		contenedor=div.getParent();
		coord=contenedor.getCoordinates();
		CargandoAjax.setStyles({
			"top":(coord.height/2) - 60,
			"left":(coord.width/2)- 65
		});
		contenedor.grab(CargandoAjax);
		CargandoAjax.show();

	},
	escondeAjax:function(capa){
		div=$(capa);
		CargandoAjax.hide();
	},
	verHospedaje:function(){
		if($('conten_tabla_hospedaje')){
			$('conten_tabla_hospedaje').load("listadoHospedaje.php");
		}
	},
	pagHospedaje:function(url){
		if($('conten_tabla_hospedaje')){
			$('conten_tabla_hospedaje').load(url);
		}
	},
	Solicita:function(id){
		$('form_polo').show();
	},
	cierrarSolicitud:function(){
		$('form_polo').hide();
	}
	,activaContacto:function(){
		if($('formContacto')){
			$('formContacto').set("send",{
				onSuccess:function(){
					$('msgContacto')
					.set("html","<b>Gracias nos contactaremos con Ud. en la brevedad posible</b>");
					setTimeout(function(){
						//window.location.href='index.php';
						return false;
					},3000);
				}
			});
			$('formContacto')
			.addEvent("submit",function(){
				var Form = $('formContacto');
				var ret = Spry.Widget.Form.validate(Form);
				if(ret){
					this.send();
					this.reset();
					return false;
				}else{
					return false;
				}
			});	
				
				
		}
	},
	verImagenHospedaje:function(e,pos){
		var imgs=$$('#galeryHospedaje img');
		total=imgs.length - 1 ;
		var tween = $('foto_big').get('tween', {property: 'opacity',duration:800});
		if(pos=="adelante"){
			if(e<total){
				$('siguiente').set("onclick","Hola.verImagenHospedaje("+(e+1)+",'adelante')");
			}else{
				$('siguiente').set("onclick","Hola.verImagenHospedaje("+e+",'adelante')");
			}
			
			(e==total)?$('anterior').set("onclick","Hola.verImagenHospedaje("+(e-1)+",'atras')"):$('anterior').set("onclick","Hola.verImagenHospedaje("+(e)+",'atras')");
			
		}else if(pos=="atras"){
			if(e>0){
				$('anterior').set("onclick","Hola.verImagenHospedaje("+(e-1)+",'atras')");
			}else{
				
				$('anterior').set("onclick","Hola.verImagenHospedaje("+e+",'atras')");	
			}
			//(e==total)?$('siguiente').set("onclick","Hola.verImagenHospedaje("+total+",'adelante')"):
			$('siguiente').set("onclick","Hola.verImagenHospedaje("+(e)+",'adelante')");
			
		}
		tween.start(0).chain(function(){
			$('foto_big').set("src",imgs[e].get("src"));
			tween.start(1);
		});
	
	
		//alert(imgs[e].get("src"));
	},
	verPalabrasClientes:function(url){
		(url=="")?pag="listaClientes.php":pag=url
			new Request.JSON({
				url:pag,
				onSuccess:function(e){
					fila=e.filas;
					$('pa-subtitle2').set("html",fila[0].titulo);
					$('comentarioCliente').set("html",fila[0].sumilla);
					$('pa-texto').set("html",this.nl2br(fila[0].comentario));
					$('imgCliente').set("src","images/"+fila[0].imagen_chica)
					$('div_paginacio_cliente').set("html",e.navegacion)
					$('imgCliente').show();
					
				
					jQuery('#pa-texto').jScrollPane({
						showArrows:false,
						scrollbarWidth:40
					});
						//jQuery('#pa-texto').css("top",178);
						jQuery('.jScrollPaneContainer').css("top",178);
						Cufon.refresh();
				}.bind(this)
			}).send();
		
	},
	verReloj:function(){
		if($('hora')){
			if (!document.layers&&!document.all&&!document.getElementById)
			return
			
			 var Digital=new Date()
			 var hours=Digital.getHours()
			 var minutes=Digital.getMinutes()
			 var seconds=Digital.getSeconds()
			
			var dn="PM"
			if (hours<12)
			dn="AM"
			if (hours>12)
			hours=hours-12
			if (hours==0)
			hours=12
			
			 if (minutes<=9)
			 minutes="0"+minutes
			 if (seconds<=9)
			 seconds="0"+seconds
			//change font size here to your desire
			myclock="<span>"+hours+":"+minutes+":"
			 +seconds+" "+dn+"</span>"
			if (document.layers){
			document.layers.hora.document.write(myclock)
			document.layers.hora.document.close()
			}
			else if (document.all)
			hora.innerHTML=myclock
			else if (document.getElementById)
			document.getElementById("hora").innerHTML=myclock
			setTimeout(function(){
				this.verReloj();
			}.bind(this),1000)
			}
	},
	verVIP:function(){
		new Ventana({
			titulo:"",
			url: "form_vip.php",
			modal:true,
			fondo:"",
			alto:741,
			ancho:650,
			borde:0,
			separacion:0,
			btnCerrar:"cerrar_vip"	
		}).render();
	}
	
});



var Ventana= new Class({
	Implements: [Options,Events],
	options :{
		modal:false,
		ancho:350,
		titulo:'',
		alto: 350,
		id : "VentanaMoo",
		fondo : "white",
		fondoModal:"#000000",
		opacidad:0.35,
		html:"",
		url:"",
		arrastra:false,
		juntoA:"",
		separacion:10,
		borde:1,
		btnCerrar:"",
		imagenFondo:"",
		colorfondoCabecera:"",
		colorBorde:"",
		textoCerrar:"",
		anchoPrivado:35,
		htmlCerrar:"",
		estiloCabecera:"",
		
		onCerrar:$empty()
	},
	initialize:function(options){
		this.setOptions(options);
		av=window.getWidth()/2;
		alv=window.getHeight()/2;
		ad=this.options.ancho/2;
		ald=this.options.alto/2;
		ventana=new Element("div",{
				id:this.options.id,
					styles:{
						backgroundColor : this.options.fondo,
						padding:this.options.separacion + 'px',
						height:this.options.alto + 'px',
						width:this.options.ancho + 'px',
						position:'absolute',
						border:this.options.borde+'px solid #CCC',
						left:parseInt(av)-parseInt(ad),
						top:parseInt(alv)-parseInt(ald),
						zIndex:1200,
						display:'none'
					}
					
		});
		
		if(!$(this.options.juntoA)){
			ventana.set('html','<div id="header__moo" class="cabecera__moo" style="padding:10px;height:15px" >'+
								 '<div style="width:85%;float:left;">'+this.options.titulo+'</div>'+
								 '<div align="right" id="cierra_v_moo" style="float:left;width:15%;cursor:pointer;" title=""></div>'+
								 '</div>'+
								 '<div style="border-top:0px solid #CCC;padding:35px;height:'+parseInt(this.options.alto-25)+
								 'px;overflow:auto;vertical-align:middle" align="center" id="conte__moo" class="cuerpo__moo">'+
								 '</div>');
			
		}else{
			ventana.set('html','<div style="border-top:0px solid #CCC;height:'+parseInt(this.options.alto)+
								'px;overflow:auto;vertical-align:middle" align="center" id="conte__moo" class="cuerpo__moo">'+
								'</div>');
		}
	
	},
	render:function(){		
		if(!this.options.modal){
				$$('select').setStyle("visibility","hidden");
				$$('body').grab(ventana);
				
			if(!$(this.options.juntoA)){	
				$('cierra_v_moo').addEvent('click',this.cerrar.bind(this));
			}

				if(this.options.url==""){
					$('conte__moo').set('html',this.options.html);	
				}else{
					$('conte__moo').load(this.options.url);	
				}
				
		}else{
			var modal= new Element('div',{
				id:"VentanaMooModal",
				styles:{
					backgroundColor : this.options.fondoModal,
					opacity:this.options.opacidad,
					height:window.getScrollHeight(),
					width:window.getScrollWidth(),
					zIndex:1009,
					position:'absolute',
					top:'0px',
					left:'0px',
					visibility:'hidden'
				}
			});
			$$('select').setStyle("visibility","hidden");
			$$('body').grab(modal);
			modal.tween("opacity",[0,this.options.opacidad]);
			//modal.fadeTo(this.options.opacidad);
			$$('body').grab(ventana);
			
			if(this.options.separacion==0){
				$('conte__moo').setStyle("padding","0px");
			}
			
			if(this.options.htmlCerrar!=""){
				$('cierra_v_moo').set("html",this.options.htmlCerrar);
			}
			if(this.options.colorBorde!=""){
				ventana.setStyles({"border-color":this.options.colorBorde});
			}
			if(this.options.estiloCabecera!=""){
				$('header__moo').addClass(this.options.estiloCabecera);
			}
			if(this.options.imagenFondo!=""){
					$('conte__moo').setStyle("background-image","url("+this.options.imagenFondo+")");
					$('conte__moo').setStyle("background-repeat","repeat-x");
			}
			
			this.posicionar();
			if(this.options.url==""){
				$('conte__moo').set('html',this.options.html);	
			}else{
					try{
						$('conte__moo').set('load',{
							'evalResponse':true,
							'onSuccess':function(){
								if($(this.options.btnCerrar) && this.options.url){
									$(this.options.btnCerrar).addEvent('click',this.cerrar.bind(this)).setStyle("cursor","pointer").set("title","");
								}else{
									$('cierra_v_moo').addEvent('click',this.cerrar.bind(this));
								}
							}.bind(this)
						});
					
					}catch(err){
							txt="There was an error on this page.\n\n";
							txt+="Error description: " + err.description + "\n\n";
							txt+="Click OK to continue.\n\n";
							alert(txt);
					}
						
				$('conte__moo').load(this.options.url);	
			}
		}
		
		if(this.options.arrastra=="si"){
			if($('header__moo')){
				$('header__moo').setStyle("cursor","move");
				$(ventana).makeDraggable({handle :'header__moo'/*,container:document.body*/});
			}
			
		}
		
		document.addEvents({
			'keypress':function(e){
				if(e.key == 'esc' ){
					if($('conte__moo')){
						this.cerrar();
					}
				}
			}.bind(this)
		});
		window.addEvents({
			'resize':function(){
				if($('conte__moo')){
				//	$('VentanaMooModal').morph({"width":window.getScrollWidth(),"height":window.getScrollHeight()});
					this.posicionar();
				}
				
			}.bind(this),
			"scroll":function(){
				if($('conte__moo')){
					//$('VentanaMooModal').morph({"width":window.getScrollWidth(),"height":window.getScrollHeight()});
					this.posicionar();
				}
			}.bind(this)
		});
	
		$('VentanaMooModal').addEvent("click",function(){
			if($('conte__moo')){
				this.cerrar();
			}
		}.bind(this));
		
		
		var pos=window.getHeight();
				var posAncho=window.getWidth();
				sizes = window.getSize();
				scrollito = window.getScroll();
				
				
				ventana.setStyles({
					//top:0 + defaz.toInt()  
					'top': (scrollito.y + (sizes.y - this.options.alto) / 2).toInt()
				});
		
		
	},
	cerrar:function(){
			//window.removeEvent('keypress',function(e){});
			$$('select').setStyle("visibility","visible");
			$('VentanaMooModal')
			.set("tween",{
				duration:500,
				onComplete:function(){
						$('VentanaMooModal').destroy();
				}
			});
			if($(this.options.id)){
				$(this.options.id).destroy();
			}
			$('VentanaMooModal').tween("opacity",[this.options.opacidad,0])
			
			$$('select').setStyle("visibility","visible");
			this.fireEvent('cerrar');
	},
	posicionar:function(){
		var scrollventana = new Fx.Scroll(window, {
				wait: false,
				duration: 800,
				transition:  Fx.Transitions.Sine.easeInOut
		});
		if($(this.options.juntoA!="")){
				var pos=$(this.options.juntoA).getCoordinates();
				scrollventana.toElement($(this.options.juntoA).getParent());
				try{
					ventana.set('morph', {
									duration: 800, 
									transition: 'quad:out',
									onComplete:function(){
										//$('VentanaMooModal').setStyles({"width","100","height":"100"})
									}
								})
								
							.setStyle("left",pos.left - (this.options.ancho / 2).toInt());
							ventana.morph({
								opacity : [0.5,1],
								top: pos.top -  (this.options.alto).toInt() - 30
							});
				}catch(err){
					  txt="There was an error on this page.\n\n";
					  txt+="Error description: " + err.description + "\n\n";
					  txt+="Click OK to continue.\n\n";
					  alert(txt);
				}	
				
							
		}else{
				var pos=window.getHeight();
				var posAncho=window.getWidth();
				sizes = window.getSize();
				scrollito = window.getScroll();
				//ventana.setStyles({"top":0,"display":"none"});
				/*
				ventana.setStyles({
					//top:0 + defaz.toInt()  
					'top': (scrollito.y + (sizes.y - this.options.alto) / 2).toInt()
				});
				*/
				
				try{
					//$('VentanaMooModal').morph({"width":window.getScrollWidth(),"height":window.getScrollHeight()});
					//ventana.setStyles({'top': (scrollito.y + (sizes.y - this.options.alto) / 2).toInt()});
					ventana.set('morph', {
									duration: 500, 
									transition: 'sine:in:out',
									onComplete:function(){
										//scrollventana.toElement($('conte__moo'));
										ventana.setStyles({"display":"block"});
									}
								})								
							.morph({
								/*'top': (scrollito.y + (sizes.y - this.options.alto) / 2).toInt(),
								"left":posAncho / 2 - (this.options.ancho / 2).toInt()
								*/
							});
					$('cierra_v_moo').addEvent('click',this.cerrar.bind(this));
					
							
				}catch(err){
					  txt="There was an error on this page.\n\n";
					  txt+="Error description: " + err.description + "\n\n";
					  txt+="Click OK to continue.\n\n";
					  alert(txt);
				}	
				
		}
	}
});

function Alertas(msg,w){
	if(!w){
		$ancho=300;
	}else{
		$ancho=w;	
	}
		
	
	new Ventana({
		id:"ventana_1_registroooo",
		titulo:'Holaperu.com.pe',
		modal:true,
		html:"<div class='contenidoVentana'><img src='images/alert.png' align='absmiddle'/>"+msg+"</div>",
		ancho:$ancho,
		alto:120,
		arrastra:"si",
		fondo:"#FFF",
		estiloCabecera:"fondocabecera",
		separacion:0,
		colorBorde:"#FFB652",
		htmlCerrar: "X",
		borde:3
	}).render();
}

var ASlide = new Class({
	options: {
		showControls: false,
		showDuration: 5000,
		showTOC: false,
		tocWidth: 20,
		tocClass: 'toc',
		tocActiveClass: 'toc-active'
	},
	Implements: [Options,Events],
	initialize: function(container,elements,options) {
		//settings
		this.container = $(container);
		this.elements = $$(elements);
		this.currentIndex = 0;
		this.interval = '';
		if(this.options.showTOC) this.toc = [];
		
		//assign
		this.elements.each(function(el,i){
			var capa= new Element('div',{
			});
			capa.inject(this.container);
			if(this.options.showTOC) {
				this.toc.push(new Element('a',{
					text: i+1,
					href: '#',
					'class': this.options.tocClass + '' + (i == 0 ? ' ' + this.options.tocActiveClass : ''), //modificado para dulce
					//'class': 'toc'+(i+1)+' ' + (i == 0 ? ' ' + 'toc'+(i+1)+'-active' : ''),
					events: {
						click: function(e) {
							if(e) e.stop();
							this.stop();
							this.show(i);
						}.bind(this)
					},
					styles: {
						left: 270+ ((i + 1) * (this.options.tocWidth + 70)) //mpodificado parsa dulce  < ((i + 1) * (this.options.tocWidth + 10)) >
					}
				}).inject(this.container));
				//.inject(capa))
			}
			
			if(i > 0) el.set('opacity',0);
		},this);
		
		//next,previous links
		if(this.options.showControls) {
			this.createControls();
			
		}
		//events
		this.container.addEvents({
			mouseenter: function() { this.stop(); }.bind(this),
			mouseleave: function() { this.start(); }.bind(this)
		});

	},
	show: function(to) {
		//alert(this.currentIndex+1);
		this.elements[this.currentIndex].fade('out');
		if(this.options.showTOC) this.toc[this.currentIndex].removeClass(this.options.tocActiveClass);
		this.elements[this.currentIndex = ($defined(to) ? to : (this.currentIndex < this.elements.length - 1 ? this.currentIndex+1 : 0))].fade('in');
		if(this.options.showTOC) this.toc[this.currentIndex].addClass(this.options.tocActiveClass);
	},
	start: function() {
		this.interval = this.show.bind(this).periodical(this.options.showDuration);
	},
	stop: function() {
		$clear(this.interval);
	},
	//"private"
	createControls: function() {
		var next = new Element('a',{
			href: '#',
			id: 'next',
			text: '>>',
			events: {
				click: function(e) {
					if(e) e.stop();
					this.stop(); 
					this.show();
				}.bind(this)
			}
		}).inject(this.container); 
		var previous = new Element('a',{
			href: '#',
			id: 'previous',
			text: '<<',
			events: {
				click: function(e) {
					if(e) e.stop();
					this.stop(); 
					this.show(this.currentIndex != 0 ? this.currentIndex -1 : this.elements.length-1);
				}.bind(this)
			}
		}).inject(this.container); 
	}
});

var ACarrusel= new Class({
	Implements : Options,
	contenedor:"",
	options:{
		anchoItem:"",
		altoItem:"",
		ver:2,
		avanze:2,
		anterior:"",
		siguiente:"",
		duracion:0.5,
		auto:"",
		anchoTotal:"",
		transicion:"linear",
		ruedita:"",
		controles:"si"
	},
	imgSiguienteActivo:"",
	imgAnteriorActivo:"",
	anchoTotal:"",
	timer:"",
	hijos:"",
	
	initialize:function (contenedor,options){
		this.setOptions(options);
		this.contenedor=$(contenedor);
		padre=this.contenedor.getParent().getStyle("width");
		var warp= new Element("div",{
			styles:{
				"overflow":"hidden",
				"position":"relative",
				"width":padre
			}
		});
		
		
		if(this.options.ruedita!=""){
			this.contenedor.addEvents({
				"mousewheel":function(e){
					var e = new Event(e).stop();
					if ( e.wheel > 0  ) {
						this.mover("adelante");
					}else{
						this.mover("atras");
					}
				
				}.bind(this)
			});
		}
		this.contenedor.getParent().grab(warp);
		warp.adopt(this.contenedor);
		var ancho=this.contenedor.getParent().getCoordinates();
		if(this.options.anchoItem=="" && this.options.altoItem==""){
			this.options.anchoItem= (ancho.width.toInt()/this.options.ver);
			this.options.altoItem= (ancho.height.toInt()/this.options.ver);
		}
		var nodos=this.contenedor.getChildren();
		this.hijos=nodos;
		this.anchoTotal=this.options.anchoItem * nodos.length;
		this.contenedor.setStyles({"overflow":"hidden","position":"relative","list-style":"none","margin":0,"padding":0,"width":this.anchoTotal });
		this.contenedor.getChildren()
		.setStyles({"float":"left","height":this.options.altoItem,"width":this.options.anchoItem})
		.each(function(e,k){
			//e.set("id","_item_"+(k+1).toInt());
			e.addEvents({
				"mouseenter":function(){
					if(this.options.auto!=""){
						this.detenerAutomovible();
					}
					//e.setStyle("cursor","pointer");
				}.bind(this),
				"mouseleave":function(){
					if(this.options.auto!=""){
						this.automovible();
					}
				}.bind(this)
			});
		}.bind(this));
		
		this.imgSiguienteActivo=$(this.options.siguiente).getElement("img").get("src");
		this.imgAnteriorActivo=$(this.options.anterior).getElement("img").get("src");
		
		new Asset.images([
			this.options.imgSiguienteDesactivo , this.options.imgAnteriorDesactivo
		]);
		
		
		
		if(this.options.controles=="si"){
			if(this.hijos.length > this.options.ver){
				$(this.options.anterior)
				.setStyle("cursor","pointer");
				$(this.options.siguiente)
				.setStyle("cursor","pointer");
				$(this.options.siguiente).
						addEvent("click",function(){
							this.mover("adelante");
					}.bind(this));
					
					$(this.options.anterior).
						addEvent("click",function(){
							this.mover("atras");
					}.bind(this));
				
			}else{
				$(this.options.siguiente).getElement("img").set("src",this.options.imgSiguienteDesactivo);
				
			}
			$(this.options.anterior).getElement("img").set("src",this.options.imgAnteriorDesactivo);
		}
		
		if(this.options.auto!=""){
				this.automovible();
		}
	},
	automovible:function(){
		this.timer=this.mover.periodical(this.options.auto * 1000,this,["adelante"]);
	},
	detenerAutomovible:function(){
		$clear(this.timer);
	},
	mover:function(direccion){	
			
			if(direccion=="adelante"){
				if(this.hijos.length > this.options.ver){
						actual=this.contenedor.getStyle("margin-left").toInt();
						this.contenedor.set("morph",{
							duration:this.options.duracion * 1000,wait:false,transition:this.options.transicion,
							onStart:function(){
								itemactual= - (this.contenedor.getStyle("margin-left").toInt());//this.anchoTotal
								aver=(itemactual/this.options.anchoItem)+1;
								if(aver>(this.hijos.length-this.options.avanze)){
									this.contenedor.get("morph").cancel();
									this.moverAlPrimero();
									return false;
								}
							}.bind(this)
						});
						this.contenedor.morph({
							"margin-left":  (actual - this.options.anchoItem * this.options.avanze)
							//"opacity" : [0.5,1]
						});
						$(this.options.anterior).getElement("img").set("src",this.imgAnteriorActivo);
						//alert(this.imgSiguienteActivo);
						
				}else{
					//para hola hola
					$(this.options.siguiente).setStyle("cursor","default");
							
				}
				
			}else if (direccion="atras"){
				if(this.hijos.length > this.options.ver){		
					actual=this.contenedor.getStyle("margin-left").toInt();
					this.contenedor.set("morph",{duration:this.options.duracion * 1000,wait:false,transition:this.options.transicion,
						onStart:function(){
							itemactual=(this.contenedor.getStyle("margin-left").toInt());//this.anchoTotal
							if(itemactual==0){
								this.contenedor.get("morph").cancel();
								
									$(this.options.anterior).getElement("img").set("src",this.options.imgAnteriorDesactivo);
									
								return false;
							}
						}.bind(this)
					});
					this.contenedor.morph({
						"margin-left":  (actual + this.options.anchoItem * this.options.avanze)
						//"opacity" : [0.5,1]
					});
					
				}else{
					$(this.options.anterior).setStyle("cursor","default");
				}
			}
	},
	moverAlPrimero:function(index){
		this.contenedor.set("morph",{duration:this.options.duracion * 1000,wait:true,transition:this.options.transicion});
		this.contenedor.morph({
			"margin-left":  0
			//"opacity" : [0.5,1]
		})
	}
});


var AGalery= new Class({
	Implements: [Options,Events],
	options :{
		altoImagen:400,
		anchoImagen:400,
		klass:"galery",
		opacidad:0.5,
		fondoModal:"#000",
		altoDiv:600,
		anchoDiv:600,
		colorFondo:'white',
		imgFondo:''
	},
	imgs:[],
	prev:null,
	next:null,
	imagenActual:0,
	divImagen:null,
	modal:null,
	initialize:function(options){
		this.modal= new Element('div',{
				id:"VentanaMooModal",
				styles:{
					backgroundColor : this.options.fondoModal,
					opacity:this.options.opacidad,
					height:window.getScrollHeight(),
					width:window.getScrollWidth(),
					zIndex:1009,
					position:'absolute',
					top:'0px',
					left:'0px',
					visibility:'hidden'
				}
			});	
			
	
			
			
		this.divImagen=new Element("div",{
				id:this.options.id,
					styles:{
						backgroundColor : this.options.colorFondo,
						height:this.options.altodiv,
						width:this.options.anchodiv,
						position:'absolute',
						left:parseInt(window.getWidth()/2)-parseInt(this.options.anchoDiv/2),
						top:parseInt(window.getHeight()/2)-parseInt(this.options.altoDiv/2),
						zIndex:1200,
						display:'none'
					}
					
		});
			
		this.modal.addEvent("click",this.close.bind(this))	;
		this.setOptions(options);
		this.imgs=$$('a.'+this.options.klass);
		this.imgs
		.each(function(j,k){
			j.
			addEvent("click",function(e){
				e.stop();
				this.init(k);
			}.bind(this));
		}.bind(this));
	},
	init:function(e){
		if(!$('VentanaMooModal')){
			$$('body').grab(this.modal);
			this.modal.tween("opacity",[0,this.options.opacidad]);
			$$('body').grab(this.divImagen);

		}
	
	},
	close:function(){
		$$('select').setStyle("visibility","visible");
			$('VentanaMooModal')
			.set("tween",{
				duration:500,
				onComplete:function(){
						$('VentanaMooModal').destroy();
				}
			});
			
			$('VentanaMooModal').tween("opacity",[this.options.opacidad,0])
			
			$$('select').setStyle("visibility","visible");
			this.fireEvent('cerrar');
	}
	
});





/****/		
new Asset.css('css/formcheck.css');
var Hola = new Hola();




