/* function initTimeline(){
	
} */

function fillBlock(x){
	//x = link object
	var pDiv = "d" + $(x).parents("div:eq(1)").attr("id");
	var vHref = pDiv + ".php";
	//use inc-5 plugin.  Ref: http://johannburkard.de/blog/programming/javascript/inc-a-super-tiny-client-side-include-javascript-jquery-plugin.html#comment9
//	$("#timeline_content").inc(vHref);
//	
	$("#content_wrapper").fadeOut("normal",function(){
		$(this).load(vHref);
		setTimeout(function() { 
			$("#content_wrapper").fadeIn("slow");
		}, 700);
	});
	
//	$("#if_navigation").attr("class","selected");
}

	function initTimeline(){
		var o = document.getElementById("d1977");fillBlock(o);
		$("div.obj-dot").attr("align","center");
		$("div.dot-line, div.line").html('<img src="images/img_line.gif" border="0" />')
		$("div.dot").html('<img src="images/img_circle.gif" border="0">')

		var aObjDate = $("div.obj-date");
		aObjDate.each(function(){
			$(this).css("cursor","pointer");
			var aID = "d" + $(this).attr("id");
			var oA = $(this).find("a:eq(0)");
			oA.attr("id",aID);
			//this = date object as a whole
			$(this).click(function(){
				$(".selected").removeClass();
				$(".line-selected").removeClass("line-selected");
				$(oA).addClass("selected")/* .add($(this)).css("color","#65B561") */;
				$(this).find("div.line:eq(0)").addClass("line-selected");
				fillBlock(oA)
			});
		});
	}

	function dateSpacing(){
		var vWidth = $("#timeline_content").width() - 20; //a couple px wider than timeline end boxes.
		
		var aObjDate = $("div.obj-date");
		var aDistRaw = new Array(9);//Assumes the date objects are already in the correct order.
		//Put the list in the array
		aObjDate.each(function(i){
			aDistRaw[i] = parseInt($(this).attr("id"));//id MUST = year.
		});
		var ceiling = (aDistRaw[aDistRaw.length-1])- aDistRaw[0];
		var vPxsPer = Math.round(vWidth / ceiling);//each year is vPx pixels wide.

		//Establish the percent from absolute-position left.
		var aDist = new Array(9);
		var vSpan, vPx, vLastYear
		for (var y = 0; y<aDistRaw.length; y++){
			vLastYear = aDistRaw[aDistRaw.length-1];
			vSpan = aDistRaw[aDistRaw.length-1] - aDistRaw[y];
			vPx = vWidth - (vSpan * vPxsPer);
			if(y==1){
				aDist[y] = vPx-17 + "px";//1980 & 81 are a tad too close.
			}else{
				aDist[y] = vPx-13 + "px";
			}
		}
		aObjDate.each(function(z){
			$(this).css("left",aDist[z]);
		});
	}
	var aImgs = new Array(10);
	function preloadImgs(){
		var aNames = new Array ("1977_01","1977_02","1980","1981","1985","1988","1994","1999","2007","2009");
		var str;
		for(var i = 0; i < aImgs.length; i++){
			str = "images/" + aNames[i] + ".jpg"
			aImgs[i] = new Image; aImgs[i].src = str;
		}
	}
