if(document.images) {
	site1 = new Image();site1.src = "/images/bg-texture.jpg";
	site2 = new Image();site2.src = "/images/stripe-pattern.gif";
	site3 = new Image();site3.src = "/images/postpic-new.png";
	image1 = new Image();image1.src = "/images/nav-home-over.png";
	image2 = new Image();image2.src = "/images/nav-categories-over.png";
	image3 = new Image();image3.src = "/images/nav-photos-over.png";
	image4 = new Image();image4.src = "/images/nav-about-over.png";
	image5 = new Image();image5.src = "/images/nav-go-over.png";
	image6 = new Image();image6.src = "/images/nav-map-over.png";
}
if (top.location != location)
	top.location.href = document.location.href;
	
function nav(imgName, state) {
	document.images[imgName].src = "/images/nav-" + imgName + "-" + state + ".png";
}
var siteWidth = 840;
function getWidth() {
	var n_win = window.innerWidth ? window.innerWidth : 0;
	var n_docel = document.documentElement ? document.documentElement.clientWidth : 0;
	var n_body = document.body ? document.body.clientWidth : 0;
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	var currentWidth = n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	if(currentWidth < siteWidth)
		return siteWidth;
	else
		return currentWidth;
}
var old_index = 0;
var timeout_id;
function clear_timeouts() {
	if(timeout_id != null)
		self.clearTimeout(timeout_id);
}
function popupon(index, leftPx) {
	clear_timeouts();
	if(old_index != 0) {
		if(document.getElementById(old_index + "Sub"))
			document.getElementById(old_index + "Sub").style.display = "none";
			nav(old_index, "off");
	}
	if(document.getElementById(index + "Sub")) {
		document.getElementById(index + "Sub").style.top = navtop;
		document.getElementById(index + "Sub").style.left = ((getWidth() - siteWidth) / 2) + leftPx;
		document.getElementById(index + "Sub").style.display = "block";
	}
	nav(index, "over");
	old_index = index;
}
function popupoff() {
	if(old_index != 0)
		timeout_id = setTimeout("if(document.getElementById(old_index + 'Sub'))document.getElementById(old_index + 'Sub').style.display = 'none';nav(old_index, 'off');", 100);
}
function addComment(postID) {
	var commentWin = window.open("/comments_add.cfm?postID=" + postID, "commentWin", "width=600,height=400,scrollbars=yes,resizable=yes");
	commentWin.focus();
}
function postFacebook(u,t) {
	window.open('http://www.facebook.com/sharer.php?u='+u+'&t='+t,'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}
function loadFlash(flashMovie, width, height) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '" align="middle"><param name="allowScriptAccess" value="sameDomain"><param name="wmode" value="transparent"><param name="movie" value="' + flashMovie + '"><param name="quality" value="high"><embed src="' + flashMovie + '" quality="high" width="' + width + '" height="' + height + '" align="middle" allowScriptAccess="sameDomain" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>');
}
$(function() {
	$('div.postpic').hover( 
		function(){ 
			var element = '#postpictitle' + this.id.substring(7);
			$(element).stop(true, true).fadeTo('fast', .8);
		}, 
		function(){ 
			var element = '#postpictitle' + this.id.substring(7);
			$(element).stop(true, true).fadeOut('slow');
		}
	);
});

