function buildBlogArchive(entries)//{{{
{
	var archiveList = document.createElement('ul');
	for (var i=0;i<entries.length;i++) {
		archiveList.appendChild(
			buildBlogArchiveItem(
				entries[i][0],
				entries[i][1],
				entries[i][2]
				)
			);
	}
	
	return archiveList;
} //}}}

function buildBlogArchiveItem(header,intro,url)//{{{
{
	var archiveItem = document.createElement('li');
	
	var archiveItemLink = document.createElement('a');
	archiveItemLink.appendChild(document.createTextNode(header));
	archiveItemLink.setAttribute('href',url);
	
	var archiveItemIntro = document.createElement('p');
	archiveItemIntro.appendChild(document.createTextNode(intro));
	
	archiveItem.appendChild(archiveItemLink);
	archiveItem.appendChild(archiveItemIntro);
	
	return archiveItem;
} //}}}

/*
function showBlogArchive(entries)//{{{
{
	var itemList = buildBlogArchive(entries);
	
	//alert(mouseX+' | '+mouseY);
	
	if (!document.getElementById('listBlogArchive')) {
		var toolTipBox = document.createElement('div');
		toolTipBox.setAttribute('class','moduleBox');
		toolTipBox.appendChild(itemList);
		toolTipBox.setAttribute('id','listBlogArchive');
		toolTipBox.setAttribute('style','');
		toolTipBox.style.position = 'absolute';
		toolTipBox.style.zIndex = 100;
		toolTipBox.style.visibility = 'visible';
		toolTipBox.onmouseout=function(e)
		{
			var toolTipBox = document.getElementById('listBlogArchive');
			if (
				mouseX > toolTipBox.offsetLeft &&
				mouseX < toolTipBox.offsetRight &&
				mouseY < toolTipBox.offsetTop &&
				mouseY < toolTipBox.offsetBottom
				)
			return;
			
			this.style.visibility = 'hidden';
		}
		document.getElementsByTagName('body')[0].appendChild(toolTipBox);
	} else {
		var toolTipBox = document.getElementById('listBlogArchive');
		toolTipBox.replaceChild(itemList,toolTipBox.firstChild);
		toolTipBox.style.visibility = 'visible';
	}
	
	toolTipBox.style.top = (mouseY-5)+'px';
	toolTipBox.style.left = (mouseX-5)+'px';
	
} //}}}
*/

function showDayArchive(caller,bloggerID)//{{{
{
	var toolTipBoxID = 'ttArchiveList_'+caller.id;
	
	if (document.getElementById(toolTipBoxID)) {
		var toolTipBox = document.getElementById(toolTipBoxID);
		toolTipBox.style.visibility = 'visible';
		
		//alert(findPosX(caller)+'x'+findPosY(caller));
		
		return;
	} else {
		xajax_buildDayArchive(caller.id,bloggerID);
	}
	
} //}}}

function hideDayArchive(e)//{{{
{
	if (!e) e=window.event;
	
	var posX = e.pageX;
	var posY = e.pageY;
	
	switch(this.tagName.toLowerCase()) {
		case('td'):
			var ttDiv = this.getElementsByTagName('div')[0];
			var ttTd = this;
			break;
		case('div'):
			var ttDiv = this;
			var ttTd = this.parentNode;
			break;
	}
	
	if (posX >= ttTd.offsetLeft && posX <= (ttTd.offsetLeft+ttTd.offsetWidth) && posY >= ttTd.offsetTop && posY <= (ttTd.offsetTop+ttTd.offsetHeight))
		return;
	
	if(posX >= ttDiv.offsetLeft && posX <= (ttDiv.offsetLeft+ttDiv.offsetWidth) && posY >= ttDiv.offsetTop && posY <= (ttDiv.offsetTop+ttDiv.offsetHeight))
		return;
	
	alert(e.type);
	ttDiv.style.visibility = 'hidden';
	//alert(this.tagName.toLowerCase()+' | '+posY+' | '+(ttDiv.offsetTop+ttDiv.offsetHeight));
} //}}}

function buildDayArchive(callerID,entries,position)//{{{
{
	var archiveList = document.createElement('ul');
	for (var i=0;i<entries.length;i++) {
		archiveList.appendChild(
			buildBlogArchiveItem(
				entries[i][0],
				entries[i][1],
				entries[i][2]
				)
			);
	}
	
	var toolTipBoxID = 'ttArchiveList_'+callerID;
	var toolTipBox = document.createElement('div');
	var parentElement = document.getElementById(callerID).parentNode;
	
	toolTipBox.setAttribute('class','moduleBoxPopUp');
	toolTipBox.appendChild(archiveList);
	toolTipBox.setAttribute('id',toolTipBoxID);
	toolTipBox.setAttribute('style','');
	toolTipBox.style.float = 'left';
	toolTipBox.style.position = 'absolute';
	toolTipBox.style.marginTop = '-2px';
	toolTipBox.style.marginLeft = '2px';
	toolTipBox.style.position = 'absolute';
	//toolTipBox.style.top = '5px';//(findPosY(parentElement)+5)+'px';
	//toolTipBox.style.left = '5px';//(findPosX(parentElement)+5)+'px';
	toolTipBox.style.zIndex = 200;
	toolTipBox.style.visibility = 'visible';
	toolTipBox.id=toolTipBoxID;
	toolTipBox.className='moduleBoxPopUp';
	//toolTipBox.onmouseout = hideDayArchive;
	
	if (!parentElement.style) parentElement.style = '';
	parentElement.style.position = 'relative';
	parentElement.appendChild(toolTipBox);
	parentElement.onmouseout = hideDayArchive;
	//alert(parentElement.tagName);
	
	//alert(findPosX(parentElement)+' x '+findPosY(parentElement));
} //}}}


function findPosX(obj)//{{{
{
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	
	return curleft;
} //}}}

function findPosY(obj)//{{{
{
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	
	return curtop;
} //}}}