/*
function initQuickLinks
-- This function fixes all the "links" in the quicklink
   dropdown list by prepending the base of the "home-link"
   link.  The "home-link" is the <a> tag, and Dreamweaver 
   makes it's path relative based on each document.  Therefore,
   Dreamweaver fixes the path of this link, no matter what directory
   the current document is located in.  However, the "links" in the
   quicklink list are not real links, but rather are defined through the
   value property of the <option> tag.  Because of this, Dreamweaver does
   not fix the relative paths (it only fixes "href=" and "src=" attributes of
   certain elements).  Therefore, this function grabs the base location,
   and applies the prefix to any value attribute which starts with a "/".
   The result is that the quicklink "links" behave properly regardless of their
   relation to the referenced document.
*/
function initQuickLinks()
{
 var home=new getObj('home-link');
 home=home.obj;
 if (typeof(home) != "undefined")
  {
    var url=home.href;
    var pos=url.indexOf("index.html");
    if (pos>0)
     base=url.substring(0,pos-1);
    else
     base=".";

   	nav = document.getElementById('quicklink');
   	for(i=0;i<nav.length;i++)
   	{
   	 lnk=nav[i];
   	 if (lnk.value.substring(0,1) == "/")
    	 lnk.value=base+lnk.value;
    } // end for
  } // end type undefined test
} // end function initQuickLinks


// This line is necessary to initialize the quicklink box
window.onload=initQuickLinks;

/*
function quickLink()
-- this function gets the currently selected item from the dropdown list 
   'quicklink' and obtains its 'value' property.  If the value is not an
   empty string, it loads the URL defined in value.
*/
function quickLink()
{
 loc = "";
 if (document.getElementById)
  qlink=document.getElementById('quicklink');
 else
  qlink=document.quicklink;

 loc=qlink.options[qlink.selectedIndex].value;
 if (loc != "")
  location=loc;
}


/*
function getObj(name)
-- credits to www.quirksmode.com for this code (the DHTML micro API)
-- this function retrieves a class object with two fields - the object being
   sought whose name is <name>, and the style object of that object.
   Basically, when accessing an object with a certain id, say 'home-link', this
   function retrieves that object, if it exists, and returns it in the .obj
   field.
   
   Usage:  
     var <variable_name> = new getObj("id of object being sought");
     <variable_name>.obj <-- this is the actual HTML DOM element with the 
       specified id
*/
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	  this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	  this.obj = document.all[name];
	  this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
