
$(function(){
	
	if( $('.bg_home').length<=0 ){
		$('#main_scroll').jScrollPane();
	}
	
	var active_icon = '';
	$('#icons a').hover(function(){
		active_icon = $('body').attr('class');
		if( active_icon.indexOf('profit')>=0 ){
			active_icon = 'profit';
		}else if( active_icon.indexOf('growth')>=0 ){
			active_icon = 'growth';
		}else if( active_icon.indexOf('excellence')>=0 ){
			active_icon = 'excellence';
		}
		$('body').removeClass('profit').removeClass('growth').removeClass('excellence').addClass( $(this).attr('title') );
	}, function(){
		$('body').removeClass('profit').removeClass('growth').removeClass('excellence');
		//if( active_icon!='' ){
		$('body').addClass( active_icon );
		//}
	});
	
    $("h2.flap").click(function () {
    	$("h2.flap_open").not(this).click();
    	// $('#main_scroll')[0].scrollTo(30);
        $(this).toggleClass('flap_open').next().next().slideToggle("slow", function () {
        	$('#main_scroll').jScrollPane({reinitialiseOnImageLoad:true});
      	}); 
    });
    
    var hash = jQuery(location).attr('hash');
    if( hash.substr(0,6)=='#case/' ){
        $("h2.flap:eq(" + (parseInt(hash.substr(6))-1) + ")").click();
    }else{
        //$("h2.flap:first").click();
    }
    
    $('.viewIcon').parent().click(function(){
	$('#main_scroll').jScrollPane();
	});
	
	
	if ($('.htmlarea').length == 2) {
    		$('.htmlarea:first').hide();
	}
});


