var DunasLib = 
{
	/** << Main Function 
	* ---------------------*/
	main : {
		init : function() {
			DunasLib.liveWeather.init();
			DunasLib.cufon.init();
			//DunasLib.corner.init();
			//DunasLib.pngFix.init();
			//DunasLib.corner.init();
		}
	},
	
	/** << Set Cufon 
	* ---------------------*/
	cufon : {
		init : function() {
			Cufon.replace('.daxCompactBold', {fontFamily:'DaxCompact-Bold'});
			
			Cufon.replace('.text-titulo', {fontFamily:'DaxCompact-Bold'});
			Cufon.replace('.opciones-habitaciones,.menu-espanol,.opciones-servicios,.opciones-informacion,#menu_inter_izquierda,#menu_inter_derecha,.opciones-turisitica,.opciones-datos,.opciones_galeria', {fontFamily:'DaxCompact-Bold'});
		}
		
	},
	
	/** << sliderPhotos fade
	* ---------------------*/
	sliderPhotos : {
		init : function() {
		 $('.centro_img').cycle({fx: 'fade', opacy: 19});
		}
	},
	
	/** << Live Weather
	* ---------------------*/
	liveWeather : {
		init : function() {
			this.parameters = {};
			this.parameters.op = 'clima';
			this.parameters.localidad_id = "PEXX0009"; // Ica
			this.getData(this.parameters);
		},
		getData : function(options) {
			$.ajax({
				url : "getWeather.php",
				data : options,
				dataType: 'json',
				success: function(response){
					var clima = response.clima;
	
					$('#live-weather-temperature').html(clima.temperatura);
					$('#live-weather-location').html(clima.lugar).append(' City');
					$('#live-weather-img').html('<img src="images/iconos-clima/'+clima.codigo+'.png" id="weather-img"  width="63"  height="63" alt='+clima.estado+'>');
					
					Cufon.refresh('.daxCompactBold');
					
					$.getScript('js/jquery.pngFix.js', function() {
						$('#live-weather-img').pngFix();
					});
				}
			})
		}
	},
	
	/** << Live Weather
	* --------------------- */
	homeSlides : {
		init : function() {
			$('.header_reservas img').toggle(
				function () {
					$('#nuestras-promociones').animate({ top: '-280px' }, 1000 );			
					$('.header_reservas').animate({ top: '0px' }, 1000 );
				}, 
				function () {
					$('#nuestras-promociones').animate({ top: '0px' }, 1000 );		
					$('.header_reservas').animate({ top: '0px' }, 1000 );
				}
			);
			$('.header_reservas2 img').toggle(
				function () {			
					$('#consulta-reservas').animate({ top: '-400px' }, 1000 );
					$('.header_reservas2').animate({ top: '0px' }, 1000 );
				}, 
				function () {
					$('#consulta-reservas').animate({ top: '0px' }, 1000 );	
					$('.header_reservas2').animate({ top: '0px' }, 1000 );
				}
			);
		}
	},
	
	/** << Corner Declarations
	* --------------------- */
	corner : {
		init : function() {
			$('.banner_izquierda').corner('tl 10px').corner('bl 10px').corner('br 10px');
			$('#ishtar-container').corner('bl 10px').corner('br 10px');
			$('#habitaciones').corner('10px');
			$('.paquete_contenido').corner('10px');
			$('#servicios').corner('10px');
			$('#informacion').corner('10px');
			$('#contenido_text').corner('10px');
			$('.botones_ver').corner('30px');
			
			$('ul.cosas_habitacion').corner('tl 10px').corner('bl 10px');
			$('.secciones_habitaciones').corner('10px');	
			
			$('.contactenos_contenido1').corner('10px');
			$('.contactenos_contenido2').corner('10px');
		}
	},
	
	/** << PngFix Declarations
	* --------------------- */
	pngFix : {
		init : function() {
			$('#header,.titulo_reservas,#logo_inter,#menu-top').pngFix();
		}
	},
	
	/** << Validate Declarations
	* ----------------------- */
	
	validateForms : {
	 	init : function() { },
		
		pageSolicita : function() {

			var v = $("#form1").validate({
				errorElement : 'span',
				onkeyup: false,
				onblur: false,
				errorClass: "invalid",
				rules: {
					txt_nombre : { required: true  },
					txt_apellido : { required: true  },
					txt_email : { required: true  },
					txt_fecha_reservacion : { required: true  }
				},
				messages: {
					txt_fecha_reservacion: { required: " *"  },
					txt_nombre : { required: " *"  },
					txt_apellido : { required: " *"  },
					txt_email : { required: " *"  }
				},
				submitHandler: function(form) {
					v.submit();
				},
				success: function(span) { // set   as text for IE
					span.html(" ").addClass("checked");
				}
			});	
		},
		
		pageContactUs : function() {
			var v = $("#form1").validate({
				errorElement : 'span',
				onkeyup: false,
				onblur: false,
				errorClass: "invalid",
				rules: {
					txt_nombre : { required: true  },
					txt_apellido : { required: true  },
					txt_email : { required: true  }
				},
				messages: {
					txt_nombre : { required: " *"  },
					txt_apellido : { required: " *"  },
					txt_email : { required: " *"  }
				},
				submitHandler: function(form) {
					v.submit();
				},
				success: function(span) { // set   as text for IE
					span.html(" ").addClass("checked");
				}
			});	
		}
	},
	
	/** << Setup Calendars
	* ----------------- */
	
	calendar : {
		init : function() {},
		
		pageSolicita : function() {
			$("#txt_fecha_reservacion").datepicker({ 
				yearRange: "+0:+3", 
				minDate: "0d", 
				maxDate: "3y", 
				showAnim: "slideDown",
				dateFormat: "yy-mm-dd",
				showStatus: true, 
				showOn: "both", 
				buttonImage: "../js/calendar/images/calendar1.png",
				buttonImageOnly: true,
				onSelect: function(dateText, inst) { 
					var isValid = $('#txt_fecha_reservacion').validate();
						
				}
			})
		}
	},
	
	/** << Setup Lightbox
	* ---------------- */
	
	lightbox : {
		init : function() { $('.view-img').lightBox(); }
	},
	
	/** << Setup Lightbox
	* ---------------- */
	
	gallery : {
		init : function() { 
			$('.mycarousel').jcarousel({scroll:1});
		} 	
	}
}

DunasLib.main.init();
