// JavaScript Document
function changeHaus(x,id,path) {
	if (!path) {
		path = "";
	}
	
	if (id == "home") {
		if (x == 0) {
			file = path+"images/home.gif";
			document.images[id].src = file;
		} else {
			file = path+"images/home0.gif";
			document.images[id].src = file;			
		}
	}
}

function showdate() {
	var today=new Date();	
	var display_value =" Time: " + today.getHours();	

	if(today.getMinutes() < 10){
		display_value+=":0" + today.getMinutes();
	} else{
		display_value+=":" + today.getMinutes();
	}

	if (today.getSeconds() < 10){
		display_value+=":0" + today.getSeconds();
	} else{
		display_value+=":" + today.getSeconds();
	}

	display_value = "Date: " + (today.getMonth()+1) + "/"  +
	today.getDate() + "/" + today.getYear();
	//document.clock.date_time.value=display_value;
	//timerID=setTimeout("start()",100);
	
	document.write(display_value);
}

function start(){
	var today=new Date();	
	var display_value =" Time: " + today.getHours();	

	if(today.getMinutes() < 10){
		display_value+=":0" + today.getMinutes();
	} else{
		display_value+=":" + today.getMinutes();
	}

	if (today.getSeconds() < 10){
		display_value+=":0" + today.getSeconds();
	} else{
		display_value+=":" + today.getSeconds();
	}

	//if(today.getHours()>=12){
	//	display_value+=" P.M."
	//} else{
	//	display_value+=" A.M."
	//}

	display_value += " Date: " + (today.getMonth()+1) + "/"  +
	today.getDate() + "/" + today.getYear();
	//document.clock.date_time.value=display_value;
	//timerID=setTimeout("start()",100);
	
	document.write(display_value);
}



function changePics(x,id,name) {
	if (id == "bigday") {
		if (x == 0) {
			document.images[id].src = "pics/BigDay/P1010027.jpg";
		} else {
			document.images[id].src = name;			
		}
	} else if (id == "cam") {
		if (x == 0) {
			document.images[id].src = "pics/Cambridge/DSC00347.jpg";
		} else {
			document.images[id].src = name;			
		}	
	}
}

function openindex() {
	OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
	OpenWindow.document.write("<TITLE>Title Goes Here</TITLE>")
	OpenWindow.document.write("<BODY BGCOLOR=pink>")
	OpenWindow.document.write("<h1>Hello!</h1>")
	OpenWindow.document.write("This text will appear in the window!")
	OpenWindow.document.write("</BODY>")
	OpenWindow.document.write("</HTML>")
	
	OpenWindow.document.close()
	self.name="main"
}

function readFromFile(filename) {
	filename = 'test.txt';
	var text = '';
	var filechar;
	netscape.security.PrivilegeManager.enablePrivilege('UniversalFileAccess');
	var file = new java.io.File(filename);
	var FileReader = new java.io.FileReader(file);
	filechar = FileReader.read();
	while (filechar != -1) {
		text = text + String.fromCharCode(filechar);
		filechar = FileReader.read();
	}
	
	document.write(text);
	FileReader.close();
	return text;
}


