function writeHeader() {

var pathPrefix, tempPath, out, hostName;
// set the name of the server hosting the site
pathPrefix = '';
tempPath = window.location.pathname;

if( window.location.hostname.indexOf('web.mala.bc.ca') != -1)
{
	pathPrefix += 'http://www.mala.bc.ca/';
}

else {
	// remove anything before \Homeroom\
	tempPath = tempPath.substring(tempPath.indexOf('/homeroom/')+1, tempPath.length);

	do {
		pathPrefix += '../';
		tempPath = tempPath.substring(tempPath.indexOf('/')+1, tempPath.length);
	} while( tempPath.indexOf('/') != -1 );
}

pathPrefix += 'Homeroom/';

out = '<table width=\"100%\" style=\"margin-bottom: 0px; margin-top: 0px; padding-top: 0px;\">\n';
out += '<tr><td width=\"50%\">\n';
out += '<a href=\"' + pathPrefix + '\" class=\"mainnav\">';
out += '<img src=\"' + pathPrefix + 'Content/Images/Headers/hometop.jpg\" align=\"left\" border=\"0\" /></a>\n'
out += '</td>\n';
out += '<td width=\"50%\">\n\n';
out += '<table width=\"100%\" align=\"right\" class=\"mainnav\">\n';
out += '<tr><td class=\"mainnav\" width=\"100%\">\n';
out += '<a href=\"' + pathPrefix + 'Content/search.htm\" class=\"mainnav\">Search</a>|\n';
out += '<a href=\"' + pathPrefix + 'Content/sitemap.htm\" class=\"mainnav\">Sitemap</a>\n';
out += '</td></tr>\n';
out += '</table>\n\n';
out += '</td></tr>\n';
out += '<tr><td colspan=\"2\">\n\n';
out += '<table width=\"100%\" class=\"sitenav\" style=\"border-top: 1px black solid;\">\n';
out += '<tr class=\"sitenav\"><td class=\"sitenav\">\n';
out += '<a href=\"' + pathPrefix + 'Content/Topics/\" class=\"sitenav\">Topics</a>\n';
out += '<a href=\"' + pathPrefix + 'Content/Timeline/\" class=\"sitenav\">Timelines</a>\n';
out += '<a href=\"' + pathPrefix + 'Content/Resource/\" class=\"sitenav\">Resources</a>\n';
out += '<a href=\"' + pathPrefix + 'Content/Textbook/\" class=\"sitenav\">Textbooks</a>\n';
out += '<a href=\"' + pathPrefix + 'Content/Schools/Public/\" class=\"sitenav\">Public Schools</a>\n';
out += '<a href=\"' + pathPrefix + 'Content/Schools/Private/\" class=\"sitenav\">Independent Schools</a>\n';
out += '<a href=\"' + pathPrefix + 'Content/PostSec/\" class=\"sitenav\">Post Secondary</a>\n';
out += '</td></tr>\n';
out += '</table>\n\n';
out += '</td></tr>\n';
out += '</table>\n\n';

document.write( out );
}

writeHeader();                                                                                                                                                                                                         
