$(function() {
	menuhide();
	menushow();
	hdetector();	
	newsawards();
	portfolio_menuhide();
	portfolio_menushow();
});

function hdetector()
{
	var bHeight = document.getElementById("mside").clientHeight;
	var cHeight=document.getElementById("mcontent").clientHeight;
	var screen_height=screen.height;
	var contentHeight=cHeight+200;
	var boxHeight=bHeight+150;

	if(cHeight>=bHeight)
	{
		var rcon=document.getElementById("right-container");
		rcon.style.height=(contentHeight+"px");
		var m=document.getElementById("mbar");
		m.style.height=(contentHeight+"px");
		var lcon=document.getElementById("left-container");
		lcon.style.height=(contentHeight+"px");
		var n_position=(cHeight)+220;
		var np= (n_position+"px");
		$('.pagination').css('top',np);
		$('.nextprevious').css('top',np);
		$('#side-img').css('position','absolute');
		$('#side-img').css('top',(cHeight-100)+"px");
		if(screen_height<cHeight)
		{
			$('.spacer').css('height',60+'px');
			$('#wrapper-outer').css('padding-bottom',10+'px');
		}
	}
	else
	{
			if(document.getElementById('side-message'))
			{
		var rcon=document.getElementById("right-container");
			rcon.style.height=(bHeight+"px");
			var m=document.getElementById("mbar");
			m.style.height=(bHeight+"px");
			var lcon=document.getElementById("left-container");
			lcon.style.height=(bHeight+"px");
			}
			else
			{
			var rcon=document.getElementById("right-container");
		rcon.style.height=(boxHeight+"px");
		var m=document.getElementById("mbar");
		m.style.height=(boxHeight+"px");
		var lcon=document.getElementById("left-container");
		lcon.style.height=(boxHeight+"px");
			}
		var n_position=(boxHeight)+20;
		var np= (n_position+"px");
		$('.pagination').css('top',np);
		$('.nextprevious').css('top',np);
		$('#side-img').css('margin-top',130+"px");			
		if(screen_height<(boxHeight-20))
		{
			$('.spacer').css('height',60+'px');
			$('#wrapper-outer').css('padding-bottom',10+'px');
		}
	}	
}

function menuhide()
{
	$('#nav')
	.children() 
	.find('li')   
	.parent('ul').hide() 				 
}

function menushow()
{
	$('.menu-active')
	.children()
	.find('li')
	.parent('ul').show()
	
	$('.parent-menu-active')
	.children()
	.find('li')
	.parent('ul').show()	

	$('.menu-active').addClass('parent-menu-active');	
}
	
function newsawards()
{
	if(document.getElementById("news"))
	{
		$("#nav-news-awards").addClass("menu-active");
	}
}

function portfolio_menuhide()
{
 $('#nav-sub')
		.children() 
		.find('li')   
		.parent('ul').hide() 
 $('#nav_project')
		.children() 
		.find('li')   
		.parent('ul').hide() 				 
}

function portfolio_menushow()
{
	$('.here')
			.children()
			.find('li')
			.parent('ul').show()
	$('.parent-here')
			.children()
			.find('li')
			.parent('ul').show()			
}
