var sMenuState = 1;
var sMenu = "";

//------------------------------------------
//
//
//          Drop down menus
//
//
//------------------------------------------
function showSubMenu2(menulist) {
	
  setMenuState(menulist, 1);
  var sMenuState = getMenuState(menulist);

  if (document.getElementById(menulist).style.display == "")
    return;
  if (sMenuState == 1) {
		
      //$('#' + menulist).slideDown(200);
		$('#' + menulist).css("display", "inline");

  }
	

}

function setMenuState(menulist, state) {
  if (sMenu.indexOf(menulist) == -1) {
    sMenu += menulist + "," + state + ":";
  } else {
    var nCurrentMenuState = getMenuState(menulist);
    var sCurrentMenu = menulist + "," + nCurrentMenuState + ":";
    var sNewMenu = menulist + "," + state + ":";
    sMenu = sMenu.replace(sCurrentMenu, sNewMenu);
  }

  return -1;
}

function getMenuState(menulist) {
  if (sMenu.indexOf(menulist) == -1) {
    setMenuState(menulist, 0);
    return 0;
  } else {
    var sMenuArray = new Array();
    sMenuArray = sMenu.split(":");

    for (i = 0; i < sMenuArray.length; i++) {
      if (sMenuArray[i].indexOf(menulist) != -1) {
        var sMenuItemArray = new Array();
        sMenuItemArray = sMenuArray[i].split(",");
        return sMenuItemArray[1];
      }
    }
  }

  return -1;
}

function doHideSubMenu2(menulist) {

  if (getMenuState(menulist) == 0 && document.getElementById(menulist) && document.getElementById(menulist).style.display != "none") {
    
    //$('#' + menulist).slideUp(200);
		$('#' + menulist).css("display", "none");//(200);
    //homepageImageSwitchIsPaused = false;
	}
}

function hideSubMenu2(menulist) {
  var nMenuState = getMenuState(menulist);

  nMenuState = 0;
  setMenuState(menulist, nMenuState);
  setTimeout("doHideSubMenu2('" + menulist + "')", 0);
}

function incrementWatcher2(menulist) {
  var nMenuState = getMenuState(menulist);
  nMenuState += 1;
  setMenuState(menulist, nMenuState);
}















function setFooterPosition()
{
	var footerHeight = $("#footer").height();
	var documentHeight = $(document).height();// + 20;
	$("#footer").css("display", "");
	var footerPosition = documentHeight - 81;
	$("#footer").css("top", footerPosition + "px");
	
	setTimeout("setFooterPosition()", 1000);
}
/*
function setFooterPosition()
{
	var footerPositionTop;
	var windowHeight = $(window).height();
	var documentHeight = $(document).height() - 4;
	var minFooterTopPosition = 666;//$(document).height();; //Is actually six six six but I ain't using that in my code - bad luck!!!
	
	$("#footer").css("display", "none");
		
	if ( documentHeight > windowHeight )
	{
		//alert("DOC HEIGHT (" + documentHeight + ") IS BIGGER THAN WIN HEIGHT (" + windowHeight + ")");
		footerPositionTop = documentHeight;
	} else {
		footerPositionTop = windowHeight - ($("#footer").height());
	}
		
	//if ( (windowHeight - $("#footer").height()) < minFooterTopPosition )
	//{
	//	footerPositionTop = minFooterTopPosition;// - ($("#footer").height() + 4);
	//} else {
	//	footerPositionTop = windowHeight - ($("#footer").height());
	//}			
	$("#footer").css("display", "block");	
	$("#footer").css("top", footerPositionTop + "px");
	//setTimeout("setFooterPosition()", 1000);
}
*/
		$(document).ready(
			function() {
				
				setFooterPosition();
				
				$(window).resize(function() {
					setFooterPosition();
					setTimeout("setFooterPosition()", 1000);
				});
				
			}
		)