var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_DOM   = (document.getElementById) ? true : false;
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav6up = (is_nav && is_DOM);
var is_ie = (agt.indexOf("msie") != -1);
var is_ie3 = (is_ie && (is_major < 4));
var msie_vers_start = agt.indexOf("msie")+5;
var msie_real_vers = parseFloat(agt.substring(msie_vers_start, msie_vers_start+3));
var is_ie4  = (is_ie && (is_major == 4) && (msie_real_vers < 5));
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.")!=-1));
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);
var is_aol   = (agt.indexOf("aol") != -1);
var is_aol3  = (is_aol && is_ie3);
var is_aol4  = (is_aol && is_ie4);
var is_mac    = (agt.indexOf("mac")!=-1);

function runCampusFlash() {
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH=705 HEIGHT=213>\n');
	document.write('<PARAM NAME=movie VALUE="flash/campus.swf">\n');
	document.write('<param name="wmode" value="transparent">\n');
	document.write('<PARAM NAME=quality VALUE=high>\n');
	document.write('<PARAM NAME=bgcolor VALUE=#FFFFFF>\n');
	document.write('<EMBED src="flash/campus.swf" quality=high bgcolor=#FFFFFF WIDTH=705 HEIGHT=213 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" wmode="transparent"></EMBED>\n');
	document.write('</OBJECT>\n');
}

function flashLink(code) {
	if ( code == "learnmore" || code == "staticLM" ) {
		location.href = bannerlinks[code];
	}
	else if(code == "openaccount" || code == "staticOA") {
		openCenteredWindow(bannerlinks[code],code,400,520,false,true);
		return void(0);
	}
	else {
		window.open(bannerlinks[code]);
		return void(0);
	}
}

function runCampusStatic() {
	html = "";
	html += '<div class="staticbanner"><img src="images/cstatic.jpg" width="705" height="213" alt="" border="0">';
	html += '<a class="staticOA" href="javascript:flashLink(\'staticOA\');"><img src="images/dot_trans.gif" width="144" height="24" alt="" border="0"></a>';
	html += '<a class="staticLM" href="javascript:flashLink(\'staticLM\');"><img src="images/dot_trans.gif" width="144" height="24" alt="" border="0"></a></div>';
	document.write(html);
}

function goLocations(url) {
	var zip = document.getElementById("zipcode");
	if (zip.value == "")	{
		alert('Please enter a ZIP code');
		zip.focus();
	} else
		openWindow(url+'&ZIP='+zip.value, 'locations', 'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,resizable=yes,width=650,height=450,screenX=10,screenY=10,left=10,top=10', null);
	return false;
}

// ================================================== Bubble handling code
var _htmlobj = null;
function showbubble(elem, name) {

	if ( _htmlobj != null ) {
		_htmlobj.style.left = -1000;
	}
	_htmlobj = document.getElementById(name);

	pos = getPosition(elem);

	_htmlobj.style.top = pos.top - 110;
	_htmlobj.style.left = pos.left + elem.offsetWidth + 40;
}

function hidebubble() {
	_htmlobj.style.left = -1000;
}

function getPosition(elem){
	var pos = { top: 0, left: 0 };
	while (elem != null) {
		pos.left += elem.offsetLeft;
		pos.top += elem.offsetTop;
		elem = elem.offsetParent;
	}
	return pos;
}

// == Taken (and modified) from https://online.citibank.com/JRS/cm/js/branding.js (JG 5/28/09)
var child_win;
function launchPopup(url,winName,winParams){
	if(winName=='_top'){top.location.href=url; return;}
	if(winName==null||winName=='')
		winName='childWin';
	if(child_win!=null&&!child_win.closed)
		child_win.close();
	child_win=window.open(url,winName,winParams);
}



// ======================================== DHTML menu bar code
var _pos;
var _aelem;
var _currelem;

function showMenu(atag, item) {
	if (_aelem) {
		_aelem.style.background = "url(images/navarr_side.gif) no-repeat";
	}		
	if ( _currelem ) {
		_currelem.style.left = -1000;
		if ( _currelem.id == "studentbank" && is_ie ) {
			document.getElementById("iframe").style.left = -1000;
		}
	}
	_currelem = document.getElementById(item);
	_pos = atag.offsetLeft+1;
	_aelem = atag;
	keepMenu(_currelem);
}

function keepMenu(elem) {
	elem.style.left = _pos;
	_aelem.style.background = "url(images/navarr_down.gif) no-repeat";
	if ( elem.id == "studentbank" && is_ie ) {
		document.getElementById("iframe").style.left = _pos;
	}	
}

function hide(name) {
	hideMenu(document.getElementById(name));
}

function hideMenu(elem) {
	elem.style.left = -1000;
	_aelem.style.background = "url(images/navarr_side.gif) no-repeat";
	if ( elem.id == "studentbank" && is_ie ) {
		document.getElementById("iframe").style.left = -1000;
	}
}

function setup() {
	// ====== IE DHTML Menu Hacks
	// Add li:hover to the menu items
	if ( !is_ie) return;
	uls = document.getElementsByTagName("ul");
	for (u=0; u<uls.length; u++) {
		if (uls[u].className == "menuitems") {
			lis = uls[u].getElementsByTagName("li");
			for (i=0; i<lis.length; i++) {
				if ( !lis[i].onmouseover) {
					lis[i].onmouseover 	= function() {this.className += " iehover ";}
					lis[i].onmouseout 	= function() {this.className=this.className.replace(' iehover ', '');}
				}
			}
		}
	}
	// Add an iframe hack to the studentbanking menu to hide dropdowns.
	div = document.getElementById("studentbank");
	iframe = '<iframe id="iframe" src="about:blank" scrolling="no" frameborder="0" style="position:absolute;z-index:0;top:106px;left:-1000px;width:'+div.offsetWidth+'px;height:' + div.offsetHeight +'px;"></iframe>';
	document.getElementById("menubar").innerHTML += iframe;		
}

