/* Add function(s) to specific handlers - START */
window.addEvent('domready', function(){
	Nifty("ul.column h3","top");
	Nifty("ul.column div","bottom");

	Nifty("ul#agenda h3","top");
	Nifty("ul#agenda div","bottom same-height");
	Nifty("ul#nav a","small transparent top");

	/* Left Menu */
	Nifty("div#searchBox h3","top");
	Nifty("div#searchBox div","bottom");
	Nifty("div#loginBox h3","top");
	Nifty("div#loginBox div","bottom");
	Nifty("div#menuBox h3","top");
	Nifty("div#menuBox div","bottom");

	// Set screen visible
	if($('containercenter'))
		$('containercenter').style.visibility = 'visible';

	// Create frameLinks if supported
/*
	var frameLinks = $$('a.frameLink');
	frameLinks.each(function(frameLink, i){
		frameLink.addEvent('click', function(e, url) {
			e = new Event(e).stop();
			url = this.href;
			top.location.href = url;
		});
	}); 
*/
	prepareInputsForHints();
});
/* Add function(s) to specific handlers - END */


/* Form Hints - START */
function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			// the span exists!  on focus, show the hint
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			// when the cursor moves away from the field, hide the hint
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	// repeat the same tests as above for selects
	var selects = document.getElementsByTagName("select");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]) {
			selects[k].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			selects[k].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}
/* Form Hints - END */

/* Return height & width - START */
function f_filterResults(n_win, n_docel, n_body) {
    var n_result = n_win ? n_win : 0;
    if (n_docel && (!n_result || (n_result > n_docel)))
        n_result = n_docel;
    return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function f_clientHeight() {
    return f_filterResults (
        window.innerHeight ? window.innerHeight : 0,
        document.documentElement ? document.documentElement.clientHeight : 0,
        document.body ? document.body.clientHeight : 0
    );
}
function f_clientWidth() {
    return f_filterResults (
        window.innerWidth ? window.innerWidth : 0,
        document.documentElement ? document.documentElement.clientWidth : 0,
        document.body ? document.body.clientWidth : 0
    );
}
/* Return height & width - END */


/* Font resize functions  - START */
var contentFontSizeDefault = 12;
var contentFontSizeCurrent = 12;

function resizeFont(grow) {
	if(grow) contentFontSizeCurrent++;
	else if(contentFontSizeDefault < contentFontSizeCurrent ) {
		contentFontSizeCurrent--;
	}
	document.frames['contentDiv'].document.body.style.fontSize = contentFontSizeCurrent + "px";
}
/* Font resize functions  - END */




