try {
 document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

var dragObject = null;
var mouseOffset = null;

document.onmousemove = mouseMove;
document.onmouseup = mouseUp;

var scrollbarGlobal;

function barClick(ev) {

	ev = ev || window.event;
	var mousePos = mouseCoords(ev);
	
	var offsetLeftTmp = 3;
	if(document.all) {
		var pNode = this;
		while( pNode.parentNode ) {
			offsetLeftTmp += pNode.offsetLeft;
			pNode = pNode.parentNode;
		} 
	} else {
		offsetLeftTmp = this.offsetLeft;
	}
	scrollbarGlobal.boundL = offsetLeftTmp;
	scrollbarGlobal.boundR = offsetLeftTmp+this.offsetWidth-scrollbarGlobal.offsetWidth;

	scrollbarGlobal.style.position='absolute';
	if((mousePos.x - this.offsetLeft) > (this.offsetWidth - scrollbarGlobal.offsetWidth)) 
		scrollbarGlobal.style.left = scrollbarGlobal.boundR; 
	else 
		scrollbarGlobal.style.left = mousePos.x;

	scrollbarGlobal.setEntry(getEntry(scrollbarGlobal.offsetLeft - this.offsetLeft));
	document.getElementById('timelineScrollbar').style.backgroundPosition=-(scrollbarGlobal.offsetLeft - this.offsetLeft)+'px 0px';		
	mouseMove(ev);
}

function getEntry(barLeft) {
	var barWidth = scrollbarGlobal.boundR - scrollbarGlobal.boundL;	
	var contentWidth = scrollbarGlobal.entries.length - 1;
	return parseInt(barLeft*contentWidth/barWidth);	
}
 
function mouseMove(ev) {
	ev = ev || window.event;
	var mousePos = mouseCoords(ev);

	if(dragObject) {
		dragObject.style.position = 'absolute';
		var left = mousePos.x - mouseOffset.x;
		

		if(left<=dragObject.boundL)
			dragObject.style.left = dragObject.boundL;
		else if(left>dragObject.boundR)
			dragObject.style.left = dragObject.boundR;
		else
			dragObject.style.left = left;

		dragObject.setEntry(getEntry(dragObject.offsetLeft - dragObject.boundL));		
		document.getElementById('timelineScrollbar').style.backgroundPosition=-(dragObject.offsetLeft - dragObject.boundL)+'px 0px';		
		return false;
	}
}

function mouseUp(ev) {
	dragObject = null;
}


function getPosition(e){
	var left = 0;
	var top = 0;
	while (e.offsetParent){
		left += e.offsetLeft;
		top += e.offsetTop;
		e = e.offsetParent;
	}
	left += e.offsetLeft;
	top += e.offsetTop;
	return {x:left, y:top};
}

function mouseCoords(ev){
	if(ev.pageX || ev.pageY)
		return {x:ev.pageX, y:ev.pageY};
	return {
		x:ev.clientX+document.body.scrollLeft-document.body.clientLeft,
		y:ev.clientY+document.body.scrollTop-document.body.clientTop
	};
}

function getMouseOffset(target, ev){
	ev = ev || window.event;
	var docPos = getPosition(target);
	var mousePos = mouseCoords(ev);
	return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
}

function makeDraggable(item){
	if(!item) return;
	var boundL_ = item.offsetLeft;
	var boundR_ = item.offsetLeft+550;
	var content = item.content;
	item.onmousedown = function(ev) {
		dragObject = this;
		dragObject.boundL = boundL_;
		dragObject.boundR = boundR_;
		mouseOffset = getMouseOffset(this,ev);
		return false;
	}
}

var lastYear = null;

var Timeline = function() {
	var entries_ = new Array();
	var pairs_ = {};	
	return {
		entries : entries_,
		pairs : pairs_,
		container : null,
		configureTimeline : function(entryString) {
			var unsplitEntries = entryString.split('&');
			for(x in unsplitEntries)
			{
				var splitEntry = unsplitEntries[x].split('|');
				this.pairs[splitEntry[0]]=splitEntry[1];
				this.entries[x] = splitEntry[0];
			}
		},
		appendTimeline : function(id) {
			this.container = document.getElementById(id);
			var wrap = document.createElement('Div');
			var lineWrap = document.createElement('Div');
			var contentWrap = document.createElement('Div');
			var content = document.createElement('Div');
			var scrollButton1 = document.createElement('Div');
			var scrollButton2 = document.createElement('Div');
			var line = document.createElement('Div');
			var scrollbar = document.createElement('Div');
			var bar = document.createElement('Div');
			var entryTemp;
				
			wrap.setAttribute('id','timelineWrap');
			lineWrap.setAttribute('id','timelineLineWrap');
			contentWrap.setAttribute('id','timelineContentWrap');
			content.setAttribute('id','timelineContent');
			scrollButton1.setAttribute('id','timelineScrollButton1');
			scrollButton2.setAttribute('id','timelineScrollButton2');
			scrollButton1.innerHTML = '1957';
			scrollButton2.innerHTML = '2008';
			scrollbar.setAttribute('id','timelineScrollbar');
			scrollbar.setAttribute((document.all?'className':'class'),'timelineScrollbar');
			line.setAttribute('id','timelineLine');
			bar.setAttribute('id','timelineBar');
			bar.setAttribute((document.all?'className':'class'),'timelineBar');
			bar.onmousedown = barClick;
		
			wrap.appendChild(lineWrap);
			wrap.appendChild(contentWrap);
			contentWrap.appendChild(content);
			lineWrap.appendChild(line);
			line.appendChild(scrollButton1);
			line.appendChild(bar);
			line.appendChild(scrollButton2);
			bar.appendChild(scrollbar);			
			scrollbarGlobal = scrollbar;
			scrollbarGlobal.pairs = this.pairs;
			scrollbarGlobal.entries = this.entries;
			scrollbarGlobal.setEntry = function(entryNo) {
				document.getElementById('timelineContent').innerHTML='<div class="yearDiv">'+scrollbarGlobal.entries[entryNo]+'</div>'+scrollbarGlobal.pairs[scrollbarGlobal.entries[entryNo]];
			}
			this.container.appendChild(wrap);
			makeDraggable(scrollbar);	
			scrollbarGlobal.setEntry(0);	
		},
		createTimeline : function(id, entryString) {
			this.configureTimeline(entryString);
			this.appendTimeline(id);
		}
	}
}
var load = function() {
	var irelandTimeline = Timeline();
	irelandTimeline.createTimeline('timelineDiv','1957|Leo Laboratories, a Danish pharmaceutical company, establishes the first significant presence of a life science company in Ireland - a plant to supply the UK and Irish markets.&1958|The Department of Genetics is founded at Trinity College Dublin. Graduates from the department helped the early growth of the Irish life science sector.&1960|Two German entrepreneurs founded Loftus Bryan Chemicals Ltd. (later Avondale Chemical) in Rathdrum, County Wicklow, to manufacture active ingredients for generic medicines.&1963|The government-apointed Commission of Industrial Organization identifies life sciences as an area that should be targeted for development in advance of Ireland\'s expected entry into the European Common Market.&1964|Squibb (now Bristol-Myers Squibb) sets up a bulk pharmaceuticals manufacturing plant in Swords, Dublin.&1967|Biocon Biochemicals Ltd, the first indigenous biotechnology company, is set up to manufacture and supply enzymes and other ingredients to the brewing industry.&1969|Pfizer Pharmaceuticals Production Corp. sets up a plant in Ringaskiddy, County Cork, to manufacture citric acid.<p>Elan Corporation PLC, is founded in Dublin. From humble beginnings, it rises to become the unrivaled \'superstar\' of the indigenous Irish life sciences sector.&1972|Ireland joins the European Economic Community, giving Ireland-based companies ready access to continental Europe.&1973|A patent tax exemption is introduced for patents that involve research, planning, processing, experimenting, testing, designing, or developing.&1974|Wyeth sets up its first plant in Ireland at Askeaton, County Limerick, to manufacture infant nutritional products. Wyeth has extended its involvement in Ireland to other locations.&1975|Penn Chemicals (now GlaxoSmithKline) follows pfizer into Ringaskiddy, starting a period of major investment in the cork region.&1976|Quest Biocon, a Dutch company, establishes a food-ingredient plant in Carrigaline, County Cork. Meanwhile, in Tipperary, Merck Sharp and Dohme is also setting up a facility.&1979|Employment in the life sciences sector reported at 4,750 people, up from virtually nothing a decade before.&1981|Elanco Animal Health, a division of Eli Lilly and Company, establishes a facility outside Kinsale, County Cork.&1983|Schering Plough takes over the Chembiotica antibiotic plant at Innishannon, County Cork, to manufacture biotechnology products such as Interferon-A.&1987|BioResearch Ireland is established as a partnership between five Irish universities and the Irish government, to develop an R and D infrastructure in biotechnology.&1992|Biotrin International, an important indigenous life science company, is formed with headquarters in Dublin, where it conducts its R and D, manufacturing, and marketing activities.<p>Trinity Biotech, another homegrown life science company, is founded to develop, manufacture, and market diagnostic test kits. The company now has four US facilities, one in Germany, and one in Sweden.&1994|A league table of pharmaceutical companies ranked in the world by sales shows that Ireland is home to eight of the top 10.&1996|Megazyme International Ireland Ltd., a supplier of diagnostic kits and reagents to the food, feed, dairy, and wine sectors, relocates to Bray, County Wicklow, from Australia.&1997|The Irish Council for Science, Technology, and Innovation is established to advise the government on all aspects relating to the strategic direction of its science, technology, and innovation policy.<p>The \'Rainbow\' coalition government of fine Gael, Labour, and Democratic Left introduces a 12.5% corporation tax.&1998|The \'Technology Foresight\' exercise begins, asking high-level people from industry, higher education, government, and research institutes to assess the direction that technology is headed across many fields.<p>The Program for Research in Third-Level institutions (PRTLI) is set up, administered by Ireland\'s Higher Education Authority (HEA) to provide \'bricks-and-mortar\' investment for new facilities. To date, 605 million euros has been allocated.&1999|A new Fianna Fail-led government changes the corporate tac arrangements introduced by the previous government, providing for a phased introduction of 12.5% corporate tax rate: from 32% for financial year 1998 to 12.5% again by January 2003.&2000|The Irish government establishes the First National Development Plan, including a huge commitment to a \'knowledge-economy\' by allocating 2.5 billion euros from 2000-2006 for research, technology, and innovation activities.<p>Science Foundation Ireland (SFI), the national foundation for excellence in scientific research, is launched as part of the First National Development Plan. SFI was allocated a budget of 711 million euros, half of which was allocated for biotechnology.&2001|Genzyme. one of the world\'s largest biopharmaceutical companies, sets up a manufacturing operation in Waterford and plans a total capital investment of 410 million euros by 2010.<p>Enterprise Ireland, a government agency, establishes BioConnect Ireland, a biotechnology network.&2003|Exports of pharmaceuticals and chemicals from Ireland are worth 35.7 billion euros, representing 43% of the total value of Ireland\'s exports.&2004|The Irish government encourages generation of intellectual property by removing a 9% tax on the sale or transfer of IP.<p>A new R and D tax credit is introduced to encourage foreign and indigenous companies to undertake new or additional R and D activity in Ireland.<p>The 90 million euro National Institute for Bioprocessing Research and Traininf (NIBRT) is set up by the Industrial Development Authority, the government body responsible for attracting foreign investment into Ireland.&2006|The government\'s Strategy for Science, Technology and Innovation is published, laying out a plan for moving towards a knowledge economy from 2006-2013.&2007|The Second National Development Plan (2007-2013) is launched, with enterprise, science, and innovation garnering 11% of the 184 billion euros provided under the plan.<p>One of the world\'s largest biopharmaceutical facilities, the 1.8 billion euro Wyeth Biopharma Campus at Grange Castle, is set up on a 90 acre site in Clondalkin, County Dublin, and employs approximately 1,300 people.<p>Genzyme announces a new investment of approximately 270 million euros in its Irish manufacturing plant in Waterford, creating 52 new jobs and bringing its Irish workforce to 411.<p>Ireland is named the European leader in foreign direct investment in the life sciences. From June 2006 to June 2007, Ireland attracted 25% of the European total.&2008|Ireland has more than 170 companies in the life science sector, employing more than 35,000 people.');

}

