function swapImage(imgName, imgSrc)
{
	if (document.images)
	{
		document[imgName].src = imgSrc;
	}
}

//var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
//var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

/*if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}*/
var y = 0;
var g = 0;
var q = 9;
var f = 0;
function changeheight(submen,mheight){
 if(y>mheight&&g==0){g=1;return;}
 if(y<1&&g==1){g=0;return;}
 if(g)q=-9;if(!g)q=9;y=y+q;
 var e=document.getElementById(submen);
 e.style.height = y + 'px';
  t=setTimeout('changeheight("'+submen+'",'+mheight+');',0);
}
var h=0;
var s=0;
var x=9;
function changeheight2(submen,mheight){
 if(h>mheight&&s==0){s=1;return;}
 if(h<1&&s==1){s=0;return;}
 if(s)x=-9;if(!s)x=9;h=h+x;
 var e=document.getElementById(submen);
 e.style.height = h + 'px';
  t1=setTimeout('changeheight2("'+submen+'",'+mheight+');',0);
}
function switchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("submenus").getElementsByTagName("div"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			var program = document.getElementById('menuConnectProg');
			var admission = document.getElementById('menuConnectAdmit');
			var facilities = document.getElementById('menuConnectFacilities');
			var sl = document.getElementById('menuConnectSL');
			var contact = document.getElementById('menuConnectContact');
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu")
				{
					if ((program) && (obj != "sub1"))
						program.style.height = 183 +'px';
					else if ((admission) && (obj != "sub1") && (obj != "sub2"))
						admission.style.height = 144 +'px';
					else if ((facilities) && (obj != "sub1") && (obj != "sub2") && (obj != "sub3"))
						facilities.style.height = 177 + 'px';
					else if ((sl) && (obj != "sub1") && (obj != "sub2") && (obj != "sub3") && (obj != "sub4"))
						sl.style.height = 209 + 'px';
					else if ((sl) && (obj != "sub1") && (obj != "sub2") && (obj != "sub3") && (obj != "sub4") && (obj != "sub5"))
						contact.style.height = 241 + 'px';
					ar[i].style.display = "none";
				}
			}
			
			el.style.display = "block";
			var mheight = 0;

			s = 0;
			if (obj == "sub1")
			{
				mheight = 180;
				if (program)
				{
					h = 113;
					changeheight2('menuConnectProg',213);
				}
				else if (admission)
				{
					h = 144;
					changeheight2('menuConnectAdmit',244);
				}
				else if (facilities)
				{
					h = 177;
					changeheight2('menuConnectFacilities',277);
				}
				else if (sl)
				{
					h = 209;
					changeheight2('menuConnectSL',309);
				}
				else if (contact)
				{
					h = 241;
					changeheight2('menuConnectContact',341);
				}
			}
			else if (obj == "sub2")
			{
				mheight = 320;
				if (admission)
				{
					h = 144;
					changeheight2('menuConnectAdmit',276);
				}
				else if (facilities)
				{
					h = 177;
					changeheight2('menuConnectFacilities',307);
				}
				else if (sl)
				{
					h = 209;
					changeheight2('menuConnectSL',339);
				}
				else if (contact)
				{
					h = 241;
					changeheight2('menuConnectContact',371);
				}

			}
			else if (obj == "sub3")
			{
				mheight = 190;
				if (facilities)
				{
					h = 177;
					changeheight2('menuConnectFacilities',307);
				}
				else if (sl)
				{
					h = 209;
					changeheight2('menuConnectSL',339);
				}
				else if (contact)
				{
					h = 241;
					changeheight2('menuConnectContact',371);
				}

			}
			else if (obj == "sub4")
			{
				mheight = 130;
				if (sl)
				{
					h = 209;
					changeheight2('menuConnectSL',309);
				}
				else if (contact)
				{
					h = 241;
					changeheight2('menuConnectContact',341);
				}
			}
			else if (obj == "sub5")
			{
				mheight = 170;
				if (contact)
				{
					h = 241;
					changeheight2('menuConnectContact',361);
				}

			}
			else if (obj == "sub6")
				mheight = 0;
			else if (obj == "sub7")
				mheight = 160;
			else if (obj == "sub8")
				mheight = 120;
			y = 0;
			g = 0;
			changeheight(obj,mheight);
		}//else{
			//el.style.display = "none";
		//}
	}
}

/*function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate

var y = 0;
var g = 0;
var q = 5;
var f = 0;
function changeheight(){
 if(y>70&&g==0){g=1;return;}
 if(y<1&&g==1){g=0;return;}
 if(g)q=-5;if(!g)q=5;y=y+q;
 e=document.getElementById("sub3");
 e.style.display = "block";
 e.style.height = y + 'px';
  t=setTimeout("changeheight();",0);
}*/
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()
/****
Variables to set 
****/

//How do you want the script to work? 
//0 = Fade in - Fade out
//1 = Slide in - Fade out
//2 = Random 
nWorks = 1

//If you use the slide set these variables:
nSlidespeed = 2 //in px
nNewsheight = 10 //This is how long down it should start the slide.

nBetweendelay = 5000 //The delay before fading out.
nFont = 'arial,helvetiva' //The font for the news.
nFontsize = 12 //Font size in pixel.
nFadespeed = 100 //The speed to fade in, in milliseconds.

//Set the colors, first color is same as background, last color is the color it stops at:
//You can have as many colors you want
nColor=new Array('#ffffff','#CCCCCC','#999999','#666666','#333333','#000000')

//This is the news you wanna have, set the link and the text. If you don't wan't it to link anywhere
//use a # as the link
nNews=new Array()
//Copy there three lines and change the info and numbers to get more news.
nNews[0]=new Array()
nNews[0]["text"]="Learning to Understand"
nNews[0]["link"]=""

nNews[1]=new Array()
nNews[1]["text"]="education is the foundation of success ..."
nNews[1]["link"]=""

nNews[2]=new Array()
nNews[2]["text"]="knowledge is power ..."
nNews[2]["link"]=""

nNews[3]=new Array()
nNews[3]["text"]="believe in yourself and you will achieve ..."
nNews[3]["link"]=""

nNews[4]=new Array()
nNews[4]["text"]="future endeavour awaits ..."
nNews[4]["link"]=""

nNews[5]=new Array()
nNews[5]["text"]="education is a journey that never ends ..."
nNews[5]["link"]=""

/********************************************************************************
Object code...Object constructors and functions...
********************************************************************************/
function makeNewsObj(obj,nest,font,size,color,news,fadespeed,betweendelay,slidespeed,works,newsheight){
    nest=(!nest) ? "":'document.'+nest+'.'
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;	
   	this.writeref=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;
	if(font){this.color=new Array(); this.color=eval(color); this.news=new Array(); this.news=eval(news)
		this.font=font; this.size=size; this.speed=fadespeed; this.delay=betweendelay; this.newsheight=newsheight;
		this.fadeIn=b_fadeIn;this.fadeOut=b_fadeOut; this.newsWrite=b_newsWrite; this.y=1
		this.slideIn=b_slideIn; this.moveIt=b_moveIt; this.slideSpeed=slidespeed; this.works=works
		if(bw.dom || bw.ie4){this.css.fontFamily=this.font; this.css.fontSize=this.size; this.css.color=this.color[0]}
	}
	this.obj = obj + "Object"; 	eval(this.obj + "=this"); return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px;}

function b_newsWrite(num,i){
	if (bw.ns4){
		this.writeref.write("<a href=..//%22%22+this.news%5Bnum%5D%5B%27link%27%5D+%22/%22 target=\"myTarget\" style=\"text-decoration:none; font-size:"+this.size+"px\">"
			+"<font face=\""+this.font+"\" color=\""+this.color[i]+"\">"+this.news[num]['text']+"</font></a>")
		this.writeref.close()
	}else this.writeref.innerHTML = '<a id="'+this.obj+'link' +'" target="myTarget"  style="text-decoration:none; font-size:'+this.size+'px; color:'+this.color[i]+'" href="../%27+this.news%5Bnum%5D%5B%27link%27%5D+%27">'+this.news[num]['text']+'</a>'
}
//Slide in
function b_slideIn(num,i){
	if (this.y>0){
		if (i==0){this.moveIt(0,this.newsheight); this.newsWrite(num,this.color.length-1)}
		this.moveIt(this.x,this.y-this.slideSpeed)
		i ++
		setTimeout(this.obj+".slideIn("+num+","+i+");",50)
	}else setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}
//The fade functions
function b_fadeIn(num,i){
	if (i<this.color.length){
		if (i==0 || bw.ns4) this.newsWrite(num,i)
		else{
			obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
			obj.style.color = this.color[i]
		}
		i ++
		setTimeout(this.obj+".fadeIn("+num+","+i+")",this.speed)
	}else setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}

function b_fadeOut(num,i){
	if (i>=0){
		if (i==0 || bw.ns4) this.newsWrite(num,i)	
		else{
			obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
			obj.style.color = this.color[i]
		}
		i --
		setTimeout(this.obj+".fadeOut("+num+","+i+")",this.speed)
	}else{
		num ++
		if(num==this.news.length) num=0
		works = !this.works?0:this.works==1?1:Math.round(Math.random())
		if(works==0) setTimeout(this.obj+".fadeIn("+num+",0)",500)
		else if (works==1){this.y=1; setTimeout(this.obj+".slideIn("+num+",0)",500)
		}
	}
}
/********************************************************************************************
The init function. Calls the object constructor and set some properties and starts the fade
*********************************************************************************************/
function fadeInit(){
	oNews = new makeNewsObj('topMsg','intro',nFont,nFontsize,"nColor","nNews",nFadespeed,nBetweendelay,nSlidespeed,nWorks,nNewsheight)
	oNewsCont = new makeNewsObj('intro')
	works = !oNews.works?0:oNews.works==1?1:Math.round(Math.random())
	if (works==0) oNews.fadeIn(0,0)
	else if (works==1) oNews.slideIn(0,0)
	oNewsCont.css.visibility = "visible"
}
//if(bw.bw) onload = fadeInit
