// JavaScript Document

function switchRole(roleNum) {	
	for (var i = 1; i <= 5; i++) {
		var targetDiv = document.getElementById("role" + i);
		
		if (i == roleNum) {
			targetDiv.style.display = "block";
		} else {
			targetDiv.style.display = "none";
		}
	}
}

function showDiv(divId) {
	document.getElementById(divId).style.display = "block";
}

function hideDiv(divId) {
	document.getElementById(divId).style.display = "none";
}

function switchService(serviceNum) {
	for (var i = 1; i < 6; i++) {
		if (i == serviceNum) {
			showDiv("service" + i);
			document.getElementById("serviceLink" + i).className = "serviceCurrent";
			document.getElementById("serviceIcon" + i).src = "../images/service" + i + "_on.gif";
			//document.getElementById("serviceImage").src =  "../images/servicesImage" + i + ".jpg";
		} else {
			hideDiv("service" + i);	
			document.getElementById("serviceLink" + i).className = "service";
			document.getElementById("serviceIcon" + i).src = "../images/service" + i + "_off.gif";
		}
	}
}

function switchMonth(num) {
	for (var i = 1; i < 8; i++) {
		if (i == num) {
			showDiv("month" + i);
			document.getElementById("monthLink" + i).className = "monthSelected";
		} else {
			hideDiv("month" + i);
			document.getElementById("monthLink" + i).className = "month";
		}
	}
}

function switchCert(num) {
	for (var i = 0; i < 4; i++) {
		if (i == num) {
			showDiv("certificate" + i);
		} else {
			hideDiv("certificate" + i);
		}
	}
}

function switchCertDesc(certNum) {
	for (var i = 1; i < 4; i++) {
		var targetDiv = document.getElementById("cert" + i);
		
		if (i == certNum) {
			targetDiv.style.display = "block";
		} else {
			targetDiv.style.display = "none";
		}
	}
}

function showWorkshopInfo(div,name,description,date,location) {
	var info = document.getElementById("workshopInfo");
	
	info.innerHTML = "<h4 style='display: inline;'>" + name + "</h4><br /><br /><table cellpadding='0' cellspacing='0'><tr><td valign='top' width='80' align='right'><strong>Date/Time:</strong>&nbsp;&nbsp;</td><td>" + date + "</td></tr><tr><td valign='top' align='right'><strong>Location:</strong>&nbsp;&nbsp;</td><td>Brooklyn College <br />2900 Bedford Avenue <br />" + location + "<br />Brooklyn, NY</td></tr><tr><td valign='top' align='right'><strong>Trainer:</strong>&nbsp;&nbsp;</td><td>Miriam Lefkowitz</td></tr></table><br />" + description;
	
	info.style.left = getLeft(div) - 80 + "px";
	info.style.top = getTop(div) - 180 + "px";
	info.style.display = "block";
	
	document.getElementById(div).onmouseout = function() {
		setTimeout("document.getElementById('workshopInfo').style.display = 'none'",1000);			
	}
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height) {
	if(popUpWin) {
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function getLeft(obj) {
	if ('string' == typeof obj)
	obj = document.getElementById(obj);
	var x = 0;
	while (obj != null) {
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return x;
}

function getTop(obj) {
	if ('string' == typeof obj)
	obj = document.getElementById(obj);
	var y = 0;
	while (obj != null) {
		y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return y;
}

