// BUScript.js
// DHTML and JavaScript functions for Purchase College
// Author:  M. Dempster 11/12/00
// Copyright:  LiquidMatrix Corp.

//Browser control vars.  Determines which browser the client is using.  Does NOT detect NS6.0 properly.
//********** Routine to correctly detect IE 4+ and Nav 4+
//var agt = navigator.userAgent.toLowerCase();
//var appVer = navigator.appVersion.toLowerCase();
//var is_minor = parseFloat(appVer);
//var is_major = parseInt(is_minor);

//var iePos  = appVer.indexOf('msie');
//if (iePos !=-1) {
//  is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)))
//  is_major = parseInt(is_minor);
//}

//var is_moz   = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
//               (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
//               (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
//               (agt.indexOf('gecko/')!=-1) && 
//               ((navigator.vendor=="")||(navigator.vendor=="Mozilla")));

//var is_nav_type  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
//                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
//                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)                              
//                && (!(is_moz)));
                
//var is_opera = (agt.indexOf("opera") != -1);
//var is_ie_type   = ((iePos!=-1) && (!is_opera));                

// It is is IE 4+
//var isIE = (is_ie_type && is_minor >= 4);
// Navigator 4+
//var isNav = (is_nav_type && is_minor >= 4 && is_minor < 5);
// Navigator 6+
//var isNav6 = (is_nav_type && is_minor >= 5);                     
//var isOther (!isNav && !isIE && !isNav6);
//************* Detect Routine Ends

var isNav = (document.layers) ? true:false;
var isIE = (document.all) ? true:false;
var isNav6 = (document.getElementById) ? true:false;
var isOther = (!isNav&&!isIE&&!isNav6) ? true:false;
//Other global Vars

//Creates image objects for preloding.  Objects are NOT referenced directly.
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
//Swaps images in an HTML Page.  Take 1st arg, replace it's current src with 2nd arg.  Do this until all arg pairs are completed.
function changeImages() {
        if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function jumpto(form, name) {
	var myindex= eval('form.'+ name + '.selectedIndex');
    var myval=eval('form.' + name + '.options[myindex].value');
    if (myval != "") {
	location.href=myval;
    }
}

// VISIBILITY FUNCTIONS.  Show or Hide layers on the page.  Does NOT affect the display property...els still take up space allotted them


//Highlight function.  Change the specified object's class to the specified class name.  Class must be in main CSS file or in page itself.
function changelight(row, stylename) {
    if (isIE) { eval('document.all.' + row + '.className = "' + stylename + '"'); }
}

function popup(url, name, wwidth, wheight, wresize, wscrolls){
    eval("window.open('" + url + "','" + name + "','toolbar=no,menubar=no,address=no,status=no,dependent=no,resizable=" + wresize + ",scrollbars=" + wscrolls + ",height=" + wheight + ",width=" + wwidth + "')");
}

function external(url){
    eval("window.open('/external.asp?URL=" + escape(url) + "','butlerEXT','toolbar=yes,menubar=yes,address=yes,status=yes,dependent=no,resizable=1,height=540,width=760')");
}