// browser detection script for CSS.  (C) Rogier Gruys and David Wolowicz, University of Victoria, 2002-2004
// Version 3.0 May 17, 2004

function setcss(SiteDir,CssName)
{	
 
//test for ie3 ie4
		if ((navigator.userAgent.indexOf('MSIE 4')!=-1) || (navigator.userAgent.indexOf('MSIE 3')!=-1))
		{
			if(navigator.userAgent.indexOf('Win')!=-1 && (navigator.userAgent.indexOf('MSIE 4')!=-1))
			{
				document.write('<link rel="stylesheet" type="text/css" href="' + SiteDir+ 'css/' + CssName + '.css" />')
			}
		}		
		else if ((navigator.userAgent.indexOf('MSIE 6')!=-1) || (navigator.userAgent.indexOf('MSIE 5.5')!=-1) || (navigator.appName=='Opera'))
		{
			document.write('<link rel="stylesheet" type="text/css" href="' + SiteDir+ 'css/' + CssName + '-print.css" media="print" />')
			createdropdown(SiteDir);
		}
 		else
 		{
			 //test for safari
	 		if(navigator.userAgent.indexOf('Safari')!=-1 || navigator.userAgent.indexOf('OmniWeb')!=-1 || navigator.userAgent.indexOf('Camino')!=-1)
	 		{
				document.write('<link rel="stylesheet" type="text/css" href="' + SiteDir+ 'css/' + CssName + '-print.css" media="print" />')
	 			if(navigator.userAgent.indexOf('Safari/12')!=-1)
				{
					createdropdown(SiteDir);
				}
			}
	  
	//test for NS
			else if (navigator.appName=="Netscape")
			{
			//test for NS4
				if (navigator.userAgent.indexOf('Netscape/7.0')!=-1)
				{
					document.write('<link rel="stylesheet" type="text/css" href="' + SiteDir+ 'css/' + CssName + '-print.css" media="print" />')
				}
//NS 6 or higher		
				else if(navigator.userAgent.substring(8,9) == '5')
				{
					document.write('<link rel="stylesheet" type="text/css" href="' + SiteDir+ 'css/' + CssName + '-print.css" media="print" />')
					createdropdown(SiteDir);
				}
				
			}
//IE 5 or higher
 			else
			{
				document.write('<link rel="stylesheet" type="text/css" href="' + SiteDir+ 'css/' + CssName + '-print.css" media="print" />')
		
			}
	
		}

		
}


function createdropdown(SiteDir){
	window.onload= function()
	{		
			menudata=document.getElementById("aud_menu");
			menudata.innerHTML='<ul id="drop_menu"><li>'
								+'<a href="'+SiteDir+'prospect/index.html">&nbsp;&nbsp;Becoming&nbsp;a&nbsp;Student&nbsp;&nbsp;</a>'
									+'<ul>'
										+'<li>'
											+'<a href="'+SiteDir+'prospect/index.html">Getting Started</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'prospect/financial.html">Financial&nbsp;Information</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'students/services.html">Student Services</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'about/facilities.html">Campus Facilities</a>'
										+'</li>'
									+'</ul>'
								+'</li>'
								
								+'<li>'
									+'<a href="'+SiteDir+'students/index.html">&nbsp;&nbsp;Current&nbsp;Students&nbsp;&nbsp;</a>'
									+'<ul>'
										+'<li>'
											+'<a href="'+SiteDir+'students/index.html">Student Resources</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'students/services.html">Student Services</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'students/financial.html">Financial&nbsp;Information</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'about/facilities.html">Campus Facilities</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'workplacelearning/index.html">Co-op and Practica</a>'
										+'</li>'
									+'</ul>'
								+'</li>'
								
								+'<li>'
									+'<a href="'+SiteDir+'staff/index.html">&nbsp;&nbsp;Faculty&nbsp;&amp;&nbsp;Staff&nbsp;&nbsp;</a>'
									+'<ul>'
										+'<li>'
											+'<a href="'+SiteDir+'staff/index.html">Faculty &amp; Staff Resources</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'academic/index.html">Faculties and Departments</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'admin/index.html">Administration and Services</a>'
										+'</li>'
										+'<li><a href="'+SiteDir+'opportunities/">Faculty Opportunities</a></li>'
										+'<li>'
											+'<a href="'+SiteDir+'careers/index.html">Careers at UVic</a>'
										+'</li>'
									+'</ul>'
								+'</li>'
								
								+'<li>'
									+'<a href="'+SiteDir+'alumni-friends/index.html">&nbsp;&nbsp;Alumni&nbsp;&amp;&nbsp;Friends&nbsp;&nbsp;</a>'
									+'<ul>'
									
										+'<li>'
											+'<a href="http://www.uvic.ca/alum">Alumni Home</a>'
										+'</li>'
										+'<li>'
											+'<a href="http://www.uvic.ca/devt">Giving to UVic</a>'
										+'</li>'
										+'<li>'
											+'<a href="'+SiteDir+'about/index.html">Visitor Information</a>'
										+'</li>'
										+'<li>'
											+'<a href="http://www.uvic.ca/events">Events Calendar</a>'
										+'</li>'
									+'</ul>'
								+'</li>'
								+'<li>'
								+'<a>&nbsp;</a>'
								+'</li>'
								+'</ul>';
			
					
			
			
			
			if (document.all&&document.getElementById) {
				navRoot = document.getElementsByName("drop_menu");
				for(j=0; j<navRoot.length; j++)
				{
					
					
					for (i=0; i<navRoot[j].childNodes.length; i++) {
						node = navRoot[j].childNodes[i];
						if (node.nodeName=="LI") {
							node.onmouseover=function() {
								this.className+=" over";
							  }
							node.onmouseout=function() {
  								this.className=this.className.replace(" over", "");
  							}
  						}
  					}
				}
			}


	}
	
	
}







//Popup window function. (C) Rogier Gruys, University of Victoria, 2003
// Version 1.0 July 18, 2003
var newWin = null; 
function popUp(strURL, strType, strWidth, strHeight) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="none") 
   strOptions="resizable,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="menu") 
   strOptions="menubar,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="scroll") 
   strOptions="toolbar,menubar,scrollbars,"+ 
     "resizable,location,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}

//address encoding function. (C) Rogier Gruys and David Wolowicz, University of Victoria, 2004
// Version 2.0 April 20, 2004
function address(one, zero) 
{
	var a = 'ma';
	var b = 'il';
	var c = 'to:';
	document.write('<a href="');
	document.write(a+b+c);
	document.write(zero);
	document.write('&#64;');
	document.write(one);
	document.write('" title="Send E-mail">');
	document.write(zero);
	document.write('&#64;');
	document.write(one+'</a>');
}

function goTo()
{
var s = document.quickList.urlList;
var d = s.options[s.options.selectedIndex].value;
location.href = d;
s.selectedIndex=0;
}



