/***********************************************
* Encrypt Email script- Please keep notice intact.
* Tool URL: http://www.dynamicdrive.com/emailriddler/
* **********************************************/
function AddressScrambler() {
    
    var emailarray3076= new Array(107,101,110,109,114,97,122,64,99,111,109,99,97,115,116,46,110,101,116)
    var postemail3076=''
    for (i=0;i<emailarray3076.length;i++)
    postemail3076+=String.fromCharCode(emailarray3076[i])
    
    document.write('<a href="mailto:'+postemail3076+'">'+postemail3076+'</a>')
}

/*********************************************************************
tree.js : HTML tree navigator state control code.
Copyright (C) 2006, Ken Mraz

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

NOTE: The text is not included in this file to save download time.
      You can find the text online at:  http://www.gnu.org/licenses/gpl.txt
************************************************************************/
var navAgent = navigator.userAgent.toLowerCase();
var isIE = ((navAgent.indexOf("msie") != -1) && (navAgent.indexOf("opera") == -1));
var prevHideSideBar = false;
var hideSideBar = false;
var printerView = false;
var pinIconHtml="";
var unpinIconHtml="";
var navTreeCtlHtml='<ul><li><a href="javascript:PrintView();">Toggle Print View</a></li><li><a href="javascript:Collapse();">Collapse All</a></li><li><a href="javascript:Expand();">Expand All</a></li></ul>';

/*************************************
* Initialize the side bar
* ************************************/
function initTree()
{
	if ( isIE && document.readyState != "complete" ) {
		setTimeout( function() { initTree()}, 50 );
		return false;
	}
    // extract the global variables for the pin icons.
    var pinIconObj=document.getElementById("pinIcon");
    pinIconHtml=pinIconObj.innerHTML;
    var unpinIconObj=document.getElementById("unpinIcon");
    unpinIconHtml=unpinIconObj.innerHTML;

    // This will display the control links only if JS is enabled...
    var navctls=document.getElementById("navctls");
    if (navctls) {
        navctls.innerHTML=navTreeCtlHtml;
    }

    // Retrieve the pin indicator element so we can set its HTML
    // and initial to the pinned state...
    var pinIndicator=document.getElementById("pinicon");
    pinIndicator.innerHTML=unpinIconHtml;

    // Collapse the whole tree
    var divs=document.getElementsByTagName("DIV");
    for (i=0;i<divs.length;i++) {
        if (divs[i].id.indexOf("tree")==0) {
            divs[i].style.display="none";
            var key=document.getElementById("x" + divs[i].id);
            var newHtml=document.getElementById("folder.gif");
            key.innerHTML=newHtml.innerHTML;
        }
    }

    // load the cookie into a variable and unescape it
    var the_cookie = Get_Cookie( 'treeState' );
    
    // break each name:value pair into an array
    if (the_cookie) {
        var separated_values = the_cookie.split("/");

        // initialize the pin state variable...
        hideSideBar = false;
        var foundSidebar = false;
        for (var loop = 0; loop < separated_values.length; loop++)
        {
            property_value = separated_values[loop];
            if (property_value == "sidebar") {
                foundSidebar = true;
                break;
            }
        }
        // if we didn't find the sidebar cookie
        // hide the sidebar
        if (!foundSidebar) {
            hideSideBar = true;
            var sidebarObj=document.getElementById("sidebar");
            sidebarObj.style.display="none";
            var main=document.getElementById("maintext");
            main.className = 'mainwide';
            pinIndicator.innerHTML=pinIconHtml;
        }
        
        // loop through all tree divs; if we find them
        // in the cookie, we re-expand them...
        for (i=0;i<divs.length;i++) {
            if (divs[i].id.indexOf("tree")==0) {
                // search for this div...
                for (var loop = 0; loop < separated_values.length; loop++)
                {
                    property_value = separated_values[loop];
                    if (property_value == divs[i].id) {
                        divs[i].style.display="block";
                        var key=document.getElementById("x" + divs[i].id);
                        var newHtml=document.getElementById("textfolder.gif");
                        key.innerHTML=newHtml.innerHTML;
                        break;
                    }
                }
            }
        }
    }
}

/*************************************
* persist side bar state with cookies
* ************************************/
function setTreeState()
{
    var the_cookie = '';
    if (hideSideBar) {
        the_cookie=the_cookie + "sidebarOff";
    } else {
        the_cookie=the_cookie + "sidebar";
    }

    divs=document.getElementsByTagName("DIV");
    for (i=0;i<divs.length;i++) {
        if (divs[i].id.indexOf("tree")==0) {
            var visible=(divs[i].style.display!="none")
            key=document.getElementById("x" + divs[i].id);
            if (visible) {
                the_cookie = the_cookie + '/';
                the_cookie=the_cookie + divs[i].id;
            }
        }
    }
    Set_Cookie( 'treeState', the_cookie, 30, '/', '', '' );
}

/***********************************************
* set styles for optimal printing
* **********************************************/
function PrintView() {
    var row1=document.getElementById("row1");
    var mainNav=document.getElementById("mainNav");
    if (printerView) {
        // restore
        printerView=false;
        row1.style.display="";
        mainNav.style.display="";
        hideSideBar = prevHideSideBar;
    } else {
        prevHideSideBar = hideSideBar;
        hideSideBar=true;
        printerView=true;
        row1.style.display="none";
        mainNav.style.display="none";
        var sidebarObj=document.getElementById("sidebar");
        sidebarObj.style.display="none";
        var main=document.getElementById("maintext");
        main.className = 'mainwide';
    }
}

/*************************************
* Toggle sidebar and persist state
* ************************************/
function PinSidebar() {
    var sidebarObj=document.getElementById("sidebar");
    var main=document.getElementById("maintext");
    var visible=(sidebarObj.style.display!="none")
    var pinIndicator=document.getElementById("pinicon");
    if (hideSideBar) {
        sidebarObj.style.display="block";
        main.className = 'maintext';
        hideSideBar = false;
        pinIndicator.innerHTML=unpinIconHtml;
    } else {
        sidebarObj.style.display="none";
        main.className = 'mainwide';
        hideSideBar = true;
        pinIndicator.innerHTML=pinIconHtml;
    }
    setTreeState();
}

/*************************************
* Show sidebar but don't persist state
* ************************************/
function ShowSidebar() {
    var sidebarObj=document.getElementById("sidebar");
    var visible=(sidebarObj.style.display!="none")
    if (!visible) {
        var main=document.getElementById("maintext");
        sidebarObj.style.display="block";
        main.className = 'maintext';
    }
}

/*************************************
* Hide sidebar but don't persist state
* ************************************/
function HideSidebar() {
    if (hideSideBar) {
        var sidebarObj=document.getElementById("sidebar");
        var main=document.getElementById("maintext");
        var visible=(sidebarObj.style.display!="none")
        if (visible) {
            sidebarObj.style.display="none";
            main.className = 'mainwide';
        }
    }
}

/*************************************
* Toggle a tree list item and persist 
* state
* ************************************/
function Toggle(item) {
    var obj=document.getElementById(item);
    var visible=(obj.style.display!="none")
    var key=document.getElementById("x" + item);
    if (visible) {
        obj.style.display="none";
        var newHtml=document.getElementById("folder.gif");
        key.innerHTML=newHtml.innerHTML;
    } else {
        obj.style.display="block";
        var newHtml=document.getElementById("textfolder.gif");
        key.innerHTML=newHtml.innerHTML;
    }
    setTreeState();
}

/*************************************
* Expand tree list and persist state
* ************************************/
function Expand() {
    var divs=document.getElementsByTagName("DIV");
    for (i=0;i<divs.length;i++) {
        if (divs[i].id.indexOf("tree")==0) {
            divs[i].style.display="block";
            var key=document.getElementById("x" + divs[i].id);
            var newHtml=document.getElementById("textfolder.gif");
            key.innerHTML=newHtml.innerHTML;
        }
    }
    setTreeState();
}

/*************************************
* Collapse tree list and persist state
* ************************************/
function Collapse() {
    var divs=document.getElementsByTagName("DIV");
    for (i=0;i<divs.length;i++) {
        if (divs[i].id.indexOf("tree")==0) {
            divs[i].style.display="none";
            var key=document.getElementById("x" + divs[i].id);
            var newHtml=document.getElementById("folder.gif");
            key.innerHTML=newHtml.innerHTML;
        }
    }
    setTreeState();
}


