function submitenter(myfield,e) {
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   myfield.form.submit();
   return false;
   }
else
   return true;
}

function writelastmodified() {
var lastModos;
var yr;
var mo;
var dy;
var hrs;
var mn;
var lastModos;
var lastMods;
lastMods = document.lastModified.toString();
lastModos = new Date(lastMods);
yr = lastModos.getFullYear();
mo = lastModos.getMonth()+1;
dy = lastModos.getDate();
hrs = lastModos.getHours();
mn = lastModos.getMinutes();
document.write("Last updated:<BR>" + yr+ "/" + mo + "/" + dy+ " at " + hrs +":" +mn +"<BR>by ");
// document.write("<BR>Last updated: <BR>" + document.lastModified + "<BR>by ");
}


// If the platform is Macintosh, use the Macintosh style sheet.
if (navigator.platform.indexOf('Mac') != -1) {
  document.write('<link rel="stylesheet" href="/css/macstyles.css">');
// Otherwise, use the Windows style sheet.
} else if (navigator.platform.indexOf('Win') != -1) {
  document.write('<link rel="stylesheet" href="/css/winstyles.css">');
  // Otherwise, use the other style sheet.
} else{
  document.write('<link rel="stylesheet" href="/css/otherstyles.css">');
}
// *************************************************
// *************************************************

var goodBrowser=false;
var appVer = (navigator.appVersion);
var NS = (navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) >= 3);
var NS4 = (navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) >= 4);
var MSIE = (navigator.appName == 'Microsoft Internet Explorer') && (parseInt(navigator.appVersion) >= 4);
var MACIE = (navigator.appName == 'Microsoft Internet Explorer') && (appVer.indexOf('Macintosh') != -1);
var mp1;
var mp2;
var mp3;
var mp4;
var mp5;
var mp6;
var mp7;
var mp8;

if (NS || MSIE || MACIE) {
 var goodBrowser=true
 var bPic=new Array();
 var rDir="/";
 var iDir=rDir+"images/menus2/";
 for (var i=0;i<=9;i++) 
 bPic[i]=new Image(115,24);
 bPic[0].src=iDir+"acad.gif";
 bPic[1].src=iDir+"acad0.gif";
 bPic[2].src=iDir+"admin.gif";
 bPic[3].src=iDir+"admin0.gif";
 bPic[4].src=iDir+"campus.gif";
 bPic[5].src=iDir+"campus0.gif";
 bPic[6].src=iDir+"visite.gif";
 bPic[7].src=iDir+"visite0.gif";
 bPic[8].src=iDir+"news.gif";
 bPic[9].src=iDir+"news0.gif";
 bPic[10]=new Image(294,10);
 bPic[11]=new Image(294,10);
 bPic[10].src=iDir+"carreblanc.gif";
 bPic[11].src=iDir+"carreblanc.gif";

 var bTxt=new Array();
 for (var t=0;t<=5;t++)
 bTxt[t]=new Image(179,126);
 bTxt[0].src=iDir+"acadtxt.gif";
 bTxt[1].src=iDir+"admintxt.gif";
 bTxt[2].src=iDir+"campustxt.gif";
 bTxt[3].src=iDir+"visitetxt.gif";
 bTxt[4].src=iDir+"newstxt.gif";
 bTxt[5].src=iDir+"bluetxt.gif";
}

function LiteButton(which, mouseOver) {
 var text;
 var gr;
 var txt;
 var lc0='location=\"';
 var lc='location=\"/';
 var lc2='location=\"http://vtls.etatfr.ch/';
 var lc3='location=\"http://www.etatfr.ch/';
 var lc4='location=\"http://www.rero.ch/';
 var lc5='location=\"http://www.snl.ch/';
 var lc6='location=\"emplois.html';
 var lc7='location=\"http://www.annuaire.ch/';
 var lc8='location=\"http://webx500.switch.ch:8888/';
 var lc9='location=\"http://switchetv.switch.ch/';
 var lc10='location=\"http://www.search.ch/';
 var lc11='location=\"http://www.switch.ch/';
 var lc12='location=\"http://rero-catalog.rero.ch/';
 if (!goodBrowser)
 return false;
 if (which==0) {
 gr=document.acad;
 txt=document.tx;
 text="Academics Departments Teaching Research "+rDir+"";
 if (NS4 || MSIE || MACIE) {
 mp1=lc+'main/facultes\"';
 mp2=lc+'main/lehre.html"';
 mp3=lc+'main/recherche.html"';
 mp4=lc+'main/formcont.html"';
 mp5=lc+'uninet\"';
 mp6='';
 mp7=mp6
 mp8=mp6;
 
 }
 } else if (which==1) {
 gr=document.admin;
 txt=document.tx;
 text="Administration  "+rDir+"";
 if (NS4 || MSIE || MACIE) {
 mp1=lc+'main/services_centraux.html"';
 mp2=lc+'annuaire\"';
 mp3=lc+'main/calendrier\"';
 mp4=lc+'rectorat/reglements\"';
 mp5='';
 mp6=mp5
 mp7=mp5
 mp8=mp5
 }
 }  else if (which==2) {
 gr=document.campus;
 txt=document.tx;
 text="Campus  "+rDir+"";
 if (NS4 || MSIE || MACIE) {
 mp1=lc+'main/prof.html\"';
 mp2=lc+'main/collab_scient.html\"';
 mp3=lc+'main/etudiant\"';
 mp4=lc+'apu\"';
 mp5=lc+'main/alumni.html\"';
 mp6=lc+'main/bibliotheque.html\"';
 mp7=lc+'main/sport.html\"';
 mp8=lc+'mensa\"';
 }
 } else if (which==3) {
 gr=document.visite;
 txt=document.tx;
 text="Visitor\'s Center  "+rDir+"";
 if (NS4 || MSIE || MACIE) {
 mp1='';
 mp2=mp1
 mp3=mp1
 mp4=mp1
 mp5=lc+'unibref\"';
 mp6=lc+'map\"';
 mp7=lc+'main/link"';
 mp8=mp1
 }
 } else if (which==4) {
 gr=document.news;
 txt=document.tx;
 text="N E W S + E V E N T S  "+rDir+"/spc";
 if (NS4 || MSIE || MACIE) {
 mp1='';
 mp2=mp1
 mp3=mp1
 mp4=mp1
 mp5=lc+'spc/comm_press\"';
 mp6=lc+'memento\"';
 mp7=lc+'spc/spc_folder/media.html"';
 mp8=lc+'main/eventsF.html"';
 }
 } else if (which==5) {
 gr=document.bottomlineos;
 txt=document.tx;
 text="vide";
 if (NS4 || MSIE || MACIE) {
 mp1='';
 mp2=mp1
 mp3=mp1
 mp4=mp1
 mp5=mp1
 mp6=mp1
 mp7=mp1
 mp8=mp1
 }
 }
else return false;

// gr=document.news; 4
// txt=document.tx;     := image map
// text="N E W S + E V E N T S  "+rDir+"/spc";
// <a href="news_eventsF.html" onMouseOver="if (LiteButton(4, 1)) return true;" onMouseOut="if (LiteButton(4, 0)) return true;"><img src="images/newsF.gif" width=189 height=24 border=0 align=bottom name=news></a> 

 gr.src=bPic[2 * which + mouseOver].src;
 txt.src=bTxt[which].src;
 window.status=mouseOver ? text : "";
 return true;
 }

// *************************************************
// *************************************************
// *************************************************

function setCookie(name, value, expire) {
document.cookie = name + "=" + escape(value)
+ ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}

function register(name) {
var today = new Date()
var expires = new Date()
// expires.setTime(today.getTime() + 1000*60*60*24*365)
setCookie("wwwunifrchMAP", name, expires)
}

function setCookie4thisPageNum (pageNumId) {
var today = new Date()
var expires = new Date()
expires.setTime(today.getTime() + 1000*60*10)  // ten minutes
var search = "wwwUnifrChPageNum="
if (document.cookie.length > 0) { // if there are any cookies
	offset = document.cookie.indexOf(search)
	if (offset != -1) { // if cookie exists
		offset += search.length
		// set index of beginning of value
		end = document.cookie.indexOf(";", offset)
		// set index of end of cookie value
		if (end == -1)
		end = document.cookie.length
		valueos = unescape(document.cookie.substring(offset, end))
		offsetos = valueos.indexOf(pageNumId)
			if (offsetos != -1) { 
			// this page has already been visited today			
			}
			else { // add this page numid to cookie value
			valueos += pageNumId + ",";
			document.cookie = "wwwUnifrChPageNum=" + valueos + "; expires=" + expires.toGMTString() +";path=/;";
			// document.cookie = "wwwUnifrChPageNum=" + valueos + ";path=/;";
			}
    		}
    	else 	{ // cookie wwwUnifrChPageNum does not exist yet    			
		 document.cookie = "wwwUnifrChPageNum=" + pageNumId + ",; expires=" + expires.toGMTString() +";path=/;";
		 // document.cookie = "wwwUnifrChPageNum=" + pageNumId + ",;path=/;";
    		}
  	}
  else 	{ // if there are no cookies
          document.cookie = "wwwUnifrChPageNum=" + ";path=/;";
  	}	
	
}	

// **************************************************************
function hereIam(hereWeAre) {
	var findos = "hic=";
	var valueos = " ";
	var offset1 = document.location.toString();
	var back2os = document.referrer;
	var offset2 = offset1.indexOf(findos);
	if (offset2 != -1) {
		offset2 += findos.length
		var endos = offset1.length
		valueos = unescape(offset1.substring(offset2, endos));
		if (valueos == hereWeAre) {
		document.write('<img src="images/lepointRouge.gif" width="9" height="10" align="baseline">[<a href="'+back2os+'">here</a>]');  		
 		}
 		else {
 		    chk4Page(hereWeAre);
 		}
   	}
   	else {
 		    chk4Page(hereWeAre);
 		}


}

function chk4Page (pageNumId) { 
	var search = "wwwUnifrChPageNum=";
	if (document.cookie.length > 0) { // if there are any cookies
	offset = document.cookie.indexOf(search)
		if (offset != -1) { // if cookie exists
		offset += search.length
		// set index of beginning of value
		end = document.cookie.indexOf(";", offset)
		// set index of end of cookie value
		if (end == -1)
		end = document.cookie.length
		valueos = unescape(document.cookie.substring(offset, end))
		offsetos =  valueos.indexOf(pageNumId);
	if (offsetos != -1) {
	// page has been visited today
	document.write('<img src="images/lepointBleu.gif" width="9" height="10" align="baseline">');
	}
	else {
	// document.write("This page: " + pageNumId + " has not been visited yet.");
	}
     }
   }
}



function getCookie(Name) {
var search = Name + "="
if (document.cookie.length > 0) { // if there are any cookies
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset)
// set index of end of cookie value
if (end == -1)
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
     }
   }
}
