	function getWindowHeight() {
		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;
	}
	function setContent() {
		if (document.getElementById) {
			var windowHeight = getWindowHeight();
			if (windowHeight > 0) {
				var contentElement = document.getElementById('wrapper');
				var contentHeight = contentElement.offsetHeight;
				if (windowHeight - contentHeight > 0) {
					contentElement.style.position = 'relative';
					contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
				}
				else {
					contentElement.style.position = 'static';
				}
			}
		}
	}
	window.onload = function() {
		setContent();
	}
	window.onresize = function() {
		setContent();
	}


/** Pick random image for top right corner **/

	var randImages = new Array(
	"/img/random/1.jpg",
	"/img/random/2.jpg",
	"/img/random/5.jpg",
	"/img/random/6.jpg",
	"/img/random/7.jpg",
	"/img/random/8.jpg",
	"/img/random/9.jpg",
	"/img/random/10.jpg",
	"/img/random/11.jpg",
	"/img/random/12.jpg",
	"/img/random/13.jpg",
	"/img/random/14.jpg",
	"/img/random/15.jpg");
	
	
	function pickImg ()
	{
		var number = Math.round(Math.random() * 12)
		document.images["rand"].src = randImages[number];
	}



sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


function Show()
{
	x = document.getElementById('fullList');
	y = document.getElementById('More');
	z = document.getElementById('Less');
	x.style.display = 'block';
	y.style.display = 'none';
	z.style.display = 'block';
}

function Hide()
{
	x = document.getElementById('fullList');
	y = document.getElementById('More');
	z = document.getElementById('Less');
	x.style.display = 'none';
	y.style.display = 'block';
	z.style.display = 'none';
}



/** Image gallery **/


var gal = {
    init : function() {
        if (!document.getElementById || !document.createElement || !document.appendChild) return false;
        if (document.getElementById('gallery')) document.getElementById('gallery').id = 'jgal';
        var li = document.getElementById('jgal').getElementsByTagName('li');
        li[0].className = 'active';
        for (i=0; i<li.length; i++) {
            li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')';
            li[i].style.backgroundRepeat = 'no-repeat';
            li[i].title = li[i].getElementsByTagName('img')[0].alt;
            gal.addEvent(li[i],'click',function() {
                var im = document.getElementById('jgal').getElementsByTagName('li');
                for (j=0; j<im.length; j++) {
                    im[j].className = '';
                }
                this.className = 'active';
            });
        }
    },
    addEvent : function(obj, type, fn) {
        if (obj.addEventListener) {
            obj.addEventListener(type, fn, false);
        }
        else if (obj.attachEvent) {
            obj["e"+type+fn] = fn;
            obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
            obj.attachEvent("on"+type, obj[type+fn]);
        }
    }
}

gal.addEvent(window,'load', function() {
    gal.init();
});


