function is_array( mixed_var ) {    // Finds whether a variable is an array
     return ( mixed_var instanceof Array );
}
function empty( mixed_var ) {    // Determine whether a variable is empty
    return ( mixed_var === "" || mixed_var === 0   || mixed_var === "0" || mixed_var === null  || mixed_var === false  ||  ( is_array(mixed_var) && mixed_var.length === 0 ) );
}
function floatval(mixed_var) {    // +   original by: Michael White (http://crestidg.com)
    return (parseFloat(mixed_var) || 0);
}

function scroller_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();
    });
};

$(document).ready(function()
{
	$('.inner-tools>ul>li').not('.inactive').mouseenter(function(){
		$('.inner-tools>ul>li').not('.tools').add('.activetool').slideDown(100);
	});

	$('.inner-tools').mouseleave(function(){
		$('.inner-tools>ul>li').not('.activetool').add('.tools').not('.inactive').slideUp(100);
	}
	);

	$('#userbox a.pseudolink').click(function(){
		$(this).next().toggle();
	});

	$('button').hover(
			function(){$(this).addClass("ui-state-hover");}, function(){$(this).removeClass("ui-state-hover");}
		).mousedown(function(){
			$(this).addClass("ui-state-active");
		}).mouseup(function(){
			$(this).removeClass("ui-state-active");
	}).addClass('ui-state-default').addClass('ui-corner-all').not('.icon').addClass('ui-button');

	$('a.thumber').click(function(){
		$('.inner-left img').removeAttr('src').attr('src', $(this).attr('rel'));
		$('.inner-left h4').html($(this).parent().find('span.id').html());
		return false;
	});

    jQuery('#scroller').jcarousel({
		visible: 1,
		buttonNextHTML: null,
		buttonPrevHTML: null,
		vertical: true,
        auto: 3,
        wrap: 'both',
		scroll: 1,
        initCallback: scroller_initCallback
    });

	/*$('a.thumber').tooltip({
		delay: 0,
		showURL: false,
		fixPNG: true,
		bodyHandler: function()
		{
			return $("<img width='300' />").attr("src", $(this).attr('rel'));
		}
	});

	$('.inner-big img').tooltip({
		delay: 0,
		showURL: false,
		fixPNG: true,
		bodyHandler: function()
		{
			return $("<img width='300' />").attr("src", this.src);
		}
	});*/

	$('#date').mask("9999-99-99 99:99:99");

});
