// Some Globals
cVisible = 'visible';
cHidden = 'hidden';

var dWin = null;

function v() { return; }

function swapNav(l,r,o) {
  var sBase = "/images/";
  var sFile = "navsep";
  var sExt = ".gif";  
  if (document.images && document.images["nav"+l]) document.images["nav"+l].src = sBase + sFile + (o ? "-l" : "") + sExt;
  if (document.images && document.images["nav"+r]) document.images["nav"+r].src = sBase + sFile + (o ? "-r" : "") + sExt;
}



function getObject(oid) {
	if (document.all) {
		return document.all[oid];
	} else if (document.getElementById) {
		return document.getElementById(oid);
	} else {
		return eval('document.'+oid+';');
	}
}

function setProperty (objID, sProp) {
	var obj = getObject(objID);
	if (!obj) return;
	eval('obj.'+sProp+';');
}

function getProperty(objID,sProp) {
    var obj = getObject(objID);
	return eval('obj.'+sProp+';');
}

function toggleDiv (objID) {
  // Default is to show
  var newprop = "block";
  if (getProperty(objID,'style.display') == newprop) newprop = 'none';
  setProperty(objID,"style.display='"+ newprop +"'")
}

function frameWindow(qstr) {
  var w = screen.width;
  var h = screen.height;
  var ww = parseInt(w * .95);
  var hh = parseInt(h * .95);
  var opt = "toolbar,statusbar,width="+ww+",height="+hh+",top="+(h/2 - hh/2 - 20)+",left="+(w/2 - ww/2);
  window.open("/frame.php?"+qstr,"datawin",opt); 	
}

function download(qstr,sv) {
  var w = screen.width;
  var h = screen.height;
  var ww = parseInt(w * .90);
  var hh = parseInt(h * .70);
  
  // Sub out the PDF with EXE or whatever...
  if ((m = qstr.match(/_([0-9]+)\./)) && featureExtensions[m[1]]) {    
    qstr = qstr.replace(/\.[a-z]+$/,"."+featureExtensions[m[1]]);    
  }
  
  if (sv) qstr = 'save/'+qstr;
  var opt = "menubar,resizable,width="+ww+",height="+hh+",top="+(h/2 - hh/2 - 20)+",left="+(w/2 - ww/2);
  if (dWin && !dWin.closed) dWin.close();
  dWin = window.open("http://"+ location.hostname.replace('ww2','www') +"/download.php/"+qstr,"downloadwin",opt); 	
}

function writeToDiv(divId, sHTML) {
  var obj = getObject(divId);
  if (document.layers) { 
    with (document.layers[divId].document) {
      open();
      write(sHTML);
      close();	
    }  
  }
  else obj.innerHTML = sHTML;
}