// general object getter used by lots of routines
function getDocObj(elem,parent) {
    if (document.layers) {
	if (parent) {
	    return "document."+parent+".document."+elem;
	} else {
	    return "document."+elem;
	}
    } else if (document.all) {
	return "document.all."+ elem;
    } else if (document.getElementById) {
	return "document.getElementById('"+elem+"')";
    }
}

// used to pop up profiles on old officers page
function newWin(newContent, targetId, height, width) {
    if (winContent != null) {winContent.close()}
    winAttr = 'right=0, top=0, width=' + width + ', height=' + height + ', toolbar=no,scrollbars=yes,resizable=yes';
    winContent = window.open(newContent,targetId,winAttr);
    if (window.focus) {winContent.focus();}
}



//***************** OUTMOST CONTENT CONTROL ***************
// used by new structure to size the content div and spacer div
var hgt = 0, wid = 0; bodyid = "contentdiv"; navid = "spacerdiv"; divoffset = 100; winContent=null; infoContent=null;

// used by new structure to size the content div and spacer div
// right-left bar display added here too
function sizeDiv() {
	 bodyTarget = eval(getDocObj(bodyid));
	 navTarget = eval(getDocObj(navid));

//dumpNav();

// IE minbody 352 minnav 63 bottomoffset 0 navoffset 0
// Mozilla minbody 348 minnav 38 bottomoffset ? nav offset 21
	 if (navigator.appName == "Microsoft Internet Explorer") {
//12px nav text
//	     minBody = 340; minNav = 50; bottomOffset = 10 ; navOffset = 15;
//14px nav text
	   minBody = 340; minNav = 5; bottomOffset = 10 ; navOffset = 51;
	 } else if (navigator.appName == "Opera") {
//12px nav text
//	     minBody = 340; minNav = 50; bottomOffset = 0 ; navOffset = -5;
//14px nav text
	   minBody = 340; minNav = 5; bottomOffset = 0 ; navOffset = 29;
	 } else { // navigator.appName = Netscape
//12px nav text
//	     minBody = 348; minNav = 50; bottomOffset = 10 ; navOffset = 35;
//14px nav text
	   minBody = 348; minNav = 5; bottomOffset = 10 ; navOffset = 50;
	 }

	 hgt = getBodyHeight();
	 bThgt = hgt - divoffset - bottomOffset; // space up from bottom of page
	 if (bThgt < minBody) {
	    bThgt = minBody;
	 }
	 bodyTarget.style.height = bThgt;

	 nThgt = bThgt - 269 - navOffset; // align nav length with body length

	 if (nThgt < minNav) {
	    nThgt = minNav;
	 }
	 navTarget.style.height = nThgt;

     tsize = 760;
//	 barSize = 115;
	 barSize = 230;
	 tsizeL = 760 + barSize;
	 tsizeR = tsizeL + barSize;

     lBar =	 document.getElementById("AleftBar"); //eval(getDocObj("AleftBar"  ));
     rBar =	 document.getElementById("ArightBar"); //eval(getDocObj("ArightBar" ));
	 siteTable = eval(getDocObj("AsiteTable"));

//	 dumpObj();

	 wdt = getBodyWidth();

	 if (wdt > 990) {
		rBar.className = "";
//		lBar.className = "";
		rBar.style.width = barSize+"px";
//		lBar.style.width = barSize+"px";
//		siteTable.style.width = tsize + barSize + barSize + "px";
		siteTable.style.width = tsize + barSize + "px";
//	 } else if (wdt > 890) {
//		lBar.className = "hide";
//		rBar.className = ""
//		lBar.style.width = "0px";
//		rBar.style.width = barSize+"px";
//		siteTable.style.width = tsize + barSize + "px";
	 } else {
		lBar.className = "hide";
		rBar.className = "hide";
		lBar.style.width = "0px";
		rBar.style.width = "0px";
		siteTable.style.width = "760px";
	 }

     gooberBox = eval(getDocObj("goober"));
	 if (navigator.appName == "Microsoft Internet Explorer") {
	   gooberOff = 81;
	 } else if (navigator.appName == "Opera") {
	   gooberOff = 79;
	 } else { // navigator.appName = Netscape
	   gooberOff = 80;
	 }

	 gooberSize = (bThgt - minBody) + gooberOff;
     gooberBox.style.height = gooberSize;
//	 loogie = gooberBox.contentWindow.document.getElementById('contentFrame');
//	 loogie.style.height = goobersize - 28;
		 
//	 alert("r="+rBar.style.width+" l="+lBar.style.width);

// reposition eventdiv
     posProfile();
	 
	 window.onresize = sizeDiv;
}


// used by new structure to size the content div and spacer div
function getBodyWidth() {
 if (parseInt (navigator.appVersion) > 3) {
  if (navigator.appName == "Netscape") {
   siz = window.innerWidth - 16;
  } else {
   siz = document.body.offsetWidth - 20;
  }
 }
 return siz;
}

// used by new structure to size the content div and spacer div
function getBodyHeight() {
	 if (parseInt (navigator.appVersion) > 3) {
		  if (navigator.appName == "Netscape") {
		     siz = window.innerHeight - 16;
		  } else {
		     siz = document.body.offsetHeight - 20;
		  }
	 }
	 return siz;
}
//***************** OUTMOST CONTENT CONTROL ***************


//*********************** INFO DIV CONTROL ****************
function openProfile(pSRC) {
    pFRAME = eval(getDocObj("eventIframe"));
    pFRAME.src = pSRC;
	pFRAME.style.width = 625;
	pFRAME.style.height = 240;

    pDIV   = eval(getDocObj("eventDiv"));
	posELE	 = eval(getDocObj("contentdiv"));
    pos = getElePos(posELE);
	if (navigator.appName == "Microsoft Internet Explorer") {
	   pos.y += 25;
	   pos.x += 5;
    } else if (navigator.appName == "Opera") {
	   pos.y += 30;
	   pos.x += 20;
    } else { // navigator.appName = Netscape
	   pos.y += 30;
	   pos.x += 18;
    }
//	pos.y += 25;
	setElePos(pos,pDIV);
    pDIV.className = "";
    pFRAME.className = "";
}

function posProfile() {
    pDIV   = eval(getDocObj("eventDiv"));
	posELE	 = eval(getDocObj("contentdiv"));
    pos = getElePos(posELE);
	if (navigator.appName == "Microsoft Internet Explorer") {
	   pos.y += 25;
	   pos.x += 0;
    } else if (navigator.appName == "Opera") {
	   pos.y += 30;
	   pos.x += 20;
    } else { // navigator.appName = Netscape
	   pos.y += 30;
	   pos.x += 18;
    }
//	pos.y += 25;
	setElePos(pos,pDIV);
}

function closeProfile() {	
    pFRAME = eval(getDocObj("eventIframe"));
    pDIV   = eval(getDocObj("eventDiv"));
    pDIV.className = "hide";
    pFRAME.className = "hide";
    pFRAME.src = "";
}

function viewProfile() {
    vDIV = eval(getDocObj("eventDiv"));
    vFRAME = eval(getDocObj("eventIframe"));
    if (vDIV.className == "hide") {
	    vDIV.className = "";
	    vFRAME.className = "";
	} else {
	    vDIV.className = "hide";
	    vFRAME.className = "hide";
	}
}

function hideProfile() {
    hDIV = eval(getDocObj("eventDiv"));
    hFRAME = eval(getDocObj("eventIframe"));
	hDIV.className = "hide";
	hFRAME.className = "hide";
}

function getElePos(pObj) {
    var coords = {x: 0, y: 0};
    var maxDepth = 15;
    var depth = 1;
    target = pObj;
    while (target && depth < maxDepth) {
       coords.x += target.offsetLeft;
       coords.y += target.offsetTop;
       target = target.offsetParent;
       depth++;
    }
    return coords;
}

function setElePos(pos,pObj) {
    if (document.layers) {
	pObj.left = pos.x;
	pObj.DIV.top = pos.y;
    } else if (document.all) {
	pObj.style.posLeft = pos.x;
	pObj.style.posTop = pos.y;
    } else if (document.getElementById) {
	pObj.style.left = pos.x + 'px';
	pObj.style.top = pos.y + 'px';
    }
}


function sizeInfoDiv() {
    infoDIV = eval(getDocObj("infoDiv"));
    infoFRAME = eval(getDocObj("infoIframe"));
    obj = infoFRAME.contentWindow.document.getElementById('bodytable');
    if (obj) {
	    window.setTimeout(function () {obj=infoFRAME.contentWindow.document.getElementById('bodytable');obj.className='infoTable';},50);
	    window.setTimeout(function () {infoFRAME.style.height = infoFRAME.contentWindow.document.body.scrollHeight+10;infoFRAME.style.width = obj.offsetWidth + 20;},1050);
	    window.setTimeout(function () {infoDIV.style.height   = infoFRAME.contentWindow.document.body.scrollHeight+10;infoDIV.style.width	= obj.offsetWidth + 20;},1050);
	    window.setTimeout(function () {infoDIV.className = "";},150);
	    window.setTimeout(function () {infoFRAME.className = "";},150);
    }
}

function infoShowState() {
    infoDIV = eval(getDocObj("infoDiv"));
    infoFRAME = eval(getDocObj("infoIframe"));
    obj = infoFRAME.contentWindow.document.getElementById('bodytable');
	str  = "class = "+obj.className+"\n";
	str += "tx = "+infoDIV.style.left+"\n";
	str += "ty = "+infoDIV.style.top+"\n";
	str += "h  = "+infoDIV.style.height+"\n";
	str += "w = "+infoDIV.style.width+"\n";
	str += "c = "+infoFRAME.src+"\n";
    alert(str); 
}
//*********************** INFO DIV CONTROL ****************

function viewLyrics(title) {
	name = "./lyrics/" + title + ".html";
	target = eval(getDocObj("lyrics"));
	target.src = name;
	target.className = "";
    setTimeout("enSizeIframe('lyrics')",1000);
}

function viewBoth(title) {
	  name = "./lyrics/" + title + ".html";
	  audio = "./songs/" + title + ".mp3";
	  location.href = audio;
	  lyric = eval(getDocObj("lyrics"));
	  lyric.src = name;
	  lyric.className = "";
      setTimeout("enSizeIframe('lyrics')",1000);
}

function playSong(title) {
	  audio = "./songs/" + title + ".mp3";
	  location.href = audio;
	  lyric = eval(getDocObj("lyrics"));
	  lyric.className = "hide";
	  lyric.src = "";
}


	var winContentb = null;
	function newWinb(newContent, targetId, height, width) {
	  if (winContentb != null) {winContentb.close();}
	  lyrics = "./lyrics/" + newContent + ".html";
	  audio = "./songs/" + newContent + ".mp3";
	  location.href = audio;
	  lyric = eval(getDocObj("lyrics"));
	  lyric.src = lyrics;
//	  winAttr = 'right=0, top=0, width=' + width + ', height=' + height + ', toolbar=no,scrollbars=yes,resizable=yes';
//	  setTimeout("winContentb = window.open('"+lyrics+"','"+targetId+"','"+winAttr+"');winContentb.focus();",1000);
	}

//************************* EVENT - NEWS CONTROL *****************
// used by new event calendar interface
// used by new news interface
function enYearView(id,state,frameurl) {
//alert("enYearView:id="+id+":state="+state+":frameurl="+frameurl);
    if (state == null || state == "") {
	  state = document.getElementById("ye"+id).className;
    }
	reverseList = false;
    if (state == "hide") {
// get cookie setting
	listOrder = enGetListOrder(id);
// if cookie not set AND frame source not set then (do nothing maybe) set cookie to "ascending"
	if (!listOrder && document.getElementById("yf"+id).src == "") {
	    enSetListOrder(id,"ascending");
// if cookie not set AND frame source set then we have a problem *********
// if cookie == "ascending" AND frame src not set then update cookie expire
	} else if (listOrder == "ascending" && document.getElementById("yf"+id).src == "") {
	    enSetListOrder(id,"ascending");
// if cookie == "descending" AND frame src not set then
//	 set up call to enReverse(id,false) and update cookie expire
	} else if (listOrder == "descending" && document.getElementById("yf"+id).src == "") {
	    enSetListOrder(id,"descending");
			reverseList = true;		
// if cookie set and frame src set do nothing
	} 
	    document.getElementById("ye"+id).className = ""; // year table row
	    document.getElementById("o"+id).className = "";  // open all
	    document.getElementById("c"+id).className = "";  // close all
	    document.getElementById("s"+id).className = "";  // reverse
	    document.getElementById("ys"+id).src = "../images/minus.gif"; // image
	    if (document.getElementById("yf"+id).src != frameurl) {// year frame
	       document.getElementById("yf"+id).src = frameurl;
	   if (reverseList) {
		       setTimeout("enReverse('"+id+"','false')",500);
		   }
		} else {
		   enSizeIframe("yf"+id);
		}
    } else {
	    document.getElementById("ye"+id).className = "hide";
	    document.getElementById("o"+id).className = "hide";
	    document.getElementById("c"+id).className = "hide";
	    document.getElementById("s"+id).className = "hide";
	    document.getElementById("ys"+id).src = "../images/plus.gif";
//	   document.getElementById("yf"+id).src = "";
//	   document.getElementById("yf"+id).height = 0;
    }
}

// used by new event calendar interface
// used by new news interface
function enToggleView(id,state) {
  if (state == null || state == "") {
    state = document.getElementById("e"+id+"a").className;
  }

  if (state == "hide") {
    document.getElementById("e"+id+"a").className = ""; // spacer image
    document.getElementById("e"+id+"b").className = ""; // description
    document.getElementById("e"+id+"c").className = ""; // spacer image
    document.getElementById("s"+id).src = "../images/darrow.gif"; // image
    window.parent.enSizeIframe(window.name);
  } else {
    document.getElementById("e"+id+"a").className = "hide";
    document.getElementById("e"+id+"b").className = "hide";
    document.getElementById("e"+id+"c").className = "hide";
    document.getElementById("s"+id).src = "../images/rarrow.gif";
    window.parent.enSizeIframe(window.name);
  }
}

// used by new event calendar interface
// used by new news interface
function enOpenAll(id) {
    var idx = 0;
    yf = eval(getDocObj("yf"+id));
    while (yf.contentWindow.document.getElementById("e"+idx+"a")) {
	  yf.contentWindow.document.getElementById("e"+idx+"a").className = "";
	  yf.contentWindow.document.getElementById("e"+idx+"b").className = "";
	  yf.contentWindow.document.getElementById("e"+idx+"c").className = "";
	  yf.contentWindow.document.getElementById("s"+idx).src = "../images/darrow.gif";
	  idx++;
    }
    setTimeout("enSizeIframe('yf"+id+"')",1000);
}

// used by new event calendar interface
// used by new news interface
function enCloseAll(id) {
    var idx = 0;
    yf = eval(getDocObj("yf"+id));
    while (yf.contentWindow.document.getElementById("e"+idx+"a")) {
		yf.contentWindow.document.getElementById("e"+idx+"a").className = "hide";
		yf.contentWindow.document.getElementById("e"+idx+"b").className = "hide";
		yf.contentWindow.document.getElementById("e"+idx+"c").className = "hide";
		yf.contentWindow.document.getElementById("s"+idx).src = "../images/rarrow.gif";
		idx++;
    }
    setTimeout("enSizeIframe('yf"+id+"')",1000);
}

// used by new event calendar interface
// used by new news interface
// used by new event calendar interface
// used by new news interface
function enSizeIframe(id) {
//alert("enSizeIframe:id="+id);
// old line DO NOT DELETE!
//   document.getElementById(id).height = document.getElementById(id).contentWindow.document.body.scrollHeight;
   obj = document.getElementById(id);
   yoff = 0;
   if (navigator.appName != "Microsoft Internet Explorer") {
       obj.height = null; // force reset of this value
   }
// window.setTimeout cause function to execut in the current window scope
// using setTimeout allows time for true values to be set in the document object
//   window.setTimeout(function () {h=obj.contentWindow.document.body.scrollHeight;if (navigator.appName == "Opera"){obj.style.height=h+"px";}else{obj.height = h;}},50);
   window.setTimeout(function () {obj.height=obj.style.height=obj.contentWindow.document.body.scrollHeight;},500);
}

function enSizeIframe2(iFrameObj) {
   yoff = 0;
   if (navigator.appName != "Microsoft Internet Explorer") {
       iFrameObj.height = null; // force reset of this value
   }
// window.setTimeout cause function to execut in the current window scope
// using setTimeout allows time for true values to be set in the document object
//   window.setTimeout(function () {h=obj.contentWindow.document.body.scrollHeight;if (navigator.appName == "Opera"){obj.style.height=h+"px";}else{obj.height = h;}},50);
   window.setTimeout(function () {iFrameObj.height=iFrameObj.style.height=iFrameObj.contentWindow.document.body.scrollHeight;},500);
//   if (id == "goober") alert(obj.contentWindow.document.body.scrollHeight);
}

if (navigator.appName != "Microsoft Internet Explorer") {
  Node.prototype.swapNode = function (node) {
    var nextSibling = this.nextSibling;
    var parentNode = this.parentNode;
    node.parentNode.replaceChild(this, node);
     parentNode.insertBefore(node, nextSibling);
  }
}

function enReverse(id,cookieToggle) {
    yf = eval(getDocObj("yf"+id));
    yft = yf.contentWindow.document.getElementById("mainTable");
    var numRows = yft.rows.length;
    var endRow = numRows / 2;
    for (i=0; i<endRow; i++) {
      var row1 = yft.rows[i];
      var row2 = yft.rows[--numRows];
      row1.swapNode(row2);
    }

    if (cookieToggle == "true") {
      listOrder = enGetListOrder(id);
      if (!listOrder || listOrder == "ascending") {
	enSetListOrder(id,"descending");
      } else {
	enSetListOrder(id,"ascending");
      }
	}
}

function enGetListOrder(id) {
	if (!getCookie(id+"ListOrder")) {
	  return false;
	} else {
      return getCookie(id+"ListOrder");
    }
}

function enSetListOrder(id,value) {
    setCookie(id+"ListOrder",value,30);
}

function enView(val,url) {
	setCookie("EventView",val,30);
	location.href = url;
}

function enShowPast(id) {
  yf = eval(getDocObj("yf"+id));
//alert("O");
//  yft = yf.contentWindow.document.getElementById("mainTable");
  for (i=0; (a = yf.contentWindow.document.getElementsByTagName("link")[i]); i++) {
//alert (a.getAttribute("title"));
    if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
       if (a.getAttribute("title") == "hidePast" || a.getAttribute("title") == "showPast") {
	  if (a.disabled) {
	    a.disabled = false;
	  } else {
	    a.disabled = true;
	  }
       }
    }
  }
  enSizeIframe("yf"+id);
}

//************************* EVENT - NEWS CONTROL *****************

//************************** GALLERY CONTROL *****************
// used by new photo gallery interface
// used to hide/show event picture galleries
function GalleryView(id,state,gallery) {
    if (state == null || state == "") {
	state = document.getElementById("e"+id+"a").className;
    }
    if (state == "hide") {
	document.getElementById("e"+id+"a").className = "";
	document.getElementById("e"+id+"b").className = "";
	document.getElementById("e"+id+"c").className = "";
	if (document.getElementById("e"+id+"d").src != gallery) {
	    document.getElementById("e"+id+"d").src = gallery;
//	} else {
//	    location.hash = "ee"+id+"danchor";
	}
	document.getElementById("s"+id).src = "../../images/darrow.gif";

    } else {
	document.getElementById("e"+id+"a").className = "hide";
	document.getElementById("e"+id+"b").className = "hide";
	document.getElementById("e"+id+"c").className = "hide";
	document.getElementById("s"+id).src = "../../images/rarrow.gif";
    }
}

// used by new photo gallery interface
// used to show photo gallery lists
function GalleryYearView(id,state) {
    if (state == null || state == "") {
	state = document.getElementById("ye"+id).className;
    }
    if (state == "hide") {
	 document.getElementById("ye"+id).className = "";
	 document.getElementById("ys"+id).src = "../../images/minus.gif";
    } else {
	 document.getElementById("ye"+id).className = "hide";
	 document.getElementById("ys"+id).src = "../../images/plus.gif";
    }
}

function GallerySizeIframe(id) {
    obj = document.getElementById(id);
    window.setTimeout(function () {obj.height = obj.contentWindow.document.body.scrollHeight;location.hash = "e"+id+"anchor";},50);
}
//************************** GALLERY CONTROL *****************

//********************* NEWSLETTER CONTROL ************************
var nlWin;

function viewNewsletter(nlSRC,nlDEST) {
//alert("view newsletter "+nlSRC)
//    if (screen.width > 800 && screen.height > 600) {
//		dest = eval(getDocObj(nlDEST));
//		alert("|"+dest.src+"|");
//		dest.className = "";
//		dest.src = nlSRC;
//		dest.src = "";
//		setTimeout("alert('bump');dest.src = '"+nlSRC+"';",1000);
//	} else {
//		nlWin = window.open(nlSRC,"new");
	newPDFWin(nlSRC);
//	}    
}

// new window creation for files
var pdfWindow;
function newPDFWin(newContent) {
    if (pdfWindow) {
//	    dumpObj(pdfWindow);
	    pdfWindow.close();
	}
	winWid = screen.width * .6;
	winHgt = winWid / 1.618;
	winLft = (screen.width/2) - (winWid/2);
	winTop = (screen.height/2) - (winHgt/2);
    winAttr = 'left='+winLft+', top='+winTop+', width='+winWid+', height='+winHgt+', toolbar=no, scrollbars=yes, resizable=yes';
    pdfWindow = window.open("",'pdfwin',winAttr);
	pdfWindow.document.write("<html><head><link href='./osu.css' rel='stylesheet' type='text/css'></head><body class='osu1' onblur='self.close'><embed src='"+newContent+"' width='100%' height='100%'></body></html>");

    if(!pdfWindow.focus) {
	    newPDFWin(newContent);
	} else {
        pdfWindow.focus();
	}
}


//********************* NEWSLETTER CONTROL ************************

//************************* COOKIE CONTROL *****************

function getCookie( name ) {
  var start = document.cookie.indexOf( name + "=" );
  var len = start + name.length + 1;
  if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
    return null;
  }
  if ( start == -1 ) return null;
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
  var today = new Date();
  today.setTime( today.getTime() );
  if ( expires ) {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );
  document.cookie = name+"="+escape( value ) +
    ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}

function deleteCookie( name, path, domain ) {
  if ( getCookie( name ) ) document.cookie = name + "=" +
    ( ( path ) ? ";path=" + path : "") +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

//************************* COOKIE CONTROL *****************

//*********************** TAB CONTROL **********************
function tabOnMouseOver(tabID,tabClass) {
  tab = eval(getDocObj(tabID));
  if (tab.className != "tabcelllock") {
    tab.className = tabClass;
	tab.style.cursor = "pointer";
  } else {
    tab.style.cursor = "default";
  }
}

function tabOnMouseOut(tabID,tabClass) {
  tab = eval(getDocObj(tabID));
  if (tab.className != "tabcelllock") {
    tab.className = tabClass;
	tab.style.cursor = "auto";
  }
}

function tabOnClick(tabID,tabSrc,tabDest) {
  tab = eval(getDocObj(tabID));
  eDiv = eval(getDocObj("eventDiv"));
  eFrame = eval(getDocObj("eventIframe"));
  if (eDiv) {
     if (eDiv.className == "") {
	     eDiv.className = "hide";
	     eFrame.className = "hide";
		 eFrame.src = "";
     }
  }
  if (tab.className != "tabcelllock") {
    tab.className = "tabcelllock";
	tab.style.cursor = "auto";
	dest = eval(getDocObj(tabDest));
	dest.style.height="100%";
	dest.src = tabSrc;
  }
}

function tabUnlock() {
	var argnum = tabUnlock.arguments.length;
	for (i=0; i<argnum; i++) {
		tab = eval(getDocObj(tabUnlock.arguments[i]));
		tab.className = "tabcelloff";
	}
}

function gotoTab() {
   if (location.search != "") {
     var x = location.search.substr(1).split("&");
	 for (var i=0; i<x.length; i++) {
	   var y = x[i].split("=");
//alert(y[0]+":"+y[1]);
	   if (y[0] == "tab") {
	      tab = document.getElementById(y[1]);
		  if (tab) tab.click();
	   }
	 }
  }
}

function doTab(tabSrc,tabDest) {
	dest = eval(getDocObj(tabDest));
	dest.src = tabSrc;
}

//*********************** TAB CONTROL **********************
function faqToggleView(id,state) {
  if (state == null || state == "") {
    state = document.getElementById("e"+id+"a").className;
  }

  if (state == "hide") {
    document.getElementById("e"+id+"a").className = "";
    document.getElementById("e"+id+"b").className = "";
    document.getElementById("e"+id+"c").className = "";
    document.getElementById("s"+id).src = "../images/darrow.gif";
  } else {
    document.getElementById("e"+id+"a").className = "hide";
    document.getElementById("e"+id+"b").className = "hide";
    document.getElementById("e"+id+"c").className = "hide";
    document.getElementById("s"+id).src = "../images/rarrow.gif";
  }
}

function dumpObj(Obj) {
	var newline = false;
//Obj = eval(getDocObj("qlDiv"));
//Obj = eval(getDocObj("AsiteTable"));

	for (var n in Obj) {
		if (newline) {
			term = "\n";
			newline = false;
		} else {
			term = "\t";
			newline = true;
		}
		val = eval(Obj.name+"."+n);
//		if (typeof(val) == "string") {
//			val.replace(/{.*}/gm,"{}");
//		}
		str += n + "(" + typeof(n) + ")";
		if (typeof(val) != "function") {
			str += " = " + val + term;
		} else {
			str += term;
		}
	}
	alert(str);
}

function dumpNav() {
	str = ""
	str += "appCodeName = " + navigator.appCodeName + "\n";
	str += "appName = " + navigator.appName + "\n";
	str += "appMinorVersio = " + navigator.appMinorVersion + "\n";
	str += "cpuClass = " + navigator.cpuClass + "\n";
	str += "platform = " + navigator.platform + "\n";
//	str += "plugins = " + navigator.plugins + "\n";
	str += "opsProfile = " + navigator.opsProfile + "\n";
	str += "userProfile = " + navigator.userProfile + "\n";
	str += "systemLanguage = " + navigator.systemLanguage + "\n";
	str += "userLanguage = " + navigator.userLanguage + "\n";
	str += "appVersion = " + navigator.appVersion + "\n";
	str += "userAgent = " + navigator.userAgent + "\n";
	str += "onLine = " + navigator.onLine + "\n";
	str += "cookieEnabled = " + navigator.cookieEnabled + "\n";
//	str += "mimeTypes = " + navigator.mimeTypes + "\n";
	alert(str);
}

// AJAX routines to use instead of iframes
    //Browser Support Code
    function getHTML(theSRC,theTARGET) {
        var getHTMLRequest;  // The variable that makes Ajax possible!
        try {
		        // Opera 8.0+, Firefox, Safari
            getHTMLRequest = new XMLHttpRequest();
        } catch (e) {
            // Internet Explorer Browsers
            try{
                getHTMLRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    getHTMLRequest = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    // Something went wrong
                    alert("Your browser is broken!");
                    return false;
                }
            }
        }

// Create a function that will receive data sent from the server
        getHTMLRequest.onreadystatechange = function() {
//		alert(theTARGET+ " readystate: "+getHTMLRequest.readyState);
            if (getHTMLRequest.readyState == 4) {
                loadHTML(getHTMLRequest.responseText, theTARGET);
            }
        }

        getHTMLRequest.open("GET", theSRC, true);
        getHTMLRequest.send(null);

    }

    function postHTML(theSRC,theTARGET,parameters) {
        var postHTMLRequest;  // The variable that makes Ajax possible!
        try {
		        // Opera 8.0+, Firefox, Safari
            postHTMLRequest = new XMLHttpRequest();
        } catch (e) {
            // Internet Explorer Browsers
            try{
                postHTMLRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    postHTMLRequest = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
                    // Something went wrong
                    alert("Your browser is broken!");
                    return false;
                }
            }
        }

// Create a function that will receive data sent from the server
        postHTMLRequest.onreadystatechange = function() {
//		alert(theTARGET+ " readystate: "+getHTMLRequest.readyState);
            if (postHTMLRequest.readyState == 4) {
//alert(postHTMLRequest.readyState);
                loadHTML(postHTMLRequest.responseText, theTARGET);
            }
        }

//        parameters = getFormFieldValues(theFORM);
//alert(parameters);		
        postHTMLRequest.open("POST", theSRC, true);
		postHTMLRequest.setRequestHeader("Content-type","application/x-www-form-urlencoded");
		postHTMLRequest.setRequestHeader("Content-length",parameters.length);
		postHTMLRequest.setRequestHeader("Connection","keep-alive"); 
        postHTMLRequest.send(parameters);

    }

    function loadHTML(theSRC,theTARGET) {
//alert("Loading "+theTARGET);
//alert(theSRC);
       target = eval(getDocObj(theTARGET));
	   if (!target) {alert("HTML load failed for "+theTARGET);return;}
	   if (target.scrollTop) {target.scrollTop = 0;}

// run the inline-scripts found in the body
       var theREGEX1 = /<iscript>([\s\S]*?)<\/iscript>/gim;
	   var myHTML = theSRC;	    
//	   var SCRIPTS1 = theREGEX1.exec(myHTML);
	   var SCRIPTS1 = myHTML.match(theREGEX1);

//	   alert(SCRIPTS1);

	   if (SCRIPTS1) {
// for each unique script eval it then replace
	       var unique = new Array(0);
		   var uval;
		   var dup = false;
		   var s = 0;
		   for (i=0;i<SCRIPTS1.length;i++) {
		       for (j=0;j<unique.length&&!dup;j++) {
			       if (SCRIPTS1[i] == unique[j]) {
				       dup = true;
				   }
			   }
			   if (!dup) {
                   unique.length++;
			       unique[s] = SCRIPTS1[i];
				   s++;
				   var theSCRIPT = SCRIPTS1[i].replace(/(<iscript>|<\/iscript>)/gim,"");
			       uval = eval(theSCRIPT);
//alert(uval);
//uval = "goober";
				   rval = uval.replace(/([\(\)\\\/\&\"\'\;\#\?\+\.\*\[\]\=\_\<\>\:])/gim,"\\$1");
				   
                   var tmp = SCRIPTS1[i].replace(/([\(\)\\\/\&\"\'\;\#\?\+\.\*\[\]\=\_\<\>\:])/gim,"\\$1");
				   
				   tmp = tmp.replace(/\s/gim,"\\s");
//alert(tmp);
                   tscript = "myHTML = myHTML.replace(/"+tmp+"/gim,\"" + rval + "\");";
//                   tscript = "myHTML = myHTML.replace(/"+SCRIPTS1[i].replace(/([\(\)\\\/\&\"\'\;\#\?\+\.\*\[\]\=\_\<\>\:])/gim,"\\$1")+"/gim,\"" + rval + "\");";
//alert(tscript);
                   eval(tscript);
			   } else {
			       dup = false;
			   }
		   }
	   }

       target.innerHTML = myHTML;

// run the scripts found in the body	    
	   var theREGEX2 = /<script>([\s\S]*?)<\/script>/gim;
	   var SCRIPTS2 = theSRC.match(theREGEX2);
	   if (SCRIPTS2) {
	       for (i=0;i<SCRIPTS2.length;i++) {
               var theSCRIPT = SCRIPTS2[i].replace(/(<script>|<\/script>)/gim,"");
//alert("Running: "+theSCRIPT);
               eval(theSCRIPT);
           }
	   }
    }
	
    function getJS(theSRC, theID) {
//alert("Loading JS:"+theSRC);
        id = document.getElementById(theID);
		if (id) { return;}
        head = document.getElementsByTagName("head")[0];
//		if (id) { head.removeChild(id);}

        script = document.createElement('script');
        script.type = "text/javascript";
        script.id = theID;
        script.src = theSRC;
        head.appendChild(script);
    }	    

    function getCSS(theSRC,theID) {
//alert("Loading CSS:"+theSRC);
        id = document.getElementById(theID);
		if (id) { return;}
        head = document.getElementsByTagName("head")[0];
//		if (id) { head.removeChild(id);}

        css = document.createElement('link');
        css.rel = "stylesheet";
        css.type = "text/css";
        css.id = theID;
        css.href = theSRC;
        head.appendChild(css);
    }
	
	function getDetails(theSRC,theTarget) {
		getHTML(theSRC,theTarget);
	}	    
// end AJAX routines