jQuery(document).ready(function($){
    $('.blink').
        live('focus', function() {
            if(this.title==this.value) {
                this.value = '';
            }
        }).
        live('blur', function(){
            if(this.value=='') {
                this.value = this.title;
            }
        });
    
    var interval = null;
    $('.slider-hld li:gt(0)').hide();
    $('.slider-nav a').click(function() {
    		reset_interval();
    		if ($(this).is('.active') ) { return false; };
    		var index = $('.slider-nav a').index(this);
    		$('.slider-hld li.active').removeClass('active').stop(true, true).fadeOut();
    		$('.slider-hld li:eq(' + index + ')').addClass('active').stop(true, true).fadeIn();
    		$('.slider-nav a.active').removeClass('active');
    		$(this).addClass('active');
    		return false;
	});
	function next_slide() {
		var next = $('.slider-hld li.active').next();
		if ( !next.length ) {
			next = $('.slider-hld li:first');
		};
		$('.slider-hld li.active').removeClass('active').stop(true, true).fadeOut();
		next.addClass('active').stop(true, true).fadeIn();
		
		var next_nav = $('.slider-nav a.active').parent().next().find('a');
		if ( !next_nav.length ) {
			next_nav = $('.slider-nav a:first');
		};
		$('.slider-nav a.active').removeClass('active');
		next_nav.addClass('active');
	}
	function reset_interval() {
		if ( !window.autorotation ) { return; }
		window.clearInterval(interval);
		interval = window.setInterval(next_slide, window.speed);
	}
	if (window.autorotation && $('.slider-nav a').length > 1) {
		var interval = window.setInterval(next_slide, window.speed);;
	};
	function gallery_fix_thumbs_height () {
		$('.gallery-thumbs ul').each(function() {
			var max_p = 0, max_header = 0;
			$(this).find('li').each(function() {
				max_p = (max_p < $(this).find('p').height() ) ? $(this).find('p').height() : max_p ;
				max_header = (max_header < $(this).find('h3').height() ) ? $(this).find('h3').height() : max_header ;
			})
			$(this).find('li p').height(max_p);
			$(this).find('li h3').height(max_header);
		});
	}
	gallery_fix_thumbs_height();
    $('#bottom .widget_links li:first').addClass('first');
    $('#bottom .widget:last').addClass('col-last');
    $('.right-side .menu li:last').addClass('last');


});

