/* Author: 

*/

$(document).ready(function(){
	
	var mobile =
	(
		navigator.userAgent.match(/Android/i) ||
		navigator.userAgent.match(/webOS/i) ||
		navigator.userAgent.match(/iPhone/i) ||
		navigator.userAgent.match(/iPod/i) ||
		navigator.userAgent.match(/iPad/i)
	)
	
	// Nav
	if (mobile) // We have to use .live events instead of hoverIntent
	{
		$('#nav li').live('mouseenter', function() {
			$(this).addClass('active');
			$('.panel', this).slideDown( 250 );
		}).live('mouseleave', function() {
			$(this).removeClass('active');
			$('.panel', this).slideUp( 'fast' );
		});
	}
	else
	{
		$('#nav li').hoverIntent(function() {
			$(this).addClass('active');
			$('.panel', this).slideDown( 250 );  			
		}, function() {
			$(this).removeClass('active');
			//$('.panel', this).animate({oacity: 'hide', top: '0'}, 100);	
			$('.panel', this).slideUp( 'fast' );
		});     
	};
	
	// Disable Navigation to Parent Pages
	$('#nav li.parent > a').click(function(e) {
		e.preventDefault();
	});

	// Uniform
	$('.uniform select, .uniform input:checkbox, .uniform input:radio, .uniform input:file .uniform input:submit').uniform();
	
	// Inner Tabs
/*
	$('.tabs').tabs('#content > div', {
		effect: 'ajax',
		history: true
	});
*/

	// Fix Fade-In Cleartype issues with IE. Oh, IE.
(function($) {
    $.fn.fadeIn = function(speed, callback) {
        return this.animate({opacity: 'show'}, speed, function() {
                if ( $.browser.msie )
                {
                        this.style.removeAttribute('filter');
                }
                if ( $.isFunction(callback) )
                {
                        callback.call(this);
                }
        });
    };

    $.fn.fadeOut = function(speed, callback) {
        return this.animate({opacity: 'hide'}, speed, function() {
                if ( $.browser.msie )
                {
                        this.style.removeAttribute('filter');
                }
                if ( $.isFunction(callback) )
                {
                        callback.call(this);
                }
        });
    };

    $.fn.fadeTo = function(speed, to, callback) {
        return this.animate({opacity: to}, speed, function() {
                if ( to == 1 && $.browser.msie )
                {
                        this.style.removeAttribute('filter');
                }
                if ( $.isFunction(callback) )
                {
                        callback.call(this);
                }
        });
    };
})(jQuery);
		
});


