$(document).ready(function(){

	//BODY TAGS
	$('body:has(.horizontal_scrolling)').addClass('scrolling');
	$('#content .container #img-container #text').parents('body').addClass('horizontal_text');
	var text_block = $('#content .container #img-container #text');
	$('#content .container #img-container #text').remove();
	$('#img-container .picture_holder:first').after(text_block);
	var container_width = $('#img-container').width();
	$('body.horizontal_text	#img-container').width(container_width + 128);
	if (!jQuery.support.opacity) {
		$('#img-container').width(container_width + 128);
	}//close if

	//HOME
	$('body.section-1 #content .container #img-container .picture_holder').hide();
	var home_random = Math.floor(Math.random()*$('body.section-1 #content .container #img-container .picture_holder').length);
	$('body.section-1 #content .container #img-container .picture_holder:eq(' + home_random + ')').show();
	
	//MENU STYLE
	$('#menu ul li:only-child').addClass('solo');
	$('#menu .container p').remove();
	var li_active = $('#menu li.active a').html();
	var active_txt = "// " + li_active + " //";
	$('#menu li.active:not(.solo) a').html(active_txt);
	$('#menu ul li').addClass('solid');	


	//MENU SCREEN
	var container_h = $('#content').height();
	$('#screen').css('display','none');

	if (jQuery.support.opacity) {
		$('body.scrolling #menu .container').hover(function() {
			$('#screen').fadeIn('fast');	
			$('#content .container #img-container #text p').css('color','#ededed');		
			$('#img-container .captioning').hide();
		}, function() {
			$('#screen').fadeOut('fast');	
			$('ul:has(li.section-title) li:not(.section-title)').hide();
			$('#content .container #img-container #text p').css('color','#231F20');	
			$('#img-container .captioning').show();
			$('#menu ul li.active').parent().children().show();
		})
	}//close if

	else {
		$('body.ie7').css('overflow-x','hidden');
		var container_h = $('#content').height();
		$('#screen').height(container_h).css('display','none');
		$('body.scrolling:not(.ie6) #menu .container').hover(function() {
			$('#screen').css('display','block');	
			$('#img-container .captioning').hide()
		}, function() {
			$('#screen').css('display','none');	
			$('ul:has(li.section-title) li:not(.section-title)').hide();
			$('#img-container .captioning').show()
			$('#menu ul li.active').parent().children().show();
		})
	}//close IE

	$('body.ie8 #menu').hover(function() {
			$(this).addClass('ie8hover');
	}, function() {
			$(this).removeClass('ie8hover');	
	})


	//COLLAPSING MENU
	$('#menu ul:has(li.section-title) li:not(.section-title)').hide();
	
	$('#menu ul:not(.active) li.section-title').click(function() {
		if ($(this).parent().hasClass('active')) {
			$('ul:has(li.section-title) li:not(.section-title)').hide();
			$(this).parent().children().not('.section-title').hide();
			$('#menu ul').removeClass('active');			
			$(this).parent().removeClass('active');
		}
		else {
			$('#menu ul:has(li.section-title) li:not(.section-title)').hide();
			$(this).parent().children().show();
			$('#menu ul').removeClass('active');			
			$(this).parent().addClass('active');
		}
		$('#menu ul li.active').parent().children().show();
	})//close click


	//START OPEN FOR TEXT
	//$('body:not(.scrolling) #menu ul li.active').parent().children().show();
		$('#menu ul li.active').parent().children().show();

});

