// Utility Functions
function popupWindow(url,width,height,scrollbars,name) {
	var handle;
	if(arguments.length < 4) {scrollbars = 'no';}
	if(arguments.length < 5) {name = 'popup';}
	if(handle != null && !handle.closed) {handle.close();}
	handle = window.open(url,name,'toolbar=no,location=no,directories=no,status=no,scrollbars='+scrollbars+',resizable=yes,width='+width+',height='+height);
	handle.focus();
}
function popup(url,width,height) { 
	popupWindow(url,width,height,'yes','popup'); 
}

// Require Flash 6 or higher
var flashOK = false;
if(navigator.plugins["Shockwave Flash"]) {
	var flashVersion = navigator.plugins["Shockwave Flash"].description.split('Shockwave Flash ')[1];
	if(flashVersion >= '6') { flashOK = true; }
} else if(window.ActiveXObject) {
	objFlash=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');");
	if(objFlash) { flashOK = true; }
}

function showFlash(url,width,height,base) {
	if(arguments.length < 4) {base = '.';}
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab##version=6,0,29,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="BASE" value="'+base+'"><embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" base="'+base+'"></embed></object>');
}

function focusSearch(t) { t.className='x_formelem'; t.value=''; }
function doSearch() { document.fSearch.submit(); }

function navOver(t,l) { if(arguments.length<2) l=''; t.className = 'x_navOver'+l; }
function navOut(t,l) { if(arguments.length<2) l=''; t.className = 'x_nav'+l; }
var allowGoTo = true;
function stopGoTo() { allowGoTo = false; }
function goToPage(id) { if(allowGoTo) window.location = relPath + 'index.cfm?p='+id; }
function goToURL(url) { if(allowGoTo) window.location = url; }

//rollover function for arrows, used by lots of object templates
var	prevarrow = new Image();var	prevarrowon = new Image();
var nextarrow = new Image();var nextarrowon = new Image();
prevarrow.src = 'img/arrow_prev.gif';prevarrowon.src = 'img/arrow_prev_on.gif';
nextarrow.src = 'img/arrow_next.gif';nextarrowon.src = 'img/arrow_next_on.gif';

function navrollover(i) {
	if (i == 'prev') document.images["img_" + i].src = prevarrowon.src;
	else if (i == 'next') document.images["img_" + i].src = nextarrowon.src;
}
function navrollout(i) {
  if (i=='prev') document.images["img_" + i].src = prevarrow.src;
  else if (i=='next') document.images["img_" + i].src = nextarrow.src;
}

// very minimal generic rollovers by andrew 
function switchImg(imageID,newSrc) {
	document.images[imageID].src = newSrc;
}

// supporting code for showNote and hideNote, used by the calendar in events.cfm
var _x; var _y;
if (!document.all) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMousePosition;
function getMousePosition(e) {
  if (!document.all) { _x = e.pageX; _y = e.pageY; } 
  else { _x = event.clientX + document.body.scrollLeft; _y = event.clientY + document.body.scrollTop; }
  return true;
}
var currentNote = "";
function showNote(divid,divpos){
	if(arguments.length < 2) { divpos = 'right'; }
	var hn; var cn = currentNote; currentNote = divid; if(cn != "") { hideNoteAction(cn); }
	if(document.all){hn=document.all[divid];}else if(document.getElementById){hn=document.getElementById(divid);}
	if(divpos == 'right') { hn.style.left=_x+5;hn.style.top=_y; } else { hn.style.left=_x-135;hn.style.top=_y; }
	hn.style.visibility="visible";
}
function hideNoteAction(divid) {
	var hn;
	if(divid != currentNote) {
		if(document.all){hn=document.all[divid];}else if(document.getElementById){hn=document.getElementById(divid);}
		hn.style.visibility = "hidden";
	}
}
function hideNote(divid) { currentNote = ""; setTimeout("hideNoteAction('"+divid+"')",100); }