function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//preload nav images
MM_preloadImages('/img/nav_on_01_1.png')
MM_preloadImages('/img/nav_on_01_2.png')
MM_preloadImages('/img/nav_on_01_3.png')
MM_preloadImages('/img/nav_on_01_4.png')
MM_preloadImages('/img/nav_on_01_5.png')
MM_preloadImages('/img/nav_on_01_6.png')
MM_preloadImages('/img/nav_on_01_7.png')
MM_preloadImages('/img/nav_on_01_8.png')

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//AJAX include_______________________________________________

function include(xUrl,xId) {

 

  var xmlhttp = false;

 

  /*@cc_on @*/

 

  /*@if (@_jscript_version >= 5)

 

  // JScript gives us Conditional compilation, we can cope with old IE versions.

  // and security blocked creation of the objects.

 

  try {

    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

   } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

   }

 

  /*@end @*/

 

  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {

    xmlhttp = new XMLHttpRequest();

  }

 

  xmlhttp.open("GET", xUrl,true);

  xmlhttp.onreadystatechange=function() {

 

          if (xmlhttp.readyState==4) {

                document.getElementById(xId).innerHTML = xmlhttp.responseText;

          }

  }

  xmlhttp.send(null)

 

}



//dhtml menu_______________________________________________
function positionMenu() {
	hideAllDivs();
	/*
	if (window.innerWidth) { //ff
		var browserWidth = window.innerWidth - 17;
	} else if (document.all) { //ie
		var browserWidth = document.body.clientWidth;
	}
	*/
	var browserWidth = document.documentElement.clientWidth; //ff or ie
	
	var pos = (browserWidth - 946) / 2;
	document.getElementById("hiddenMenu").style.position = "absolute";
	document.getElementById("hiddenMenu").style.top = "145px";
	document.getElementById("hiddenMenu").style.left = pos+"px";
}
window.onresize = positionMenu;

function hideDiv(id) {
	var id = "dropDown_"+id;
	if (document.getElementById) {
		document.getElementById(id).style.display = 'none';
	}
}

function showDiv(id) {	
	var id = "dropDown_"+id;
	hideAllDivs();
	startTimeOut();
	//show menu
	if (document.getElementById) {
		document.getElementById(id).style.display = 'block';
	}
}

function hideAllDivs() {
	//hide all menus
	var i=1
	for (i=1;i<=8;i++) {
		var id = "dropDown_"+i;
		document.getElementById(id).style.display = "none";
	}
}

var timeOut = 0;
function startTimeOut() {
	clearTimeout(timeOut)
	timeOut=setTimeout("hideAllDivs()",2000)
}



//random background image_________________________________________
function randomBG() {

	//var rootDir = "/img/backgrounds/";
	//var rootDir = "/img/backgrounds/";

	//show random background for homepage

	//var images = new Array()
	//images[0] = "gradientimage.jpg"
	//images[1] = "socialRec.jpg"
	//images[2] = "inTheGym.jpg"
	//images[3] = "futureNow.jpg"
	//images[4] = "creativeLab.jpg"
	//images[5] = "techCenter.jpg"
	//images[6] = "communityCenter.jpg"
	//images[7] = "extracurricular.jpg"
	
	//var imageIndex = Math.floor( Math.random()*images.length );

	//show specific background for each channel (8)
	
	//var dirs = new Array();
	//dirs[0] = "/ClubPrograms"
	//dirs[1] = "/SocialRec"
	//dirs[2] = "/InTheGym"
	//dirs[3] = "/FutureNow"
	//dirs[4] = "/CreativeLab"
	//dirs[5] = "/TechCenter"
	//dirs[6] = "/CommunityCenter"
	//dirs[7] = "/Extracurricular"

	//var n = 0;
	//var str = location.pathname;
	//for (n in dirs) {
	//	var searchStr = dirs[n];

		//search for dir in location.path
	//	if ( str.indexOf(searchStr) > -1) {
			//document.write("JK.debug > found "+dirs[n]+" in location.pathname")
	//		imageIndex = n;
	//	}

	//}

    //imageIndex = 0;
        
	//change background image
	//document.body.style.backgroundImage='url(' + rootDir + images[imageIndex]+ ')'
	//document.body.style.backgroundImage='url(' + rootDir + images[0]+ ')'
}



//init_______________________________________________
function init() {
	positionMenu()
}

//Add to favorites link
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}