function preloadGaleria(){
	$('ul#myRoundabout').roundabout({
		shape: 'figure8',
		btnNext: '#btnnext',
		btnPrev: '#btnprev'		  
	});
	$('#myRoundabout').css('visibility','visible');
	$('.showcase .showloading').hide();
}

$(function(){ 
	preloadGaleria();
});


$(document).ready(function() {
		$(".smallbox").fancybox({
			'width'				: 490,
			'height'			: 130,
			'autoScale'     	: false,
			'autoDimensions'    : true,
			'scrolling'         : 'no',
			'padding'           : 0,
			'margin'            : 0,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
		});
		
		$(".bigbox").fancybox({
			'width'				: 550,
			'height'			: 600,
			'autoScale'     	: false,
			'autoDimensions'    : true,
			'scrolling'         : 'no',
			'padding'           : 0,
			'margin'            : 0,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
		});

		$(".trailer").fancybox({
			'width'				: 689,
			'height'			: 516,
			'autoScale'     	: false,
			'autoDimensions'    : true,
			'scrolling'         : 'no',
			'padding'           : 0,
			'margin'            : 0,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
		});

		$(".mapacine").fancybox({
			'width'				: 500,
			'height'			: 370,
			'autoScale'     	: false,
			'autoDimensions'    : true,
			'scrolling'         : 'no',
			'padding'           : 0,
			'margin'            : 0,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
		});
		
		$(".la_ruta_diversion").fancybox({
			'width'				: 600,
			'height'			: 1000,
			'autoScale'     	: false,
			'autoDimensions'    : true,
			'scrolling'         : 'no',
			'padding'           : 0,
			'margin'            : 0,
			'transitionIn'		: 'fade',
			'transitionOut'		: 'fade',
			'type'				: 'iframe'
		});
		
		$("a[rel=group]").fancybox({
			'margin'			:  25,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titlePosition' 	: 'over',
			'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
				return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			}
	});
});

	//$.fn.fancybox.close()
	
//18.4789272879404, -69.96285796165466	 //oficina principal
function showMap(myLat,myLang) {
	$(window)
		.load(function(){

			if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("map_canvas"));
			
			var mylatlng = new GLatLng(myLat,myLang);
			map.setCenter(mylatlng, 14);
			
			/*GEvent.addListener(map,"click", function(overlay,latlng) {     
			  if (latlng) {   
				var myHtml
				  = "Lat: " + latlng.lat() + "<br />"
				  + "Lng: " + latlng.lng() + "<br />"
				  + "Zoom: " +map.getZoom()+ "<br />"
				  ;
				map.openInfoWindow(latlng, myHtml);
			  }
			});*/
			
			map.addControl(new GSmallMapControl());
			map.addControl(new GMapTypeControl());
			map.addOverlay(new GMarker(mylatlng));
			}			
		})
		.unload(function(){
			GUnload();
		});	

}



$(function(){
	//mostrarFormulario();
	//mostrarEnvioNewsletter();
	//activityButtons();
	
	$("#form_enviar").validate({
	   errorElement: 'em',
	   //errorContainer: ".IgnErrorContainer",
	   //errorLabelContainer: ".IgnErrorLabel",
		//errorPlacement: function(error, element) {
		//	error.insertInside("fe_"+element.attr("name"));
		//},
		 submitHandler: function(form) {
			//submitFormEnviar();
			form.submit();
			return true;	
		 },
		 
		rules: {
			department: {
				required: true
			},
			name: {
				required: true,
				minlength: 2
			},
			subject: {
				required: true,
				minlength: 2
			},
			email: {
				required: true,
				email: true
			},
			message: {
				required: true,
				minlength: 10
			}
		} /*,
		messages: {
			f_nombre: {
				required: "Escribe tu nombre",
				minlength: "Tu nombre debe tener por lo menos 4 carÃ¡cteres"
			},
			f_empresa: {
				required: "Escribe tu empresa",
				minlength: "Tu empresa debe tener por lo menos 4 carÃ¡cteres"
			},
			f_cargo: {
				required: "Escribe tu cargo",
				minlength: "Tu cargo debe tener por lo menos 4 carÃ¡cteres"
			},
			f_telefono: {
				required: "Escribe tu telÃ©fono",
				minlength: "Tu telÃ©fono debe tener por lo menos 10 dÃ­gitos"
			},
			f_email: {
				required: "Escribe tu direcciÃ³n de correo electrÃ³nico",
				email: "Favor escribe una direcciÃ³n de correo vÃ¡lida"
			},
			f_notas: {
				required: "Escribe una nota",
				minlength: "Tu nota debe tener por lo menos 10 carÃ¡cteres"
			}			

		}*/
	});
	
});

