//alert("function.js is included");

/**
* http://www.library.utoronto.ca/HTMLcourses/DHTML/visible4.html
*/
var DHTML = (document.getElementById || document.all || document.layers);

function getObjById(name)	{ //alert(name);
	  if (document.getElementById)	{    	// DOM level 1 browsers: IE 5+, NN 6+
	  	//alert('get element by id');
	  	this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	  }
	  else if (document.all)	{  			// IE 4
		this.obj = document.all[name];
		this.style = document.all[name].style;
	  }
	  else if (document.layers)  { 			// NN 4
	   	this.obj = document.layers[name];
	   	this.style = document.layers[name];
	  }
	  return this;
}
// http://www.library.utoronto.ca/HTMLcourses/DHTML/visible4.html

var sub_links = new Array(6);
sub_links["Project"] = new Array("Abstract","Applicant Description","Scope of Work");
sub_links["Watershed"] = new Array("Watershed link 1","Watershed link 2","Watershed link 3");
sub_links["Visualization"] = new Array("Visualization link 1","Visualization link 2","Visualization link 3");
sub_links["Assesment"] = new Array("Assesment link 1","Assesment link 2","Assesment link 3");
sub_links["Survey"] = new Array("Survey link 1","Survey link 2","Survey link 3");
sub_links["Communicate"] = new Array("Communicate link 1","Communicate link 2","Communicate link 3");

var sub_links_href = new Array (6);
sub_links_href["Project"] = new Array("abstract.php","applicant_description.php","scope_of_work.php");
sub_links_href["Watershed"] = new Array("#","#","#");
sub_links_href["Visualization"] = new Array("#","#","#");
sub_links_href["Assesment"] = new Array("#","#","#");
sub_links_href["Survey"] = new Array("#","#","#");
sub_links_href["Communicate"] = new Array("#","#","#");

function display_sublinks(main_link) {
	//alert(sub_links[main_link]);

	var linkObj = new getObjById("sub_links");
	//alert(linkObj.obj.innerHTML);
	if(main_link=="project") {
		linkObj.obj.innerHTML = "<span><a href='project_tasks.php' class='blue'>Tasks Overview</a> | " + 
			"<a href='project_team.php' class='blue'>Project Team</a> | " +
			"<a href='planning_committee.php' class='blue'>Planning Committee</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '190px';
		linkObj.style.width = '345px';
	} else if(main_link=="reports") {
		linkObj.obj.innerHTML = "<span><a href='review_reports.php' class='blue'>Review Reports</a> | " +
			"<a href='submit_report.php' class='blue'>Submit Report</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '430px';
		linkObj.style.width = '210px';
	} else if(main_link=="watershed") {
		linkObj.obj.innerHTML = "<span><a href='watershed_problems.php' class='blue'>Problems</a> | " +
			"<a href='watershed_map.php' class='blue'>Map</a> | " +
			"<a href='watershed_data.php' class='blue'>Watershed Data</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '60px';
		linkObj.style.width = '225px';
	} else if(main_link=="pictures") {
		linkObj.obj.innerHTML = "<span><a href='view_pics.php' class='blue'>View Pictures</a> | " +
			"<a href='upload_pics.php' class='blue'>Upload Pictures</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '500px';
		linkObj.style.width = '200px';
	}
}

function display_sublinks_level2(main_link) {
	//alert(sub_links[main_link]);

	var linkObj = new getObjById("sub_links");
	//alert(linkObj.obj.innerHTML);
	if(main_link=="project") {
		linkObj.obj.innerHTML = "<span><a href='../project_tasks.php' class='blue'>Tasks Overview</a> | " +
			"<a href='../project_team.php' class='blue'>Project Team</a> | " +
			"<a href='../planning_committee.php' class='blue'>Planning Committee</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '190px';
		linkObj.style.width = '345px';
	} else if(main_link=="reports") {
		linkObj.obj.innerHTML = "<span><a href='../review_reports.php' class='blue'>Review Reports</a> | " +
			"<a href='../submit_report.php' class='blue'>Submit Report</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '430px';
		linkObj.style.width = '210px';
	} else if(main_link=="watershed") {
		linkObj.obj.innerHTML = "<span><a href='../watershed_problems.php' class='blue'>Problems</a> | " +
			"<a href='../watershed_map.php' class='blue'>Map</a> | " +
			"<a href='../watershed_data.php' class='blue'>Watershed Data</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '60px';
		linkObj.style.width = '225px';
	} else if(main_link=="pictures") {
		linkObj.obj.innerHTML = "<span><a href='../view_pics.php' class='blue'>View Pictures</a> | " +
			"<a href='../upload_pics.php' class='blue'>Upload Pictures</a></span>";
		linkObj.style.visibility = 'visible';
		linkObj.style.left = '500px';
		linkObj.style.width = '200px';
	}
}