var DEBUG = false;
var helpLoopOn;
var helpLoopTimer;

function toggleAdvancedSearch() {
	var elmSearchArea = document.getElementById("springboard");
    
	if ( elmSearchArea.className != "SBD_Base_SpringBoardBackground BD_stdFloatLeft BD_stdWhiteBackground BD_siteEffectiveWidth" ) {
		
		if(helpLoopOn)
		{
			helpLoopOn = false;
			clearTimeout(helpLoopTimer);
		}
		
		elmSearchArea.className = "SBD_Base_SpringBoardBackground BD_stdFloatLeft BD_stdWhiteBackground BD_siteEffectiveWidth";
		elmSearchArea.style.height = "92px";
		
		openAdvancedSearch();
	}
	else {
		closeAdvancedSearch();
	}
}

var moveTimer;

function openAdvancedSearch()
{
	

	clearTimeout(moveTimer);
	var elmSearchArea = document.getElementById("springboard");
	var intHeight = parseInt(elmSearchArea.style.height);
	
	if (parseInt(intHeight) < 204)
	{
		intNewHeight = parseInt(intHeight + (205-intHeight)*0.5);
		elmSearchArea.style.backgroundPosition = "top left"; // "0px " + (intNewHeight - 350) + "px";
		elmSearchArea.style.height = intNewHeight + "px";
		moveTimer = setTimeout('openAdvancedSearch()',20);
	}
	else {
		var advancedSearch = document.getElementById("SBD_SpringBoardContent");
		advancedSearch.style.display = "block";
		var os = document.getElementById("openspringboard");
		os.className = "SBD_Base_SpringboardClose";
	}
}

function closeAdvancedSearch()
{
	clearTimeout(moveTimer);
	var elmSearchArea = document.getElementById("springboard");
	var intHeight = parseInt(elmSearchArea.style.height);
	var advancedSearch = document.getElementById("SBD_SpringBoardContent");
	advancedSearch.style.display = "none";
	if (parseInt(intHeight) > 92)
	{
		intNewHeight = parseInt(intHeight + (92 - intHeight) * 0.5);
		elmSearchArea.style.backgroundPosition = "top left"; // "0px " +  (intNewHeight - 350) + "px";
		elmSearchArea.style.height = intNewHeight + "px";
		moveTimer = setTimeout('closeAdvancedSearch()',20);
	}
	else 
	{
		elmSearchArea.className = "SBD_Base_SpringBoardHolder BD_stdFloatLeft BD_siteEffectiveWidth BD_siteEffectiveWidth";
		elmSearchArea.style.backgroundPosition = "top left"; // "0% 100%";
		var os = document.getElementById("openspringboard");
		os.className = "SBD_Base_SpringboardOpen";
	}
}

function toggleCorporationSpringboard() {

	var elmSearchArea = document.getElementById("springboard2");
    
	if ( elmSearchArea.className != "SBD_C_SpringBoardHolder SBD_C_SpittWidth" ) {
		
		if(helpLoopOn)
		{
			helpLoopOn = false;
			clearTimeout(helpLoopTimer);
		}
		
		elmSearchArea.className = "SBD_C_SpringBoardHolder SBD_C_SpittWidth";
		elmSearchArea.style.height = "0px";
		
		openCorporationSpringboard();
	}
	else {
		closeCorporationSpringboard();
	}
}


function openCorporationSpringboard()
{
	

	clearTimeout(moveTimer);
	var elmSearchArea = document.getElementById("springboard2");
	var intHeight = parseInt(elmSearchArea.style.height);
	
	if (parseInt(intHeight) < 368)
	{
		intNewHeight = parseInt(intHeight + (369-intHeight)*0.5);
		elmSearchArea.style.backgroundPosition = "top left"; // "0px " + (intNewHeight - 350) + "px";
		elmSearchArea.style.height = intNewHeight + "px";
		moveTimer = setTimeout('openCorporationSpringboard()',5);
	}
	else {
		var advancedSearch = document.getElementById("SBD_C_SpringBoardContent");
		advancedSearch.style.display = "block";
		var os = document.getElementById("openspringboard2");
		os.className = "SBD_C_SpringboardClose";
	}
}

function closeCorporationSpringboard()
{
	clearTimeout(moveTimer);
	var elmSearchArea = document.getElementById("springboard2");
	var intHeight = parseInt(elmSearchArea.style.height);
	var advancedSearch = document.getElementById("SBD_C_SpringBoardContent");
	advancedSearch.style.display = "none";
	if (parseInt(intHeight) > 0)
	{
		intNewHeight = parseInt(intHeight + (0- intHeight) * 0.5);
		elmSearchArea.style.backgroundPosition = "top left"; // "0px " +  (intNewHeight - 350) + "px";
		elmSearchArea.style.height = intNewHeight + "px";
		moveTimer = setTimeout('closeCorporationSpringboard()',10);
	}
	else {
		elmSearchArea.className = "contentminitop33";
		elmSearchArea.style.backgroundPosition = "top left"; // "0% 100%";
		//elmSearchArea.style.display = "none";
		var os = document.getElementById("openspringboard2");
		os.className = "SBD_C_SpringboardOpen";
	}
}




function toggleAtSpringboard() {
	var elmSearchArea = document.getElementById("springboard");
    
	if ( elmSearchArea.className != "SBD_Base_SpringBoardBackground BD_stdFloatLeft BD_stdWhiteBackground BD_siteEffectiveWidth" ) {
		
		if(helpLoopOn)
		{
			helpLoopOn = false;
			clearTimeout(helpLoopTimer);
		}
		
		elmSearchArea.className = "SBD_Base_SpringBoardBackground BD_stdFloatLeft BD_stdWhiteBackground BD_siteEffectiveWidth";
		elmSearchArea.style.height = "92px";
		
		openAtSpringboard();
	}
	else {
		closeAtSpringboard();
	}
}

var moveTimer;

function openAtSpringboard()
{
	

	clearTimeout(moveTimer);
	var elmSearchArea = document.getElementById("springboard");
	var intHeight = parseInt(elmSearchArea.style.height);
	
	if (parseInt(intHeight) < 204)
	{
		intNewHeight = parseInt(intHeight + (205-intHeight)*0.5);
		elmSearchArea.style.backgroundPosition = "top left"; // "0px " + (intNewHeight - 350) + "px";
		elmSearchArea.style.height = intNewHeight + "px";
		moveTimer = setTimeout('openAtSpringboard()',20);
	}
	else 
	{
		var advancedSearch = document.getElementById("SBD_SpringBoardContent");
		advancedSearch.style.display = "block";
		var os = document.getElementById("openspringboard");
		os.className = "SBD_A_SpringboardClose";
	}
}

function closeAtSpringboard()
{
	clearTimeout(moveTimer);
	var elmSearchArea = document.getElementById("springboard");
	var intHeight = parseInt(elmSearchArea.style.height);
	var advancedSearch = document.getElementById("SBD_SpringBoardContent");
	advancedSearch.style.display = "none";
	if (parseInt(intHeight) > 92)
	{
		intNewHeight = parseInt(intHeight + (92 - intHeight) * 0.5);
		elmSearchArea.style.backgroundPosition = "top left"; // "0px " +  (intNewHeight - 350) + "px";
		elmSearchArea.style.height = intNewHeight + "px";
		moveTimer = setTimeout('closeAtSpringboard()',20);
	}
	else 
	{
	
		elmSearchArea.className = "SBD_Base_SpringBoardHolder BD_stdFloatLeft BD_siteEffectiveWidth";
		elmSearchArea.style.backgroundPosition = "top left"; // "0% 100%";
		var os = document.getElementById("openspringboard");
		os.className = "SBD_A_SpringboardOpen";
	}
}