	///////////////////
	//   Variables   // 
	///////////////////
    var agt=navigator.userAgent.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
	var isFX=(navigator.userAgent.indexOf("Firefox")  != -1);
	var isNS=(navigator.userAgent.indexOf("Netscape") != -1);
    var isSafari = (navigator.userAgent.indexOf("Safari") != -1);
	var isIE=((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var isIE5 = (isIE && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1));
	var isIE55= (isIE && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1));
    var isIE6 = (isIE && (is_major == 4) && (agt.indexOf("msie 6.") !=-1));
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_mac    = (agt.indexOf("mac")!=-1);
	var preloadFlag=true;
	var separator=((document.URL.toString().toLowerCase().indexOf("file")==0)? String.fromCharCode(92): "/" );
	for (i=document.URL.length-1;i>=0;i--) {
		if ((document.URL.charAt(i)==String.fromCharCode(92))||(document.URL.charAt(i)=="/")) {separator=document.URL.charAt(i);break;}
	}
	///////////////////
	//   String    //
	///////////////////
	function processForAlert(aText){
		var res="";
		for (var i=0;i<aText.length;i++){
			if (aText.charAt(i)=='"'){
				res=res+" ";
			}else if (aText.charAt(i)=="'"){
				res=res+" ";
			}else{
				res=res+aText.charAt(i);
			}
		}
		return res;
	}
	///////////////////
	//   Language    //
	///////////////////
//	function changeLanguage(aLang){
//		document.the_form.lng.value=aLang;
//		goToPage(document.location);
//	}
	///////////////////
	//   Navigation  //
	///////////////////
	function goToPage(){
//		var go=false;
//		if (validation==true){
//			if (confirm("Voulez-vous quitter cette page sans validation?")){
//				go=true;
//			}
//		}else{
//			go=true;
//		}
//		if (go){
			newURL=goToPage.arguments[0];
			if (newURL!='') document.location=newURL;
//		}
	}
	///////////////////
	//    Images     //
	///////////////////
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}
	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];
			}
		}
	}
	///////////////////
	//    Layers     //
	///////////////////
	function showLayer(aLayerName){
		for (var i=0; i<showLayer.arguments.length; i++) {
			e=document.getElementById(showLayer.arguments[i]);
			if (e) e.style.display="block";
		}
	}
	function hideLayer(aLayerName){
		for (var i=0; i<hideLayer.arguments.length; i++) {
			e=document.getElementById(hideLayer.arguments[i]);
			if (e) e.style.display="none";
		}
	}
	function showHideLayer(name){
		aName=name+selected_group.toString();
		if (document.layers){
			var path="document["+aName+"].display"}
		else{
			var path=document.all? "document.all."+aName+".style.display" :"document.getElementById('"+aName+"').style.display"
		}
		var currstate=eval(path)
		if (currstate=="none"){eval(path+"='block'");}else{eval(path+"='none'");}
	}
	function makeVisible(aLayerName){
		for (var i=0; i<makeVisible.arguments.length; i++) {
			e=document.getElementById(makeVisible.arguments[i]);
			if (e) e.style.visibility="visible";
		}
	}
	function makeInvisible(aLayerName){
		for (var i=0; i<makeInvisible.arguments.length; i++) {
			e=document.getElementById(makeInvisible.arguments[i]);
			if (e) e.style.visibility="hidden";
		}
	}
	///////////////////
	function writeButton(aLink,text,aWidth){
		document.write('<table border="0" cellspacing="0" cellpadding="4">');
		document.write('<tr><td class="admin_buttonOff" onMouseOver="className=\'admin_buttonOn\';" ');
		if (aWidth!=null) document.write(' width="'+aWidth+'" ');
		document.write('onMouseOut="className=\'admin_buttonOff\';"');
		if (navigator.userAgent.indexOf("Safari")==-1) {
			document.write(' onClick="document.location=\'');
			document.write(aLink+'\'"');
		}
		document.write(' nowrap>');
		if (navigator.userAgent.indexOf("Safari")==-1) {
			document.write('<a href="#" class="admin_button">'+text+'</a>');
		}
		else {
			document.write('<a href="../../JS/'+aLink+'" class="admin_button">'+text+'</a>');
		}
		document.write('</td></tr></table>');
	}
	function writeFunctionButton(aFunctionLink,text,aWidth){
		document.write('<table border="0" cellspacing="0" cellpadding="4">');
		document.write('<tr><td class="admin_buttonOff" onMouseOver="className=\'admin_buttonOn\';" ');
		if (aWidth!=null) document.write(' width="'+aWidth+'" ');
		document.write('onMouseOut="className=\'admin_buttonOff\';" ');
		if (navigator.userAgent.indexOf("Safari")==-1) {
			document.write('onClick="'+aFunctionLink+'" ');
		}
		document.write('nowrap>');
		//document.write('<a href="javascript:'+aFunctionLink+';" class="button">'+text+'</a>');
		if (navigator.userAgent.indexOf("Safari")==-1) {
			document.write('<a href="javascript:'+aFunctionLink+'" ');
		}
		else {
			document.write('<a href="#" ');
		}
		document.write(' class="admin_button">'+text+'</a>');
		document.write('</td></tr></table>');
	}
	function writeEmail(aName,aDomain){
		document.write("<a href='mailto:"+aName);
		document.write("@");
		document.write(aDomain+"'>");
		document.write(aName);
		document.write("@");
		document.write(aDomain);
		document.write("</a>");
	}
	///////////////////
	//    Table      //
	///////////////////
	function writeCellColor(aUserID){
		document.write("#FFFFFF");
	}
	function openHelpWindow(aFile){
		helpWin=window.open(aFile,"helpWin","width=400 + height=400,status=no,resizable=no,toolbar=no,location=no,scrollbars=no,left=10,top=10");
	}
	///////////////////
	//    Maths      //
	///////////////////
	function Mod(a, b) { 
		return a-Math.floor(a/b)*b;
	} 
	function isEvenNumber(x) { 
		return (Mod(x,2)==0);
	} 
	function isOddNumber(x) { 
		return (Mod(x,2)==1);
	} 
	///////////////////
	//     Date      //
	///////////////////
	function displayHours(){
		var now = new Date();
		var hours= now.getHours();
		var minutes= now.getMinutes();
		var seconds= now.getSeconds();
		var months= now.getMonth();
		var dates= now.getDate();
		var years= now.getYear();
		var timeValue = ""
		timeValue += ((months >9) ? "" : " ")
		timeValue += ((dates >9) ? "" : " ")
		timeValue = ( months +1)
		timeValue +="/"+ dates
		timeValue +="/"+  years
		var ap="A.M."
		if (hours == 12) {ap = "P.M."}
		if (hours == 0) {hours = 12;}
		if(hours >= 13){
			hours -= 12;
			ap="P.M."
		}
		var timeValue2 = " " + hours
		timeValue2 += ((minutes < 10) ? ":0":":") + minutes + " " + ap
		return timeValue2;
	}
	function MakeArray(n) {
		this.length = n
		return this
	}
	monthNames = new MakeArray(12);
	monthNames[1] = "January";
	monthNames[2] = "February";
	monthNames[3] = "March";
	monthNames[4] = "April";
	monthNames[5] = "May";
	monthNames[6] = "June";
	monthNames[7] = "July";
	monthNames[8] = "August";
	monthNames[9] = "Sept.";
	monthNames[10] = "Oct.";
	monthNames[11] = "Nov.";
	monthNames[12] = "Dec.";
	daysNames = new MakeArray(7)
	daysNames[1] = "Sunday";
	daysNames[2] = "Monday";
	daysNames[3] = "Tuesday";
	daysNames[4] = "Wednesday";
	daysNames[5] = "Thursday";
	daysNames[6] = "Friday";
	daysNames[7] = "Saturday";
	function writeDate() {
		var now = new Date();
		var theDay = daysNames[now.getDay() +1]
		var theDate =now.getDate()
		var theMonth = monthNames[now.getMonth() +1]
		var theYear= now.getFullYear();
		var dayth="th";
		if ((theDate == 1) || (theDate == 21) || (theDate == 31)) {dayth="st";}
		if ((theDate == 2) || (theDate ==22)) 	{dayth="nd";}
		if ((theDate== 3) || (theDate  == 23)) 	{dayth="rd";}
		document.write( theDay + " " + theDate + dayth + " of " + theMonth + " " + theYear);
	}
	///////////////////
	//   Cookies     //
	///////////////////
	function setCookie(aName,aVal) {
		createCookie(aName,aVal,1);
	}
	function createCookie(aName,aVal,days) {
		if (getCookieCount()<20) {
			var date = new Date();
			date.setTime(date.getTime()+(24*60*60*1000*days)); // 1 day
			var expires = "; expires="+date.toGMTString();
			document.cookie = "Des_playlists_"+aName+"="+aVal+expires+"; path=/";
		}
		else {alert("You have reach the limit of 20 cookies.");}
	}
	function getCookie(aName) {
		var myCookies = document.cookie.split(';');
		for (var i=0;i < myCookies.length;i++)
		{
			myCookieArray=myCookies[i].split("=");
			myFullName=myCookieArray[0];
			while (myFullName.charAt(0)==' ') myFullName = myFullName.substring(1,myFullName.length);
			if (myFullName.indexOf("Des_playlists_"+aName)!=-1) {
				return myCookieArray[1];
			}
		}
		return null;
	}
	function getCookieCount() {
		return document.cookie.split(';').length;
	}
	function eraseCookie(name){
		myCookie=getCookie();
		if (myCookie!=null) {
			myCookieNameIndex=myCookie.indexOf(name);
			if (myCookieNameIndex!=-1) {
				// the subCookie exists
				part1=myCookie.substring(0,myCookieNameIndex);
				indexPart2=myCookie.indexOf("_",myCookieNameIndex)+1;
				part2=myCookie.substring(indexPart2,myCookie.length);
				setCookie(part1+part2);			
			}
		}
	}
	function eraseAllCookies() {
		createCookie("@",1);
	}
	///////////////////
	// Query Strings //
	///////////////////
	function queryString(qs) {
	// optionally pass a querystring to parse		this.params = new Object();
		this.get=queryString_get;
		if (qs == null) qs=location.search.substring(1,location.search.length);
		if (qs.length == 0) return;
		qs = qs.replace(/\+/g, ' ');
		var args = qs.split('&');
		for (var i=0;i<args.length;i++)
		{
			var pair = args[i].split('=');
			name = unescape(pair[0]);
			var value;
			if (pair.length == 2)	value = unescape(pair[1]);
			else					value = name;
			this.params[name] = value;
		}
	}
	function queryString_get(key, default_) {
		default_="";
		if (default_ == null) default_ = "";// changes UNDEFINED to NULL
		var value=this.params[key];
		if (value==null){value=default_;}
		return value;
	}
	function PageQuery(q) {
		if(q.length > 1) this.q = q.substring(1, q.length);
		else this.q = null;
		this.keyValuePairs = new Array();
		if(q) {
			for(var i=0; i < this.q.split("&").length; i++) {
				this.keyValuePairs[i] = this.q.split("&")[i];
			}
		}
		this.getKeyValuePairs = function() { return this.keyValuePairs; }
		this.getValue = function(s) {
			for(var j=0; j < this.keyValuePairs.length; j++) {
				if(this.keyValuePairs[j].split("=")[0] == s)
					return this.keyValuePairs[j].split("=")[1];
			}
			return -1;
		}
		this.getParameters = function() {
			var a = new Array(this.getLength());
			for(var j=0; j < this.keyValuePairs.length; j++) {
				a[j] = this.keyValuePairs[j].split("=")[0];
			}
			return a;
		}
		this.getLength = function() { return this.keyValuePairs.length; }	
	}
	/////////////////////////////////////////////////////////
	//
	//				 DRAGGABLE POP-UP WINDOWS
	//
	/////////////////////////////////////////////////////////
	isIE=document.all;
	isHot=false;
	function ddInit(e){
//	  topDog=isIE ? "BODY" : "HTML";
//	  whichDog=isIE ? document.all.toolWin : document.getElementById("toolWin");  
//	  hotDog=isIE ? event.srcElement : e.target;  
//	  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
//		hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
//	  }  
//	  if (hotDog.id=="titleBar"){
//		offsetx=isIE ? event.clientX : e.clientX;
//		offsety=isIE ? event.clientY : e.clientY;
//		nowX=parseInt(whichDog.style.left);
//		nowY=parseInt(whichDog.style.top);
//		ddEnabled=true;
//		document.onmousemove=dd;
//	  }
//	  while (hotDog.id!="header"&&hotDog.tagName!=topDog){
//		hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
//	  }  
//	  if (hotDog.id=="header"){
//		offsetx=isIE ? event.clientX : e.clientX;
//		offsety=isIE ? event.clientY : e.clientY;
//		nowX=parseInt(whichDog.style.left);
//		nowY=parseInt(whichDog.style.top);
//		ddEnabled=true;
//		document.onmousemove=dd;
//	  }
	}
	function dd(e){
//	  if (!ddEnabled) return;
//	  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
//	  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
	  return false;  
	}
	function hideMe(){
	  whichDog.style.visibility="hidden";
	}
	function showMe(){
	  whichDog.style.visibility="visible";
	}
	document.onmousedown=ddInit;
	document.onmouseup=Function("ddEnabled=false");
	//	isIE=document.all;
	//	isHot=false;
	//	function ddInit(e){}
	//	function dd(e){
	//	  if (!ddEnabled) return;
	//	  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
	//	  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
	//	  return false;  
	//	}
	//	function hideMe(){
	//	  whichDog.style.visibility="hidden";
	//	}
	//	function showMe(){
	//	  whichDog.style.visibility="visible";
	//	}
	//	document.onmousedown=ddInit;
	//	document.onmouseup=Function("ddEnabled=false");
	/////////////////////////////////////////////////////////
	//
	//                 FLASH
	//
	/////////////////////////////////////////////////////////
//	function stopIndexSound() {
//		if (courseName!="Business Principles"){ // hack for Business Principles
//			window.document.audioControls.SetVariable("soundVar","off");
//		}
//		setCookie("mainSound","off");
//		//alert("(stopIndexSound) indexSound="+getCookie("mainSound"));
//	}
//	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
//	
//	function audioControls_DoFSCommand(command, args) {
//		var myFlashObj = InternetExplorer? audioControls : document.audioControls;
//		setCookie(command, args);
//		//refresfIndex();
//	}
//	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 &&
//		navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
//		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
//		document.write('on error resume next \n');
//		document.write('Sub audioControls_FSCommand(ByVal command, ByVal args)\n');
//		document.write(' call audioControls_DoFSCommand(command, args)\n');
//		document.write('end sub\n');
//		document.write('</SCRIPT\> \n');
//	}
	
