// JavaScript Document
// set browser sniffer variables
var ns4=document.layers
var ns6=document.getElementById&&!document.all 
var ie4=document.all
var opr=navigator.userAgent.indexOf("Opera")
var aol=navigator.userAgent.indexOf("AOL")
var mac=navigator.userAgent.indexOf("Macintosh")
// alert(navigator.userAgent);

// set variables for DHTML scroller
var upH = 17; // Height of up-arrow 
var upW = 9; // Width of up-arrow
var downH = 17; // Height of down-arrow
var downW = 9; // Width of down-arrow
var dragH = 14; // Height of thumb button
var dragW = 9; // Width of scrollbar
var scrollH = 237; // Height of scrollbar

var speed = 4; // Scroll speed

var upH_IB = 15; // Height of up-arrow 
var upW_IB = 14; // Width of up-arrow
var downH_IB = 15; // Height of down-arrow
var downW_IB = 14; // Width of down-arrow
var dragH_IB = 10; // Height of thumb button
var dragW_IB = 14; // Width of scrollbar
var scrollH_IB = 78; // Height of scrollbar	

// changeImage function
function ChangeImage(ImageName, NewImage, Title, Directory)
{
if (document.images)
	{
// alert (ImageName + " - " + NewImage + " - " + Title + " - " + Directory);
	if (String (Directory) != "undefined")
		document[ImageName].src = Directory + "/" + NewImage;
	else
		document[ImageName].src = "imagesWWW/" + NewImage;
	}

if (String (Title) != "undefined")
	window.status=Title;
else
	window.status=' ';
}

// ChangeImageEx function
function ChangeImageEx() {
	if (document.images) {
		if (ChangeImageEx.arguments.length == 5)
			{
			if (document.layers) 
				document.layers[ChangeImageEx.arguments[0]].document[ChangeImageEx.arguments[1]].src = ChangeImageEx.arguments[4] + '/imagesWWW/' + ChangeImageEx.arguments[2];
			else
				document[ChangeImageEx.arguments[1]].src = ChangeImageEx.arguments[4] + '/imagesWWW/' + ChangeImageEx.arguments[2];
				
			if (ChangeImageEx.arguments.length > 2)
				window.status=ChangeImageEx.arguments[3];
			}				

		if (ChangeImageEx.arguments.length == 6)
			{
			if (document.layers) 
				document.layers[ChangeImageEx.arguments[0]].document.layers[ChangeImageEx.arguments[1]].document[ChangeImageEx.arguments[2]].src = ChangeImageEx.arguments[5] + '/imagesWWW/' + ChangeImageEx.arguments[3];
			else
				document[ChangeImageEx.arguments[2]].src = ChangeImageEx.arguments[5] + '/imagesWWW/' + ChangeImageEx.arguments[3];

			if (ChangeImageEx.arguments.length > 2)
				window.status=ChangeImageEx.arguments[4];
			}	
		}
	
}

// internal popup function
function newWindow(url){

// new window popup
	col_pop = window.open(url)	
	col_pop.focus();
}

// internal popup function
function globalPopUp(url, hgt){

	// put close opened pop menu
//	if (window.col_pop) {	
//		col_pop.close();
//	}

	col_pop = window.open(url, 'col', 'width=546,height='+hgt+',resizable=yes')	
	col_pop.focus();
}

// slideshow popup function
function slideshowPopUp(url){

	col_pop = window.open(url, 'col', 'width=600,height=400,resizable=yes,scrollbars=no')	
	col_pop.focus();
}

// buildingPopUp popup function
function buildingPopUp(url, hgt){

	// put close opened pop menu
//	if (window.col_pop) {	
//		col_pop.close();
//	}

	col_pop = window.open(url, 'col', 'width=477,height='+hgt+',resizable=yes,scrollbars=yes')	
	col_pop.focus();
}

// mapToPopUp popup function
function mapToPopUp(url, hgt){

	// put close opened pop menu
//	if (window.col_pop) {	
//		col_pop.close();
//	}

	col_pop = window.open(url, 'col', 'width=460,height='+hgt+',resizable=yes,scrollbars=no')	
	col_pop.focus();
}

// unframed popup function
function plainPopUp(url){
	
	colgate_pop = window.open(url, 'colgate', 'width=800,height=600,resizable=yes,scrollbars')	
	colgate_pop.focus();
}

// external popup function
function extPopUp(url){

	// put close opened pop menu
//	if (window.colgate_pop) {	 
//		colgate_pop.close();
//	}
	
	var urlString
	//urlString  = "http://www.colgate.edu/frameset.aspx?nwURL=" + url;
	urlString  = "/frameset.aspx?nwURL=" + url;
	// Escape "&" used in the news&events url in quicklinks
	urlString = urlString.replace(/&/g,"%26");
	
	var toolbarString = "toolbar=yes,location=yes,menubar=yes,"
	if (mac>0 && aol>0)
		toolbarString=""
	colgate_pop = window.open(urlString, 'col', 'width=850,height=600,resizable=yes,'+toolbarString+'scrollbars');
	colgate_pop.focus();
}

// external popup function
function extPopUpNonFrame(url){
	var urlString
	//urlString  = "http://www.colgate.edu/frameset.aspx?nwURL=" + url;
	urlString  = url;
	// Escape "&" used in the news&events url in quicklinks
	//urlString = urlString.replace(/&/g,"%26");
	
	var toolbarString = "toolbar=yes,location=yes,menubar=yes,"
	if (mac>0 && aol>0)
		toolbarString=""
	colgate_pop = window.open(urlString, 'col', 'width=850,height=600,resizable=yes,'+toolbarString+'scrollbars');
	colgate_pop.focus();
}

// put the given page into the parent window ("remove frames")
function removeFrame(theURL) {
	parent.location.href = theURL;
}


// set image preloads for nav rollovers
/*
if (document.images)
{
	Preload_image_01 = new Image();
	Preload_image_01.src = "/imagesWWW/nav_about_roll.gif";
	Preload_image_02 = new Image();
	Preload_image_02.src = "/imagesWWW/nav_admissions_roll.gif";
	Preload_image_03 = new Image();
	Preload_image_03.src = "/imagesWWW/nav_academics_roll.gif";
	Preload_image_04 = new Image();
	Preload_image_04.src = "/imagesWWW/nav_athletics_roll.gif";
	Preload_image_05 = new Image();
	Preload_image_05.src = "/imagesWWW/nav_student_roll.gif";
	Preload_image_06 = new Image();
	Preload_image_06.src = "/imagesWWW/nav_news_roll.gif";
	Preload_image_07 = new Image();
	Preload_image_07.src = "/imagesWWW/tab_home_roll.gif";
	Preload_image_08 = new Image();
	Preload_image_08.src = "/imagesWWW/tab_offices_roll.gif";
	Preload_image_09 = new Image();
	Preload_image_09.src = "/imagesWWW/tab_libraries_roll.gif";	
	Preload_image_10 = new Image();
	Preload_image_10.src = "/imagesWWW/tab_mycolgate_roll.gif";
	Preload_image_11 = new Image();
	Preload_image_11.src = "/imagesWWW/sub_alumni_roll.gif";
	Preload_image_12 = new Image();
	Preload_image_12.src = "/imagesWWW/sub_parents_roll.gif";
	Preload_image_13 = new Image();
	Preload_image_13.src = "/imagesWWW/sub_giving_roll.gif";
	Preload_image_14 = new Image();
	Preload_image_14.src = "/imagesWWW/ss_go_roll.gif";
	Preload_image_15 = new Image();
	Preload_image_15.src = "/imagesWWW/foot_giving_roll.gif";
	Preload_image_16 = new Image();
	Preload_image_16.src = "/imagesWWW/foot_working_roll.gif";
	Preload_image_17 = new Image();
	Preload_image_17.src = "/imagesWWW/foot_back_roll.gif";
}
*/

function clearBox(){
	if (document.Form1.Tab_nav1_siteSearch)
	{
		if (document.Form1.Tab_nav1_siteSearch.value=="Site Search"){
			document.Form1.Tab_nav1_siteSearch.value="";
		}
	}
	if (document.Form1.Banner_Tab_nav1_siteSearch)
	{
		if (document.Form1.Banner_Tab_nav1_siteSearch.value=="Site Search"){
			document.Form1.Banner_Tab_nav1_siteSearch.value="";
		}
	}
	
}

// Start Functions for nav
function Highlight(){
   RadTree1.Nodes[0].Highlight(); 
}

function FindNodeByText(text){
 var i;
 for (i=0; i<RadTree1.AllNodes.length; i++)
  if (RadTree1.AllNodes[i].Text == text)
   return RadTree1.AllNodes[i];

 return null;
}

function highlightNode(text){
 var node = FindNodeByText(text);
 if (node != null)
  node.highlight();
}

function swap(imgName, imgPath){
	if (document.images){
		document[imgName].src = "imagesWWW/global/" + imgPath;
	}
}
//End Functions for nav

//Start Functions for QuickLinks
function switchMenu(obj) {
	var elem = document.getElementById(obj);
	if ( elem.style.display != "none" ) {
		elem.style.display = 'none';
		label1QL.style.display='';
		label2QL.style.display='none';
	}
	else {
		elem.style.display = '';
		label1QL.style.display='none';
		label2QL.style.display='';
	}
}

if (document.images) {
    viewoff = new Image();
    viewoff.src  = 'images//QLViewBtnUp.gif';
    viewon = new Image();
    viewon.src = 'images//QLViewBtnDwn.gif';
    hideoff = new Image();
    hideoff.src  = 'images//QLHideBtnUp.gif';
    hideon = new Image();
    hideon.src = 'images//QLHideBtnDwn.gif';
    searchoff = new Image();
    searchoff.src  = 'images//button_go.gif';
    searchon = new Image();
    searchon.src = 'images//button_go_roll.gif';
    
}

function flip (image,switchValue){
    if (document.images)
        document.images[image].src = eval(image + switchValue + ".src");
}
//End Functions for QuickLinks

function GotoURL(f) {  window.location.href = f.picker.options[f.picker.selectedIndex].value;  }

function noEnter() {
	// code for input text box to make this work: onKeyPress="return noEnter()" 
	return !(window.event && window.event.keyCode == 13);
}