windowOpen = false;
windowName = null;
function loadBrowser(b_img, b_title, b_url) {
	//If there's a window open and it belongs to the source, let's close it!
	if (windowOpen == true && b_img == windowName) {
		//Close the window and disable the loading spinner.
		document.getElementById('browser_outer').style.visibility = 'hidden';
		document.getElementById('browser_spinner').style.visibility = 'hidden';
		//The window is closed and this is what it was named.
		windowOpen = false;
		windowName = b_img;
	}
	//If there's no window open or the current window doesn't belong to the source, let's open it!
	else {
		var browserContent = document.getElementById('browser_content');
		var browserTitle = document.getElementById('browser_title');
		var browserUrl = document.getElementById('browser_url');
		var browserTarget = document.getElementById('browser_target_url');
		//Make the window visable.
		document.getElementById('browser_outer').style.visibility = 'visible';
		//We ridin' spinnaz, they don't stop.
		if (windowName !== b_img) {document.getElementById('browser_spinner').style.visibility = 'visible';}
		//Well, I guess they do.
		browserContent.onload = function() {document.getElementById('browser_spinner').style.visibility = 'hidden';}
		//Display the window content.
		browserTitle.innerHTML = b_title;
		browserUrl.innerHTML = b_url;
		setTimeout (function(){browserContent.src = b_img;},0500);
		//Set a link for the invisible pane.
		browserTarget.href = b_url;
		//There's a window open and this is what it's named.
		windowOpen = true;
		windowName = b_img;
	}
}
function showIconlabel(id) {
	changeOpac(100, id);
}
function hideIconlabel(e, id) {
	if (!e) var e = window.event; //IE Compatibility
	var blog_icon = document.getElementById('blog_icon');
	var twitter_icon = document.getElementById('twitter_icon');
	var target = e.relatedTarget;
	if (target == blog_icon || target == twitter_icon) {
		changeOpac(0, id);
	}
	else {
		opacity(id, 100, 0, 250);
	}
}
//Original Opacity Code: http://brainerror.net/scripts/javascript/blendtrans/
//Modified by timb (04/22/09)
//--Start Opacity Code--
function opacity(id, opacStart, opacEnd, millisec) { 
	var speed = Math.round(millisec / 100); 
	var timer = 0; 
	if(opacStart > opacEnd) {
		if(document.getElementById(id).style.opacity < 1) {
			return;
		}
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
	else
	if(opacStart < opacEnd) {
		if(document.getElementById(id).style.opacity > 1) {
			return;
		}
		for(i = opacStart; i <= opacEnd; i++) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
}
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}
//--End Opacity Code--
//Also clocks.
function updateClock() {
	var currentTime = new Date();
	var dayNames = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"];
	var currentDay = dayNames[currentTime.getDay()];
	var currentHours = currentTime.getHours();
	var currentMinutes = currentTime.getMinutes();
	var currentSeconds = currentTime.getSeconds();

	//Pad the minutes and seconds with leading zeros, if required.
	currentMinutes = (currentMinutes < 10 ? "0" : "") + currentMinutes;
	currentSeconds = (currentSeconds < 10 ? "0" : "") + currentSeconds;

	//Choose either "AM" or "PM" as appropriate.
	var timeOfDay = (currentHours < 12) ? "AM" : "PM";

	//Convert the hours component to 12-hour format if needed.
	currentHours = (currentHours > 12) ? currentHours - 12 : currentHours;

	//Convert an hours component of "0" to "12".
	currentHours = (currentHours == 0) ? 12 : currentHours;

	//Compose the string for display.
	var currentTimeString = currentDay + " " + currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

	//Update the time display.
	document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}