// JavaScript Document

	function getTalks()
	{
		try{
		//alert("making Talks")
		
		var table = document.createElement("table");
		formatTable(table)
	/*	table.setAttribute("style","border:solid gray 1px;");
		table.setAttribute("border", "0");
		table.setAttribute("width", tablewidth);
		table.setAttribute("cellpadding", "2");
		table.setAttribute("cellspacing", "0");
		*///document.getElementById("talksHolder").appendChild(table);
		
		var headerrow = table.insertRow(0);
		headerrow.insertCell(0).appendChild(document.createTextNode("Listing"));
		headerrow.insertCell(1).appendChild(document.createTextNode("Date"));
		
		headerrow.getElementsByTagName("td")[0].setAttribute("width","70%")
		headerrow.getElementsByTagName("td")[1].setAttribute("width","30%")
		
		var tabletemp = document.createElement("table");
		tabletemp = table.cloneNode(true);
	
		headerrow = tabletemp.insertRow(1);
		switcher = document.createElement("td");
		switcher.setAttribute("onClick","showSomeTalks()");
		switcher.setAttribute("colspan",2);
		var switchButton = document.createElement("button");
		switchButton.setAttribute("style","width: 100%;");
		switchButton.onclick = showSomeTalks;
		switchButton.appendChild(document.createTextNode("Minimize"));
		switcher.appendChild(switchButton);
		headerrow.appendChild(switcher)	;
		
		headerrow = table.insertRow(1);
		switcher = document.createElement("td");
		switcher.setAttribute("onClick","showAllTalks()");
		switcher.setAttribute("colspan",2);
		var switchButton = document.createElement("button");
		switchButton.setAttribute("style","width: 100%;");
		switchButton.onclick = showAllTalks;
		switchButton.appendChild(document.createTextNode("Maximize - See All"));
		switcher.appendChild(switchButton);
		headerrow.appendChild(switcher)	;
	
		
		var talksList = xmlDoc.getElementsByTagName("talk");
		//alert("number of talks: " + talksList.length);
		for ( var i=0; i < 3; i++)
		{
			//alert("loop " +i);	
			var e = talksList[i];
			var listing = e.getElementsByTagName("listing")[0].firstChild.data;
			var linkline = e.getElementsByTagName("linkline")[0].firstChild.data;
			var date =  e.getElementsByTagName("eventDate")[0].firstChild.data;
			
			var row = table.insertRow(i+2);
			var anchorT = document.createElement("a");
			anchorT.setAttribute("href",linkline);
			anchorT.appendChild(document.createTextNode(rightTrim(listing.toString())))
			row.insertCell(0).appendChild(anchorT);
			row.insertCell(1).appendChild(document.createTextNode(rightTrim(date)));
		}
		
		shortTalksTable = table
		
		
		for ( var i=0; i < talksList.length; i++)
		{
			//alert("loop " +i);	
			var e = talksList[i];
			var listing = e.getElementsByTagName("listing")[0].firstChild.data;
			var linkline = e.getElementsByTagName("linkline")[0].firstChild.data;
			var date =  e.getElementsByTagName("eventDate")[0].firstChild.data;
			//alert("loop " +i+"listing"+listing+"date"+date);
			
			var row = tabletemp.insertRow(i+2);
			var anchorT = document.createElement("a");
			anchorT.setAttribute("href",linkline);
			anchorT.appendChild(document.createTextNode(rightTrim(listing)))
			row.insertCell(0).appendChild(anchorT);
			row.insertCell(1).appendChild(document.createTextNode(rightTrim(date)));
		}
		allTalksTable = tabletemp
		}catch(e){
			alert(e)
		}
		initTalks()
	}
	
	function initTalks()
	{
		//alert("in init")
		document.getElementById("talksContent").appendChild(shortTalksTable);
	}
	function showAllTalks()
	{	
		//alert("showAllTalks()")
		document.getElementById("talksHolder").removeChild(document.getElementById("talksContent"));
		var div = document.createElement("div")
		div.setAttribute("id","talksContent")	
		document.getElementById("talksHolder").appendChild(div)
		document.getElementById("talksContent").appendChild(allTalksTable);
	}
	function showSomeTalks()
	{	
		document.getElementById("talksHolder").removeChild(document.getElementById("talksContent"));
		var div = document.createElement("div")
		div.setAttribute("id","talksContent")	
		document.getElementById("talksHolder").appendChild(div)
		document.getElementById("talksContent").appendChild(shortTalksTable);
	}