jQuery(document).ready(function($) {
    $('.home_widgets .widget ul li:last-child').css({'border-bottom':'none', 'padding-bottom': '0'});
    $('#footer .widget ul li:last-child').css({'border-bottom':'none', 'padding-bottom': '0'});
    //Scroll to top
$('a[href=#top]').click(function(){
        $('html, body').animate({scrollTop:0}, 'slow');
        return false;
    });
//tipsy
$('ul.social li span').tipsy({gravity: 's', fade: true});

//External Links
  $("a[href^=http]").each(function(){
      if(this.href.indexOf(location.hostname) == -1) {
         $(this).attr({
            target: "_blank",
            title: ""
         });
      }
   });


//home widget same height
function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

equalHeight($(".home_widgets .widget"));
equalHeight($("#footer .widget"));


/******************************************
 *          shortcodes
 *****************************************/

//tip
  jQuery('.tip_s').tipsy({gravity: 's'});
  jQuery('.tip_n').tipsy({gravity: 'n'});
  jQuery('.tip_e').tipsy({gravity: 'e'});
  jQuery('.tip_w').tipsy({gravity: 'w'});

// custom Tabs 
	jQuery(".custom_tabs").tabs(".custom_tabs_content", {
		tabs: "li",
		effect:'fade'
	});

//Accordion
	jQuery(".accordion").tabs(".accordion .acc_content", {tabs: 'h2.acc_title', effect: 'slide', initialIndex: null});
	jQuery('.accordion .acc_title:first-child').addClass('current');
	jQuery('.accordion .acc_title.current').next('div.acc_content').css('display', 'block');

//Images
jQuery('a.lightbox_img img ').hover( function () {
			jQuery(this).stop().animate({ opacity: 0.8}, 300);

		}, function () {
			jQuery(this).stop().animate({ opacity: 1 }, 300);
		});


jQuery('.gallery .gallery-item img').hover( function () {
			jQuery(this).stop().animate({ opacity: 0.6}, 300);

		}, function () {
			jQuery(this).stop().animate({ opacity: 1 }, 300);
		});

	jQuery("a.lightbox_img").prettyPhoto({deeplinking: false});
	jQuery(".wp-caption a").prettyPhoto({deeplinking: false});

//DropDown
	jQuery(".navigation ul.nav ul a").removeAttr('title');
	jQuery(" .navigation ul.nav ul").css({display: "none"}); // Opera Fix
	jQuery(".navigation ul.nav li").each(function()
		{	
	var $submeun = jQuery(this).find('ul:first');
	jQuery(this).hover(function()
		{	
	$submeun.stop().css({overflow:"hidden", height:"auto", display:"none", paddingTop:0}).slideDown(250, function()
		{
	jQuery(this).css({overflow:"visible", height:"auto"});
		});	
		},
	function()
		{	
	$submeun.stop().slideUp(250, function()
		{	
	jQuery(this).css({overflow:"hidden", display:"none", zIndex:5000});
			});
		});	
	});
	jQuery(".navigation ul.nav ul li:last-child").css('border-bottom','none');
	jQuery(".navigation ul.nav ul li:last-child").addClass('roundbt');
      	jQuery('.navigation ul.nav li ul li ul').parent().append('<span class="drop_arrow"></span>');

        


});
