
function collapse_all (n_index, n_depth) {
var o_tree = TREES[n_index ? n_index : 0];
if (n_depth == null) n_depth = 1;
if (!o_tree) alert("Title statement error: Tree components missing or not specified.");
var a_nodes = o_tree.a_nodes;
for (var i = a_nodes.length - 1; i >= 0; i--)
if (a_nodes[i].n_depth >= n_depth && a_nodes[i].open)
a_nodes[i].open(1, 1);
o_tree.ndom_refresh();
}

function expand_all (n_index, n_depth) {
var o_tree = TREES[n_index ? n_index : 0];
if (!o_tree) alert("Tree is not initialized yet");
var a_nodes = o_tree.a_nodes;
for (var i = 0; i< a_nodes.length; i++)
if (n_depth == null || a_nodes[i].n_depth <= n_depth)
a_nodes[i].open(0, 1);
o_tree.ndom_refresh();
}

function openItemByCaption (s_caption) {
collapse_all(0,1);

var o_tree = (TREES[0]);
var a_item = o_tree.find_item(s_caption);
for(var n=0; n < a_item.length; n++) {
o_item=a_item[n];
var n_id = o_item.n_id,
n_depth = o_item.n_depth,
a_index = o_item.o_root.a_index,
a_parents = [o_item];
while (n_depth) {
if (a_index[n_id].n_depth < n_depth) {
a_parents[a_parents.length] = a_index[n_id];
n_depth--; }
n_id--; }
for (var i = a_parents.length-1; i >= 0; i--)
if (a_parents[i].n_state & 48) a_parents[i].open();
} 
o_item.select();
}

function colorDivs(color,rDiv){
if (rDiv == null) rDiv="container";
if (color==null) color="g"
if (color==0) color="g"
if (color=="blue") color="b"
if (color=="green") color="g"
if (color=="purple") color="p" 
el=document.getElementById(rDiv).getElementsByTagName("tr")
numOfDivs=el.length
for(i=0;i<numOfDivs;i++){
if((i+1)%2==0) el[i].className = 't'+color+'even';
else  el[i].className = 't'+color+'odd'; }
}

function column(align) {
document.write('</td><td class=noprint bgcolor="white"></td><td class=noprint background="images/blue-border.gif"></td>');
if ((align == "top") || (align == "bottom")) document.write('</tr><tr><td class=noprint></td><td class=noprint background="images/blue-border.gif"></td><td class=noprint  bgcolor="white"></td><td class=noprint bgcolor="white" valign="' + align +'">');
else if (align == "left") document.write('</tr><tr><td class=noprint </td><td class=noprint background="images/blue-border.gif"></td><td class=noprint bgcolor="white"></td><td class=noprint bgcolor="white">');
else if ((align == "right") || (align == "resume")) document.write('<td class=noprint></td><td class=noprint background="images/blue-border.gif"></td><td bgcolor="white"></td><td valign="top" bgcolor="white">'); 
else if (align == "rtop") document.write('<td class=noprint></td><td class=noprint background="images/blue-border.gif"></td><td class=noprint bgcolor="white"></td><td class=noprint valign="top" bgcolor="white">');
else if (align == "rbottom") document.write('<td class=noprint></td><td class=noprint background="images/blue-border.gif"></td><td class=noprint bgcolor="white"></td><td class=noprint valign="bottom" bgcolor="white">');
else alert('Error: Invalid JavaScript column function: "' + align + '"\n Must be "left", "top", "bottom", "right", "rtop", "rbottom".'); 
}

function toSpans(span) {
var str=span.firstChild.data;
var a=str.length;
span.removeChild(span.firstChild);
for(var i=0; i<a; i++) { var theSpan=document.createElement("SPAN");
theSpan.appendChild(document.createTextNode(str.charAt(i)));
span.appendChild(theSpan);}
}

function RainbowSpan(span, hue, deg, brt, spd, hspd) {
this.deg=(deg==null?360:Math.abs(deg));
this.hue=(hue==null?0:Math.abs(hue)%360);
this.hspd=(hspd==null?3:Math.abs(hspd)%360);
this.length=span.firstChild.data.length;
this.span=span;
this.speed=(spd==null?50:Math.abs(spd));
this.hInc=this.deg/this.length;
this.brt=(brt==null?255:Math.abs(brt)%256);
this.timer=null;
toSpans(span);
this.moveRainbow();
}

RainbowSpan.prototype.moveRainbow = function() {
if(this.hue>359) this.hue-=360;
var color;
var b=this.brt;
var a=this.length;
var h=this.hue;
for(var i=0; i<a; i++) {
if(h>359) h-=360;
if(h<60) { color=Math.floor(((h)/60)*b); red=b;grn=color;blu=0; }
else if(h<120) { color=Math.floor(((h-60)/60)*b); red=b-color;grn=b;blu=0; }
else if(h<180) { color=Math.floor(((h-120)/60)*b); red=0;grn=b;blu=color; }
else if(h<240) { color=Math.floor(((h-180)/60)*b); red=0;grn=b-color;blu=b; }
else if(h<300) { color=Math.floor(((h-240)/60)*b); red=color;grn=0;blu=b; }
else { color=Math.floor(((h-300)/60)*b); red=b;grn=0;blu=b-color; }
h+=this.hInc;
this.span.childNodes[i].style.color="rgb("+red+", "+grn+", "+blu+")";}
this.hue+=this.hspd;
}

function ById(id){return document.getElementById(id)}
function t_i(id){
var hlp=ById('Tp'+id);
if (hlp){
 hlp.innerHTML+=' '
hlp.style.visibility='visible'; }
}

function t_o(id){ var hlp=ById('Tp'+id); if(hlp) hlp.style.visibility='hidden';}


function hmenus() {
//  if(document.all&&document.getElementById) {   gave permission denied error ???
if (document.getElementById) {
navRoot = document.getElementById("mainmenu");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() { this.className+=" over"; }
node.onmouseout=function() { this.className=this.className.replace(" over", "");}
} } } }


var TimeOut         = 100;
var currentLayer    = null;
var currentitem     = null;
var currentLayerNum = 0;
var noClose         = 0;
var closeTimer      = null;

function mopen(n) {
var l  = document.getElementById("menu"+n);
var mm = document.getElementById("mmenu"+n);
if(l) {
mcancelclosetime();
l.style.visibility='visible';
if(currentLayer && (currentLayerNum != n))
currentLayer.style.visibility='hidden';
currentLayer = l;
currentitem = mm;
currentLayerNum = n;			
} else if(currentLayer) {
currentLayer.style.visibility='hidden';
currentLayerNum = 0;
currentitem = null;
currentLayer = null;}
}

function mclosetime() { closeTimer = window.setTimeout(mclose, TimeOut); }

function mcancelclosetime() { if(closeTimer) { window.clearTimeout(closeTimer); closeTimer = null; } }

function mclose() {
if(currentLayer && noClose!=1)   {
currentLayer.style.visibility='hidden';
currentLayerNum = 0;
currentLayer = null;
currentitem = null;
} else { noClose = 0; }
currentLayer = null;
currentitem = null;
}

document.onclick = mclose; 

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function closeUp() { closeScroll(0); setTimeout("window.close()",800); } 

function title(color,ltitle,treeitems,rtitle,ltext) {
if ((color != "purple") && (color != "green") && (color != "red") && (color != "blue")) alert('The color "' + color + '" specified in the title is not "blue", "green" , "red", or "purple"!');
document.write('<table cellspacing=0 cellpadding=0 border=0 width="100%" bgcolor="#e4ecff">');
document.write('<tr><td class=noprint colspan=20 height=5><img src="pixel.gif" height=5 width=760></td></tr><tr><td class=noprint width=5 height=8>');
document.write('<img src="pixel.gif" height=1 width=5></td><td class=noprint colspan=2 width=10><img src="images/bodynav_' + color);
document.write('_left_curve.gif" height=28 width=10></td><td class="title" width="5%" height=28 background="images/bodynav_');
document.write(color + '_bkg.gif"><span class=noprint>' + ltitle + '</span></td><td class=noprint width=10 colspan=2><img src="images/bodynav_');
document.write(color + '_rt_curve.gif" height=28 width=10></td><td class=noprint width=5><img src="pixel.gif" height=1 width=5></td>');
document.write('<td class=noprint width=10 colspan=2><img src="images/bodynav_' + color + '_left_curve.gif" height=28 width=10 border=0></td>');
document.write('<td background="images/bodynav_' + color + '_bkg.gif" class=title width="94%"><table class=noprint cellpadding=0 cellspacing=0 border=0 width="100%"><tr><td class="title">');
document.write('<a name=titlebar></a>'+rtitle+'</td></tr></table></td><td class=noprint width=10 colspan=2><img src="images/bodynav_');
document.write(color + '_rt_curve.gif" height=28 width=10></td><td class=noprint width=6><img src="pixel.gif" height=1 width=6></td></tr><tr>');
document.write('<td></td><td class=noprint width=1 background="images/blue-border.gif"></td><td class=noprint width=9 bgcolor=white></td><td class=noprint width="20%" bgcolor="white" valign="top">');
document.write('<table align="center" cellpadding=0 cellspacing=0><tr><td height=3></td></tr><tr><td>Click');
document.write('</td><td><img src="plus.gif" height=11 width=16 onClick="expand_all(0,1);"><br><img src="xbox.gif" height=11 width=16 onClick="collapse_all(0,1);"></td>');
document.write('<td style="white-space: nowrap;"><span class=small>to expand selection<br>to collapse the tree</span></td></tr></table>');
document.write('<div class="Tree">');
new tree (treeitems,TREE_TPL);
document.write('</div>');
if (ltext != null) { document.write('<span style="position:absolute; bottom:80px;width:130px;text-align:center">');
if (ltext=='close') { document.write('<input type="button" value="Close Window" onClick="closeUp(0)"></span>'); }
else { document.write(ltext+'</span>'); }
}
document.write('<td class=noprint width=9 bgcolor="white"></td><td class=noprint width=1 background="images/blue-border.gif"></td><td class=noprint width=5>');
document.write('<img src="pixel.gif" width=5 height=1></td><td class=noprint width=1 background="images/blue-border.gif"></td><td class=noprint width=9 bgcolor="white"></td><td valign="top" bgcolor="white"><div id="main">&#160;<br>');
}

function subhead(color,text) {
if ((color != "purple") && (color != "green") && (color != "red") && (color != "blue")) alert('The color "' + color + '" specified in the title is not "blue", "green" , "red", or "purple"!');
document.write('<table cellspacing=0 cellpadding=0 border=0><tr><td width=10 class=noprint><img src="images/bodynav_' + color);
document.write('_left_curve.gif" height=28 width=10></td><td height=28 background="images/bodynav_');
document.write(color + '_bkg.gif" class="title">' + text + '</td><td width=10 class=noprint><img src="images/bodynav_');
document.write(color + '_rt_curve.gif" height=28 width=10></td></tr></table>');
}

function dothead(color,text) {
document.write('<table cellspacing=0 cellpadding=0 border=0 width="100%"><tr><td>');
subhead(color,text);
document.write('</script></td></tr><tr><td rowspan=2></td><td class=sep background=');
document.write(color + 'dots.gif width="90%"></td></tr></table><p>');
}

// Google Analytics

var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-12364876-1");
pageTracker._trackPageview();
} catch(err) {}