var divLinks, divLinkDescs;
var pageId;

$(document).ready(function() {
	writeToday();
	buildsubmenus_horizontal();
	pageId = $('body')[0].id;
	if (pageId == 'home') {
		divLinks = $('#home-link').eq(0);
		divLinkDescs = $('#home-linkdesc').eq(0);
		$('#home-linkdesc div').hide();
		$('#home-link a').mouseover(onHomeLinkOver);
	}
	if (btn) btn.init();
});

function onHomeLinkOver() {
	divLinks.find('a').removeClass('down');
	$(this).addClass('down');
	divLinkDescs.find('div').hide();
	var id = this.id;
	divLinkDescs.find('#'+id).show();
}

function popup(name) {
	var url = '';
	var width = 600; var height = 500;
	var left = 200, top = 100;
	switch (name) {
			case 'tmamap': url = 'bando-tma.html'; 
				width = 1060; height = 800; left = 60; top: 10;
				break;
			case 'labtour': url = 'labtour/index.html'; 
				width = 700; height = 650; left = 150; top: 10;
				break;
			default: return;
		}
	
	window.open(url,'_blank',"width=" + width + ", height=" + height 
				+ ", left=" + left + ", top=" + top
				+ ", status=no, titlebar=no, menubar=no, toolbar=no, scrollbars=yes");
		
}

function writeToday() {
	// Array of day names
	var dayNames = new Array("Sunday","Monday","Tuesday","Wednesday",
					"Thursday","Friday","Saturday");
	// Array of month Names
	var monthNames = new Array("January","February","March","April","May","June","July",
	"August","September","October","November","December");

	var now = new Date();
	var today;
	today = now.getDate() + '/' + (now.getMonth()+1) + '/'
			+ now.getFullYear();
	var divToday = document.getElementById('today');
	if (divToday) {
		divToday.textContent = today;
		divToday.innerText = today;
	}
}


