$(document).ready(function(){
	$("ul.sf-menu").superfish({
		delay:       10,
		animation:   {opacity:'show',height:'show'},
		speed:       'fast',
		autoArrows:  false
	});
	$(document).pngFix();
	$(".shadow").dropShadow({left: 1, top: 1, blur: 0});
	checkErrores();
});
/*Mostrar y Ocultar*/
$(document).ready(function(){
	$(".botoMuestra").click(function () {
		$(".slide").slideToggle("fast");
	});
});
/*Tabs Sidebar*/
  $(document).ready(function(){
	/*$("a.tab").click(function () {
		$(".active").removeClass("active");
		$(this).addClass("active");
		$(".content").slideUp();
		var content_show = $(this).attr("title");
		$("#"+content_show).slideDown();
	});*/
  });
// initialize scrollable together with the circular plugin
$(document).ready(function() {
	$("#infinite").scrollable().circular().autoscroll({autoplay: true});
	$("#demo img[title]").tooltip('#demotip');
});

function toggle( id ){
	if ( $('#botoCola_'+id ).attr( "class" ) == "linkDesColap" ){
		$('#senaAdic_'+id).slideDown("fast");
		$('#botoCola_'+id).attr( 'class', 'linkColap' );
	}else{
		$('#senaAdic_'+id).slideUp("fast");
		$('#botoCola_'+id).attr( 'class', 'linkDesColap' );
	}
}

function realoadPlanSeleccion( plan_entrada ){
	var ruta_web = $("#ruta_web").attr( "value" );
	$.ajax({
		type: "POST",
		url: ruta_web + "/plan_seleccion_print.php",
		data: "plan_entrada="+ plan_entrada,
		success: function(datos){
			$("#estreno").html( datos );
		}
	});
}

/*
function contrata( input, tipo, plan_entrada ){
	var key = $(input).attr( "value" );
	var selected = $(input).attr( "checked" ) ? 1 : 0;

	var ruta_web = $("#ruta_web").attr( "value" );
	$.ajax({
		type: "POST",
		url: ruta_web + "/plan_seleccion.php",
		data: "tipo="+ tipo + "&key=" + key + "&selected=" + selected,
		success: function(datos){
			realoadPlanSeleccion( plan_entrada );
		}
	});
}*/

function checkErrores(){
	if ( $("#lista_errores").html() ){
		var lista = $("#lista_errores").html().split( ';' );
		for( var i=0; i < lista.length; i++ ){
			$( "#" + lista[i] ).addClass('error');
			$( "#_" + lista[i] ).addClass('error');
		}
	}
}


function trim(input, solo_texto){
	if ( solo_texto ){
		s = input;
	}else{
		input = document.getElementById( input );
		s = input.value;
	}

	s = s.replace(/^\s+/, "");
	s = s.replace(/\s+$/, "");

	if ( solo_texto ){
		return s;
	}else{
		input.value = s;
	}
}
