function mycarousel_initCallback(carousel) {
	var altura;
	altura = 0;
	$('.jcarousel-item', carousel.container).each(function(){
		var h = $(this).height();	//parseInt($(this).css('height'));
		if(h > altura) altura=h;
	});
	//Establecer altura de botones
	$('.jcarousel-next', carousel.container).height(altura);
    $('.jcarousel-prev', carousel.container).height(altura);
};
function mycarousel_initCallback_home(carousel) {
    jQuery('.jcarousel-control a:first').addClass("current");
    jQuery('.jcarousel-control a').each(function(){
        var $this = $(this);
        $this.bind('click', function() {
            carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
            $this.parent().children().removeClass("current");
            $this.addClass("current");
            clearInterval($.carouserlIntervalID);
            return false;
        });
    });
    var tabsLength = $('div#flash ul.jcarousel-list li.jcarousel-item').length;
    var TIME = 8000;
    var pointer = 1;
    var f = function() {
        carousel.scroll(pointer);
        $('div#flash div.jcarousel-control a').removeClass("current");
        $('div#flash div.jcarousel-control a:eq(' + (pointer - 1) + ')').addClass("current");
        pointer < tabsLength ? pointer++ : pointer = 1;
    };
    $.carouserlIntervalID = setInterval(f, TIME);
};
$(document).ready(function() {
    var dls = document.location.search.replace('?', '');
    $.qs = {};
    $(dls.split('&')).each(function(i, el) {
        var pcs = el.split('=');
        $.qs[pcs[0]] = pcs[1];
    });
	//Script to make IE cufon loading faster
	Cufon.now();

	//Tabs
/*	$("#pestanas_crsl ul.tabs").tabs("#pestanas_crsl > div.panes > div", {
		onClick: function(event, tabIndex) { 
        	this.getTabs().eq(tabIndex).parent().addClass("current");
			this.getCurrentTab().parent().removeClass("current");
		}
	});
	
	$("#noticias2 ul.tabs").tabs("#noticias2 > div.panes > div", {
		onClick: function(event, tabIndex) { 
        	this.getTabs().eq(tabIndex).parent().addClass("current");
			this.getCurrentTab().parent().removeClass("current");
		}
	});*/
	
	//Encuentra tu solución y Otros Sectores

	$("a[href=#solucion_desplegable], a[href=#otros-sectores], a[href=#desplegable2], a[href=#desplegable3]").each(function() {
	  $(this).click(function(){
		return false;
		})
	  .mousedown(function(e) {
		var evt = e;
		$(this).mouseup( function(e) {
			var srcElement, displayIdElement;
			srcElement = $(this);
			displayIdElement = srcElement.attr("href");
			srcElement.unbind('mouseup');
			//console.log("evt.button: %o HREF: %o", evt.button, srcElement.attr("href"));
			if( evt.button == 0 || evt.button == 1 ) {
				// Hide context menus that may be showing
				$(".applusMenu:not("+displayIdElement+")").hide();
				
				// Show the menu
				$(document).unbind('click');
				$(displayIdElement).addClass('applusMenu').toggle();
				
				// Hide bindings
				setTimeout( function() { // Delay for Mozilla
					//Evitar oculatar las opciones de la capa
					$(displayIdElement).click( function(e) {	//Evitar que se cierre la capa
						//console.log("CAPA e: %o", e);
						return false;
					}).find("button").click( function(e) {	//Permitir enviar el formulario
						//console.log("FORM e: %o", e);
						//$(this).parents("form").submit();
						return false;
					}).end()
					.find("a").click( function(e) {	//Permitir enviar el formulario
						//console.log("FORM e: %o", e);
						document.location=$(this).attr("href");
						return false;
					});
					$(document).click( function(e) {	//Cerrar cuando se clica en cualqueir parte del documento
						//console.log("e: %o", e);
						$(document).unbind('click');
						//$(menu).fadeOut(o.outSpeed);
						$(displayIdElement).hide();
						return false;
					});
				}, 0);
			}
		});
	});
	});
	
	//Submenu 2
	//$("#subnav1 ul li.desplegable>a").click(function(){
	//	$("div.navmenu2_desp").toggle();
	//	return false;
	//});

});
/*
$(document).ready(function() {
    var raiz = jsRoot;
    var frmSltnFilter = function() {
        $('#solucion_desplegable form[name=frmSolucion] select:gt(1) option:gt(0)').remove();
        $('#solucion_desplegable form[name=frmSolucion] select').removeAttr('disabled');
        $('#solucion_desplegable form[name=frmSolucion] select:gt(1)').attr('disabled', 'disabled');
        var cls = $('#solucion_desplegable form[name=frmSolucion]').find('li:eq(1)').attr('class');
        if (cls == "servicios") {
            $.getJSON(raiz + 'LineaServicio/Json/', function(data) {
                $(data).each(function(i, el) {
                    $('select[name=servicios]').append('<option value="' + el.value + '">' + el.label + '</option>');
                })
                $('select[name=servicios]').bind('change', function() {
                    $('select[name=sector]').removeAttr('disabled');
                    $.getJSON(raiz + 'Sector/Json/?sv=' + $(this).val(), function(data) {
                        $(data).each(function(i, el) {
                            $('select[name=sector]').append('<option value="' + el.value + '">' + el.label + '</option>');
                        })
                    });
                })
            });
        } else if (cls == "sectores") {
            $.getJSON(raiz + 'Sector/Json/', function(data) {
                $(data).each(function(i, el) {
                    $('select[name=sector]').append('<option value="' + el.value + '">' + el.label + '</option>');
                })
                $('select[name=sector]').bind('change', function() {
                    $('select[name=servicios]').removeAttr('disabled');
                    $.getJSON(raiz + 'LineaServicio/Json/?st=' + $(this).val(), function(data) {
                        $(data).each(function(i, el) {
                            $('select[name=servicios]').append('<option value="' + el.value + '">' + el.label + '</option>');
                        })
                    })
                })
            });
        }
    }
    $("a[href=#solucion_desplegable]").bind('click', function() {
        $('#solucion_desplegable form[name=frmSolucion] select[name=orden]').bind('change', function() {
            var nodeClass = $(this).val();
            var node = $('#solucion_desplegable form[name=frmSolucion] li.' + nodeClass);
            var nodec = node.clone();
            node.remove();
            $('#solucion_desplegable form[name=frmSolucion] ul li.orden').after(nodec);
            frmSltnFilter();
        })
        frmSltnFilter();
        $("a[href=#solucion_desplegable]").unbind('click');
        $('#solucion_desplegable form[name=frmSolucion] button').bind('click', function() {
            $('#solucion_desplegable form[name=frmSolucion] select[name=orden]').attr('disabled', 'disabled');
            $('#solucion_desplegable form[name=frmSolucion]').trigger('submit');
        })
    })
})

$(document).ready(function() {
    var raiz = jsRoot;
    var frmSltnFilter = function() {
        $.getJSON(raiz + 'LineaServicio/Json/', function(data) {
            $(data).each(function(i, el) {
                $('select[name=ls]').append('<option value="' + el.value + '">' + el.label + '</option>');
            })
        });
        $.getJSON(raiz + 'Sector/Json/', function(data) {
            $(data).each(function(i, el) {
                $('select[name=st]').append('<option value="' + el.value + '">' + el.label + '</option>');
            })
        });
    }
    $("a[href=#solucion_desplegable]").bind('click', function() {
        frmSltnFilter();
        $("a[href=#solucion_desplegable]").unbind('click');
        $('#solucion_desplegable form[name=frmSolucion] button').bind('click', function() {
            $('#solucion_desplegable form[name=frmSolucion]').trigger('submit');
        })
    })
})*/