//-------------------------------------------------------------------------------------------
IDNumber = 0;
//-------------------------------------------------------------------------------------------
function WriteHead()
{
	head =
	"<link rel=\"shortcut icon\" href=\"style/favicon.ico\" />" +
	"<link rel=\"stylesheet\" type=\"text/css\" name=\"DefaultStyles\" title=\"Green Glass\" href=\"style/style.css\" />";
	document.write(head);
}
//-------------------------------------------------------------------------------------------
function BackToTop() 
{
	var x1 = x2 = x3 = 0;
  	var y1 = y2 = y3 = 0;    	
	if (document.documentElement) 
   	{
    	x1 = document.documentElement.scrollLeft || 0;
        y1 = document.documentElement.scrollTop || 0;
    }
    if (document.body)
	{
		x2 = document.body.scrollLeft || 0;
        y2 = document.body.scrollTop || 0;
    }
    x3 = window.scrollX || 0;
    y3 = window.scrollY || 0;
    var x = Math.max(x1, Math.max(x2, x3));
    var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
    if (x > 0 || y > 0) 
	{ window.setTimeout("BackToTop()", 25); }
}
//-------------------------------------------------------------------------------------------
function WriteTopMenu(Header, Title)
{
	menu =
	"<div id=\"top-left\"></div>" +
	"<div id=\"location1\"></div>" +
	"<div style=\"float:left; padding:15px 5px\">" + Title + "</div>" +
	"<div id=\"top-right\"></div>" +
	"<div id=\"menu-top\">" +
		"<a href=\"index.html\"><img onmouseover=\"SetTitle('Home'); src='style/images/menu/home-over.png'\" onmouseout=\"SetTitle('brandon-holland.com'); src='style/images/menu/home.png'\" src=\"style/images/menu/home.png\" alt=\"Home\"/></a>" +
		"<a href=\"pictures.html\"><img onmouseover=\"SetTitle('Pictures'); src='style/images/menu/picture-over.png'\" onmouseout=\"SetTitle('brandon-holland.com'); src='style/images/menu/picture.png'\" src=\"style/images/menu/picture.png\" alt=\"Pictures\"/></a>" +
		"<a href=\"videos.html\"><img onmouseover=\"SetTitle('Videos'); src='style/images/menu/video-over.png'\" onmouseout=\"SetTitle('brandon-holland.com'); src='style/images/menu/video.png'\" src=\"style/images/menu/video.png\" alt=\"Videos\"/></a>" +
		"<a href=\"software.html\"><img onmouseover=\"SetTitle('Software'); src='style/images/menu/software-over.png'\" onmouseout=\"SetTitle('brandon-holland.com'); src='style/images/menu/software.png'\" src=\"style/images/menu/software.png\" alt=\"Software\"/></a>" +
		"<a href=\"links.html\"><img onmouseover=\"SetTitle('Links'); src='style/images/menu/links-over.png'\" onmouseout=\"SetTitle('brandon-holland.com'); src='style/images/menu/links.png'\" src=\"style/images/menu/links.png\" alt=\"Links\"/></a>" +
		"<a href=\"about.html\"><img onmouseover=\"SetTitle('About'); src='style/images/menu/about-over.png'\" onmouseout=\"SetTitle('brandon-holland.com'); src='style/images/menu/about.png'\" src=\"style/images/menu/about.png\" alt=\"About\"/></a>" +
	"</div>";
	document.write(menu);
	var ImagePath = "style/images/" + Header + "1.png";
	if(document.getElementById)
	{ var Location = document.getElementById("location1").style; }	
	else if(document.all)
	{ var Location = document.all["location1"].style; }
	else if(document.layers)
	{ var Location = document.layers["location1"]; }
	Location.backgroundImage = "url("+ImagePath+")";
}	
//-------------------------------------------------------------------------------------------
function WriteBotMenu()
{
	menu =
	"<div id=\"bot-left\"></div>" +
	"<div id=\"bot-right\"></div>" +
	"<div id=\"menu-bot\">" +
		"<a href=\"\" onclick=\"BackToTop(); return false\"><img onmouseover=\"src='style/images/menu/bot-up-over.png'\" onmouseout=\"src='style/images/menu/bot-up.png'\" src=\"style/images/menu/bot-up.png\" alt=\"Back To Top\"/></a>" +
	"</div>";
	document.write(menu);
}
//-------------------------------------------------------------------------------------------
function WriteCopyrights()
{
	copyrights =
    "<div id=\"copybox\">" +
		"<div id=\"copyright\">" +
			"Copyrights &copy; 2004-2010 brandon-holland.com-04.09.10 \"Green Glass\". All rights reserved." +
		"</div>" +
    "</div>";
    document.write(copyrights);
}
//-------------------------------------------------------------------------------------------
function WriteTitleBox(Header)
{
	titlebox =
	"<div id=\"tabbox\">" +
		"<div id=\"location2\"></div>" +
		"<div style=\"height:25px; width:77px; float:right\"></div>" +
		"<div id=\"titletab\">" +
			"<div id=\"menutitle\" style=\"margin:5px 0px\">brandon-holland.com</div>" +
		"</div>" +
	"</div>";
	document.write(titlebox);
	var ImagePath = "style/images/" + Header + "2.png";
	if(document.getElementById)
	{ var Location = document.getElementById("location2").style; }	
	else if(document.all)
	{ var Location = document.all["location2"].style; }
	else if(document.layers)
	{ var Location = document.layers["location2"]; }
	Location.backgroundImage = "url("+ImagePath+")";
}
//-------------------------------------------------------------------------------------------
function WriteInfoBox(TitleText, Content, Picture, Show, New)
{
	IDNumber++;
	titlebox =
	"<div class=\"infobox\">" +
		"<div class=\"ibtitle\">" + 
			"<div style=\"float:left\">";
			if(New)
			{ titlebox += "<div class=\"new\"></div>" } 
			titlebox += TitleText + "</div>" +
			"<div style=\"float:right; font-size:10px\"><a id=\"switch" + IDNumber + "\" href=\"javascript:HideInfoBox('" + IDNumber + "')\">Hide</a></div>" +
		"</div>" +
		"<div id=\"box" + IDNumber + "\">" +
		"<div style=\"padding-top:5px\">" + Content + "</div>";
		if(Picture != false)
		{ titlebox += "<div style=\"text-align:center; padding-top:5px\"><img class=\"picture\" src=\"" + Picture + "\" alt=\"Picture" + IDNumber + "\"/></div>" }
	titlebox += "</div>" +
	"</div>";
	document.write(titlebox);
	if(Show == false)
	{ HideInfoBox(IDNumber); }
}
//-------------------------------------------------------------------------------------------
function Seperate()
{ document.write("<div class=\"seperator\"></div>"); }
//-------------------------------------------------------------------------------------------
function PreloadMenu()
{ 
	Home = new Image(52,50);
	Home.src = "style/images/menu/home-over.png";
	Picture = new Image(52,50);
	Picture.src = "style/images/menu/picture-over.png";
	Video = new Image(52,50);
	Video.src = "style/images/menu/video-over.png";
	Software = new Image(52,50);
	Software.src = "style/images/menu/software-over.png";
	Links = new Image(52,50);
	Links.src = "style/images/menu/links-over.png";
	About = new Image(52,50);
	About.src = "style/images/menu/about-over.png";
	BackUp = new Image(52,50);
	BackUp.src = "style/images/menu/bot-up-over.png"; 
}
//-------------------------------------------------------------------------------------------
function SetTitle(TitleText)
{ 
	if(document.getElementById)
	{ var TheTitle = document.getElementById("menutitle"); }
	else if(document.all)
	{ var TheTitle = document.all["menutitle"]; }
	else if(document.layers)
	{ var TheTitle = documents.layers["menutitle"]; }
	TheTitle.innerHTML = TitleText; 
} 
//-------------------------------------------------------------------------------------------
function HideInfoBox(BoxID)
{
	var Box = "box" + BoxID;
	var Switch = "switch" + BoxID;
	if(document.getElementById)
	{ 
		var TheBox = document.getElementById(Box).style;
		var TheSwitch = document.getElementById(Switch);
	}	
	else if(document.all)
	{ 
		var TheBox = document.all[Box].style;
		var TheSwitch = document.all[Switch];
	}
	else if(document.layers)
	{ 
		var TheBox = documents.layers[Box].style;
		var TheSwitch = document.layers[Switch];
	}
	TheBox.display = TheBox.display? "":"none";
	TheSwitch.innerHTML = TheBox.display? "Show":"Hide";
}
//-------------------------------------------------------------------------------------------
function DarkenPage()
{
    var page_screen = document.getElementById('screen');
	var y;
	if (document.body.parentNode.scrollHeight > document.body.parentNode.offsetHeight)
	{ y = document.body.parentNode.scrollHeight; }
	else
	{ y = document.body.parentNode.offsetHeight; }
	page_screen.style.height = y + 'px';
    page_screen.style.display = 'block';
}
//-------------------------------------------------------------------------------------------
function LightenPage()
{
    var page_screen = document.getElementById('screen');
    page_screen.style.display = 'none';
}
//-------------------------------------------------------------------------------------------
function ShowPicture(imgURL, altText)
{
	var imgPanel = document.getElementById('imagepanel');
	var w = 510;
	var xc = 0; var yc = 0;
    DarkenPage();
    xc = Math.round((document.body.clientWidth/2)-(w/2)) - 5;
	if(self.pageYOffset)
	{ yc = self.pageYOffset; }
	else if(document.documentElement && document.documentElement.scrollTop)
	{ yc = document.documentElement.scrollTop; }
	else if(document.body.scrollTop)
	{ yc = document.body.scrollTop; }
	yc += 75;
    imgPanel.innerHTML = "<div><a href=\"javascript:ClosePicture()\"><img class=\"panelpic\" src=\"" + imgURL + "\" alt=\"" + altText + "\"/></a></div>";
	imgPanel.style.left = xc + "px";
    imgPanel.style.top  = yc + "px";
    imgPanel.style.display = 'block';
}
//-------------------------------------------------------------------------------------------
function ShowVideo(videoURL, videoPreview, infoText)
{
	var vidPanel = document.getElementById('videopanel');
	var w = 365;
	var xc = 0; var yc = 0;
    DarkenPage();
    xc = Math.round((document.body.clientWidth/2)-(w/2)) - 5;
	if(self.pageYOffset)
	{ yc = self.pageYOffset; }
	else if(document.documentElement && document.documentElement.scrollTop)
	{ yc = document.documentElement.scrollTop; }
	else if(document.body.scrollTop)
	{ yc = document.body.scrollTop; }
	yc += 75;
	    
	vidPanel.innerHTML = 
	"<p id=\"videoPlayer\"><a href=\"http://www.macromedia.com/go/getflashplayer\">Get the Flash Player</a> to see this player.</p>" +
	"<p>" + infoText + "</p>" +
	"<a href=\"javascript:CloseVideo()\">Close Video</a>";
	vidPanel.style.left = xc + "px";
    vidPanel.style.top  = yc + "px";
    vidPanel.style.display = 'block';
	
	var s1 = new SWFObject("flash/flvplayer.swf","single","320","240","7");
	s1.addParam("allowfullscreen","true");
	s1.addVariable("file","../" + videoURL);
	s1.addVariable("image",videoPreview);
	s1.addVariable("width","320");
	s1.addVariable("height","240");
	s1.write("videoPlayer");
}
//-------------------------------------------------------------------------------------------
function ClosePicture()
{
    var imgPanel = document.getElementById('imagepanel');
    imgPanel.style.display = 'none';
	LightenPage();
}
//-------------------------------------------------------------------------------------------
function CloseVideo()
{
    var vidPanel = document.getElementById('videopanel');
    vidPanel.style.display = 'none';
	LightenPage();
}
//-------------------------------------------------------------------------------------------