function initialiseMenu(){
	clearMenu();
	//parent.document.title="TopMenu";
}
function clearMenu(){
	//MenuParam
	NumberOfTopMenuImg=4;
	NumberOfSubMenus=4;
	//Hide sub menu div
	for(i=1;i<=NumberOfSubMenus;i++){
		DivId= "SubMenuDiv"+i;
		document.getElementById(DivId).style.visibility="hidden";
	}
	//Reload default Menu pictures
	for(i=1;i<=NumberOfTopMenuImg;i++){
		ImgId= "ImgTopMenu"+i;
		unswapPicture(document.getElementById(ImgId));
	}
}

function overImgTopMenu(Item){
	//ClearMenu
	clearMenu();
	//Change menu picture
	swapPicture(Item);
	//ShowSubMenu
	if(Item.id=="ImgTopMenu1"){
		document.getElementById("SubMenuDiv1").style.zindex="100";
		document.getElementById("SubMenuDiv1").style.visibility="visible";
	}
	if(Item.id=="ImgTopMenu2"){
		document.getElementById("SubMenuDiv2").style.visibility="visible";
	}
	if(Item.id=="ImgTopMenu3"){
		document.getElementById("SubMenuDiv3").style.visibility="visible";
	}
	if(Item.id=="ImgTopMenu4"){
		document.getElementById("SubMenuDiv4").style.visibility="visible";
	}
	/*if(Item.id=="ImgTopMenu5"){
		document.getElementById("SubMenuDiv5").style.visibility="visible";
	}*/
}

function swapPicture(ImgItem){
	var Src=ImgItem.src;
	var Ext=Src.substring(Src.length-3, Src.length);
	var Src2=Src.substring(0, Src.length-5) + "2." + Ext;
	ImgItem.src=Src2;
}
function unswapPicture(ImgItem){
	var Src=ImgItem.src;
	var Ext=Src.substring(Src.length-3, Src.length);
	var Src2=Src.substring(0, Src.length-5) + "1." + Ext;
	ImgItem.src=Src2;
}

(function($) {
	$.fn.fkCenterVertically = function(options)
	{
		var defaults = {
			parentHeight: null
		};
		
		// Extend our default options with those provided
		var opts = $.extend(defaults, options);
			
		if (opts.parentHeight == null) opts.parentHeight = $(window).height();
		
		return this.each(function()
		{
			this.opts = opts;
		
			if ( $(this).outerHeight() < this.opts.parentHeight )
				var marginY = ( this.opts.parentHeight - $(this).outerHeight() ) / 2;
			else
				var marginY = 0;
				
			$(this).css({
				'margin-top': marginY, 
				'margin-bottom': marginY
			});
		});
	};
})(jQuery);


$(document).ready(function(){
	$("#wrapper").fkCenterVertically().fadeIn();
});
$(window).resize(function(){
	$("#wrapper").fkCenterVertically();
});
