var current_page = 'about';

function menuOn(id) {
	if (current_page!=id) {
		document.getElementById('menu_link_'+id).style.color = '#0000bb';
	}
}

function menuOff(id) {
	if (current_page!=id) {
		document.getElementById('menu_link_'+id).style.color = '#000000';
	}
}

function menuClick(id,type) {
	document.getElementById('menu_about').style.background = "url('img/menu_4_inactive.png')";
	document.getElementById('menu_data').style.background = "url('img/menu_4_inactive.png')";
	document.getElementById('menu_realtime').style.background = "url('img/menu_4_inactive.png')";
	document.getElementById('menu_docs').style.background = "url('img/menu_4_inactive.png')";
	try {
		document.getElementById('menu_'+id).style.background = "url('img/menu_4_active.png')";
	} catch(err) {}
	document.getElementById('menu_link_about').style.color = '#000000';
	document.getElementById('menu_link_data').style.color = '#000000';
	document.getElementById('menu_link_realtime').style.color = '#000000';
	document.getElementById('menu_link_docs').style.color = '#000000';
	try {
		document.getElementById('menu_link_'+id).style.color = '#880000';
	} catch(err) {}
	var content = "";
	if (id=='about' || id=='data' || id=='realtime' || id=='docs') {
		content = "";
	}
	if (type=="load") {
		document.getElementById('main_frame').src = 'page_'+id+'.php#'+get_id;
	} else {
		document.getElementById('main_frame').src = 'page_'+id+'.php';
	}
	current_page = id;
}


function changesPopup() {
	OpenWin = window.open("changes.php","changesPopup","toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,width=650,height=400");
}


$(document).ready(function() {
	$('#menu_about').mouseenter(function() { menuOn('about') });
	$('#menu_data').mouseenter(function() { menuOn('data') });
	$('#menu_realtime').mouseenter(function() { menuOn('realtime') });
	$('#menu_docs').mouseenter(function() { menuOn('docs') });
	$('#menu_about').mouseleave(function() { menuOff('about') });
	$('#menu_data').mouseleave(function() { menuOff('data') });
	$('#menu_realtime').mouseleave(function() { menuOff('realtime') });
	$('#menu_docs').mouseleave(function() { menuOff('docs') });
	$('#menu_about').click(function() { menuClick('about','click') });
	$('#menu_data').click(function() { menuClick('data','click') });
	$('#menu_realtime').click(function() { menuClick('realtime','click') });
	$('#menu_docs').click(function() { menuClick('docs','click') });
	menuClick(get_page,'load');
	$('#changes').click(function() { changesPopup() });
});

