
function findPosition( oLink ) {  //positioning for use w/ menus
  if( oLink.offsetParent ) {
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
      posX += oLink.offsetLeft;
      posY += oLink.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oLink.x, oLink.y ];
  }
}

function ow(url,w,h,name) {
	window.open(url,name, "width="+w+", height="+h+", toolbar=no, location=no, directories=no,status=no, menubar=no, scrollbars=yes,resizable=yes");
}

function ci() {
  if (document.images) {
    for (var i=0; i<ci.arguments.length; i+=2) {
      document[ci.arguments[i]].src = eval(ci.arguments[i+1] + ".src");
    }
  }
}


//detect browser
var d, dom, ie, ie4, ie5x, moz, mac, win, lin, old, ie5mac, ie5xwin, op;

d = document;
n = navigator;
na = n.appVersion;
nua = n.userAgent;
win = ( na.indexOf( 'Win' ) != -1 );
mac = ( na.indexOf( 'Mac' ) != -1 );
lin = ( nua.indexOf( 'Linux' ) != -1 );

if ( !d.layers ){
	dom = ( d.getElementById );
	op = ( nua.indexOf( 'Opera' ) != -1 );
	konq = ( nua.indexOf( 'Konqueror' ) != -1 );
	saf = ( nua.indexOf( 'Safari' ) != -1 );
	moz = ( nua.indexOf( 'Gecko' ) != -1 && !saf && !konq);
	ie = ( d.all && !op );
	ie4 = ( ie && !dom );
	ie5x = ( d.all && dom );
	ie5mac = ( mac && ie5x );
	ie5xwin = ( win && ie5x );
}

function disablefields(){
	for (var i=0; i<disablefields.arguments.length; i++) {
		var thingy = document.getElementById(disablefields.arguments[i]);
		thingy.disabled = true;
		thingy.style.backgroundColor = 'LightGrey';
		thingy.style.color = 'DarkGray';
    }
}

function enablefields(){
	for (var i=0; i<enablefields.arguments.length; i++) {
		var thingy = document.getElementById(enablefields.arguments[i]);
		thingy.disabled = false;
		thingy.style.backgroundColor = 'White';
		thingy.style.color = 'Black';
    }
}
function changeDiv(the_div,the_change)
{
  var the_style = getStyleObject(the_div);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
}

function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}

