




 $(function() {


  
  
	
	// Sidenav Accordion Config
		$( "ul#accordion" ).accordion({
			collapsible: true,
			active:false,
			header: 'a.top_level',
			autoHeight:false,
			icons:false
		});

	// Top Nav Dropdown Accordion Config				
		$( "ul.dropdown" ).accordion({
			collapsible: true,
			active:false,
			header: 'li a.has_slide', // this is the element that will be clicked to activate the accordion 
			autoHeight:false,
			event: 'mousedown',
			icons:false
		});
 	
 	// Content Box Toggle Config 
		$("a.toggle").click(function(){
			//$(this).toggleClass("toggle_closed").next().slideToggle("slow");
			$(this).next().slideToggle("slow");
			return false; //Prevent the browser jump to the link anchor
		});
		
		
    $(".slidingDiv").hide();
	//$(".muestra-alimentacion").show();
	$('.muestra-alimentacion').click(function(){
    $("#sort-otros.slidingDiv").hide();		
	$("#sort-alimentacion.slidingDiv").show();
	});
	
	//$(".muestra-otros").show();
	$('.muestra-otros').click(function(){
    $("#sort-alimentacion.slidingDiv").hide();		
	$("#sort-otros.slidingDiv").show();
	});
	
	//$(".muestra-ninguno").show();
	$('.muestra-ninguno').click(function(){
    $("#sort-alimentacion.slidingDiv").hide();		
    $("#sort-otros.slidingDiv").hide();
	});

		
		 
 	
 	// Content Box Tabs Config
			$(".tabs").tabs({selected:1}); /* edit: tab 2 seleccionada, tab 1 deshabilitada temporalmente */
			/*$(".tabs").tabs(); desmarcar para habilitar tabs*/ 
			$("#tabs-2").tabs({selected:0});
		 
 
	// Content Box Accordion Config		
		$( ".content_accordion" ).accordion({
			collapsible: true,
			active:false,
			header: 'h3.bar', // this is the element that will be clicked to activate the accordion 
			autoHeight:false,
			event: 'mousedown',
			icons:false,
			animated: true
		});
		
	// Sortable Content Boxes Config				
		$( ".main_container" ).sortable({
			handle:'.grabber',  // the element which is used to 'grab' the item
			items:'div.box', // the item to be sorted when grabbed!
			opacity:0.8,
			revert:true,
			tolerance:'pointer',
			helper:'original',
			forceHelperSize:true,
			placeholder: 'dashed_placeholder',		
			forcePlaceholderSize:true
		});

	// Sortable Accordion Items Config			
		$( ".content_accordion" ).sortable({
			handle:'a.handle',
			axis: 'y', // the items can only be sorted along the y axis
			revert:true,
			tolerance:'pointer',
			forcePlaceholderSize:true
		});
		
	// Input Datepicker Config
		//$( ".datepicker" ).datepicker({ dateFormat: 'd M yy' });; // the time format which will be input to the datepicker field upon selection. more info on formatting here: http://docs.jquery.com/UI/Datepicker/formatDate
	
	// input Slider	Config
		$( ".slider" ).slider(); // creates a simple slider with default settings
	
		
	// input Range Slider Config	
		/*$( ".slider_range" ).slider({
			range: true, // creates a range slider
			min: 0,
			max: 500,
			values: [ 75, 300 ],
			slide: function( event, ui ) {
				$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
			}
		});*/
		
		/*$( "#amount" ).val( "$" + $( "#slider_range" ).slider( "values", 0 ) +
			" - $" + $( "#slider_range" ).slider( "values", 1 ) );*/
		
	// Dialog Config
		$( "#dialog" ).dialog({
			autoOpen: false, 
			show: "fade",
			hide: "fade",
			modal: true 
		});
		
		$( "#opener" ).click(function() {
			$( "#dialog" ).dialog( "open" ); // the #dialog element activates the modal box specified above
			return false;
		});
	
	//Progress Bar Config
		$( "#progressbar" ).progressbar({
			value: 37
		});
		
	// Dismiss alert box
		$(".alert").click(function(){
			$(this).fadeOut('slow');
		});
				
		
// Other Scripts

	// Orbit
		$('#featured').orbit();
		//$('#noticias-slider').orbit({animation: 'vertical-slide', timer: false, directionalNav: true, pauseOnHover: true, animationSpeed: 500,});
		$('#noticias-slider').cycle({ fx: 'scrollUp', prev: '#anterior',  next:   '#siguiente',  timeout: 6000, 
    delay:  -2000 , pause: 'true'  }); 

	// Uniform Config (more info can found at http://pixelmatrixdesign.com/uniform/)
       //$( "input:checkbox, input:radio, input:file").uniform();
	
    // Tipsy Top Config (more info found at http://onehackoranother.com/projects/jquery/tipsy/)
		$('[title]').tipsy({
			fade: true,     // fade tooltips in/out?
			fallback: '',    // fallback text to use when no tooltip text
			gravity: 's',    // gravity
			opacity: 1,    // opacity of tooltip
			title: 'title',  // attribute/callback containing tooltip text
			trigger: 'hover' // how tooltip is triggered - hover | focus | manual    	
		});  
		
	// Tipsy Side Config
		$('input[title]').tipsy({
			trigger: 'focus',  
			offset:'5',
			gravity: 'w'
		});
		
	// Tipsy Side Config
		$('a.hoverright').tipsy({
			fade: true,
			trigger: 'hover',  
			offset:'5',
			title: 'title',
			gravity: 'w'
		});
		
		
		
		
		
		
	/*	
	$('#contactform').submit(function(){
		var action = $(this).attr('action');
		$('#contactform #submit').attr('disabled','disabled');
		$("#avisos").slideUp(750,function() {
		$('#avisos').hide();			
		
		$.post(action, { 
			nombre: $('#nombre').val(),
			email: $('#email').val(),
			empresa: $('#empresa').val(),			
			poblacion: $('#poblacion').val(),				
			provincia: $('#provincia').val(),			
			tel: $('#tel').val(),
			pais: $('#pais').val(),
			motivo: $('#motivo').val(),
			consulta: $('#consulta').val(),
			verify: $('#verify').val()
			
			},
			function(data){
				document.getElementById('avisos').innerHTML = data;
				$('#avisos').slideDown('slow');
				$('#contactform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#contactform').slideUp('slow');
				
			}
		);
		
		});
		return false; 
	});*/
		
		
		
		
		
		
		
		
		
		
		
	
	// focus on first field in form
	//$("input[type='text']:first", document.forms[0]).focus();
	
		
	// iOS Device Touch Config (more info can be found at http://old.nabble.com/jQuery-UI-Support-on-the-iPhone-td22011162s27240.html)
	
		$('.main_container').sortable();
		$('.grabber').addTouch();
		$('ul.content_accordion').sortable();
		$('a.handle').addTouch();
		$('.ui-slider-handle').addTouch();
		
	




	

});
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	

