/********************************************************
	@Orangekid's Blog v2.1 2006
	Notes for browser compatibility:
	
	For using AJAX in IE and Opera, make sure that the 
	onreadystatechange handler is placed only after
	the send() and open() methods otherwise it will not work.
	This is not an issue in Mozilla browsers.
	
********************************************************/
//
//	properties pertaining to REQUEST URLS
//
//	main PHP script that processes requests sent from AJAX
var phpActionGateway = "ajax-action-form.php";
var phpActionNav = "ajax-action-nav.php";
var pagedone = false;
//
//	External Elements:
//
//	This section contains references and settings for plugins
//	present on the page
//
var showFlashUserTracker = true;
//
//	properties attributed to OBJECTS RECEIVING FOCUS FROM WINDOW EVENTS
//
var objectFollowingMouse;
//
//	properties pertaining to PRELOADING
//
var workingMessage = "        "; //transmission
var workingImage = "<img src='img/loading2.gif' border='0' />";
//var workingImage = "<div align='top'><img src='img/coffee_maker_thumbs.gif' border='0' align='top' /></div>";
var workingImage3 = "<div align='top'><img src='img/cdrom_spins.gif' border='0' align='top' /></div>";
//var workingImage2 = "<div align='top' style='display:inline'><img src='img/earthbound_boy.gif' border='0' align='top' /></div>";
var workingImage2 = "<img src='img/loading2.gif' border='0' />";
var ajaxIsWorking = false;
var workingCounter = 0;
var maxWorkingTime = 30;
var workCountFlag;
//
//	properties pertaining to the LIST OF CATEGORIES
//
var listOfCategories = new Array();
var listOfCategoriesId = new Array();
var listOfCategoriesDesc = new Array();
var categoryDelimiter = " | ";
var currentCategoryView;
var startWithViewAll = true;	//initialize retreiving entries from every category
//
//	properties pertaining to ENTRY DUMP
//
var numberPerPage = 1;	
//	This should be the same as the value specified in main.php and singular/plural Paging Labels modified accordingly
var totalNumberOfPages;
var currentPage;
var entriesDump;
var entryToIndexMap = new Array();
var maxAllEntries = 200;	//---maximum number for retrieving ALL entries
//
//	Properties related to paging
//	[label] # of # [labels]
//
var singularPagingLabel = "Entry";
var pluralPagingLabel = "entries";
//
//
var privacyFlag = true;
//---
/*
	properties pertaining to DISPLAY LABELS
*/
var prevPageLabel = "<img lowsrc='img/pageprev2.gif' alt='page before' src='img/pageprev2.gif' border='0' />";
var nextPageLabel = "<img lowsrc='img/pagenext2.gif' alt='page next' src='img/pagenext2.gif' border='0' />";
var entryCategoryLabel = "";
var defaultBlogHomeLabel = "<span style='font-family:Century; font-size:12px; font-style:italic'></span>";
var defaultBlogHomeDesc = "<i>\"\"</i>";
//---
/*
	properties pertaining to the 'VIEW COMMENTS' LABELS
*/
//var addCommentLabel = "Leave a comment";
var addCommentLabel = "<img src='img/leave_a_comment.gif' align='absmiddle' border='0' />";
var viewCommentsLabel = "<img src='img/view_comments.gif' align='absmiddle' border='0' />";
var noCommentsLabel = "<img src='img/no_comments_yet.gif' border='0' align='absmiddle' />";
var commentImage = "<img src='img/facebook-poker.gif' border='0' align='absmiddle' />";
var commentsDisabledImage = "<div valign='center'><img src='img/comments_disabled_icon.gif' border='0' /></div>";
//
//	History Stack
var historyStack = new Array();	// requires the history stack functions in Extensions.js
var historyPage = -1;
var isHistory = false;
//---
/*
	properties pertaining to media tags to HTML img tags

var imgMaxWidth = 480;
var imgMaxHeight = 500;
var imgBorderSize = 1;
var imgPaddingSize = 3;
var imgBorderColor = "#C0C0C0";
*/
//---
//
//	pageFinished is invoked when the document has completed loading totally
//
function pageFinished() {
	window.onunload = function(){top.frames["historytracker"].onunload = null;}
	top.frames["historytracker"].location.href="blank.html";
	//
	reloadHistory();
	generateCategoryMenu();
	//logBrowsingInfo();
		manualLog("<span style='font-family:Georgia; font-size:12px'>Clicked from: <b> " + site_referrer + " </b></span>");
	
	try{
		if (!showFlashUserTracker)
		document.getElementById("FlashUserTracker").style.display = "none";
	}catch(e){
		alert(e);
	}
	//
	//	Set reference to the object for applying effects
	try{
		__obj = document.getElementById("targetEffectsObject");
	} catch(e) {
		//alert("init() error: " + e);
	}
	try{
		initDrag();
	}catch(e){
		//alert(e);
	}
	//
	//	comment this out if you wish to display all the right page elements
	//
	//	What I did here was to "open" & "close" the right columns 
	//	so that the elements will auto-align themselves
	//
	/*
	toggleRightHider();
	toggleRecentCommentsHider();
	toggleRecentEntriesHider();
	toggleProfileHider();
	toggleRightHider();
	toggleRecentCommentsHider();
	toggleRecentEntriesHider();
	toggleProfileHider();
	*/
	//
	//	comment this if you wish to use the Flash splash screen
	//
	
		exitFlashToPage(1);
	
	//
	//
	//
	try{
		initsnow();
	}catch(e){
		//
	}
}
function createAjaxHttp() {	
	// branch for native XMLHttpRequest object
	var ajax;
	if(window.XMLHttpRequest) {
		try {
			ajax = new XMLHttpRequest();
		} catch(e) {
			ajax = false;
			alert("Failed to create XMLHttpRequest");
		}
	// branch for IE/Windows ActiveX version
	} else if(window.ActiveXObject) {
		try {
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(e) {
			try {
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(e) {
				ajax = false;
				alert("Failed to create MS XMLHTTP object");
			}
		}
	}
	return ajax;
};
/*
	create an instance of the XMLHTTPRequest Object
	In IE this object has to be declared after the function
*/
var http = createAjaxHttp();		//This should be the ONLY variable which is created at runtime
var loggerHttp = createAjaxHttp();	//This ajax container is for logging purposes only
					//alert("XMLHttpRequest");
/*
	showWorking( msg , countDisabled )
	msg		- String to display during loading
	countDisabled	- Boolean flag, defaults to FALSE.
			  When this is set to TRUE, 
*/
var wkInterval;
	function _wkout(){
		try{
			clearInterval(wkInterval);
			var wk = document.getElementById("working");
			var w = wk.offsetWidth;
			if ( w > 100 ) {
				wk.style.width = "100px";
				
			} else {
				wk.style.width = (w + ((108 - w)/2)) + "px";
				wkInterval = setTimeout(_wkout,100);
			}
		}catch(e){
			alert(e);
		}
	}
	function _wkin(){
		try{
			clearInterval(wkInterval);
			var wk = document.getElementById("working");
			var w = wk.offsetWidth;
			if ( w <= 20 ) {
				wk.style.width = "0px";
				//
				wk.innerHTML = "";
				wk.style.display = 'none';
			} else {
				wk.style.width = (w/2.5) + "px";
				wkInterval = setTimeout(_wkin,100);
			}
		}catch(e){
			alert(e);
		}
	}
function showWorking(msg,countDisabled) {
	ajaxIsWorking = true;
	var wk = document.getElementById("working");
	//objectFollowingMouse = wk;
	if (msg==null) {
		wk.innerHTML = workingImage+workingMessage + " <br />" + "";
	} else {
		wk.innerHTML = msg;
	}
	wk.style.display = 'block';
	//---
	if (!countDisabled || countDisabled == null){
		workCountFlag = setInterval( doWorkCount , 1000);
	}
	try{
		document.getElementById("workingMaskInstance").style.display = "block";
	}catch(e){
	}
	//
	//	Animate!
	//
	_wkout();
}
function doWorkCount(){
	workingCounter++;
	var wk = document.getElementById("working");
	wk.innerHTML = workingImage + workingMessage + workingCounter + " seconds";
	if (workingCounter>maxWorkingTime) {
		resetWorkCount();
		alert("WHoOps!.\nIt was taking too long to retrieve the last entry you requested. Maybe there is no Internet connection or it could be too slow.\n\nIf you are using the Opera browser, try selecting from the menu below");
		stopAjaxRequest();
	}
}
function resetWorkCount(){
	clearInterval(workCountFlag);
	workingCounter = 0;
}
function hideWorking() {
	try{
		document.getElementById("workingMaskInstance").style.display = "none";
	}catch(e){
	}
	workingCounter = 0;
	ajaxIsWorking = false;
	objectFollowingMouse = null;
	var wk = document.getElementById("working");
	//wk.innerHTML = "";
	//wk.style.display = 'none';
	//
	resetWorkCount();
	//
	//	Animate!
	//
	_wkin();
}
function stopAjaxRequest() {
	http.abort();
	hideWorking();
}
//
//	Drag Object
//
function startDrag(objId) {
	var obj = document.getElementById(objId);
	objectFollowingMouse = obj;
}
function stopDrag(){
	objectFollowingMouse = null;
	releaseObject();
}
//---retrieve normal data
/*
	View Methods
*/
function viewDefault() {
	currentPage = 1;
	viewAllEntries();
}
var genTimeout;
function generateCategoryMenu(){
	if (!ajaxIsWorking) {
		try {
			showWorking("populating categories");
			http.open("GET",phpActionGateway + "?type=categories&action=list",true);
			http.send("");
			http.onreadystatechange = populateCategoryMenu;
		}catch(e){
			alert("Could not send AJAX data");
		}
	}else{
		clearTimeout(genTimeout);
		genTimeout = setTimeout(generateCategoryMenu,250);
	}
}

function populateCategoryMenu(){
	if (http.readyState == 4) {
		// only if "OK"
		if (http.status == 200) {
			//---create XML from string
			hideWorking();
			//createXMLObject(http.responseXML);
			try{
				var nvp = eval('('+http.responseText+')');
				//alert(http.responseText);
				//document.getElementById("entryTitle0").innerHTML = "OK:<br />"+nvp.length;
				listOfCategories = nvp;
				//---directly place in HTML document
				//var ce = document.getElementById("categoryListing");
				//var ce = document.getElementById("tableTopBanner");
				var ce = document.getElementById("categoriesBanner");
				//ce.innerHTML = categoryDelimiter;
				ce.style.paddingTop = "5px";
				ce.innerHTML = "";
				for( var j=0 ; j<listOfCategories.length ; j++) {
					listOfCategoriesId[listOfCategories[j].categoryId] = listOfCategories[j].categoryName;
					listOfCategoriesDesc[listOfCategories[j].categoryId] = listOfCategories[j].categoryDescription;
					//
					var catname = listOfCategories[j].categoryName;
					//while( catname.indexOf(" ") != -1 ){
					//	catname = catname.replace(" ","_");
					//}
					//
						ce.innerHTML += makeCategoryLink(listOfCategories[j].categoryId,catname + "("+listOfCategories[j].categoryNumEntries+")");
					// delimiter
					if( j != listOfCategories.length-1){
						ce.innerHTML += categoryDelimiter;
					}
				}
				ce.innerHTML = "<a onMouseOver='showAlt(event,this.id,\"HOME\",\"Reload this page\")' onMouseOut='hideAlt()' id='homelink' href='javascript:window.location.reload()'>HOME</a> | <a onMouseOver='showAlt(event,this.id,\"View All\",\"View all the blog entries starting from the most recent...\")' onMouseOut='hideAlt()' id='viewalllink' onclick='javascript:viewDefault()' style='cursor:pointer; text-decoration:underline'>View All</a> or choose to read: " + ce.innerHTML;
				//ce.innerHTML = "<a href='javascript:viewDefault()'>Homepage</a>" + ce.innerHTML;
				//ce.innerHTML += "<br /><p>&nbsp;</p>";
				/*
					check if startWithViewAll is set to start loading all entries
				*/
				document.getElementById("entriesTotal").innerHTML = "";
				//
				//
				//
				pagedone = true;
			}catch(e){
				alert("[JSON Parse Error on populateCategoryMenu()] " + e.description + "\n" + http.responseText);
				//expose(e,document.getElementById("entryTitle0"));
			}
			//
			//
			//
				if (rsslink != -1){
					//alert(rsslink);
					exitFlashToPage(rsslink);
				}
				if (fastfwd != "") {
					exitFlashToPage(fastfwd);
				}
				if (singleView != "") {
					viewSingleEntry(singleView);
				}
				if (startWithViewAll) {
					if (currentPage != 1) {
						totalNumberOfPages = Math.ceil(getTotalNumEntriesForAll()/numberPerPage);
						updatePagination();
					}else{
						currentPage = 1;
						viewAllEntries();
					}
				}
			
		} else {
			alert("There was a problem retrieving the XML data. There could be a problem with the Internet connection\n\n" + http.statusText);
		}
	}
}
function getCategoryNameFromId(id) {
	return listOfCategoriesId[id];
}
function getCategoryDescFromId(id) {
	return listOfCategoriesDesc[id];
}
function setCategoryLabel(str) {
	//str = formatStringAsImage(str);
	document.getElementById("currentCategoryLabel").innerHTML = str;
}
function getNumEntriesFromCategoryId(id) {
	for (var i=0 ; i < listOfCategories.length ; i++) {
		if ( listOfCategories[i].categoryId == id ) {
			return listOfCategories[i].categoryNumEntries;
		}
	}
	return null;
}
function getTotalNumEntriesForDate(date_string){
	try {
		for (var i=0; i<dateEntryArchives.length; i++) {
			if (dateEntryArchives[i].dateString == date_string) {
				return dateEntryArchives[i].numEntries;
			}
		}
	}catch(e){
		alert(e);
	}
}
function getTotalNumEntriesForAll() { //except 999
	var sum = 0;
	for (var i=0 ; i < listOfCategories.length ; i++) {
		if ( listOfCategories[i].categoryId != "999" ) {
 		 sum += Number(listOfCategories[i].categoryNumEntries);
		}
	}
	//alert("There are a total of: " + sum + " entries");
	return sum;
}
function makeCategoryLink(id,str) {
	var al = "<a id='catlink"+id+"' style='cursor:pointer; padding:2px' onMouseOut='this.style.fontWeight=\"normal\";this.style.textDecoration=\"none\";this.style.background=\"\";hideAlt()' onMouseOver='this.style.background=\"#FFCC00\";this.style.textDecoration=\"underline\";this.style.fontWeight=\"normal\"; showAlt(event,this.id,\"Chapter\",\""+str+"\")' onclick=\"javascript:viewByCategories(" + id + ");\">" + str + "</a>";
	return al;
}
function viewByDate(date_string) {
	if (!ajaxIsWorking) {
		try{
			showWorking();
			if (currentCategoryView.toString() != date_string) {
	            currentCategoryView = date_string;  //denotes all categories
				currentPage = 1;
			} else {
			}
			//alert(date_string + ", " + numberPerPage);
			// loadPage
			totalNumberOfPages = Math.ceil(getTotalNumEntriesForDate(date_string)/numberPerPage);
			setCategoryLabel("Archives for " + shortDateToString(date_string));
			//var category = document.getElementById("category").value;
			//alert(date_string + "&perpage=" + numberPerPage + "&pageno=" + currentPage);
			http.open("GET",phpActionGateway + "?type=dateview&action=view&daterange=" + date_string + "&perpage=" + numberPerPage + "&pageno=" + currentPage + "&hash=" + Math.random(),true);
			http.send("");
			//---callback handler has to be placed explicitly after "http.open()" for MSIE
			http.onreadystatechange = storeEntries;
			//alert("Sent XMLHttp");
		}catch(e){
			alert("Could not send ajax data!");
		}
	}else{
		//---
	}
}
/*
	view entries according to categories
	viewAllEntries retrieves all entries irregradless of category
*/
function viewAllEntries(){
	if (!ajaxIsWorking) {
		try{
			hideAlt();
		}catch(e){
			// I dont need to see the alert for tool tip
		}
		try{
			var pageno = currentPage;
			if (historyPage != -1){
				pageno = historyPage;
			}else{
			}
			//alert("Going to page "+pageno);
			currentPage = pageno;
			//
			//
			//
			showWorking();
            currentCategoryView = "*";  //denotes all categories
			//
			totalNumberOfPages = Math.ceil(getTotalNumEntriesForAll()/numberPerPage);
			setCategoryLabel(defaultBlogHomeLabel+"<br>"+"<span class='plainJaneExtraSmall'>" + defaultBlogHomeDesc + "</span>");
			//var category = document.getElementById("category").value;
			http.open("GET",phpActionGateway + "?type=entries&action=viewall&perpage=" + numberPerPage + "&pageno="+currentPage+"&hash=" + Math.random(),true);
			http.send("");
			//---callback handler has to be placed explicitly after "http.open()" for MSIE
			http.onreadystatechange = storeEntries;
			//alert("Sent XMLHttp");
		}catch(e){
			alert("Could not send ajax data!");
		}
	}else{
		//---
	}
}
function viewByCategories(category){
	//Do not send information while ajax is working in the background
	if (!ajaxIsWorking) {
		//window.scrollTo(0,0);
		slowScrollTop();
		if (currentCategoryView != category) {	//if a different category is selected
			//
			if (category == 999){
				/*
				 * uncomment if you wish to limit the user to a number of attempts on the password
				if (tries >= maxTries) {
					alert("Sorry! You have exceeded the maximum number of tries");
					return;
				}
				*/
				//
				var pass = prompt("Enter password","");
				authSpecial(pass);
				return;
			}
			//---
			currentPage = 1;	//initialize current page to the first
			setCategoryLabel( getCategoryNameFromId(category) + "<br><span class='plainJaneExtraSmall'>"+ getCategoryDescFromId(category) + "</span>");
			totalNumberOfPages = Math.ceil(getNumEntriesFromCategoryId(category) / numberPerPage);
			//
			//hideFlashmain();
			//exitFlashToPage(currentPage);
		}else{
		//alert("pageno is "+pageno);
			var pageno = currentPage;
			if (historyPage != -1){
				pageno = historyPage;
			}else{
			}
			//alert("Going to page "+pageno);
			currentPage = pageno;
		}
		//
		currentCategoryView = category;
		//
		//exitFlashToPage(currentPage);
			try{
				showWorking("<img src='img/loading2.gif' border='0' />"+" Loading "+getCategoryNameFromId(currentCategoryView));
				//var category = document.getElementById("category").value;
				http.open("GET",phpActionGateway + "?type=entries&action=view&pageno=" + currentPage + "&perpage=" + numberPerPage + "&id=" + category + "&hash=" + Math.random(),true);
				http.send("");
				//---callback handler has to be placed explicitly after "http.open()" for MSIE
				http.onreadystatechange = storeEntries;
				//alert("Sent XMLHttp");
				//---log browsing info
				//logBrowsingInfo();
				//clearEntries();
			}catch(e){
				alert("Could not send ajax data for viewByCategories()!\n"+e);
			}
	}
}
//
//	THIS ALLOWS YOU TO VIEW ANY ENTRY
//
function viewSingleEntry(entry_id){
	//Do not send information while ajax is working in the background
	if (!ajaxIsWorking) {
		//window.scrollTo(0,0);
		slowScrollTop();
		currentPage = 1;	//initialize current page to the first
		setCategoryLabel("<div onclick='javascript:window.location.href=\"visualblog.php\"' style='cursor:pointer; font-size:12px'><img src='img/cursor-white-right.jpg' border='0' align='absmiddle' /> Click here to return to Visual Blog</div>");
		totalNumberOfPages = 1;
		//
		//currentCategoryView = category;
		//
		//exitFlashToPage(currentPage);
			try{
				showWorking("Please wait...");
				//var category = document.getElementById("category").value;
				http.open("GET",phpActionGateway + "?id="+entry_id+"&type=singleentry&action=viewone&hash=" + Math.random(),true);
				http.send("");
				//---callback handler has to be placed explicitly after "http.open()" for MSIE
				http.onreadystatechange = storeEntries;
				//alert("Sent XMLHttp");
				//---log browsing info
				//logBrowsingInfo();
				//clearEntries();
			}catch(e){
				alert("Could not send ajax data for viewSingleEntry()!\n"+e);
			}
	}
}
//
//
//
//---
function storeEntries(){
	//alert("HTTP state: " + http.readyState);
	if (http.readyState == 4) {
		// only if "OK"
		if (http.status == 200) {
			hideFlashmain();
			//
			hideWorking();
			//---create XML from string
			//alert("Received[200] All and Well");
			try{
				//createXMLObject(http.responseXML);
				try{
					//window.scrollTo(0,0);
					slowScrollTop();
					//alert("BEFORE:\n" + http.responseText);
					//alert("AFTER:\n" + removeJPEGError(http.responseText));
					var nvp = eval('('+removeJPEGError(http.responseText)+')');
					//document.getElementById("entryTitle0").innerHTML = "OK:<br />"+nvp.length;
					entriesDump = nvp;
					//currentPage = 1;
					//setNumberOfPages(nvp.length,numberPerPage);
					//document.getElementById("entriesTotal").innerHTML = "Total: " + nvp.length + " entries";
					//---
					try {
						populateEntriesForPage(currentPage);
						logBrowsingInfo();
					} catch (e) {
						alert("Could not populate entries");
					}
					//
					//	HIstory Stack remember
					//
					try{
						//alert("Storing...."+currentCategoryView+", "+ currentPage);
						if (!isHistory) { 
							ajaxStoreNav(currentCategoryView, currentPage);
						}
					}catch(e){
						alert("Could not store into history stack!\n"+e);
					}
				}catch(e){
					//alert("[JSON Parse Error on storeEntries()]\n" + e + "\n" + http.responseText);
				}
			}catch(e){
				alert(e);
			}
		} else {
			alert("There was a problem retrieving the XML data. There could be a problem with the Internet Connection\n\n" + http.statusText);
		}
	}
};
/*
	Implementations for mapping table indexes to entry IDs on the page
*/
function getEntryIdByIndex(index) {
	return entryToIndexMap[index];
}
function getIndexByEntryId(entryId) {
	for( var z=0 ; z<entryToIndexMap.length ; z++ ) {
		//alert(entryToIndexMap[z] + " : " + entryId);
		if (entryToIndexMap[z] == entryId) {
			return z;
		}
	}
	return null;
}
/*
	Pagination
*/
function setNumberOfPages(total,perpage){
	totalNumberOfPages = Math.ceil(total/perpage);
}
function clearEntries(){
	for (var i=0 ; i < numberPerPage ; i++) {
		document.getElementById("entryComments"+i).innerHTML = "";
		document.getElementById("commentsLoaded"+i).innerHTML = "";
		document.getElementById("entryDelimiterImage"+i).innerHTML = "";
		document.getElementById("entryTitle"+i).innerHTML = "";
		document.getElementById("entryDate"+i).innerHTML = "";
		document.getElementById("entryMainImage"+i).innerHTML = "";
		document.getElementById("entryDetails"+i).innerHTML = "";
		document.getElementById("entryNumComments"+i).innerHTML = "";
		document.getElementById("entryCategory"+i).innerHTML = "";
		document.getElementById("entryIsCommentable"+i).innerHTML = "";
		document.getElementById("toggleEntryCommentsLink"+i).innerHTML = "";
		document.getElementById("dummyFooter"+i).innerHTML = "";
	}
}
function populateEntriesForPage(pageNo) {
	//
	hideComments();
	//
	clearEntries();
	//---deprecated code: do not remove for now
	/*
	var otp;
	if( pageNo != totalNumberOfPages ) {	//check if at least 2 pages
		otp = numberPerPage; 
	} else if( totalNumberOfPages==1 ) {	//check if it's the only page
		otp = entriesDump.length;
	} else {								//it has to be the last page but more than 2 pages
		otp = numberPerPage - ((totalNumberOfPages * numberPerPage) - entriesDump.length);
	}
	*/
	//
	//var startIndex = (pageNo-1) * numberPerPage;
	var startIndex = 0;
	var otp = entriesDump.length;
	//
	try{
	for(var i=0 ; i<otp ; i++) {
		//clear fields
		document.getElementById("entryComments"+i).innerHTML = "";
		document.getElementById("commentsLoaded"+i).innerHTML = "n";
		//---delimiter image
		document.getElementById("entryDelimiterImage"+i).innerHTML = "<img src='delims-img/" + entriesDump[startIndex].entryDelimiterImage + "' border='0' />";
		//---entry title
		document.getElementById("entryTitle"+i).innerHTML = entriesDump[startIndex].entryTitle;
		//---entry date
		document.getElementById("entryDate"+i).innerHTML = datetimeToString( entriesDump[startIndex].entryDate ) + " (GMT +8:00)";
		//
		document.getElementById("entryCategory"+i).innerHTML = entryCategoryLabel + " " + getCategoryNameFromId(entriesDump[startIndex].entryCategory) + " <font color='#C0C0C0'>["+entriesDump[startIndex].entry+"]</font>";
		//
		//
	if (entriesDump[startIndex].entryIsConfidential == "1" && privacyFlag == true) {
		//
		document.getElementById("entryDetails"+i).innerHTML = "<div style='font-face:Century, Times New Roman; font-size:12px; color:#FF0000' align='center'><br><div onclick='javascript:authenticatePrivateEntry()' onMouseOver='this.style.border=\"1px solid #FF0000\"' onMouseOut='this.style.border=\"1px solid #FFF\"' style='cursor:pointer;border:1px solid #FFF; padding-top:60px; padding-bottom:60px'><img src='img/noentry.gif' border='0' /><br><b>Restricted Access.</b><br><img src=\"img/PointFinger.gif\" border=\"0\" /><br>This entry has been password-protected due to potentially sensitive content<br><font size='1'>If you wish to read the rest of this entry, please drop me a message.</font><br></div></div>";
		//
	} else {
		//--- uncomment if you wish the viewers to always enter a password when they reach the page
		//privacyFlag = true;
		//
		//
		//
		//---entry main image
		document.getElementById("entryMainImage"+i).innerHTML = makeImageFromSource(entriesDump[startIndex].entryMainImage);
		//---entry write up
		document.getElementById("entryDetails"+i).innerHTML = tagsToHtml( entriesDump[startIndex].entryDetails );
		//---entry Num comments
		//document.getElementById("entryNumComments"+i).innerHTML = "No. of comments: " + entriesDump[startIndex].entryNumComments;
		//---entry category name
		var starred = "";
		if (entriesDump[startIndex].entryFavHits>0) {
		starred = "<span style='text-align:left; font-family:Arial; font-weight:bold; font-size:12px; background: url(\"img/star_fav_icon.jpg\") no-repeat top right;'>"+entriesDump[startIndex].entryFavHits+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>";
		}
		//
		document.getElementById("entryCategory"+i).innerHTML = entryCategoryLabel + " " + getCategoryNameFromId(entriesDump[startIndex].entryCategory) + " <font color='#C0C0C0'>["+entriesDump[startIndex].entry+"]</font>&nbsp;" + starred;
		
		/*
		"<a id='metalLinkAnchor"+entriesDump[startIndex].entry+"' href='main.php?entry=" +entriesDump[startIndex].entry+ "&doexit' style='text-decoration:none' onMouseOver='showAlt(event,this.id,\"Link this entry\",\"Copy and paste the location of this link to reference it from anywhere.\")' onMouseOut='hideAlt()'><img src='img/metal_link.gif' border='0' align='absmiddle'/></a>";
		*/
		
		//document.getElementById("entryTitleFont"+i).innerHTML = entriesDump[startIndex].entryTitleFont;
		//set up 'add comment' tag
		if (entriesDump[startIndex].entryIsCommentable == "y") {
			document.getElementById("entryIsCommentable"+i).innerHTML = makeACLabel(entriesDump[startIndex].entry);
		} else {
			document.getElementById("entryIsCommentable"+i).innerHTML = commentsDisabledImage;
		}
		//---set view comments link
		if (entriesDump[startIndex].entryNumComments>0) {
			document.getElementById("toggleEntryCommentsLink"+i).innerHTML = makeVCLabel(entriesDump[startIndex].entry);
		} else {
			document.getElementById("toggleEntryCommentsLink"+i).innerHTML = noCommentsLabel;
		}
		//
		document.getElementById("starSection"+i).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='500' height='50'><param name='movie' value='flv/set_star.swf?eid="+entriesDump[startIndex].entry+"'><param name='quality' value='high'><param name='wmode' value='transparent'><embed wmode='transparent' src='flv/set_star.swf?eid="+entriesDump[startIndex].entry+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='500' height='50'></embed>";
		//
		document.getElementById("dummyFooter"+i).innerHTML = "<br /><br /><br />";
		//map entry ids to indexes
		entryToIndexMap[i] = (entriesDump[startIndex].entry);
	} // end isCOnfidential
		//---be sure to increment startIndex
		startIndex++;
	}
	}catch(e){
		// This catches the overflow in the event of browsing category 999
		//
		//alert(e);
	}
	//currentPage = pageNo;
	//
	/*
	var _pageRange = 10;
	var _pageLimitFirst = Math.floor(Number(pageNo) / _pageRange);
	var _pageStartPage = (_pageLimitFirst * _pageRange) + 1;
	var _pagingString = "";
	for(var i=_pageStartPage; i<(_pageStartPage+10) ; i++){
		if (i>totalNumBerOfPages) 
			break;
		//
		_pagingString += "["+_pageStartPage+"]";
	}
	document.getElementById("page").innerHTML = _pagingString;
	//
	*/
	try{
		updatePagination();
	}catch(e){
		alert("Error in updating pagination: "+e);
	}
}
//---pagination
function updatePagination(){
	//totalNumberOfPages = Math.ceil(getTotalNumEntriesForAll()/numberPerPage);
	//
	var le = document.getElementById("prevPage");
	var re = document.getElementById("nextPage");
	var fle = document.getElementById("prevPageFooter");
	var fre = document.getElementById("nextPageFooter");
	if (totalNumberOfPages==1) {
		fle.innerHTML = le.innerHTML = "";
		fre.innerHTML = re.innerHTML = "";
	} else if(currentPage == 1) {
		fle.innerHTML = le.innerHTML = "";
		fre.innerHTML = re.innerHTML = makeNPLink(nextPageLabel);
	} else if(currentPage == totalNumberOfPages) {
		fle.innerHTML = le.innerHTML = makePPLink(prevPageLabel);
		fre.innerHTML = re.innerHTML = "";
	} else {
		fle.innerHTML = le.innerHTML = makePPLink(prevPageLabel);
		fre.innerHTML = re.innerHTML = makeNPLink(nextPageLabel);
	}
	//
	//
	//
	try{
	var _pageRange = 10;
	var _pageLimitFirst = Math.floor(Number(currentPage-1) / _pageRange);
	var _pageStartPage = (_pageLimitFirst * _pageRange) + 1;
		var _pageMoreRecent = _pageStartPage - _pageRange;
		if (_pageMoreRecent <= 0){
			var _pagingString = "| ";
		}else{
			var _pagingString = "<a href='javascript:gotoPage(" + (_pageMoreRecent+_pageRange-1) + ")'>&lt;&lt;</a> | ";
		}
		//
		//var _pageEarlier = (_pageStartPage + _pageRange - 1) + _pageRange;
		if (_pageStartPage + _pageRange > totalNumberOfPages) {
			var _pagingStringLast = "";
		}else{
			var _pagingStringLast = " <a href='javascript:gotoPage("+(_pageStartPage+_pageRange)+")'>&gt;&gt;</a>";
		}
	for(var i=_pageStartPage; i<(_pageStartPage+10) ; i++){
		if (i>totalNumberOfPages) 
			break;
		//
		if (currentPage != i){ 
			//_pagingString += "<a href='javascript:gotoPage("+i+")'>"+i+"</a> | ";
			_pagingString += "<a href='javascript:gotoPage("+i+")'>" + (totalNumberOfPages - i + 1) + "</a> | ";
		}else{
			//_pagingString += "<b><big>"+i+"</big></b> | ";
			_pagingString += "<span style='text-decoration:blink'><b><big><font color='#FF1100' face='Georgia'>" + (totalNumberOfPages - i + 1) + "</font></big></b></span> | ";
		}
	}
	_pagingString += _pagingStringLast;
	document.getElementById("page").innerHTML = _pagingString;
	}catch(e){
		alert(e);
	}
}
//---make paging elements active
function makeNPLink(label){
	return "<a href='javascript:nextPage()' id='NPLink' onMouseOver='showAlt(event,this.id,\"Page next\",\"View the entry before this\")' onMouseOut='hideAlt()'>"+label+"</a>";
}
function makePPLink(label){
	return "<a href='javascript:prevPage()' id='PPLink' onMouseOver='showAlt(event,this.id,\"Page before\",\"View the entry after this\")' onMouseOut='hideAlt()'>"+label+"</a>";
}
function loadPage() {
	try{
		historyPage = -1;
		hideFlashmain();
		var catAsString = currentCategoryView.toString();
		//alert("Viewing - " + catAsString);
    	if(currentCategoryView == "*") {
    	    viewAllEntries();
    	}else if (catAsString.indexOf("-")==4 && catAsString.length == 7) {
			viewByDate(catAsString);
		}else{
			viewByCategories(currentCategoryView);
    	}
	}catch(e){
		alert(e);
	}
}
function gotoPage(page){
	if(!ajaxIsWorking) {
		isHistory = false;
		//clearEntries();
		//window.scrollTo(0,0);	//needed to reset position on the page
		slowScrollTop();
	//var np = currentPage+1;
		currentPage = page;
	//populateEntriesForPage(np);
		loadPage();
	//---log
		//logBrowsingInfo();
	}
}
function nextPage(){
	if(!ajaxIsWorking) {
		isHistory = false;
		//clearEntries();
		//window.scrollTo(0,0);	//needed to reset position on the page
		slowScrollTop();
	//var np = currentPage+1;
		currentPage++;
	//populateEntriesForPage(np);
    	loadPage();
	//---log
		//logBrowsingInfo();
	}
}
function prevPage(){
	if(!ajaxIsWorking) {
		isHistory = false;
		//clearEntries();
		//window.scrollTo(0,0);
		slowScrollTop();
		//var pp = currentPage-1;
		currentPage--;
    	loadPage();
		//---log
		//logBrowsingInfo();
	}
}
/*
	Comments within entries
*/
function populateComments(entryId) {
	try {
		showWorking();
		http.open("GET",phpActionGateway + "?type=comments&action=view&id="+entryId,true);
		http.send("");
		http.onreadystatechange = function(){
			document.getElementById("commentsClickLoader").style.display = "none";
			if(http.readyState == 4 && http.status == 200){
				hideWorking();
				var tblRow = getIndexByEntryId(entryId);	//retrieve table row index
				//set the comments display to visible
				document.getElementById("commentsLoaded" + tblRow).innerHTML = "y";
				document.getElementById("entryComments" + tblRow).style.display = "block";
				var comments = eval('(' + http.responseText + ')');
				//populate the comments area
				if( comments.length > 0 ) {
					for ( var i=0 ; i<comments.length ; i++ ) {
						document.getElementById("entryComments" + tblRow).innerHTML += "<fieldset>" + "<legend class='commentSender'>" + comments[i].commentSender + "</legend>" + "<span class='commentDetails'>"+ comments[i].commentDetails + "</span><br />- <span class='commentTimestamp'>"+ datetimeToString(comments[i].commentDateTime) + "</span></fieldset>";
					}
				} else {
					document.getElementById("entryComments" + tblRow).innerHTML = noCommentsLabel;
				}
			}
		}
	}catch(e){
		alert("Could not send AJAX data");
	}
}
function showComments(entryId) {
	document.getElementById("commentsClickLoader").style.display = "inline";
	var tblRow = getIndexByEntryId(entryId);
	if (document.getElementById("commentsLoaded" + tblRow).innerHTML == "n") {
		populateComments(entryId);
	} else {
		document.getElementById("commentsClickLoader").style.display = "none";
		if (document.getElementById("entryComments" + tblRow).style.display != 'none') {
			document.getElementById("entryComments" + tblRow).style.display = 'none';
		} else {
			document.getElementById("entryComments" + tblRow).style.display = 'block';
		}
	}
}
function hideComments() {
	//
	var iframeLayer = document.getElementById("iframeCommentsLayer");
	iframeLayer.style.display = "none";
}
function openAddComments(entryId) {
	//window.open("comments.php?id="+ entryId , "commentsPage" , "toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=450,left = 710,top = 60");
	try{
		hideComments();
		var iframeLayer = document.getElementById("iframeCommentsLayer");
		if ( iframeLayer.style.display != "none"){ 
			hideComments();
			return;
		}
		if (IE) { // grab the x-y pos.s if browser is IE
    tempX = document.body.scrollLeft
    tempY = document.body.scrollTop
  	} else {  // grab the x-y pos.s if browser is NS
  	  tempX = window.pageXOffset;
  	  tempY = window.pageYOffset;
  	}  
  	// catch possible negative values in NS4
  	if (tempX < 0){tempX = 0}
  	if (tempY < 0){tempY = 0}  
  	
	}catch(e){
		alert("Whoops! Couldn't locate the window!\n"+e);
	}
	// show the position values in the form named Show
  	// in the text fields named MouseX and MouseY
  /*
  	objectFollowingMouse > the object referenced by its 
	ID tag to receive focus from a mousemove event
  */
  try{
	  iframeLayer.style.left = 800 + tempX;
	  iframeLayer.style.top = 200 + tempY;
			iframeLayer.style.display = "block";
			eval("parent.iframeComments.location.href = 'comments.php?id='+ entryId");
		//alert(Number(18 + tempX)+ " , "+Number(18 + tempY));
  }catch(e){
	  alert("Whoops! Couldn't read the iframe! "+e);
  }
	//animateOutComments();
}
function makeVCLabel(entryId) {
	return "<a id='VCLabel' onMouseOver='showAlt(event,this.id,\"Hmmm....\",\"Looks like someone left something here...\")' onMouseOut='hideAlt()' href='javascript:showComments(" + entryId + ")'>" + viewCommentsLabel + "</a>";
}
function makeACLabel(entryId) {
	return commentImage + "<a id='ACLabel' onMouseOver='showAlt(event,this.id,\"Got something to say?\",\"Leave your print here.\")' onMouseOut='hideAlt()' href='javascript:openAddComments("+entryId+")'>" + addCommentLabel + "</a>";
}
/*
	creates the mark up tags for the main image in each entry
*/
function makeImageFromSource( imgsrc ) {
	if (imgsrc != "") {
		return "<div align='center'><img align='center' border='0' src='"+ imgsrc + "' /></div>";
	}else{
		return "";
	}
}
//---debugging purposes
//alert("xml-http-request.js is loaded");
//
//	SPECIAL FUNCTIONS
//	Implements any additional non-required modules
//	to the blog
//
//
//	Enable password functionality for category id 999
//
var tries = 0;
var maxTries = 3;
var authPass = false;
var authURL = "";	//I have hidden the suthenticated URL because of security reasons
var _ptemp = "";
function authSpecial(pswd) {
	if(ajaxIsWorking)
		return;
	if (tries >= maxTries) {
		//alert("Sorry! You have exceeded the maximum number of tries");
		manualLog("<font color='red'><b>Exceeded number of tries...</b></font>");
		return;
	}
	try{
		_ptemp = pswd;
		showWorking(workingImage2 + "Processing password..." , true);
		http.open("GET","classes2/authbong.php?pswd="+pswd,true);
		http.send("");
		http.onreadystatechange = processAuthSpecial;
	}catch(e){
		alert("Could not send special authentication data");
	}
}
function processAuthSpecial() {
	if(http.readyState == 4 && http.status == 200){
		hideWorking();
		if ( http.responseText != "" ) {
			alert("Correct password");
			authPass = true;
			authURL = http.responseText;
			loadCategory999();
		} else {
			tries++;
			//logSiteInfo("Attemped category 999. Tries:" + tries);
			alert("Failed.\nYou are trying to attempt a protected category on this site.\n\nYou have " + (maxTries-tries) + " tries left");
			try{
				manualLog("<font color='red'>Attempt to access restricted zone! Password: <b>" +_ptemp+ "</b></font>");
			}catch(e){
				alert(e);
			}
		}
	}
}
function loadCategory999() {
	if(ajaxIsWorking)
		return;
	if(!authPass)
		return;
	try{
		//---initialize page and categories
		currentPage = 1;	//initialize current page to the first
		currentCategoryView = 999;
		setCategoryLabel( getCategoryNameFromId(currentCategoryView) );
		totalNumberOfPages = Math.ceil(getNumEntriesFromCategoryId(currentCategoryView) / numberPerPage);
		//---send AJAX data
		alert("Welcome to Carebear Land!!!\nNote that starred entries will also show up under the 'Starred Entries' category");
		showWorking(workingImage2 + "(\",)(,\")" , true);
		http.open("GET",authURL,true);
		http.send("");
		http.onreadystatechange = storeEntries;
		//
	}catch(e){
		alert("Whoops");
	}
}
//
var allArchives = false;
function showAllArchives() {
	var tds = document.getElementById("archivesTable").getElementsByTagName("td");
	for (var i=0 ; i<tds.length ; i++) {
		if (allArchives && i>7) {
			document.getElementById("archive"+i).style.display = "none";
		}else{
			document.getElementById("archive"+i).style.display = "";
		}
	}
	var archiveLabel = document.getElementById("toggleArchiveDisplay");
	if (allArchives) {
		archiveLabel.innerHTML = "more...";
		allArchives = false;
	} else {
		archiveLabel.innerHTML = "hide";
		allArchives = true;
	}
}
var scrollTimeout;
var bscrollTimeout;
var lastYScroll = 0;
function slowScrollTop() {
	lastYScroll = 0;
	clearTimeout(scrollTimeout);
	window.scrollTo(0,0);
	/*
	var sXY = getScrollXY();
	window.scrollTo( 0 , sXY[1]*0.7 );
	if ( sXY[1] > 3) {
		clearTimeout(scrollTimeout);
		scrollTimeout = setTimeout(slowScrollTop,60);
	} else {
		clearTimeout(scrollTimeout);
		window.scrollTo(0,0);
	}
	//
	*/
	document.getElementById("working").style.top = 0;
}
function slowScrollBottom() {
	
	var sXY = getScrollXY();
	try{
		if (sXY[1]<=0) {
			sXY[1] = 3;
		}
		window.scrollTo( 0 , sXY[1]*1.7 );
		var newXY = getScrollXY();
		if (newXY[1] <= lastYScroll && lastYScroll!=0) {
			//alert("Stopped scrolling down: newXY[1]=" + newXY[1] + " and lastYScroll=" + lastYScroll);
			lastYScroll = 0;
			clearTimeout(scrollTimeout);
		} else {
			//clearTimeout(scrollTimeout);
			clearTimeout(scrollTimeout);
			scrollTimeout = setTimeout(slowScrollBottom, 60);
			lastYScroll = newXY[1];
		}
	}catch(e){
		alert(e);
	}
	document.getElementById("working").style.top = 0;
}
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}
//
//	Methods to call from Flash Object
//
function exitFlashToPage(pageNo){
	//manualLog("<font color='#336699'>Fast forwarding to - <b>" +pageNo+ "</b></font>");
	currentPage = pageNo;
	currentCategoryView="*";
	//tryExitFlash();
	try{
		//alert(totalNumberOfPages);
	}catch(e){
		alert(e);
	}
	gotoPage(currentPage);
}
var tryTimeout;
function tryExitFlash(){
	if (pagedone == true){
		gotoPage(currentPage);
	}else{
		clearTimeout(tryTimeout);
		tryTimeout = setTimeout(tryExitFlash,200);
	}
}
//
function toggleLeftHider(){
	try{
	hideAlt();
	var obj = document.getElementById("leftHider");
	var image = document.getElementById("leftHiderClick");
	image.style.border = "";
	if (obj.style.display == ""){
		obj.style.display = "none";
		image.innerHTML = "<img src='img/icon-ts-expanded.gif' border='0'>";
		image.style.width = "auto";
	}else{
		obj.style.display = "";
		image.innerHTML = "<img src='img/icon-ts-retracted.gif' border='0'>";
		image.style.width = "180px";
	}
	}catch(e){
		alert(e);
	}
}
function toggleRightHider(){
	try{
		hideAlt();
	var obj = document.getElementById("rightHider");
	var image = document.getElementById("rightHiderClick");
	image.style.border = "";
	if (obj.style.display == ""){
		obj.style.display = "none";
		image.innerHTML = "<img src='img/icon-chp-expanded.gif' border='0'>";
	}else{
		obj.style.display = "";
		image.innerHTML = "<img src='img/icon-chp-retracted.gif' border='0'>";
	}
	//
	//
	//
	}catch(e){
		alert(e);
	}
}
function toggleProfileHider() {
	var rp = document.getElementById("profileHider");
	//var rct = document.getElementById("recentCommentsHandler");
	if ( rp.style.display == "") {
		rp.style.display = "none";
		//rct.innerHTML = "<img src='img/icon-visitors-retracted.gif' border='0' />";
	} else {
		rp.style.display = "";
		//rct.innerHTML = "<img src='img/icon-visitors-expanded.gif' border='0' />";
	}
}
function toggleRecentCommentsHider() {
	var rch = document.getElementById("recentCommentsHider");
	var rct = document.getElementById("recentCommentsHandler");
	if ( rch.style.display == "") {
		rch.style.display = "none";
		rct.innerHTML = "<img src='img/icon-visitors-retracted.gif' border='0' />";
	} else {
		rch.style.display = "";
		rct.innerHTML = "<img src='img/icon-visitors-expanded.gif' border='0' />";
	}
}
function toggleRecentEntriesHider() {
	var rch = document.getElementById("recentEntriesHider");
	var rct = document.getElementById("recentEntriesHandler");
	if ( rch.style.display == "") {
		rch.style.display = "none";
		rct.innerHTML = "<img src='img/pencil_entries.gif' border='0' />";
	} else {
		rch.style.display = "";
		rct.innerHTML = "<img src='img/pencil_entries_expanded.gif' border='0' />";
	}
}
//
//
//
function gotoPageByEntryId(entryID) {
	//exitFlashToPage(fastfwd)
	if(ajaxIsWorking) {
		return;
	}
	try{
		isHistory = false;
		//---initialize page and categories
		currentPage = 1;	//initialize current page to the first
		currentCategoryView = "*";
		totalNumberOfPages = Math.ceil(getTotalNumEntriesForAll()/numberPerPage);
		setCategoryLabel(defaultBlogHomeLabel+"<br>"+"<span class='plainJaneExtraSmall'>" + defaultBlogHomeDesc + "</span>");
		//---send AJAX data
		showWorking(workingImage2 + "wait..." , true);
		http.open("GET",phpActionNav+"?entry="+entryID,true);
		http.send("");
		http.onreadystatechange = onGotoPageByEntryID;
		//
	}catch(e){
		alert("Whoops");
	}
}
function onGotoPageByEntryID(){
	if(http.readyState == 4 && http.status == 200){
		hideWorking();
		//alert("Page "+http.responseText);
		exitFlashToPage(http.responseText);
	}
}
//
//
//
function authenticatePrivateEntry(){
	try{
		var passphrase = prompt("This entry has been password-enabled to protect the confidentiality or sensitivity of its content.","Enter the password");
		var attempt = passphrase;
		try{
			passphrase = hex_md5(passphrase);
		}catch(e){
			return;
		}
		if ( passphrase == kennySpecialPass ){
			//--- reveal the current private entry
			try{
				//---alert(passphrase + " = " + kennySpecialPass);
				alert("Correct pass phrase. You may now view all password protected entries on this site unless you navigate away from this page.");
				manualLog("<font color='green'>PASS. Viewing protected entry using password - <b>" + attempt + "</b></font>");
				privacyFlag = false;
				gotoPage(currentPage);
			}catch(e){
				alert("The authentication passed but there was a problem parsing the page:\n" + e);
			}
			//
		}else{
			//logRandomInfo("An attempt was made to access a private entry with the pass phrase: "+attempt)
			manualLog("<font color='red'>An attempt was made to access this password-protected entry. The password was: <b>" + attempt + "</b></font>");
			alert("Wrong pass phrase");
			return;
		}
	}catch(e){
		alert(e);
	}
}
//
//	Increase/Decrease entry font size
//
var currentFontSize = 0;
function increaseBlogFontSize(){
	var fontTgt = document.getElementById("entryDetailsTD");
	if (currentFontSize < 2) {
		currentFontSize++;
	}
	fontTgt.className = "entryDetails" + currentFontSize;
	//alert(fontTgt.className);
}
function decreaseBlogFontSize(){
	var fontTgt = document.getElementById("entryDetailsTD");
	if (currentFontSize > 0) {
		currentFontSize--;
	}
	fontTgt.className = "entryDetails" + currentFontSize;
	//alert(fontTgt.className);
}