function resize_big_text(){


	$('body.big_text .jScrollPaneContainer').height($(document).height()-190);
	if ($('body.big_text .jScrollPaneContainer').height()<410){
		$('body.big_text .jScrollPaneContainer').height(410); 
		$('body.big_text #content').height(410);
	}
	$('body.big_text #content').height($(document).height()-190);
	$('body.big_text #text_content.scroll-pane').height($(document).height()-190);
	if ($('body.big_text #text_content.scroll-pane').height()<410){
		$('body.big_text #text_content.scroll-pane').height(410);
		$('body.big_text #content').height(410);
	}
	$('body.big_text #text_content.scroll-pane').jScrollPane();

}


$(function(){
    $("#mainnav ul ul").hover(
      function () {$(this).parent().children("a").addClass("active");}, 
      function () {$(this).parent().children("a").removeClass("active");}
    );
});


$(function() {
$('#superbgimage img').hide();
	if($('#superbgimage img').length > 1){
		// Options for SuperBGImage
		$.fn.superbgimage.options = {
				slideshow:1,
				slide_interval:4000,
				speed:'slow'
		};
		// initialize SuperBGImage
		$('#superbgimage').superbgimage().hide();
	}
	else{
		// Options for SuperBGImage
		$.fn.superbgimage.options = {
			slideshow: 0 // 0-none, 1-autostart slideshow
		};
		// initialize SuperBGImage
		$('#superbgimage').superbgimage().hide();
	}
});
     
        

                     
$(document).ready(function() {  
	$('#content_surround').height($(document).height()-150);       
	resize_big_text();   
	$.extend($.fn.jScrollPane.defaults, {showArrows:true});
	$('#text_content').jScrollPane();
	setTimeout(function() {$('#text_content').jScrollPane();}, 1500);
    
	$(window).resize(function() { 
		if ($('#content_surround').is(':visible')) {
			$('#content_surround').css("display","none"); 
			$('#content_surround').height($(document).height()-150);          
			$('#content_surround').css("display","block"); 
		} else {$('#content_surround').height($(document).height()-150);}	
		resize_big_text();
	});
});




jQuery.fn.fadeOpacity = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle'}, speed, easing, callback);
}; 

$(function() {
	$('a.toggle').click(function() {
		$('#content_surround').fadeOpacity();

		$(this).text($(this).text() === 'Show Content' ? 'Show Background' : 'Show Content');      
		$(this).toggleClass('on');  
		resize_big_text();
		return false;

	});
});   




