function blogRemovePhoto()
{
	var myConfirm = confirm("Are you sure you want to remove this photo? (Photo will not be removed until you hit Update)");
	if( myConfirm )
	{
		document.getElementById('blog_photo').innerHTML = '<i>Removed</i>';
		document.getElementById('remove_photo').value = '1';
	}
}

function blogAddPhoto()
{
	document.getElementById('blog_upload_photo').style.display = 'block';
	document.getElementById('blog_photo_options').style.display = 'none';
}

function blogShowArchive(start)
{
	var total = Archives.length;
	var count = 0;
	var value = '';
	var navbar = '';

	for( i = start; i < (start + 4); i++ )
	{
		if( typeof Archives[i] != 'undefined' )
		{
			value += "<h2 style='padding: 0px; margin: 5px 0px 0px 0px;'><b>" + Archives[i][1] + " - " + Archives[i][3] + "</b></h2>" + Archives[i][2] + " <a href='/blog.php?id=" + Archives[i][0] + "'>Click here for more</a>";
			count = count + 1;
		}
	}

	document.getElementById('blog_archives').innerHTML = value;

	if( start >= 4 )
		navbar += "<a href='javascript:blogShowArchive(" + (start - 4) + ");' style='margin-right: 10px;'>&laquo; Previous</a> ";

	navbar += "Showing " + (start + 1) + " - " + (start + count) + " of " + total;

	if( (start + 4) < total )
		navbar += " <a href='javascript:blogShowArchive(" + (start + 4) + ");' style='margin-left: 10px;'>Next &raquo;</a>";

	if( total > 0 )
		document.getElementById('blog_archives_nav').innerHTML = navbar;
	else
		document.getElementById('blog_archives_nav').innerHTML = 'There are no archived blog entries.';
}

function popup_window(url, windowname, w, h)    {
	var width = w;
	if (width > screen.availWidth)
		width = screen.availWidth;
	var height = h;
	if (height > screen.availHeight)
		height = screen.availHeight;
	var left = parseInt((screen.availWidth/2) - (width/2));
	var top = parseInt((screen.availHeight/2) - (height/2));

	var window_features = "height=" + height + ",width=" + width + ",left=" + left + ",top=" + top + ",resizable=0" + ",screenX=" + left + ",screenY=" + top;
	var wp = window.open(url, windowname, window_features);
	if (!wp) {
		alert("Your browser's popup-blocker is preventing this window from being displayed");
		return;
	}
	wp.focus();
}
