/**
 * Series of utility methods to make this static site easier to handle in the future even 
 * without a database and give it an object oriented feel
 * Author: JC Holt: j.holt@mdl.com: 3/11/2005
 *
**/

//Global constants
var lCurrent   = null;
var lTitle     = "Bay Area Arborist Coopoerative Inc.";
var lAuthor    = "JC Holt";
var lTel       = "(415) 759-5420";
var lFax       = "(415) 594-9093";
var lEmail     = "info@bayareaarborist.com";

function getSiteTitle() 
{ 
	return lTitle.toUpperCase();
}

function setCurrentPage(aCurrent) 
{
	lCurrent = aCurrent;
}

function getCurrentPage() {
	return lCurrent;
}

function getAuthor() 
{
 	return lAuthor;
}

function move_in(img_name,img_src) {
 	 document[img_name].src="../images/buttons/" + img_src + "";
}

function move_out(img_name,img_src) {
 	 document[img_name].src="../images/buttons/" + img_src + "";
}

function writeToc() 
/** 
 * @Desc Responsible for writing the left navigation system
 *  It looks at what the page id is (int: getCurrentPage) to determine
 *  which item is not "active" and set in the "down" state. It is a primitive implementation
 *  but will work for now.
**/
{
	
switch(getCurrentPage()) { 

	//case '1': break

	case 0:
	        document.write("<div align=center>\n");
		document.write("<a href=services.html OnMouseOver=\"move_in('iServices','services_u.gif')\" OnMouseOut=\"move_out('iServices','services_d.gif')\"><img src=../images/buttons/services_d.gif border=0 alt=Services name=iServices></a><P>"); 
		document.write("<a href=about.html OnMouseOver=\"move_in('iAbout','about_u.gif')\" OnMouseOut=\"move_out('iAbout','about_d.gif')\"><img src=../images/buttons/about_d.gif border=0 alt=About name=iAbout></a><P>"); 
		document.write("<a href=contact.html OnMouseOver=\"move_in('iContact','contact_u.gif')\" OnMouseOut=\"move_out('iContact','contact_d.gif')\"><img src=../images/buttons/contact_d.gif border=0 alt=Contact name=iContact></a><P>"); 
		document.write("<a href=resources.html OnMouseOver=\"move_in('iRes','resources_u.gif')\" OnMouseOut=\"move_out('iRes','resources_d.gif')\"><img src=../images/buttons/resources_d.gif border=0 alt=Resources name=iRes></a><P>"); 
		document.write("<a href=../index.html TARGET=\"_top\" OnMouseOver=\"move_in('iHome','home_u.gif')\" OnMouseOut=\"move_out('iHome','home_d.gif')\"><img src=../images/buttons/home_d.gif border=0 alt=Home name=iHome></a><P>"); 
		document.write("</div>\n");
		break
	
	case 1:
		document.write("<div align=center>\n");
		document.write("<a href=services.html><img src=../images/buttons/services_u.gif border=0 alt=Services name=iServices></a><P>"); 
		document.write("<a href=\"about.html\" OnMouseOver=\"move_in('iAbout','about_u.gif')\" OnMouseOut=\"move_out('iAbout','about_d.gif')\"><img src=../images/buttons/about_d.gif border=0 alt=About name=iAbout></a><P>"); 
		document.write("<a href=contact.html OnMouseOver=\"move_in('iContact','contact_u.gif')\" OnMouseOut=\"move_out('iContact','contact_d.gif')\"><img src=../images/buttons/contact_d.gif border=0 alt=Contact name=iContact></a><P>"); 
		document.write("<a href=resources.html OnMouseOver=\"move_in('iRes','resources_u.gif')\" OnMouseOut=\"move_out('iRes','resources_d.gif')\"><img src=../images/buttons/resources_d.gif border=0 alt=Resources name=iRes></a><P>"); 
		document.write("<a href=../index.html TARGET=\"_top\" OnMouseOver=\"move_in('iHome','home_u.gif')\" OnMouseOut=\"move_out('iHome','home_d.gif')\"><img src=../images/buttons/home_d.gif border=0 alt=Home name=iHome></a><P>"); 
		document.write("</div>\n");
		break	

	case 2:
		document.write("<div align=center>\n");
		document.write("<a href=services.html OnMouseOver=\"move_in('iServices','services_u.gif')\" OnMouseOut=\"move_out('iServices','services_d.gif')\"><img src=../images/buttons/services_d.gif border=0 alt=Services name=iServices></a><P>"); 
		document.write("<a href=\"about.html\"><img src=../images/buttons/about_u.gif border=0 alt=About name=iAbout></a><P>"); 
		document.write("<a href=contact.html OnMouseOver=\"move_in('iContact','contact_u.gif')\" OnMouseOut=\"move_out('iContact','contact_d.gif')\"><img src=../images/buttons/contact_d.gif border=0 alt=Contact name=iContact></a><P>"); 
		document.write("<a href=resources.html OnMouseOver=\"move_in('iRes','resources_u.gif')\" OnMouseOut=\"move_out('iRes','resources_d.gif')\"><img src=../images/buttons/resources_d.gif border=0 alt=Resources name=iRes></a><P>"); 
		document.write("<a href=../index.html TARGET=\"_top\" OnMouseOver=\"move_in('iHome','home_u.gif')\" OnMouseOut=\"move_out('iHome','home_d.gif')\"><img src=../images/buttons/home_d.gif border=0 alt=Home name=iHome></a><P>"); 		
		document.write("</div>\n");
		break	

	case 3:
		document.write("<div align=center>\n");
		document.write("<a href=services.html OnMouseOver=\"move_in('iServices','services_u.gif')\" OnMouseOut=\"move_out('iServices','services_d.gif')\"><img src=../images/buttons/services_d.gif border=0 alt=Services name=iServices></a><P>"); 
		document.write("<a href=about.html OnMouseOver=\"move_in('iAbout','about_u.gif')\" OnMouseOut=\"move_out('iAbout','about_d.gif')\"><img src=../images/buttons/about_d.gif border=0 alt=About name=iAbout></a><P>"); 
		document.write("<a href=contact.html><img src=../images/buttons/contact_u.gif border=0 alt=Contact name=iContact></a><P>"); 
		document.write("<a href=resources.html OnMouseOver=\"move_in('iRes','resources_u.gif')\" OnMouseOut=\"move_out('iRes','resources_d.gif')\"><img src=../images/buttons/resources_d.gif border=0 alt=Resources name=iRes></a><P>"); 
		document.write("<a href=../index.html TARGET=\"_top\" OnMouseOver=\"move_in('iHome','home_u.gif')\" OnMouseOut=\"move_out('iHome','home_d.gif')\"><img src=../images/buttons/home_d.gif border=0 alt=Home name=iHome></a><P>"); 		
		document.write("</div>\n");
		break	

	case 4:
		document.write("<div align=center>\n");
		document.write("<a href=services.html OnMouseOver=\"move_in('iServices','services_u.gif')\" OnMouseOut=\"move_out('iServices','services_d.gif')\"><img src=../images/buttons/services_d.gif border=0 alt=Services name=iServices></a><P>"); 
		document.write("<a href=about.html OnMouseOver=\"move_in('iAbout','about_u.gif')\" OnMouseOut=\"move_out('iAbout','about_d.gif')\"><img src=../images/buttons/about_d.gif border=0 alt=About name=iAbout></a><P>"); 
		document.write("<a href=contact.html OnMouseOver=\"move_in('iContact','contact_u.gif')\" OnMouseOut=\"move_out('iContact','contact_d.gif')\"><img src=../images/buttons/contact_d.gif border=0 alt=Contact name=iContact></a><P>"); 
		document.write("<a href=resources.html><img src=../images/buttons/resources_u.gif border=0 alt=Resources name=iRes></a><P>"); 
		document.write("<a href=../index.html TARGET=\"_top\" OnMouseOver=\"move_in('iHome','home_u.gif')\" OnMouseOut=\"move_out('iHome','home_d.gif')\"><img src=../images/buttons/home_d.gif border=0 alt=Home name=iHome></a><P>"); 
		document.write("</div>\n");
		break
	case 5:
		document.write("<div align=center>\n");
		document.write("<a href=services.html OnMouseOver=\"move_in('iServices','services_u.gif')\" OnMouseOut=\"move_out('iServices','services_d.gif')\"><img src=../images/buttons/services_d.gif border=0 alt=Services name=iServices></a><P>"); 
		document.write("<a href=about.html OnMouseOver=\"move_in('iAbout','about_u.gif')\" OnMouseOut=\"move_out('iAbout','about_d.gif')\"><img src=../images/buttons/about_d.gif border=0 alt=About name=iAbout></a><P>"); 
		document.write("<a href=contact.html OnMouseOver=\"move_in('iContact','contact_u.gif')\" OnMouseOut=\"move_out('iContact','contact_d.gif')\"><img src=../images/buttons/contact_d.gif border=0 alt=Contact name=iContact></a><P>"); 
		document.write("<a href=resources.html OnMouseOver=\"move_in('iRes','resources_u.gif')\" OnMouseOut=\"move_out('iRes','resources_d.gif')\"><img src=../images/buttons/resources_d.gif border=0 alt=Resources name=iRes></a><P>"); 
		document.write("<a href=../index.html TARGET=\"_top\"><img src=../images/buttons/home_u.gif border=0 alt=Home name=iHome></a><P>"); 
		document.write("</div>\n");
		break	

}


}

function writeBlock()
{
    document.write("<P>&nbsp;</P><P>&nbsp;</P>\n");
}

function writeContactDetails()
{
		
     document.write("<P>&nbsp;</P>\n");
     document.write("<div align=center id=CONTACT_TXT>\n");
     
     
     //document.write("<TABLE WIDTH=558 CELLPADDING=0 CELLSPACING=0>\n<TR><TD ID=CONTACT_TXT ALIGN=MIDDLE VALIGN=TOP>\n");
     //document.write("Bay Area Arborist Cooperative Inc. <B> &middot;</B> CA Contractor's License #707545<BR>1858 Donner Ave. <B> &middot; </B> San Francisco, CA 94124<BR>\n");
     //document.write("" + getTelephone() + " <B> &middot;</B> FAX: " + getFax() + " <B> &middot; </B> <A href=\"mailto:" + getEmail() +"\">" + getEmail() + "</a>\n");
     //document.write("<BR><BR>\n</TD>\n</TR>\n</TABLE>\n");
     
     document.write("<img src=\"../images/info.gif\" border=0 alt=\"Contact Information\" height=55 width=550>\n");
     
     document.write("</div>\n");
}

function getAbout(aWhere, aWho)
{
     document.write("<A href=\"about_" + aWhere + ".html\">" + aWho + "</a>\n<BR>\n");
}

function getCert(aCertificationNumber) 
{
     document.write("Certified Arborist #" + aCertificationNumber);
}

function writeDed()
{
     document.write("<img src=\"../images/dedicated_1.gif\" border=0 alt=\"Dedicated to the preservation and enhancement of Bay Area trees\" height=\"17\" width=\"649\">\n<P>\n");
}

function getHire()
{
     document.write("<DIV ALIGN=CENTER><div ID=ST_TXT>\nTo hire one of our qualified arborists, please call or e-mail<BR>us at the number/email below.\n</div>\n</DIV>");		   
}

function getTelephone()
{ 
     return lTel;
}

function getFax() 
{
     return lFax;
}

function getEmail() 
{
     return lEmail;
}

function writeEmailHref()
{
     document.write("<a href=\"mailto:" + getEmail() + "\">" + getEmail() + "</a>\n");
}

function getBio()
{
	var aId = document.bio.list.value;
	
	var lPage = null;
	if (aId == "dash" || aId == "select") { //don't do anything...
	
	} else if (aId == "about") { 
	  lPage = location.href=("about.html");
	} else if (aId == "print") { 
		parent.main.print();
	} else if (aId == "contact") { 
           lPage = location.href=("contact.html");
        } else if (aId == "resources") {
           lPage = location.href=("resources.html");
        } else if (aId == "home") { 
           lPage = location.href=("main.html");
	} else { 
	  //Bio pages
	  lPage = location.href=("about_" + aId + ".html");
	}

}

function writeActionList() 
{
	document.write("<div id=btxt>\n");	
	document.write("<form name=bio>\n");
	document.write("Options: <select name=\"list\" class=\"selectlist\" onChange=\"getBio()\">\n");
	document.write("<option value=\"select\">Select...\n");
	document.write("<option value=\"dash\">----------------\n");
	document.write("<option value=\"about\">About\n");
	document.write("<option value=\"print\">Print Biography\n");
	document.write("<option value=\"dash\">----------------\n");
	document.write("<option value=\"ted\">Ted Kipping\n");
	document.write("<option value=\"phil\">Phil Danielson\n");
	document.write("<option value=\"ian\">Ian Butler\n");
	document.write("<option value=\"elliot\">Elliot Goliger\n");
	document.write("<option value=\"didier\">Didier Termignon\n");
	document.write("<option value=\"pete\">Pete Butler\n");
	document.write("<option value=\"greg\">Greg Stagi\n");
	document.write("<option value=\"linacre\">Howard Linacre\n");
	document.write("<option value=\"lemon\">Lemon DeGeorge\n");
	document.write("<option value=\"dmitri\">Dmitri Tioupine\n");
	document.write("<option value=\"chris\">Christopher Campbell\n");
	document.write("<option value=\"dash\">----------------\n");
	document.write("<option value=\"contact\">Contact Us</a>\n");
	document.write("<option value=\"resources\">Resources</a>\n");
	document.write("<option value=\"dash\">----------------\n");
	document.write("<option value=\"home\">BAAC Home</a>\n");
	document.write("</select>\n</form>\n</div>\n");
	
	
}
