/***********************************************************
 *
 *  oasis.js
 *  contains various functions that are used across .jsp's
 *
 *
 *
 *
 ************************************************************
 */
 
 /*
  *   Completist version of browser detection.  from www.dynamicdrive.com/dynamicindex9/browsersniffer.htm
  *   sets a bunch of variables globally, which can then be used to drive browser-specific
  *   behavior.
  */ 	
  	
var exclude=1;
var agt=navigator.userAgent.toLowerCase();
var win=0;var mac=0;var lin=1;
if(agt.indexOf('win')!=-1){win=1;lin=0;}
if(agt.indexOf('mac')!=-1){mac=1;lin=0;}
var lnx=0;if(lin){lnx=1;}
var ice=0;
var ie=0;var ie4=0;var ie5=0;var ie6=0; var ie7=0;var com=0;var dcm;
var op5=0;var op6=0;var op7=0;
var ns4=0;var ns6=0;var ns7=0;ns8=0;var mz7=0;var kde=0;var saf=0;
if(typeof(navigator.vendor)!="undefined" && navigator.vendor=="KDE"){
	var thisKDE=agt;
	var splitKDE=thisKDE.split("konqueror/");
	var aKDE=splitKDE[1].split("; ");
	var KDEn=parseFloat(aKDE[0]);
	if(KDEn>=2.2){
		kde=1;
		ns6=1;
		exclude=0;
		}
	}
else if(agt.indexOf('webtv')!=-1){exclude=1;}
else if(typeof(window.opera)!="undefined"){
	exclude=0;
	if(/opera[\/ ][5]/.test(agt)){op5=1;}
	if(/opera[\/ ][6]/.test(agt)){op6=1;}
	if(/opera[\/ ][7-9]/.test(agt)){op7=1;}
	if (agt.indexOf("MSIE")!=-1 || agt.indexOf("msie") != -1) {ie=1;}
	}
else if(typeof(document.all)!="undefined"&&!kde){
	exclude=0;
	ie=1;
	if(typeof document.getElementById !="undefined"){
		ie5=1;
		if(agt.indexOf("msie 6")!=-1 || (agt.indexOf("msie 7") != -1)) {
			if (agt.indexOf("6") != -1 ) {ie6=1;} else {ie7=1;}
			dcm=document.compatMode;
			if(dcm!="BackCompat"){com=1;}
			}
		}
	else{ie4=1;}
	}
else if(typeof(document.getElementById)!="undefined"){
	exclude=0;
	if(agt.indexOf("netscape/6")!=-1||agt.indexOf("netscape6")!=-1){ns6=1;}
	else if(agt.indexOf("netscape/7")!=-1||agt.indexOf("netscape7")!=-1){ns6=1;ns7=1;}
	else if (agt.indexOf("netscape/8")!=-1) {ns8=1;}
	else if(agt.indexOf("gecko")!=-1){ns6=1;mz7=1;}
	if(agt.indexOf("safari")!=-1 || (typeof(document.childNodes)!="undefined" && typeof(document.all)=="undefined" && typeof(navigator.taintEnabled)=="undefined")){mz7=0;ns6=1;saf=1;}
	}
else if((agt.indexOf('mozilla')!=-1)&&(parseInt(navigator.appVersion)>=4)){
	exclude=0;
	ns4=1;
	if(typeof(navigator.mimeTypes['*'])=="undefined"){
		exclude=1;
		ns4=0;
		}
	}
if(agt.indexOf('escape')!=-1){exclude=1;ns4=0;}
if(typeof(navigator.__ice_version)!="undefined"){exclude=1;ie4=0;}

/*
 *  A debugging function for determining os and browser
 *
 */
 function showBrowserVars()
 {
 	var str = "AGT: " + agt + "\n exclude: " + exclude;
 	str += "\nOS: win: " + win + " mac: " + mac + " lin: " + lin + " lnx: " + lnx;
 	str += "\n IE: ie: " + ie + " ie4: " + ie4 + " ie5: " + ie5 + " ie6: " +ie6 + " ie7: " + ie7;
 	str += "\n NS: ns4: " + ns4 + " ns6: " + ns6 + " ns7: " + ns7 + " ns8: " + ns8 + " mz7 " + mz7;
 	str += "\n OP: op5 " + op5 + " op6: " + op6 + " op7: " + op7;
 	str += "\n other: com: " + com + " dcm: " + dcm + " kde: " + kde + " saf: " + saf + " ice: " + ice;
	alert(str);
 }



/*
 *onMouseover="ddrivetip('Mozart, Wolfgang Amadeus, 1756-1791. [Symphonies, K. 543, Eb major; arr] Prague; Leipzig [1794].  Loeb Music Merritt Room Mus 745.1.54.39.5')";
		onMouseout="hideddrivetip()"
*/ 
 function linkMouseover(title)
 {
 	var message = "";
 	if (ie || ns4 || ns6) message = "Use Right Mouse Button to add \"" + title + "\" to Bookmarks/Favorites";
 	//else if (ns4 || ns6) message="Press CTRL-D to add the bookmark for this Persistent Link for \"" + title + "\"";
 	else if (op5) message = "Press CTRL-T to add the bookmark for this Persistent Link for \"" + title + "\"";
 	else message = "Use your browser's Bookmark/Favorites function to bookmark this Persistent Link for \"" + title + "\"";
	ddrivetip(message, '#ffffee');
 	return true;
 }


 
/*
 *   Code for adding a link as a bookmark
 */
 			function addLinkToBookmarks(title, url) 
			{
			
				 if (ie4) 
				 {
				  window.external.AddFavorite(url,title);
				 }  else if (ns4 ||ns6)
				 {
				    alert("Use Right Mouse Button to add this Persistent Link to your bookmarks");
				 }	else if (op5)
				 {
				 	alert("Press CTRL-T to add this Persistent Link to your bookmark");		
				 } else
				 {
				 	alert("Use your browser's Bookmark/Favorites function to add this Persistent Link");
				 }
			}
 
 /* "tooltip" for "banner" images  ADAPTED by Bobbi from the Dynamic Drive */
 /***********************************************
 * Cool DHTML tooltip script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
 * This notice MUST stay intact for legal use
 * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
 ***********************************************/
 var tipobj;
 var offsetxpoint=-30; //Customize x offset of tooltip
 var offsetypoint=0; //Customize y offset of tooltip
 if (ie) { offsetypoint=-35;}
 
 /* this function should be invoked when the body is being loaded up, but */
 /* AFTER the <div id="dhtmltooltip"></div> */
 function initToolTipSupport() { 
	enabletip=false;
 	if (ie||ns6)
 		tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : "";
 	document.onmousemove=positiontip;
 }
 
 function ietruebody(){
 	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
 }
 
 function ddrivetip(thetext, thecolor, thewidth){
 	if (ns6||ie){
 		if (typeof(thewidth)!="undefined") tipobj.style.width=thewidth+"px";
 		if (typeof(thecolor)!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor;
 		tipobj.innerHTML=thetext;
 		enabletip=true;
 		return false;
 	}
 }
 
 function positiontip(e){
 	if (enabletip){
 		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
 		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
 //Find out how close the mouse is to the corner of the window
 		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20;
 		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20;
 		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000;
 
 //if the horizontal distance isn't enough to accomodate the width of the context menu
	 if (rightedge<tipobj.offsetWidth)
 		//move the horizontal position of the menu to the left by it's width
 		tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px";
 	else if (curX<leftedge)
 		tipobj.style.left="5px";
 	else
 	//position the horizontal position of the menu where the mouse is positioned
 		tipobj.style.left=curX+offsetxpoint+"px";
 
 //same concept with the vertical position
	 if (bottomedge<tipobj.offsetHeight)
 		tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px";
 	else
 		tipobj.style.top=curY+offsetypoint+"px";
 	tipobj.style.visibility="visible";
 	}
 }
 
 function hideddrivetip(){
 	if (ns6||ie){
 		enabletip=false;
	 tipobj.style.visibility="hidden";
	 tipobj.style.left="-1000px";
	 tipobj.style.backgroundColor='';
	 tipobj.style.width='';
 	}
 }
 
 
