// JQUERY DROP DOWN MENU

$(document).ready(function(){

// HIDE SUB MENUS
$('#top > ul > li > ul').hide()
.click(function(e) { e.stopPropagation() });
$('#bottom > ul > li > ul').hide()
.click(function(e) { e.stopPropagation() });

// SHOW SUB MENUS ON HOVER
$('#top > ul > li').hover(function(){
	$(this).find('ul').stop(true, true).slideDown('fast');
}, function() {
	$(this).find('ul').stop(true, true).fadeOut('slow');
});
$('#bottom > ul > li').hover(function(){
	$(this).find('ul').stop(true, true).slideDown('fast');
}, function() {
	$(this).find('ul').stop(true, true).fadeOut('slow');
});


// FANCYBOX PHOTO GALLERY
/*
	Button helper. Disable animations, hide close button, change title type and content
*/

$('.fancybox-buttons').fancybox({
	openEffect  : 'elastic',
	closeEffect : 'elastic',

	prevEffect : 'fade',
	nextEffect : 'fade',

	closeBtn  : true,
	autoPlay  : true,

	helpers : {
		title : {
			type : 'inside'
		},
		buttons	: {}
	},

	afterLoad : function() {
		this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
	}
});



//END DOC READY
});


// FOOTER ATTACHED TO BOTTOM OF BROWSER
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 setFooter() {
if (document.getElementById) {
var windowHeight=getWindowHeight();
if (windowHeight>0) {
var contentHeight=
document.getElementById('page').offsetHeight;
var footerElement=
document.getElementById('grass');
var footerHeight=footerElement.offsetHeight;
if (windowHeight-(contentHeight+footerHeight)>=0) {
footerElement.style.position='relative';
footerElement.style.top=(windowHeight-
(contentHeight+footerHeight))+'px';
}
else {
footerElement.style.position='static';
}
}
}
}


