addLoadListener(function()
{	
	bObj = document.getElementsByTagName('body').item(0);
	
	imgNav = document.getElementById('article_img_nav');
	
	if (imgNav) {
		transDiv = document.createElement('div');
		transDiv.setAttribute('id','print');
		bObj.insertBefore(transDiv, bObj.nextSibling);
		imgNav.getElementsByTagName('li')[0].getElementsByTagName('a')[0].onclick = new Function("printArticle(this);return false;");
	}
	
	preloading(
	"buttons/close_category_articles.gif"
	);
});

function printArticle(link) {
document.getElementById('print').innerHTML = '<h1>BodyLife Articles</h1>'+document.getElementById('article_info').innerHTML;

window.print();
}

var myimages = [];
//var loadCount = 0;
function preloading() {
for (i = 0; i < preloading.arguments.length; i++) {
	myimages[i] = new Image();
	myimages[i].src = "images/"+preloading.arguments[i];
//	myimages[i].onload = new function() {
//		loadCount++;
//		if (loadCount == preloading.arguments.length) {
//			alert(preloading.arguments.length);
//		}
//	};
}
}

currentOpenList = '';

function articleList(option,obj) {
listObj = obj.parentNode.nextSibling;
if (option == 'show') {
	if (currentOpenList != '' && currentOpenList != obj) {
//		currentOpenList.innerHTML = 'View All Articles';
		currentOpenList.className = 'view_all';
		currentOpenList.parentNode.nextSibling.style.display = 'none';
	}
	
	if (currentOpenList == obj) {
		articleList('hide',obj);
		return;
	}
	
//	obj.innerHTML = 'Close All Articles';
	obj.className = 'close_all';
	listObj.style.display = 'block';
	blcid = obj.href.match(/blcid=(\d+)$/);
	location.href = "#blcid" + blcid[1];
	currentOpenList = obj;
//	linkPos = findPos(obj.parentNode);
//	eventScroll(0,linkPos[1]-7);
} else {
//	obj.innerHTML = 'View All Articles';
	obj.className = 'view_all';
	listObj.style.display = 'none';
	currentOpenList = '';
}
}

var inc = 4;

function eventScroll(initY,finalY) {
if (initY != finalY) {
 rate = Math.ceil((finalY - initY) / inc);
 newPos = initY + parseInt(rate);
 scroll(0,newPos);
 
 scrollTimer = window.setTimeout("eventScroll(" + newPos + ", " + finalY + ");", 2);
}
}

function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
	curleft = obj.offsetLeft
	curtop = obj.offsetTop
	while (obj = obj.offsetParent) {
		curleft += obj.offsetLeft
		curtop += obj.offsetTop
	}
}
return [curleft,curtop];
}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}