// JavaScript Document

function swap(id, newImage) {
	document.getElementById(id).src = newImage;
}

// colors
var black = "#000000";
var darkBlue = "#000099";
var lightPink = "#F4EFF7";
var darkPink = "#6C2A4B";
var purple = "#7F649B";
var orange = "#CC6600";
var darkRed = "#790000";
var green = "#33CC33";
var lightBlue = "#99CCCC";

// returns the html a href to a menu item and sets the given text color
function getMenuHTML(textColor, file, name) {
	var menuHTML = "<a href=\"http://xenon.stanford.edu/~lvchan/";
	menuHTML += file;
	menuHTML += "\">";
	menuHTML += "<font color=" + textColor + ">";
	menuHTML += name;
	menuHTML += "</font></a>";
	return menuHTML;
}

// returns the html a href for blog hosted at blogspot
function getBlogHTML(textColor) {
   var blogHTML = "<a href=\"http://lvchan.blogspot.com/><font color=" + textColor + "> blog </font></a>";
   return blogHTML;
}

// generates the html for the menu bar
function initMenu(lineColor, textColor) {
	if (!lineColor) {
		lineColor = darkBlue;
	}
	if (!textColor) {
		textColor = black;
	}
	var verticalBar = "<font color=" + lineColor + "> | </font>";
	var fontColorBegin = "<font color=" + textColor + ">";
	var fontColorEnd = "</font>";
	var menuHTML = "<div align=\"right\">";
	menuHTML += "<span class=menu>";
	menuHTML += getMenuHTML(textColor, "index.html", "home");
	menuHTML += verticalBar;
	menuHTML += getMenuHTML(textColor, "pearls.html", "pearls");
	menuHTML += verticalBar;
	menuHTML += getMenuHTML(textColor, "projects.html", "projects");
	menuHTML += verticalBar;
	menuHTML += getMenuHTML(textColor, "postcards.html", "postcards");
	menuHTML += verticalBar;
	menuHTML += getMenuHTML(textColor, "newplay.html", "play");
	menuHTML += verticalBar;
	//menuHTML += getMenuHTML(textColor, "blog.html", "blog");
	menuHTML += getBlogHTML(textColor);
        menuHTML += "</span>";
	menuHTML += "</div>";
	document.getElementById("menu").innerHTML = menuHTML;
}

var homeHTML = "<a href=\"index.html\">home</a>";
var pearlsHTML = "<a href=\"pearls.html\">pearls</a>";
var projectHTML = "<a href=\"projects.html\">projects</a>";
var playHTML = "<a href=\"newplay.html\">play</a>";
var postcardsHTML = "<a href\"postcards.html\">postcards</a>";
var blogHTML = "<a href=\"blog.html\">blog</a>";

// generates the menu for the home page
function initMainMenu() {
	var dotHTML = "<span class=dot> . </span>";
	var menuHTML = "<div align=\"center\">";
	menuHTML += "<span class=title>";
	menuHTML += pearlsHTML;
	menuHTML += "</span>";
	menuHTML += dotHTML;
	menuHTML += "<span class=title>";
	menuHTML += projectHTML;
	menuHTML += "</span>";
	menuHTML += dotHTML;
	menuHTML += "<span class=title>";
	menuHTML += playHTML;
	menuHTML += "</span>";
	menuHTML += dotHTML;
	menuHTML += "<span class=title>";
	menuHTML += blogHTML;
	menuHTML += "</span>";
	menuHTML += "</div>";
	document.getElementById("mainmenu").innerHTML = menuHTML;
}



