/**************************************************************************
 *             This code written by                                         *
 *              	    ------ Chris Concannon -----                *  
 *                           If you can use it.... HAVE AT :)             *
 **************************************************************************/

function stopError() {
  return true;
}

 window.onerror = stopError;

 if(window != top)
  top.location.href = location.href;

 var badBrowser = true, UA = window.navigator.userAgent; AN = window.navigator.appName;
 var IE = false, NS = false, NS6 = false;
 var layerRef, styleRef;
 var allLoaded = false;
 var ieMac = false;

// This will determine what browser is being used


	if(document.layers)
		NS = true;
	else if(document.all)
		IE = true;
	else if(document.getElementById)
		NS6 = true;

	

// This is where determination of access lives

	if ((AN.indexOf("Netscape") >= 0) && (UA.indexOf("Mozilla/4") >= 0))
		badBrowser = false;
	if ((AN.indexOf("Explorer") >= 0) && (UA.indexOf("Mozilla/4") >= 0))
		badBrowser = false;
	if ((AN.indexOf("Netscape") >= 0) && (UA.indexOf("Mozilla/5") >= 0))
		badBrowser = false;
	if ((AN.indexOf("Explorer") >= 0) && (UA.indexOf("Mozilla/5") >= 0))
		badBrowser = false;
	if ((AN.indexOf("Netscape") >= 0) && (UA.indexOf("Mozilla/6") >= 0))
		badBrowser = false;
	if ((AN.indexOf("Explorer") >= 0) && (UA.indexOf("Mozilla/6") >= 0))
		badBrowser = false;




		
// If browser is not 4.0 or up then send the browser for update or to the ADA site.

	// if (badBrowser)
	// 	document.location ='/update.html';


// Another function that swaps layers. Not used much. It just calls the other functions 
// swapping the layers from an image to info. Might even drop it all together

	function layerSwap(l1,l2,t)
	{
		if(t == 1)
		{	
			hideMenu(l1,'');
			showMenu(l2,'');
		}
		else
		{
			showMenu(l1,'');
			hideMenu(l2,'');
		}
	}


// This is where a image gets randomly picked

	function imageSwap(dep)
	{
		var daImage = "/images/rotate/" + dep + "[" + parseInt(Math.random() * 8) + "]" + ".gif";
		document.main.src=daImage	
	}

// This will determine layer vars. NS6 is not needed to be set but oh well

	if (NS) 
	{
		layerRef = "document.layers";
	        styleRef = "";
	} 
	else if (IE) 
	{
		layerRef = "document.all";
	        styleRef = ".style";
	}
	else if(NS6)
	{
		layerRef = "document.getElementById"
		styleRef = ".style";
	}

// This is where the layers are set to visible

	function showMenu(myLayer,Location)
	{
		checkLoad(myLayer)
		if(allLoaded)
			if(!NS6)
			{
				if(myLayer)
					eval(layerRef + '["'+myLayer+'"]' + styleRef + '.visibility ="visible";');
			}	
			else
				eval(layerRef + '("'+myLayer+'")' + styleRef + '.visibility ="visible";');

	}

// This is where the layers are set to hidden
	function hideMenu(myLayer)
	{
		checkLoad(myLayer)
		
		if(allLoaded)
		{
			if(myLayer != "false")
			{
				if(myLayer)
				{
					if(!NS6)
						eval(layerRef + '["'+myLayer+'"]' + styleRef + '.visibility = "hidden";');
					else
						eval(layerRef + '("'+myLayer+'")' + styleRef + '.visibility = "hidden";');
				}
			}			
		}
	}
// This determins if a layer has been loaded yet
	
	function checkLoad(myLayer)
	{
		focus();
		if (NS)
		{
	        	if (typeof(document.layers[myLayer]) != "undefined")
				allLoaded=true;
		}
		else if(IE)
		{
			if (typeof(document.all[myLayer]) != "undefined")
				allLoaded=true;
		}
		else if(NS6)
		{
			if(typeof(document.getElementById) != "undefined")
				allLoaded=true;
		}
		else
			allLoaded=false;
	}
	function swapImage(n,t)
	{
		if(t == 1)
			eval("document.img" + n + ".src='/images/' + (n%6) + '_over.gif'");
	   	else if(t == 2)
			eval("document.img" + n + ".src='/images/' + (n%6) + '.gif'");
	}

 // Show/hide nav layers
 	function setSection(s,h)
 	{
	  	if(s == "00")
	   		showMenu("extraLinks")
	  	else
	   		hideMenu("extraLinks")
	  	var sm=("section" + s)
	  	var hm=("section" + h)
	
	  	showMenu(sm);
	  	hideMenu(hm);
 	}
 

/* This is where arrow is placed and then calls showMenu for visibility (not used)

	function showArrow(post, posl, myLayer) 
	{
		checkLoad("arrow")
		if(allLoaded)
		{	
			focus();
			if(!NS6)
			{
				eval(layerRef + '.arrow' + styleRef + '.top =' + 'post');
				eval(layerRef + '.arrow' + styleRef + '.left =' + 'posl');
			}
			else
			{
				document.getElementById('arrow').style.top = post;		
				document.getElementById('arrow').style.left= posl;
			}
			showMenu('arrow',"true");
			if(myLayer != "false")
				showMenu(myLayer,"true");
		}
	}
	
*/
	
// Message box alerting users of hours for on-line services
// Deprecated
/*
		function hours()
		{
		        var currentTime = new Date()
        		var pm = "am"
        		currentTime = currentTime.toUTCString()
        		var bla = currentTime.split(" ")
        		var temp = bla[4].substr(0,2)


		        if(temp > 8)
        		        temp -= 8
        		else if(temp == 8)
        		        temp = 24
        		else
                		temp = 24 - (8 - temp)
        		if(temp > 12)
        		{
                		temp -= 12
                		if(temp != 12)
                        		pm = "pm"
        		}
        		else if(temp == 12)
                		pm = "pm"


		        alert("On-line Services are available:\n" +
		              "* Monday-Thursday 7:00am - 7:30pm\n" +
		              "* Friday 7:00am - 5:30pm \n================================= \n\n" +
		              "You will receive a Server Busy Error when On-line Services are closed!\n\n" +
		              "Time at Clark College --- " + bla[0] + " " + temp + bla[4].substr(2,3) + pm)

		}	
*/	
/**********************************************************************************************************	
* Trap for mouse movement (Not used)
**************************
		var inMenu=false
		var NS6=false;
		var browser = AN + " " + navigator.appVersion;
		browser = browser.toUpperCase();
		var minX, maxX, minY, maxY;
		var menu="";
		var menuSet=false
		var x,y
		var ho,dd,pmenu,pho,pdd
		checkLoad("arrow");
		
		if((browser.indexOf("NETSCAPE") >= 0) && (parseInt(navigator.appVersion) >= 5))
		{
			NS6 = true;
		}

		if (document.layers || NS6)
		{
			document.captureEvents(Event.MOUSEMOVE | Event.MOUSEDOWN | Event.MOUSEUP );
		}
		if(document.getElementById &&! document.all)
		{
			
		}

		document.onmousemove=mouseMove;
		
		function checkIt()
		{
			if(y >= 70 && x > 194 && y < 90 && x < 324)
			{
			// alert(menu)
				menu="HowToEnroll"
				menuSet=true
			}

			if(y >= 70 && x > 331 && y < 90 && x < 461)
			{
			// alert(menu)
				menu="MajorsAndPrograms"
				menuSet=true
			}
			if(y >= 70 && x > 468 && y < 90 && x < 608)
			{
			// alert(menu)
				menu="GeneralInformation"
				menuSet=true
			}
			if(y >= 70 && x > 605 && y < 90 && x < 755)
			{
			// alert(menu)
				menu="StudentServices"
				menuSet=true
			}
		 	
		 	menuSelect()
		 }
		   
		
		function menuSelect()
		{
			if(menuSet)
			{
				switch(menu)
				{
					case "HowToEnroll":
						dd="ddHowToEnroll";
						ho="hoHowToEnroll";
						minX=194
						maxX=310
						minY=70
						maxY=253
						break;
						
					case "MajorsAndPrograms":
						dd="ddMajorsAndPrograms"
						ho="hoMajorsAndPrograms"
						minX=331
						maxX=450
						minY=70
						maxY=233
						break;
					case "GeneralInformation":
						dd="ddGeneralInformation"
						ho="hoGeneralInformation"
						minX=468
						maxX=590
						minY=70
						maxY=280
						break;
					case "StudentServices":
						dd="ddStudentServices"
						ho="hoStudentServices"					
						minX=605
						maxX=755
						minY=70
						maxY=192
						break;
				}
				
				menuOperation()
			}
			
			
		}
		
		function menuOperation()
		{	
				if(y > minY && x > minX && y < maxY && x < maxX)
				{
					
					if(!inMenu)
					{
						if(menu != "")
							openMenu()	
					}
				
				}
				
				else
				{
				
					if(!(y > minY && x > minX && y < maxY && x < maxX))
					{
						if(menu != "")
							closeMenu()

					}

				}									
		}

		function openMenu()
		{
			
			inMenu=true
			hideMenu(menu)
			showMenu(ho)
			showMenu(dd)
			pmenu=menu
			pdd=dd
			pho=ho
		
		}
		function closeMenu()
		{
			hideMenu(pho)
			showMenu(pmenu)
			hideMenu(pdd)
			inMenu=false
			menuSet=false
		}
		
		function mouseMove(e)
		{
			if (document.layers || NS6)
			{
				x = e.pageX
				y = e.pageY
				
				checkIt()
			
			}

			if (document.all)
			{

				x = event.x + document.body.scrollLeft
				y = event.y + document.body.scrollTop
				checkIt()
			}


		}
************************************************************/
