/*
 * Helpers
 *
 * This file contains javascript functions required for advanced functionality.
 */

function Library() {

	//
	// object variables
	//

	var ddElement;
	var imgElement;

	//
	// object methods
	//

	this.toggleElement = function(id, image) {
		ddElement = document.getElementById('dd_' + id);

		if (image != null) {
			imgElement = document.getElementById('img_' + id);
			imgElement.src = (ddElement.style.display == 'block') ? 'images/plus.gif' : 'images/minus.gif';
		}

		ddElement.style.display = (ddElement.style.display == 'block') ? 'none' : 'block';
	}

	this.expandAll = function(element) {
		var i;
		var elements = document.getElementsByTagName(element);

		if (elements != null) {

			for (var i = 0; i < elements.length; i++) {
				elements[i].style.display = 'block';
			}

		}
	}

	this.go = function() {
		box = document.forms[0].navi;
		destination = box.options[ box.selectedIndex ].value;
		if( destination ) {
			location.href = destination;
		}
	}

	this.popup = function(url) {
		window.open(url,"popwin","width=600,height=400,scrollbars,resizable");
	}	
}

var Helpers = new Library();
