var pageLoaded;
function onPageLoad() {
	preloadImages();
	pageLoaded = true;
	//setMenuActive();
}

function onPageResize() {
}

function preloadImages() {
	MM_preloadImages('');
}


function customHandler(desc,page,line,chr)  {		// Display Errors in status	 
	window.status = "JAVASCRIPT ERROR : " + desc + " : PAGE=" + page + " : LINE=" + line;
	return true;
}
window.onerror=customHandler;

function confirmCancel(confirmWhat)	{
	return confirm("Are you sure you want to " + confirmWhat + "?");
}

function setMenuActive() {
	var cID = section + "_" + page;
	var cItem = document.getElementById(cID);
	if (cItem)	cItem.className = "on";

	//var cID = "mm0" + getNumber(section);	
	//var cItem = document.getElementById(cID);
	//if (cItem)	cItem.src = '../assets/images/mm0' + getNumber(section) + 'on.gif'
}


function getNumber(wSection) {
	switch  (wSection){
		case "home":
			return "1";
			break;						
		default : 
			break;
	}
}

function showOverImage(wSection) {
	if (wSection == section) return; 

	switch  (wSection){
		case "home":
			MM_swapImage('mm01','','../assets/images/mm01o.gif',1);
			break;		
		default : 
			break;
	}
}

function setupHome() {
	var homelink = document.getElementById("homeLink");
	if (homelink)
		homelink.style.visibility = 'hidden';
}
		
		function writeYear() {
	RightNow = new Date();
	var TheYear = RightNow.getYear()
	
	if (TheYear >= 100 && TheYear <= 1999)
	{TheYear=TheYear + 1900}
	else
	{TheYear=TheYear}
	document.write(TheYear)
}

function toggleDisplay(id) {
	var element = document.getElementById(id);
	element.style.display == "none" ? element.style.display = "block" : element.style.display = "none";
}

function articleShare(method,title,description,topic) {
	if (title == null)
		title = "";
	if (description == null)
		description = "";
	if (topic == null)
		topic = "";
	switch (method) {
		case "digg":
				launchWindow('http://digg.com/submit?phase=2&url=' + location.href + '.com&title=TITLE&bodytext=DESCRIPTION&topic=TOPIC','sharer',626,436);	
			break;
		case "facebook":
				window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title),'sharer','toolbar=0,status=0,width=626,height=436');
			break;
		case "newsvine":
				javascript:u=location.href;h=document.title;if(window.getSelection){sel=window.getSelection()}else if(document.getSelection){sel=document.getSelection()}else if(document.selection){sel=document.selection.createRange().text}else{sel=''};void(window.open('http://www.newsvine.com/_wine/save?ver=2&popoff=1&u='+encodeURIComponent(u)+'&h='+encodeURIComponent(h)+'&s='+encodeURIComponent(sel),'newsvine','toolbar=no,width=590,height=600,resizable=yes,scrollbars=yes'));
			break;
		case "delicious":
				window.open('http://del.icio.us/post?v=4&noui&jump=close&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=700,height=400');
			break;
		default:
			return;
	}
}

function articleTextSize(size) {
	var articleBody = document.getElementById("articleBody");
	switch (size) {
		case "small":
		 articleBody.style.fontSize = "100%"; 
		 articleBody.style.lineHeight = "170%"; 
		 break;
		case "medium":
		 articleBody.style.fontSize = "120%";
		 articleBody.style.lineHeight = "170%"; 
		 break;
		case "large":
		 articleBody.style.fontSize = "140%";
		 articleBody.style.lineHeight = "190%"; 
		 break;
	}
}







