jQuery(document).ready(function($){
	
  // When a link is clicked  
    $("#menu-tabs li a").click(function () {  
  
         // switch all tabs off  
         $(".current").removeClass("current");  
   
         // switch this tab on  
         $(this).addClass("current");  
   
         // slide all elements with the class 'content' up  
         $(".box").hide();  
   
         // Now figure out what the 'title' attribute value is and find the element with that id.  Then slide that down.  
         var content_show = $(this).attr("title");  
         $("#"+content_show).show();  
   
     });  

$('div.paging ul li ul li').parent().parent().parent().parent().parent().parent().addClass('li_parent');
$('div.paging ul .li_parent').each(function(){
 $(this).children().addClass('pag_arrow');
});

$('div.paging ul li .sub').each(function(){
	$(this).children().children().children().last().addClass('pag_last');
});



function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

$(document).ready(function() {
	equalHeight($('div.th'));
	equalHeight($('div.sol'));
});





$('div.right div.widget-container').first().css('padding-top','0');

$('div.staff_global div.staff').last().addClass('staff_last');

$('div.ab_con p').last().css('padding-bottom', '0');

/*Set default open/close settings
$('div.fr_l').hide(); //Hide/close all containers
$('div.trigger').first().addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container

//On Click
$('div.trigger').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
		$('div.trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
		$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
	}
	return false; //Prevent the browser jump to the link anchor
});*/


$('div.fr_l').hide();
$('div.fr_l').first().addClass('visi');

$('div.fr_r').first().addClass('porshe');

$('div.for').hide();
$('div.trigger').first().addClass('trig_act').next().show();

$('div.trigger').click(function(){
	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
	
	    $('div.fr_r').removeClass('porshe');
		$(this).toggleClass('trig_act').parent().addClass('porshe')
		
		$('div.fr_l').removeClass('visi');
		if ($('div.open_1').hasClass('porshe')){
			$('div#open_1').addClass('visi').fadeOut('slow');
		}
		if ($('div.open_2').hasClass('porshe')){
			$('div#open_2').addClass('visi').fadeOut('slow');
		}
		if ($('div.open_3').hasClass('porshe')){
			$('div#open_3').addClass('visi').fadeOut('slow');
		}
		if ($('div.open_4').hasClass('porshe')){
			$('div#open_4').addClass('visi').fadeOut('slow');
		}
		
		$('div.trigger').removeClass('trig_act').next().slideUp(); //Remove all "active" state and slide up the immediate next container
		$(this).toggleClass('trig_act').next().slideDown();
	}
	return false; //Prevent the browser jump to the link anchor
});

$('div.for_images ul li a').each(function(){
	$(this).removeAttr('href');
});

$('div.open_1 div.for_images ul li').click(function(){
	var imgstr = $(this).children().html();
	$('div#open_1 ul li a img').replaceWith(imgstr);
});

$('div.open_2 div.for_images ul li').click(function(){
	var imgstr = $(this).children().html();
	$('div#open_2 ul li a img').replaceWith(imgstr);
});

$('div.open_3 div.for_images ul li').click(function(){
	var imgstr = $(this).children().html();
	$('div#open_3 ul li a img').replaceWith(imgstr);
});

$('div.open_4 div.for_images ul li').click(function(){
	var imgstr = $(this).children().html();
	$('div#open_4 ul li a img').replaceWith(imgstr);
});


$('a.cboxElement').each(function(){
thischild = $(this).children('img');
thiswidth = $(this).children('img').width();
thisheight = $(this).children('img').height();
if ($(this).children('img').hasClass('colorbox-manual')) {
	$(this).width(thiswidth);
	$(this).height(thisheight);
	$('<span class="cbox_bg"></span><span class="cbox_zoom"></span>').insertBefore(thischild);
};
});

$('div.paging ul li ul li div.sub').each(function(){
	$(this).addClass('sub2');
	$(this).removeClass('sub');
});

$('div.paging ul li').hover(function(){
	$(this).addClass('hover');
	$(this).children('div.sub').fadeIn('fast');
	$(this).find('div.sub2').hide();
	}, function(){
		$(this).removeClass('hover');
		$(this).children('div.sub').fadeOut('fast');
	});



$('div.paging ul li ul li').hover(function(){
	$(this).children('div.sub2').fadeIn('fast');
	}, function(){
		$(this).children('div.sub2').fadeOut('fast');
	});

$('ul.sub-menu').each(function(){
	$(this).children('li').last().addClass('li_last');
});












});
