//------------------------------------------------------------------------------------------------------
// Google Contact List - By Keith Larson - keith@prodikl.com - 010.4440.7737
// 		Applied for Web Developer position, Seoul, South Korea
//------------------------------------------------------------------------------------------------------
// List of user's contacts. When the user rolls over the name, an extended information box appears to the right containing
// the contact's picture, contact information, and links to maps, email addresses, and chat screen names.
//
// Additional select box allows the user to choose whether to display email addresses or phone numbers.
//
// Uses information from two arrays: phoneNum & emailAdr
// These arrays are embedded in the page that contains the contact box
//
//------------------------------------------------------------------------------------------------------

// ----------- Constants

namesAmount = 8; // amount of names to be shown
subMenuServices = 'off';
menuHeights = new Array();
menuHeights['home'] = 180;
menuHeights['about'] = 210;
menuHeights['registration'] = 240;
menuHeights['support'] = 270;
menuHeights['calendar'] = 300;
menuHeights['contact'] = 330;
menuHeights['forum'] = 360;

// ----------- Functions

//simple version
function visOnAlone(name){
//	alert(name);
	document.getElementById('menuBG').style.width = '198px';
	document.getElementById('menuBG').style.marginTop = menuHeights[name]+'px';
	document.getElementById('menuBG').style.display = 'block';
}

function visOn(name){
//	alert(name);
	document.getElementById('menuBG').style.width = '199px';
	document.getElementById('menuBG').style.marginTop = menuHeights[name]+'px';
	document.getElementById('menuBG').style.display = 'block';
	document.getElementById(name).style.display = 'block';
}
function allOff(){
	document.getElementById('menuBG').style.display = 'none';
	
}
function visOff(name,e){
//	alert(e.relatedTarget.id);
//	document.getElementById('menuBG').style.display = 'none';
	var e=(!e)?window.event:e;// used to set e to either e (mozilla, etc) or window.event (for IE)
	// conditionals check whether the mouse moves to the info box, name box, an image, or a link (keep open) or off the boxes (close name and info)
	if(e.relatedTarget){ // mozilla, standards browsers
		if(e.relatedTarget.id != 'list' && e.relatedTarget.id != name && e.relatedTarget.id != 'link' && e.relatedTarget.id != 'subMenuBack'){ // the mouse rolls to these spots, keep boxes open
			// shut boxes if mouses off entire structure
//			alert(e.relatedTarget.id);
			document.getElementById(name).style.display = 'none';
			document.getElementById('menuBG').style.display = 'none';
		}
	} else if (e.toElement){ // IE
		if(e.toElement.id != 'list' && e.toElement.id != name && e.toElement.id != 'link' && e.toElement.id != 'subMenuBack'){ // the mouse rolls to these spots, keep boxes open 
			// shut boxes if mouses off entire structure
//			alert(e.toElement.id);
			document.getElementById(name).style.display = 'none';
			document.getElementById('menuBG').style.display = 'none';
		}
	}
}
