/*--Funcion para subMenu--*/
$(document).ready(function(){
	$("#mainMenu li a").mouseover(function() {

		$("#mainMenu li ul.subMenu").css("z-index","1000");
		$(this).parent().find("ul.subMenu").slideDown('fast').show();	
		$(this).parent().hover(function() {
		}, function(){
			$(this).parent().find("ul.subMenu").slideUp('600');
		});
	});
	
	$("#mainMenu li ul.subMenu li a").mouseover(function() {
		//alert('SubMenu2');
	});
	
	
	jQuery("div#slider1").codaSlider();
	
	/*
$(function() {
        $("#mainMenu_UL").lavaLamp({
            fx: "backout",
            speed: 500
        });
    });
*/
	
	try{
		jQuery('#accordion_').accordion({
			//animated: 'bounceslide',
			selectedClass: 'acc_active',
			autoheight: false
		});
	}catch(e){
		//alert(e);
	}
	

	jQuery('#myProducts').jcarousel({
        auto: 4,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });


	//jQuery('#myProducts').jcarousel();
	

});

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function showNews(tab){
	switch(tab){
		case '#hC_MC_R_Encuesta' :
			
			$('#span_Enc').removeClass();	
			$('#span_Enc').addClass('active');
				
			$('#span_Not').removeClass();
			
			$('#hC_MC_R_Noticias').slideUp();
			$('#hC_MC_R_Encuesta').slideDown();
						
			
		break;
		case '#hC_MC_R_Noticias' :
			
			$('#span_Not').removeClass();
			$('#span_Not').addClass('active');
			$('#span_Enc').removeClass();
			
			$('#hC_MC_R_Encuesta').slideUp();
			$('#hC_MC_R_Noticias').slideDown();
			
		break;
	}
}

function submitThisForm(form){		
	o_config = {'alert' : 1};	
	var v = new validator(form, a_fields, o_config);	
	if(v.exec()){ $('#'+form).submit(); }
}

