
	/**************************************************
	* Adds event triggers to html elements unobtrusivly
	**************************************************/
	function addEvent(elm, evType, fn, useCapture){
		if(elm.addEventListener){
			elm.addEventListener(evType, fn, useCapture);
			return true;
		} else if(elm.attachEvent){
			elm['on' + evType] = fn;
		}
	}

	/************************************************
	* Place
	************************************************/
	function addlisteners(){
        centerContent();
		if(!document.getElementsByTagName || !document.getElementById) return;
		//addEvent({OBJ}, '{EVENT}', {SOMEFUNCTION}, false);
	}

	/************************************************
	* Used in conjunction with the Sarissa library
	************************************************/
	startList = function() {
		if (document.all&&document.getElementById) {
			navRoot = document.getElementById("sitenav");
			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", "");
					}
				}
			}
		}
	}
	//window.onload=startList;

	/************************************************
	* Used in conjunction with the Sarissa library
	* getUrl('someurl.php', someFunction);
	************************************************/
	getUrl = function (url, fn){
		var xmlhttp = Sarissa.getXmlHttpRequest();
		xmlhttp.open('POST', url+'&ut=<?php echo $uType; ?>', true);

		xmlhttp.onreadystatechange = function(){
			if(xmlhttp.readyState == 4){
				fn(xmlhttp.responseText);
			}
		};
		xmlhttp.send(null);
	}

    /*************************************************************************
    * From A List Apart: Vertical Alignment of Content with Javascript and CSS
    * http://www.alistapart.com/d/footers/footer_variation1.html
    **************************************************************************/

    getWindowHeight = function () {
        var windowHeight = 0;
        if (typeof(window.innerHeight) == 'number') {
            windowHeight = window.innerHeight;
        }
        else {
            if (document.documentElement && document.documentElement.clientHeight) {
                windowHeight = document.documentElement.clientHeight;
            }
            else if (document.body && document.body.clientHeight) {
                    windowHeight = document.body.clientHeight;
            }
        }
        return windowHeight;
    }

    centerContent = function () {
        if (document.getElementById) {
            var windowHeight = jQuery(document).height();
            if (windowHeight > 0) {
                var contentElement = document.getElementById('wrapper');
                var bodyElement = document.getElementById('body');
                var contentHeight = contentElement.offsetHeight;
                if (windowHeight - contentHeight > 0) {
                    contentElement.style.position = 'relative';
                    
                    if(jQuery.browser.msie){
                        if( jQuery.browser.version == '0.8' ){
                            contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2) + 2) + 'px';
                        } else {
                            contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2) + 1) + 'px';
                        }
                    } else {
                        contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2) + 1) + 'px';
                    }

                    bodyElement.style.backgroundPosition = '0 '+ ((windowHeight / 2) - (contentHeight / 2)) + 'px';
                }
                else {
                    contentElement.style.position = 'static';
                    bodyElement.style.backgroundPosition = 'top center';
                }
            }
        }

    }

	// Add listeners on page load
	addEvent(window, 'load', addlisteners, false);
    addEvent(window, 'resize', centerContent, false);
    
