//JavaScript - Mouseover Buttons
//
// Load images but only if browser supports the document.images method

if (document.images)

// load the images and assign it the file sources

{

		var home = new Image();
   	home.src =  "./hotspots/home.jpg";
   	var home2 = new Image();
   	home2.src =  "./hotspots/home2.jpg";

		var contacts = new Image();
   	contacts.src =  "./hotspots/contacts.jpg";
   	var contacts2 = new Image();
   	contacts2.src =  "./hotspots/contacts2.jpg";

   	var membership = new Image();
   	membership.src =  "./hotspots/membership.jpg";
   	var membership2 = new Image();
   	membership2.src =  "./hotspots/membership2.jpg";

   	var classes = new Image();
   	classes.src =  "./hotspots/classes.jpg";
   	var classes2 = new Image();
   	classes2.src =  "./hotspots/classes2.jpg";

   	var links = new Image();
   	links.src =  "./hotspots/links.jpg";
   	var links2 = new Image();
   	links2.src =  "./hotspots/links2.jpg";
   	
   	var classreg = new Image();
   	classreg.src =  "./hotspots/classreg.jpg";
   	var classreg2 = new Image();
   	classreg2.src =  "./hotspots/classreg2.jpg";
   	
   	var maillist = new Image();
   	maillist.src =  "./hotspots/maillist.jpg";
   	var maillist2 = new Image();
   	maillist2.src =  "./hotspots/maillist2.jpg";
   	
   	var calendar = new Image();
   	calendar.src =  "./hotspots/calendar.jpg";
   	var calendar2 = new Image();
   	calendar2.src =  "./hotspots/calendar2.jpg";
   	
   	var calevents = new Image();
   	calevents.src =  "./hotspots/calevents.jpg";
   	var calevents2 = new Image();
   	calevents2.src =  "./hotspots/calevents2.jpg";
   	
   	
   	var calendarsub = new Image();
   	calendarsub.src =  "./hotspots/calendarsub.jpg";
   	var calendarsub2 = new Image();
   	calendarsub2.src =  "./hotspots/calendarsub2.jpg";
   	
   	var picturepopup = new Image();
   	picturepopup.src =  "./Pics/bastille_facts_tn.gif";
   	var picturepopup2 = new Image();
   	picturepopup2.src =  "./Pics/bastille.jpg";
 	}

		var private = new Image();
   	private.src =  "./hotspots/private.jpg";
   	var private2 = new Image();
   	private2.src =  "./hotspots/private2.jpg";

//This function performs image swapping

function swap_home(state)

{
	if (state) {document["home"].src = home2.src;}
	 else
	{document["home"].src = home.src;}
}

function swap_contacts(state)

{
	if (state) {document["contacts"].src = contacts2.src;}
	 else
	{document["contacts"].src = contacts.src;}

}

function swap_membership(state)

{
	if (state) {document["membership"].src = membership2.src;}
	 else
	{document["membership"].src = membership.src;}

}

function swap_classes(state)

{
	if (state) {document["classes"].src = classes2.src;}
	 else
	{document["classes"].src = classes.src;}
}

function swap_classreg(state)

{
	if (state) {document["classreg"].src = classreg2.src;}
	 else
	{document["classreg"].src = classreg.src;}
}

function swap_maillist(state)

{
	if (state) {document["maillist"].src = maillist2.src;}
	 else
	{document["maillist"].src = maillist.src;}
}


function swap_calendar(state)

{
	if (state) {document["calendar"].src = calendar2.src;}
	 else
	{document["calendar"].src = calendar.src;}
		
}

function swap_calevents(state)

{
	if (state) {document["calevents"].src = calevents2.src;}
	 else
	{document["calevents"].src = calevents.src;}
		
}


function swap_calendarsub(state)

{
	if (state) {document["calendarsub"].src = calendarsub2.src;}
	 else
	{document["calendarsub"].src = calendarsub.src;}
		
}

function swap_private(state)

{
	if (state) {document["private"].src = private2.src;}
	 else
	{document["private"].src = private.src;}
		
}

function swap_picturepopup(state)

{
	if (state) {document["picturepopup"].src = picturepopup2.src;}
	 else
	{document["picturepopup"].src = picturepopup.src;}
		
}
// Drop down menus
menuVis = false;

  function menuShow(e)
  {
    if (menuVis != true)
    {
      if (window.event)
      {
        var elem = event.srcElement;
      }
      else if (e)
      {
        var elem = e.target;
      }
      if (elem.nodeType == 1)
      {
        elem = elem.parentNode;
      }
      var sub_menu = "title" + elem.id.substr(5,5);
      var elemnew = document.getElementById(sub_menu);
      elemnew.style.visibility = "visible";
      menuVis=true;
    }
  }

  function hideOnMouseLeave (element, evt) 
  {
    if (element.id.substr(0,5)=='popup')
    {
      element = element.nextSibling;
      if (element.nodeType == "1")
      {
        element = element.nextSibling;
      }
    }
    if (element.contains && evt.toElement) 
    {
      if (!element.contains(evt.toElement))  
      {
        element.style.visibility = 'hidden';
        menuVis=false;
      }
    }
    else if (evt.relatedTarget) 
    {
      if (!contains(element, evt.relatedTarget))
      {
        element.style.visibility = 'hidden';
        menuVis=false;
      }
    }
  }

  function contains (container, containee) 
  {
    do 
    {
      if (container == containee) 
      {
        return true;
      }
      containee = containee.parentNode;
    }
    while (containee);
    return false;
  }
  
  function swap_links(state)

{
	if (state) {document["links"].src = links2.src;}
	 else
	{document["links"].src = links.src;}
}
//End