function Browser() {
var ua, s, i;
this.isIE= false;// Internet Explorer
this.isOP= false;// Opera
this.isNS= false;// Netscape
this.version = null;
ua = navigator.userAgent;
s = "Opera";
if ((i = ua.indexOf(s)) >= 0) {
this.isOP = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
// Treat any other "Gecko" browser as Netscape 6.1.
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}
s = "MSIE";
if ((i = ua.indexOf(s))) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
}
var closeInterval;
function closeTimeOut(){
closeInterval=setTimeout("cleanUp()",3000);
}

function cleanUp(){
for(i=eleList.length;i>=0;i--){
//alert("Value"+i+" = "+eleList[i]);
if(typeof(eleList[i])!="undefined" && eleList[i]!=""){
///alert(eleList[i].nodeName);
eleList[i].parentNode.lastChild.style.display="none";
eleList[i].className="";
eleList[i]="";
 }
}
}

var browser = new Browser();
function setNav(){
var parc=document.getElementById('navcontainer');
objParent = parc.getElementsByTagName("UL");
for(i=0;i<objParent.length;i++){
if(objParent[i].parentNode.nodeName=="LI"){
 objParent[i].style.display="none";
}
}

var par=document.getElementById('navcontainer');
var alist=par.getElementsByTagName('a');
//alert(alist.length);
for (i=0;i<alist.length;i++){
if(alist[i].parentNode.nodeName=="LI"){
//alert(alist[i].firstChild.nodeValue);
alist[i].onmouseover=function() {showChild(this)};
alist[i].onmouseout=closeTimeOut;
}
}
}


var eleList=new Array(5);
var lastEle="";
function showChild(ele){
clearTimeout(closeInterval);
//alert(ele.parentNode.lastChild.nodeName);
pointer=ele;var depth=0;
while(pointer.parentNode.nodeName!="DIV"){
if(pointer.parentNode.nodeName=="UL"){
depth++;
}
pointer=pointer.parentNode;
}
if((ele.parentNode.childNodes).length>1){
//alert(depth)
//alert(ele.parentNode.lastChild.nodeName);
ele.parentNode.lastChild.style.display="block";
//ele.parentNode.lastChild.style.position="absolute";
// I hate IE here comes some browser sniffing
if(browser.isIE){
if(browser.version=="5.01"){
if(depth>1){ele.parentNode.lastChild.style.left=(ele.offsetWidth*1.05)+"px";}
else{
//ele.parentNode.lastChild.style.left=(ele.offsetWidth*.88)+"px";
}
}
if(browser.version=="5.5"){
if(depth>1){ele.parentNode.lastChild.style.left=(ele.offsetWidth*.8)+"px";}
else{
//ele.parentNode.lastChild.style.left=(ele.offsetWidth*.87)+"px";
}
}
if(browser.version=="6"){
if(depth>1){ele.parentNode.lastChild.style.left=(ele.offsetWidth*.92)+"px";}
else{
//ele.parentNode.lastChild.style.left=(ele.offsetWidth*.97)+"px";
}
}

//alert(browser.version)
}else{
if(depth>1){ele.parentNode.lastChild.style.left=(ele.offsetWidth*.9)+"px";}
else{
//ele.parentNode.lastChild.style.left=(ele.offsetWidth*.96)+"px";
}
}
//alert(ele.offsetHeight)
//ele.parentNode.lastChild.style.top="0";
//ele.parentNode.lastChild.style.width="9em";
//alert(ele.parentNode.lastChild.nodeName);
//ele.parentNode.lastChild.style.zIndex="1000";
//ele.style.zIndex="1000";
ele.className="active";
for(i=eleList.length;i>=(depth);i--){
//alert("Value"+i+" = "+eleList[i]);
if(typeof(eleList[i])!="undefined" && eleList[i]!="" && eleList[i]!=ele){
eleList[i].parentNode.lastChild.style.display="none";
eleList[i].className="";
eleList[i]="";
}
}
eleList[depth]=ele;
lastEle=ele;
//alert(eleList[depth]); 
}
else{
for(i=eleList.length;i>=depth;i--){
//alert("Value"+i+" = "+eleList[i]);
if(typeof(eleList[i])!="undefined" && eleList[i]!=""){
///alert(eleList[i].nodeName);
eleList[i].parentNode.lastChild.style.display="none";
eleList[i].className="";
eleList[i]="";
}
}
}
}
function checkOpen(target){
for(i=0;i<eleList.length;i++){
if(eleList[i]==target){
return false;
}
}
}
if (browser.isIE){
document.onmousedown = pageMousedown;}
else{
document.addEventListener("mousedown", pageMousedown, true);}
function pageMousedown(event){
//alert(lastEle);
if(lastEle==""){return;}
if (browser.isIE){
el = window.event.srcElement;
}
else{
el = (event.target.tagName ? event.target : event.target.parentNode);
}
if(el.nodeName!="A"){
for(i=eleList.length;i>=0;i--){
//alert("Value"+i+" = "+eleList[i]);
if(typeof(eleList[i])!="undefined" && eleList[i]!=""){
///alert(eleList[i].nodeName);
eleList[i].parentNode.lastChild.style.display="none";
eleList[i].className="";
eleList[i]="";
}
}
}
}
function doClear(theText) 
{
if (theText.value == theText.defaultValue)
{
theText.value = ""
}
}
function swapImage(imgName)
{
document.mapgraphic.src=imgName;
}
function restoreImage()
{
document.mapgraphic.src='/images/default.gif';
}
var x=0;
//var xTime=0;
var timeSoFar=0;
var started=false;
var myTimeout;
function incrementX()
{
clearTimeout(myTimeout);
if(started == false)
{
document.getElementById('container').style.display="none";
window.scroll(0,0);
document.getElementById('progressBar').style.display="block";
started=true;
}//clse if started
else
{
//cleartimeout(myTimeout);
}
x+=.5;
timeSoFar+=.25
document.getElementById('progress').style.width=(x+"px");
document.getElementById('time').style.left=((x+1)+"px");
//document.getElementById('bar').style.backgroundPosition=(x+"px 0px");
if(timeSoFar%1 ==0)
{
//xTime+=2;
//document.getElementById('time').style.left=((xTime+1)+"px");
document.getElementById('time').innerHTML="<p>&laquo; "+timeSoFar+" Seconds</p>";
}
if(timeSoFar<325)
{
myTimeout = setTimeout("incrementX()",250);
}
else
{
// warn client that call has timed out and to try again
alert("There has been a problem and the query has timed out. Please use your browsers back button and try again.");
clearTimeout(myTimeout);
started=false;
}
}
function destroyX()
{
x=0;
timeSoFar=0;
clearTimeout(myTimeout);
document.getElementById('container').style.display="block";
window.scroll(0,0);
document.getElementById('progressBar').style.display="none";
started=false;
}
function jumpTo(page_id)
{
window.location.hash=page_id;
}