// javascript for GISNUS

function init () {
	
	document.getElementById('op0').onmouseover = function() {
		flashOver(0);
	}
	document.getElementById('op1').onmouseover = function() {
		flashOver(1);
	}
	document.getElementById('op2').onmouseover = function() {
		flashOver(2);
	}
	document.getElementById('op3').onmouseover = function() {
		flashOver(3);
	}
	document.getElementById('op4').onmouseover = function() {
		flashOver(4);
	}
	document.getElementById('op5').onmouseover = function() {
		flashOver(5);
	}
	document.getElementById('op6').onmouseover = function() {
		flashOver(6);
	}
	
	for (var i=0; i<7; i++) {
		document.getElementById('op'+i).onmouseout = function() {
			flashOut();
		}
	}
	
	document.getElementById('op4_o1').onmouseover = function() {
		this.style.backgroundColor = '#DDDDDD';
		displayDescription(41);
	}
	document.getElementById('op4_o1').onmouseout = function() {
		this.style.backgroundColor = '#999999';
	}
	document.getElementById('op4_o2').onmouseover = function() {
		this.style.backgroundColor = '#DDDDDD';
		displayDescription(42);
	}
	document.getElementById('op4_o2').onmouseout = function() {
		this.style.backgroundColor = '#999999';
	}
	document.getElementById('op5_o1').onmouseover = function() {
		this.style.backgroundColor = '#DDDDDD';
		displayDescription(51);
	}
	document.getElementById('op5_o1').onmouseout = function() {
		this.style.backgroundColor = '#999999';
	}
	
}

function flashOver (ind) {

	document.getElementById('op'+ind).style.color = '#333333';
	document.getElementById('op'+ind).style.backgroundColor = '#FFFFFF';

	if (ind > 3) {
		document.getElementById('op'+ind).style.overflow = 'visible';
	}
	else {
		displayDescription(ind);
	}

}

function flashOut () {
	document.getElementById('darken').style.width = '0px';
	document.getElementById('darken').style.height = '0px';
	for (var i=0;i<7; i++) {
		document.getElementById('op'+i).style.color = '#888888';
		document.getElementById('op'+i).style.backgroundColor = 'transparent';
		document.getElementById('op'+i).style.overflow = 'hidden';
	}
	
	document.getElementById('description').innerHTML = "";
}

function displayDescription(ind) {
	document.getElementById('darken').style.width = '366px';
	document.getElementById('darken').style.height = '400px';
	var content = "";
	if (ind==0) {
		content = "<h1 class=\"desc\">\"Crystal Globe\"</h1> GIS &#183; NUS is built on several Honours Year Projects by students from NUS School of Computing. This site aims to provide planners, policy makers, decision makers, academics and citizen groups valuable insights and knowledge discovery through prediction models and visualization.";
	}
	else if (ind==1) {
		content = "<h1 class=\"desc\">Census Visualizer</h1> Explore demographic information from different sub-zones in Singapore. The data is based on census release by Singapore Department of Statistics (SingStats).";
	}
	else if (ind==2) {
		content = "<h1 class=\"desc\">Electoral District Decision Support</h1> A linear regression is made on census information to forecast election results based on the demographic make up of constituencies in Singapore.";
	}
	else if (ind==3) {
		content = "<h1 class=\"desc\">Bus-Hub Connectivity</h1> Explore the bus connectivity to transport hubs, based on the walking distance to bus stops, bus waiting times and route times. Visualize spatial variations and assess impact of bus service revisions.";
	}
	else if (ind==41) {
		content = "<h1 class=\"desc\">Dental Clinic Locator</h1> A means of estimating an optimal location for opening a new dental clinic in terms of potential demand for dental services. (CS3261 AY2006/07 Sem II project)<br /><br />ID: itm_user<br />Password: itm_password";
	}
	else if (ind==42) {
		content = "<h1 class=\"desc\">Medical Services Locator</h1> A means of estimating an optimal location for opening a new medical clinic in Hougang, Paya Lebar and Woodlands in terms of potential demand for medical services. (CS3261 AY2007/08 Sem II project)<br /><br />ID: admin<br />Password: admin";
	}
	else if (ind==51) {
		content = "<h1 class=\"desc\">Housing Blocks KML</h1> A Zip file containing Google Earth KML files with placemarks of individual housing blocks and medical facilities of various DGP zones in Singapore. The data is collected by students of CS3261 AY2007/08 Sem II (NUS is not responsible for discrepancy or data quality issues).";
	}
	document.getElementById('description').innerHTML = content;
}