var xhr = false;
var authors = new Array(14);
authors[0] = "penn";
authors[1] = "flavius";
authors[2] = "laotzu";
authors[3] = "mach";
authors[4] = "roos";
authors[5] = "caesar";
authors[6] = "mahan";
authors[7] = "fred";
authors[8] = "confucius";
authors[9] = "sherman";
authors[10] = "xeno";
authors[11] = "aur";
authors[12] = "mach2";
authors[13] = "vonc";
authors[14] = "suntzu";

var aID1 = null;
var aID2 = null;
var tempval = null;
var filename = 'empty.html';

window.onload = execute;

function execute() {
	var i = null;
	document.getElementById("sitemap").onmouseover = showInfo1 ;
	document.getElementById("privacy").onmouseover = showInfo2 ;
	document.getElementById("friend").onmouseover = showInfo3 ;

	document.getElementById("onep").onmouseover = function()
	{
		aID1 = 'penn';
		makeRequest();
		return false;
	}
	document.getElementById("onep").onclick = function()
        {
		window.location='penn.html';
		return false;
        }

        document.getElementById("twof").onmouseover = function()
        {
		aID1 = 'flavius';
                makeRequest();
                return false;
        }
        document.getElementById("twof").onclick = function()
        {
                window.location='vegetius.html';
                return false;
        }

        document.getElementById("threel").onmouseover = function()
        {
                aID1 = 'laotzu';
                makeRequest();
                return false;
        }
        document.getElementById("threel").onclick = function()
        {
                window.location='laotzu.html';
                return false;
        }

        document.getElementById("fourm").onmouseover = function()
        {
                aID1 = 'mach';
                makeRequest();
                return false;
        }
        document.getElementById("fourm").onclick = function()
        {
                window.location='mach_artofwar.html';
                return false;
        }
	
	document.getElementById("fiver").onmouseover = function()
        {
                aID1 = 'roos';
                makeRequest();
                return false;
        }
        document.getElementById("fiver").onclick = function()
        {
                window.location='theodore_roosevelt.html';
                return false;
        }

        document.getElementById("sixc").onmouseover = function()
        {
                aID1 = 'caesar';
                makeRequest();
                return false;
        }
        document.getElementById("sixc").onclick = function()
        {
                window.location='julius_caesar.html';
                return false;
        }

        document.getElementById("sevenm").onmouseover = function()
        {
                aID1 = 'mahan';
                makeRequest();
                return false;
        }
        document.getElementById("sevenm").onclick = function()
        {
                window.location='mahan.html';
                return false;
        }

        document.getElementById("eightf").onmouseover = function()
        {
                aID1 = 'fred';
                makeRequest();
                return false;
        }
        document.getElementById("eightf").onclick = function()
        {
                window.location='frederickthegreat.html';
                return false;
        }

        document.getElementById("ninec").onmouseover = function()
        {
                aID1 = 'confucius';
                makeRequest();
                return false;
        }
        document.getElementById("ninec").onclick = function()
        {
                window.location='greatlearning.html';
                return false;
        }

        document.getElementById("tens").onmouseover = function()
        {
                aID1 = 'sherman';
                makeRequest();
                return false;
        }
        document.getElementById("tens").onclick = function()
        {
                window.location='sherman.html';
                return false;
        }

        document.getElementById("elevenx").onmouseover = function()
        {
                aID1 = 'xeno';
                makeRequest();
                return false;
        }
        document.getElementById("elevenx").onclick = function()
        {
                window.location='xenophon.html';
                return false;
        }

        document.getElementById("twelvea").onmouseover = function()
        {
                aID1 = 'aur';
                makeRequest();
                return false;
        }
        document.getElementById("twelvea").onclick = function()
        {
                window.location='meditations.html';
                return false;
        }

        document.getElementById("thirteenm").onmouseover = function()
        {
                aID1 = 'mach2';
                makeRequest();
                return false;
        }
        document.getElementById("thirteenm").onclick = function()
        {
                window.location='machiavelli.html';
                return false;
        }

        document.getElementById("fourteenc").onmouseover = function()
        {
                aID1 = 'vonc';
                makeRequest();
                return false;
        }
        document.getElementById("fourteenc").onclick = function()
        {
                window.location='clausewitz.html';
                return false;
        }

        document.getElementById("fifteens").onmouseover = function()
        {
                aID1 = 'suntzu';
                makeRequest();
                return false;
        }
        document.getElementById("fifteens").onclick = function()
        {
                window.location='learn.html';
                return false;
        }




	document.getElementById("sitemap").onmouseout = function() {
		document.getElementById("smpopup").style.display = 'none';	
		return false;
	}
	document.getElementById("privacy").onmouseout = function() {
                document.getElementById("smpopup").style.display = 'none';
                return false;
        }
	document.getElementById("friend").onmouseout = function() {
                document.getElementById("smpopup").style.display = 'none';
                return false;
        }

	
}

function makeRequest() {
        if (window.XMLHttpRequest) {
                xhr = new XMLHttpRequest();
        }
        else {
                if (window.ActiveXObject) {
                        try {
                                xhr = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        catch (e) { }
                }
        }

        if (xhr) {
                xhr.onreadystatechange = show_page;
                xhr.open("GET", filename, true);
                xhr.send(null);
        }
}


function show_page() {
	var i = null;
        if (xhr.readyState == 4) {
                if (xhr.status == 200) {
                        var outMsg = xhr.responseText;
                }
                else {
                        var outMsg = "There was a problem with the request " + xhr.status;
                }
		for (i=0; i<authors.length; i++) {
			var id1 = authors[i] + "t";
			var id2 = authors[i] + "d";
			var id11 = id1 + " "+  id2;
			var more = document.getElementById(id1);
                	var more2 = document.getElementById(id2);
			more.style.display = "none";
	                more2.style.display = "none";
			
		}
		id1 = aID1 + "t";
		id2 = aID1 + "d";
                more = document.getElementById(id1);
		more2 = document.getElementById(id2);
                more.style.display = "block";
		more2.style.display = "block";
        }
}



function showInfo1(evt)
{
	if(!evt) {
		evt = window.event;
	}
	var xpos = evt.clientX;
	var ypos = evt.clientY;
	xpos = parseInt(xpos) -10;
	var msg = "Site Map";
	display(msg, xpos, ypos);
}

function showInfo2(evt)
{
        if(!evt) {
                evt = window.event;
        }
        var xpos = evt.clientX;
        var ypos = evt.clientY;
	xpos = parseInt(xpos) -30;
	var msg = 'Sonshi Privacy Policy';
        display(msg, xpos, ypos);
}
function showInfo3(evt)
{
        if(!evt) {
                evt = window.event;
        }
        var xpos = evt.clientX;
        var ypos = evt.clientY;
	xpos = parseInt(xpos) -30;
	var msg = 'Tell Your Friends';
        display(msg, xpos, ypos);
}

function display(msg, xpos, ypos)
{
        smpopup2 = document.getElementById("smpopup");
        smpopup2.innerHTML = msg;
        smpopup2.zIndex = 1000;
	smpopup2.style.top = parseInt(ypos) + 60 + "px";
        smpopup2.style.left = parseInt(xpos) -30 + "px";
        document.getElementById("smpopup").style.display = 'inline';
}




