function showHideDiv(divId, linkId)
{
	divEle = document.getElementById(divId);
	linkEle = document.getElementById(linkId);
	
	if (divEle.style.display == 'none')
	{
		divEle.style.display = 'block';
		linkEle.innerHTML = '-';
	}
	else
	{
		divEle.style.display = 'none';
		linkEle.innerHTML = '+';
	}
	adjustLayoutStatic();
}

function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}

function adjustLayout()
{
	var bodyHeight 				= document.body.offsetHeight;
	var staticElementsHeight 	= document.getElementById('topContainer').offsetHeight + 
									document.getElementById('topMenuContainer').offsetHeight + 
									document.getElementById('contentTopBlock').offsetHeight + 									
									document.getElementById('bottomContainer').offsetHeight ;	
	
	
	
	//Resize the content block (light-gray and white part)
	var contentHeightLeft 		= document.getElementById('contentBlockLeftText').offsetHeight;
	var contentHeightRight 		= document.getElementById('contentBlockRightText').offsetHeight;	
	var contentHeight 			= (contentHeightLeft > contentHeightRight) ? contentHeightLeft : contentHeightRight;
	var heightRest 				= bodyHeight - staticElementsHeight;

	contentHeight = contentHeight < heightRest ? heightRest : contentHeight + 40;		
	
	document.getElementById('contentBlockLeft').style.height = 	contentHeight + 'px';
	document.getElementById('contentBlockRight').style.height = document.getElementById('contentBlockLeft').style.height;
	document.getElementById('contentMainBlock').style.height = document.getElementById('contentBlockLeft').style.height;	
	//End resize

	staticElementsHeight 		= document.getElementById('topContainer').offsetHeight + 
									document.getElementById('topMenuContainer').offsetHeight + 
									document.getElementById('contentTopBlock').offsetHeight + 
									document.getElementById('contentBlockLeft').offsetHeight +									
									document.getElementById('bottomContainer').offsetHeight ;	
									
	if (staticElementsHeight < bodyHeight)
	{
		document.getElementById('bottomContainer').style.position = 'absolute';
		document.getElementById('bottomContainer').style.bottom = "0px";
		document.getElementById('bottomContainer').style.top = "";			
	}	
	else
	{				
		document.getElementById('bottomContainer').style.position = 'relative';
		document.getElementById('bottomContainer').style.top = "0px";
		document.getElementById('bottomContainer').style.bottom = "";		
	}
	
	//Adjust width of the horizontal bars on the top right
	document.getElementById('topContainerImageRight').style.width = ( (document.body.offsetWidth - document.getElementById('topContainerImageCenter').style.width) / 2 ) + 'px';
}

function adjustLayoutStatic()
{
	var bodyHeight 				= document.body.offsetHeight;
	
	var staticElementsHeight 	= document.getElementById('topContainer').offsetHeight + 
									document.getElementById('topMenuContainer').offsetHeight + 							
									document.getElementById('bottomContainer').offsetHeight;		

	//Resize the content block (light-gray and white part)
	var contentHeight 			= document.getElementById('breadcrumbBlock').offsetHeight + document.getElementById('contentTitleBlock').offsetHeight + document.getElementById('contentBlockTable').offsetHeight;
	var heightRest 				= bodyHeight - staticElementsHeight;

	contentHeight = contentHeight < heightRest ? heightRest : contentHeight + 40;		
	
	document.getElementById('contentMainBlock').style.height = contentHeight + 'px';
	//End resize

	staticElementsHeight 		= document.getElementById('topContainer').offsetHeight + 
									document.getElementById('topMenuContainer').offsetHeight + 
									document.getElementById('contentMainBlock').offsetHeight +									
									document.getElementById('bottomContainer').offsetHeight ;	
	if (dynamicSeperator == true)
	{ document.getElementById('contentBlockSeperator').style.height = (contentHeight - 126) + 'px'; }
									
	if (staticElementsHeight < bodyHeight)
	{
		document.getElementById('bottomContainer').style.position = 'absolute';
		document.getElementById('bottomContainer').style.bottom = "0px";
		document.getElementById('bottomContainer').style.top = "";			
	}	
	else
	{
		document.getElementById('bottomContainer').style.position = 'relative';
		document.getElementById('bottomContainer').style.top = "0px";
		document.getElementById('bottomContainer').style.bottom = "";		
	}
	
	//Adjust width of the horizontal bars on the top right
	document.getElementById('topContainerImageRight').style.width = ( (document.body.offsetWidth - document.getElementById('topContainerImageCenter').style.width) / 2 ) + 'px';
}

function adjustLayoutStaticBlocks()
{
	
	var bodyHeight 				= document.body.offsetHeight;
	var staticElementsHeight 	= document.getElementById('topContainer').offsetHeight + 
									document.getElementById('topMenuContainer').offsetHeight + 
									document.getElementById('bottomContainer').offsetHeight ;	
	
	
	
	//Resize the content block (light-gray and white part)
	var contentHeightLeft 		= document.getElementById('contentBlockLeftText').offsetHeight + document.getElementById('contentBlockLeftText_2').offsetHeight + document.getElementById('contentBlockLeftText_3').offsetHeight;
	var contentHeightRight 		= document.getElementById('contentBlockRightText').offsetHeight + document.getElementById('contentBlockRightText_2').offsetHeight + document.getElementById('contentBlockRightText_3').offsetHeight;	
	var contentHeight 			= (contentHeightLeft > contentHeightRight) ? contentHeightLeft : contentHeightRight;
	var heightRest 				= bodyHeight - staticElementsHeight;

	contentHeight = contentHeight < heightRest ? heightRest : contentHeight + 40;		
	
	document.getElementById('contentBlockLeft').style.height = 	contentHeight + 'px';
	document.getElementById('contentBlockRight').style.height = document.getElementById('contentBlockLeft').style.height;
	document.getElementById('contentMainBlock').style.height = document.getElementById('contentBlockLeft').style.height;	

	//End resize

	staticElementsHeight 		= document.getElementById('topContainer').offsetHeight + 
									document.getElementById('topMenuContainer').offsetHeight + 
									document.getElementById('contentBlockLeft').offsetHeight +									
									document.getElementById('bottomContainer').offsetHeight ;	
									
	if (staticElementsHeight < bodyHeight)
	{
		document.getElementById('bottomContainer').style.position = 'absolute';
		document.getElementById('bottomContainer').style.bottom = "0px";
		document.getElementById('bottomContainer').style.top = "";			
	}	
	else
	{				
		document.getElementById('bottomContainer').style.position = 'relative';
		document.getElementById('bottomContainer').style.top = "0px";
		document.getElementById('bottomContainer').style.bottom = "";		
	}
	
	//Adjust width of the horizontal bars on the top right
	document.getElementById('topContainerImageRight').style.width = ( (document.body.offsetWidth - document.getElementById('topContainerImageCenter').style.width) / 2 ) + 'px';
}