/* ----------------------------------------------------------- */

function convertNewWindowLinks() {
	var links = document.getElementsByTagName ('a');
	for (var i=0; i < links.length; i++) {
		if (links[i].className == 'new-window') {
			links[i].onclick = function() {
				window.open(this.href);
				return false;
			};
		}
	}
};


/* ----------------------------------------------------------- */

function GEBI(n) {
	return document.getElementById(n);
}

function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}

addLoadEvent(function() {
	KDS_INIT();
	convertNewWindowLinks();
});


/* ----------------------------------------------------------- */



function KDS_INIT() {
		
	// initialize the P7 PMM menus
	//P7_initPM(1, 0, 1, -20, 10);
	P7_initPM(1, 1, 0, -20, 10);
	
	// on all pages except the homepage, make the masthead clickable! (the logo, actually)
	if (!GEBI('homepage')) {
		var h = GEBI('header').getElementsByTagName('H1')[0];
		h.onclick = function() { window.location='/index.asp'; };
		h.style.cursor='pointer';
		h.title='Return to Homepage';
	}
	
	//script the header "highlight" photo rollovers...
	

	GEBI('highlight-01').onmouseover = function() { GEBI('linktarget-01').style.color = "#7FC241"; };
	GEBI('highlight-02').onmouseover = function() { GEBI('linktarget-02').style.color = "#7FC241"; };
	GEBI('highlight-03').onmouseover = function() { GEBI('linktarget-03').style.color = "#7FC241"; };
	GEBI('highlight-04').onmouseover = function() { GEBI('linktarget-04').style.color = "#7FC241"; };
	GEBI('highlight-05').onmouseover = function() { GEBI('linktarget-05').style.color = "#7FC241"; };
	GEBI('highlight-06').onmouseover = function() { GEBI('linktarget-06').style.color = "#7FC241"; };
	GEBI('highlight-07').onmouseover = function() { GEBI('linktarget-07').style.color = "#7FC241"; };

	GEBI('highlight-01').onmouseout = function() { GEBI('linktarget-01').style.color = ""; };
	GEBI('highlight-02').onmouseout = function() { GEBI('linktarget-02').style.color = ""; };
	GEBI('highlight-03').onmouseout = function() { GEBI('linktarget-03').style.color = ""; };
	GEBI('highlight-04').onmouseout = function() { GEBI('linktarget-04').style.color = ""; };
	GEBI('highlight-05').onmouseout = function() { GEBI('linktarget-05').style.color = ""; };
	GEBI('highlight-06').onmouseout = function() { GEBI('linktarget-06').style.color = ""; };
	GEBI('highlight-07').onmouseout = function() { GEBI('linktarget-07').style.color = ""; };



	
	//script the phineas rollover...
	if (GEBI('phineas')) {
		GEBI('phineas').onmouseover = function() { this.getElementsByTagName('A')[0].getElementsByTagName('IMG')[0].src='/images/phineasphun_over.gif';};
		GEBI('phineas').onmouseout = function() { this.getElementsByTagName('A')[0].getElementsByTagName('IMG')[0].src='/images/phineasphun_out.gif';};
	}

};














// Create our namespace! and provide common function references!
//var KDS = KDS || { $E : YAHOO.util.Event , $D : YAHOO.util.Dom , $G : YAHOO.util.Dom.get , $ : YAHOO.util.Dom.get };
var KDS = KDS || { GEBI : document.getElementById };


// Declare individual apps as "inline" functions and invoke!
KDS.Page = function() {
	// privates?
	//
	//
	// public return!
	return {
		
		init : function() {
			//
			//
		}

	};

}();


