jQuery(document).ready( function(){
	var brdFade =  jQuery('.border_fade').css('background-color');
	//alert(brdFade);
	// Tabs script jquery from jQueryUI plugins 
	jQuery('#tabs').tabs({ fx: { opacity: 'toggle' } });

	//jQuery(".tag_tab a[class^='tag-link']").css('font-size','12px');
	//jQuery(".tag_tab a[class^='tag-link']").addClass('tag_link');
	jQuery('.post_content img').each( function(index) {
		w = jQuery(this).attr('width');
		h = jQuery(this).attr('height');
		if (w > '460'){
			jQuery(this).attr('width','460');
			newheight = (460/w)*h;
			jQuery(this).attr('height',newheight);
		}
	});
	// script to make the meta shrink
	if ( jQuery('.post_content_single').length ){ 
		content_h = jQuery('.post_content_single').height();
		meta_h = jQuery('.all_meta').height();
		if (content_h > meta_h){
			margin_h = content_h - meta_h + 24;
			jQuery('.meta2').css('margin-top', margin_h + 'px');
		}
		if (content_h < meta_h){
			margin_h = meta_h - content_h - 5;
			jQuery('.related_posts').css('margin-top', margin_h + 'px');
		}
	};
	// script for dropdown
	jQuery('ul.dropdown li').mouseenter(function(){
		jQuery(this).addClass('hover');
		var h = jQuery(this).find('a').next().height();
		//jQuery('ul:first',this).css('visibility', 'visible').css('top','100%').css('height', '0px').stop(true, false).animate({ 'height': h }, 200);
		jQuery('ul:first',this).css('visibility', 'visible').css('opacity', '0').stop(true, false).animate({ 'opacity': 1 }, 400);
		}, function(){
			jQuery('ul:first',this).css('visibility', 'visible').css('top', '-1500px');
	});
	jQuery('ul.dropdown li').mouseleave(function(){
		jQuery(this).removeClass("hover");
	});
	jQuery('ul.dropdown li ul li:has(ul)').find("a:first").addClass("a_parent");
	jQuery('ul.dropdown li > ul > li:last-child > a').css('border-bottom','none');

	//jQuery('.border_fade').animate({ borderBottomColor: "black" }, 1000);

	//twitter status link
	jQuery('#twitter_update_list[style^="font-size"]').css('font-size','12px');

	//fading border
	var bf = jQuery('.border_fade').css('border-left-color'); 
	var af = jQuery('.border_fade').css('color');

	jQuery('.border_fade').mouseenter( function(){
		jQuery(this).css('border-color',bf).stop(true, false).animate({ borderBottomColor : af, borderTopColor : af, borderLeftColor : af, borderRightColor : af },'fast');
	});
	jQuery('.border_fade').mouseleave( function(){
		jQuery(this).css('border-color',af).stop(true, false).animate({ borderBottomColor : bf, borderTopColor : bf, borderLeftColor : bf, borderRightColor : bf },'slow');
	});
});
