$(document).ready( function(){

	/*PNGfix for ie 6 png transparency*/
	
	$('ul.dropdown li').mouseenter(function(){
		//alert('teset');
		$(this).addClass('hover');
		var h = $(this).find('a').next().height();
		//alert($('ul:first',this).html());
		$('ul:first',this).css('display', 'block').css('opacity', '0').stop(true, false).animate({ 'opacity': 1 }, 400);
		/*}, function(){
			$('ul:first',this).css('display', 'block').css('top', '-1500px');*/
	});
	$('ul.dropdown li').mouseleave(function(){
		$(this).removeClass("hover");
		$('ul:first',this).css('display','none');
	});
	/*$(document).pngFix();*/
	/*Tabs function */
	$('div.tabs > ul > li a').click( function(){
		//alert( $(this).parents('.tabs').attr('id') );
		$(this).parents('.tabs').find('div.active').fadeOut();
		$(this).parents('.tabs').find('.active').removeClass('active');
		$(this).parents('.tabs').find('.active').addClass('hide');
		current = $(this).attr('href').replace('#','.');
		$(this).parents('.tabs').find(current).fadeIn();
		$(this).parents('.tabs').find(current).addClass('active');
		$(this).parents('.tabs').find(current).removeClass('hide');
		$(this).parents('h3').addClass('active');
		return(false);
	});

	$('.tabs').each( function(){
		$(this).find('.first_tab, .second_tab, .third_tab').css({'padding-left':'0px', 'padding-right':'0px'});
		total = $(this).width();
		first = $(this).find('.first_tab').width();
		second = $(this).find('.second_tab').width();
		third = $(this).find('.third_tab').width();
		spc = total - ( first + second + third ) - 32;
		sng = spc / 4;
		$(this).find('.first_tab').css('padding-right', (sng + 16) + 'px');
		$(this).find('.second_tab').css({'padding-left' : sng + 'px', 'padding-right': sng + 'px'});
		$(this).find('.third_tab').css('padding-left', (sng + 16) + 'px');
	});

	$('.single img').each( function(index) {
									
		w = $(this).attr('width');
		h = $(this).attr('height');
		if (w > '570'){
			$(this).attr('width','570');
			newheight = (570/w)*h;
			$(this).attr('height',newheight);
		}
	});
	
	/* post in grid */
	
	$('ul.widget_posts_thumb li').mouseenter(function(){
		$(this).find('span.title_tip').hide().show();
	});
	$('ul.widget_posts_thumb li').mouseleave(function(){
		$(this).find('span.title_tip').show().hide();
	});
	

});
