var storyFontSize = 1;

function changeTextSize(increment, layer_id) {
	var size = storyFontSize + increment;
	if (size < 4 && size > 0) { storyFontSize += increment; }
	switch(storyFontSize) {
		case 1: size = 11;
		break;
		case 2:	size = 14;
		break;	
		case 3:	size = 18;
		break;
	}
	document.getElementById(layer_id).style.fontSize = size + "px";
}
/*
function tourGetDateUpdated(time){
	var now, then, minutes, hours, updated;
	now = new Date().getTime();
	then = time;
	minutes = Math.floor( (now - then) / 60000 );
	updated = ' | updated ' + minutes + ' minutes ago';
	if (minutes > 60){
		minutes = minutes/60;
		hours = Math.floor(minutes);
		minutes = Math.floor((minutes - hours) * 60);
		updated = (hours > 23) ? ' | updated ' + hours + ' hours, ' + minutes + ' minutes ago': '';
	}
	document.write ( updated );
}*/
function tourGetDateUpdated(m, h, d, dU){
	var now, then, minutes, hours, updated, currMinutes, currHours, currDay, nDaysAgo, nMinutesAgo, nHoursAgo, hrStr, minStr;
	
  if (d){ //if this param exist do this
	
	now = new Date();
	currMinutes = now.getMinutes();
	currHours = now.getHours();
	currDay = now.getDate();
	
	nDaysAgo = currDay - d;
	nMinutesAgo = (m > currMinutes) ? m - currMinutes : currMinutes - m;
	nHoursAgo = currHours - h;
	updated = "  |  updated ";
	
	hrStr = (nHoursAgo == 1) ? 'hour' : 'hours';
	minStr = (nMinutesAgo == 1) ? 'minute' : 'minutes';

	if(nDaysAgo > 0){	updated = '';	}
	else if(nHoursAgo == 0){		updated += nMinutesAgo + " " + minStr + " ago";	}
	else{	updated += nHoursAgo + " " + hrStr + ", " + nMinutesAgo + " " + minStr + "  ago";	}
	
	document.write(updated);
  }
	
  else{
	
	now = new Date().getTime();
	then = time;
	minutes = Math.floor( (now - then) / 60000 );
	updated = ' | updated ' + minutes + ' minutes ago';
	if (minutes > 60){
		minutes = minutes/60;
		hours = Math.floor(minutes);
		minutes = Math.floor((minutes - hours) * 60);
		updated = (hours > 23) ? ' | updated ' + hours + ' hours, ' + minutes + ' minutes ago': '';
	}
	document.write ( updated );
	}
}

function tourFixRightRailAd() {
	var divArray = document.getElementsByTagName("div");
	for(i=0; i<divArray.length; i++){
		if(divArray[i].className == "tourLeftContent"){
			var leftDiv = divArray[i];
	    }
		if(divArray[i].className == "tourRightRail"){
			var rrDiv = divArray[i];
		}	    
	}
	
	var ldH = leftDiv.offsetHeight;
	var rdH = rrDiv.offsetHeight;
	var adH = $("tour160Ad").offsetHeight;
	
	if( (ldH-adH) < rdH ) $("tour160Ad").style.display = "none";
}

function pagePrint(){
	window.open('/story/print/?'+escape(window.location.href), 'Print', 'width=690,height=600');
}

//	Render Clickability Code
document.write('<scr'+'ipt src='+'"/.element/ssi/js/3.0/global/clickability/story.js" type="text/javascript"'+'></sc'+'ript>');
