// JavaScript Document

$(window).load(function() {
	 $('#slider2').nivoSlider({
        effect:'fold', // Specify sets like: 'fold,fade,sliceDown'
        slices:15, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:1400, // Slide transition speed
        pauseTime:6000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:false, // Next & Prev navigation
        directionNavHide:true, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        controlNavThumbs:false, // Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, // Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', // Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
        keyboardNav:false, // Use left & right arrows
        pauseOnHover:false, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    });
	
	$('#slideshow').after('<div id="ft-buttons-gallery" class="nav">').cycle({
        fx: 'fade',/*blindX blindY - blindZ - cover - curtainX - curtainY - fade - fadeZoom - growX - growY - scrollUp - scrollDown - scrollLeft - scrollRight - scrollHorz - scrollVert - shuffle - slideX - slideY - toss - turnUp - turnDown - turnLeft - turnRight -uncove - rwipe - zoom*/
		speed:  1000,
        pager:  '#ft-buttons-gallery'
    });
});

$(document).ready(function(){
	$("tr.odd:not(.noclick), tr.even:not(.noclick)").live("click",function(a){
		
			var b=$(this),c=b.find(":checkbox");
			//alert(c.length);
			if(c.length){
				var d=c.attr("checked");
				if(!$(a.target).is(":checkbox")){
					d=!d;
					c.attr("checked",d)
				}
					d?b.addClass("marked"):b.removeClass("marked")}
				else b.toggleClass("marked")
				}
			
		);
});

$(document).ready(function(){
	$("tr.odd, tr.even").live("hover",function(){
		var a=$(this);
		a.toggleClass("hover");
		a.children().toggleClass("hover")
	})
	
	$("#md").click(function(){
		if(!$(this).hasClass("clic")){
			markAllRows('tablesForm');
			$(this).addClass("clic"); 
		}else{
			unMarkAllRows('tablesForm');
			$(this).removeClass("clic"); 
		}
	});
	
});



function markAllRows(a){
	$("#"+a).find("input:checkbox").attr("checked","checked").parents("tr").addClass("marked");
	return true
}
function unMarkAllRows(a){
	$("#"+a).find("input:checkbox").removeAttr("checked").parents("tr").removeClass("marked");
	return true
}

$(document).ready(function(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeIn(700);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
});

$(".scrollable").scrollable({circular: true}).autoscroll({ autoplay: true });

$(".scrollable a").click(function(){
		$(".image_documental img").hide();
		$(".image_documental img").attr("src","aplication/webroot/imgs/catalogo/"+$(this).attr("rel")).fadeIn("slow");
		$(".highslide").attr("href","aplication/webroot/imgs/catalogo/"+$(this).attr("rel"));
		
	
		$(".scrollable a").removeClass("active_imagenes");
		$(this).addClass("active_imagenes")
});
	 
/*$('#pane1,#pane2').jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
$(".repeat_servicios").css("display","none");	
$(".repeat_servicios").eq(0).css("display","block");
$(".menu_servicios a:eq(0)").addClass("active_produc");
$(".menu_servicios a").click(function(){
	$(".repeat_servicios").hide();
	$(".repeat_servicios").eq($(this).index()).slideDown("flast");	
	$(".menu_servicios a").removeClass("active_produc");
	$(this).addClass("active_produc")
	
	
});

$(".repeat_diferenciados").css("display","none");	
$(".repeat_diferenciados").eq(0).css("display","block");
$("#menu_diferenciados a:eq(0)").addClass("active_diferen");
$("#menu_diferenciados a").click(function(){
	$(".repeat_diferenciados").hide();
	$(".repeat_diferenciados").eq($(this).index()).slideDown("flast");	
	$("#menu_diferenciados a").removeClass("active_diferen");
	$(this).addClass("active_diferen")
	
	
});


$('#menu a')
	.css( {backgroundPosition: "0px -54px"} )
	.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(0px -1px)"}, {duration:400})
	})
	.mouseout(function(){
		if($(this).attr("id") != "active"){
		$(this).stop().animate({backgroundPosition:"(0px -54px)"}, {duration:200, complete:function(){}
		})
		}		
	});
	
	$('#menu a').each(function(i){
		if($(this).attr("id") == "active"){
			$(this).css( {backgroundPosition: "0px -1px"} );
		}					   
	});
*/
	
});




		
	
/*ajax
$.get("servicios_secciones.php",{param:'1',id:$("#posS").val()},function(data){ $("#load").html(data);});
$("#colum_menu a").click(function(){
	$(".loading2").show();
	$("#load").hide();
	$("#colum_menu a").removeClass("activando");
	$(this).addClass("activando");
										 
	$.get("servicios_secciones.php",{param:'servicios',id:$(this).attr("name").split("-")[1]},function(data){ 
		$(".loading2").fadeOut("slow", function(){
				$("#load").show();				
				$("#load").html(data).fadeIn("slow");						   
		});			       																		  
	}); 
});	*/


/*	menu lavalam
 $("#3").lavaLamp();*/
 


/*ajax productos
$.get("productos_secciones.php",{page:0},function(data){ $("#load2").html(data);});
$(".capas a").click(function(){
	$(".loading3").show();
	$("#load2").hide();
	$(".capas a").removeClass("activando");
	$(this).addClass("activando");
									 
	$.get("productos_secciones.php",{page:$(this).attr("name").split("-")[1]},function(data){ 
		$(".loading3").fadeOut("slow", function(){
			$("#load2").show();	
			$("#load2").html(data).fadeIn("slow");	
								   
		});			       																		  
	}); 
});	*/

function validar(){
	if(document.frm.tipo_consulta.value==""){
		alert("ERROR : Por favor Seleccione el tipo de consulta ");
		document.frm.tipo_consulta.focus();
		return false;
	}else if(document.frm.nombre.value==""){
		alert("ERROR : Por favor escriba su Nombre");
		document.frm.nombre.focus();
		return false;
	}else if(document.frm.apellidos.value==""){
		alert("ERROR : Por favor escriba sus Apellidos");
		document.frm.apellidos.focus();
		return false;
	
	}else if(document.frm.n_documento.value==""){
		alert("ERROR : Por favor escriba su Número de su Documento de Identificación");
		document.frm.n_documento.focus();
		return false;
	}else if(document.frm.email.value==""){
		alert("ERROR : Por favor escriba su E-mail ");
		document.frm.email.focus();
		return false;
	}else if(document.frm.p_recidencia.value==""){
		alert("ERROR : Por favor escriba su País de residencia ");
		document.frm.p_recidencia.focus();
		return false;
	
	}else if(document.frm.d_recidencia.value==""){
		alert("ERROR : Por favor escriba su Dirección de residencia");
		document.frm.d_recidencia.focus();
		return false;
	}else if(document.frm.telefono.value==""){
		alert("ERROR : Por favor escriba su Teléfono");
		document.frm.telefono.focus();
		return false;
	}else if(document.frm.vuelo.value==""){
		alert("ERROR : Por favor escriba su Vuelo");
		document.frm.vuelo.focus();
		return false;
	}else if(document.frm.f_vuelo.value==""){
		alert("ERROR : Por favor escriba su Fecha vuelo ");
		document.frm.f_vuelo.focus();
		return false;
	}else if(document.frm.tramo.value==""){
		alert("ERROR : Por favor escriba su Tramo");
		document.frm.tramo.focus();
		return false;
	}else if(document.frm.comentario.value==""){
		alert("ERROR : Por favor  Escriba aquí su reclamo, queja o sugerencia ");
		document.frm.comentario.focus();
		return false;
	}else{
		return true;	
		//document.frm.action='enviar.php';
		//document.frm.submit();
	}
}



