//*****************************************************
// Open pop-up function
//*****************************************************

function OpenWin(URL,WIDTH,HEIGHT){
var newWindow;
if (newWindow){
	newWindow.location = URL
}
else{
	newWindow = window.open(URL,"DGI","scrollbars=no,width="+WIDTH+",height="+HEIGHT);
}
newWindow.focus();
}

//*****************************************************
// Cloak E-mail - Nicolai Goncalves
// Set up in web.config publish replacements
//*****************************************************

function cloakMail(recipient, domain, country) { // cloakMail 2.0 
	window.location.href = "mai" + "lto:" + recipient + unescape("%40") + domain + "." + country;
} 

function showMail(recipient, domain, country) { // showMail
	//window.status = recipient + unescape("%40") + domain + "." + country;
	if (recipient) {
		window.status = recipient + unescape("%40") + domain + "." + country;
	}
	else {
		window.status = "";
	}
}

//*******************************************************
//     Find/hide/show ActiveX selectBoxes
//*******************************************************

AXcompArray	= new Array();

function getAXcomp() {
	if (document.all) {
		AXcompArray = document.all.tags("select");
		//alert("AX comps found");
	}
}

function hideAXcomp() {
	for (var i = 0; i < AXcompArray.length; i++) {
		AXcompArray[i].style.visibility = "hidden";
	}

}

function showAXcomp() {
	for (var i = 0; i < AXcompArray.length; i++) {
		AXcompArray[i].style.visibility = "visible";
	}

}

//*******************************************************
//     Event handlers
//*******************************************************

function doOnLoad() {

//alert("Loading");
	setExpanded();			// leftMenu
	createNodeArray();		// leftMenu
	getAXcomp();			// find selectBoxes for topMenu 
	}

function doOnUnLoad() {

//alert("Unloading");
	storeExpanded();		// leftMenu
	}

//*******************************************************
//     Show/Hide
//*******************************************************
var state = 'none'; 

function showhide(layer_ref) { 

if (state == 'block') { 
state = 'none'; 
} 
else { 
state = 'block'; 
} 
if (document.all) { //IS IE 4 or 5 (or 6 beta) 
eval( "document.all." + layer_ref + ".style.display = state"); 
} 
if (document.layers) { //IS NETSCAPE 4 or below 
document.layers[layer_ref].display = state; 
} 
if (document.getElementById &&!document.all) { 
hza = document.getElementById(layer_ref); 
hza.style.display = state; 
} 
} 
//*******************************************************
//     Showtime
//*******************************************************
var interval = 6
var divElement;
var divWidth;
var divHeight;
var divAdjustSpeed;
var divAdjustPixel;

function AdjustDiv(NAME,WIDTH,HEIGHT,SPD,PIXEL)
{
	if(parseInt(HEIGHT) == 0)
		return;

	divElement =eval(NAME);
	
	divAdjustSpeed = SPD;
	divAdjustPixel = PIXEL;
					
	if(parseInt(divElement.style.height) < HEIGHT)
	{

		divElement.style.display = "block";
		divElement.style.width = WIDTH + "px";		
		divElement.style.overflowY = "hidden";
		divHeight = HEIGHT;
	}
	else
	{
		divHeight = 1;	
	}
	Showtime();
	
}

function Showtime(){
	
	var timerID;

	if(parseInt(divElement.style.height) < divHeight)
	{
		divElement.style.height = parseInt(divElement.style.height) + divAdjustPixel + "px";
		if(parseInt(divElement.style.height) > divHeight)
			divHeight = parseInt(divElement.style.height);
	}
	else
	{
		divElement.style.height = parseInt(divElement.style.height) - divAdjustPixel + "px";
		if(parseInt(divElement.style.height) < 25)
		{
			divElement.style.height = "1px";
			divElement.style.display = "none";
		}
	}
	
	if(parseInt(divElement.style.height) != divHeight)
		timerID = setTimeout("Showtime()",divAdjustSpeed);	
}

//*****************************************************
// loginFocus - Nicolai Goncalves
// Set focus on login fields for Mit Dgi
//*****************************************************

function loginFocus(textBoxID, textBoxID_alt) {
	objBox = document.getElementById(textBoxID);
	objBox_alt = document.getElementById(textBoxID_alt);
	
	if (objBox){
		if(objBox.value.length == 0) {
			objBox.focus();
		}
		else {
			objBox_alt.focus();
		}
	}
} 

