/* file info ----------
	project:	Maratone
	
	author:		Patric Malm Solutions AB
				David
	
	comments:	Basic javascript functionality for maratone.se
	
	version:	2006-01-29
*/

// for the image list
var imgList = new Array();

/**
 *  Loads an image
 */
function loadImg(name, url)
{
    imgList[name] = url;
}

/**
 *  Focuses an image
 */
function gotFocus(name){
    if (document.getElementById) {
        var container = document.getElementById('focusedImg');
        if (container) {
            container.src = imgList[name];
        }
    }
}

/**
 * Prints the page
 */
function printPage()
{
	window.print();
	return false;
}

/**
 *	Launches a pop-up window
 *
 *	@param	url		url for the page to be loaded
 *	@param	name	name of the new window
 *	@param	width	the width
 *	@param	height	and the height
 */
function popUp(url, name, width, height)
{
	var win = window.open(url, name, 'width=' + width + ',height=' + height + ',resizable=yes,scrollbars=yes');
	win.focus();

	return false;
}

/**
 *  Adds menu functionality to browsers not supporting
 *  hover for other elements than links.
 */
var initDropDown = function()
{
    if (document.getElementById) {
        var nav, node;
        nav = document.getElementById('nav1');
        if (nav) {
            for(var i = 0; i < nav.childNodes.length; i++) {
                node = nav.childNodes[i];
                if (node.nodeName == 'LI') {
                    node.onmouseover = function() {
                        this.className += ' over';
                    }
                    node.onmouseout = function() {
                        this.className = this.className.replace(' over', '');
                    }
                }
            }
        }
    }
}

window.onload = initDropDown;

