
/* Function:	startList
 * 
 * Description:	Handler for drop-down menus in IE
 *
 * History: 	http://www.alistapart.com/articles/dropdowns
 * 
 */

startList = function() {
	var isMac = navigator.userAgent.indexOf("Mac") != -1;
	
	if(document.all && document.getElementById && !isMac) {
		navRoot = document.getElementById("menubar");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover = function() {
					this.className+=" over";
				}
				node.onmouseout = function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

/* Function:	suggestions_validate
 *
 * Description:	Validates the form input for the suggestions form on the contact page.
 *
 *
 */

 function suggestions_validate() { 
 	var elements = document.suggestions_form.elements;
 	
 	
	for (i = 0; i < elements.length; i++) {
		var field = elements[i];

		switch(field.name) {
			case "org":
				if(field.value == "") {
					 alert ("Please enter the organization's name.");
					 return false;
				}
				break;
			
			case "contact":
				if(field.value == "") {
					alert ("Please enter the contact person's name.");
					return false;
				}
				break;
		
			case "email":
				if(field.value == "") {
					alert ("Please enter the contact person's email address.");
					return false;
				}
				break;
			
			case "url":
				if(field.value == "") {
					alert ("Please enter the organization's web site URL.");
					return false;
				}
				break;
			
			case "phone":
				if(field.value == "") {
					alert ("Please enter the contact person's phone number.");
					return false;
				}
				break;
			
			case "address":
				if(field.value == "") {
					alert ("Please enter the organization's address.");
					return false;
				}
				break;
			
			case msg:
				break;
			
			default:
				
				break;
		}
	}	
	return (true);
 }



/* Function:	license_validate
 *
 * Description:	Validates the form input for the complete license form.
 *
 *
 */

 function license_validate() { 
 	var elements = document.license_form.elements;

	for(i = 0; i < elements.length; i++) {
		var field = elements[i];

		switch(field.name) {
			case "title":
				if(field.value == "") {
					alert ("Please enter a title for your work.");
					return false;
				}
				break;
			
			case "description":
				if(field.value == "") {
					alert ("Please enter a description for your work.");
					return false;
				}
				break;
			
			case "name":
				if(field.value == "") {
					alert ("Please enter the creator's name.");
					return false;
				}
				break;
			
			case "url":
				if(field.value == "") {
					alert ("Please enter the URL for the content.");
					return false;
				}
				break;
				
			default:
				
				break;
		}
	}
	
	return (true);
 }


/* Function:	externalLinks
 * 
 * Description:	Sets links with rel="external" tags to launch hyperlinks in separate windows
 *
 * History:		Code from Alex King
 *
 */
 
function externalLinks() { 
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
			anchor.className = "external";
		}
	}
}

/* Function:	initialize
 * 
 * Description:	Calls the externalLinks and startList functions.
 *
 * History:		2004-03-25 - Initial version (atow)
 *
 */
 
initialize = function() {
	startList();
	externalLinks();
}


window.onload = initialize;
