function LoadScript() {
	//Find height and width of div id='main' and set 'popup' to fill cover completely
	Mainobj =  document.getElementById("main");
	Outerpopup = document.getElementById("popup");
	Outerpopup.style.width=Mainobj.scrollWidth+"px";
	Outerpopup.style.height=Mainobj.scrollHeight+"px";
	HideRows();
}


function ShowMe(eventId,offset) {
	if (offset==undefined) offset=1;
	linkobj =document.getElementById("link"+eventId);
	PopupBox = document.getElementById("innerpopup");
	
	ToWrite = "<a href='' onclick='HideMe(); return false' style='float:right;clear:right;margin:20px;'>X</a><p class='eventinfo'><b>"+eventinfo[eventId]['title'] +"</b><br />"+ eventinfo[eventId]['start'].substring(0,5)+"-"+ eventinfo[eventId]['end'].substring(0,5)+", "+ eventinfo[eventId]['friendlydate']+"<br /><i>"+eventinfo[eventId]['location']+"</i></p><p>"+eventinfo[eventId]['description']+"</p>";
	PopupBox.innerHTML = ToWrite;
	if (offset==1) PopupBox.style.top= (linkobj.parentNode.offsetTop-50)+"px";
	if (offset==0) PopupBox.style.top= "50px";
	PopupBox.style.maxWidth= (Mainobj.scrollWidth/2)+"px";
	//PopupBox.style.left= "200px";
	PopupBox.style.visibility="visible";
	Outerpopup.style.visibility="visible";
}

function ShowMeDBindex(index) {
	if (eventinfo[jskeyinfo[index]]['recurflag']=="") { 
		ShowMe(jskeyinfo[index],0);
	}
}

function HideMe() {
	document.getElementById("popup").style.visibility="hidden";
	document.getElementById("innerpopup").style.visibility="hidden";
}

function HideRows() {
	//alert(curweek);
	if (curweek<9 && curweek>-2) {  
		for (count=-2;count<curweek;count++) {
				document.getElementById("row"+count).style.display="none";
		}
	document.getElementById("revealer").style.display="table-row";
	}
	
}

function ShowRows() {
	if (curweek<9 && curweek>-2) {  
		//if (document.getElementById("row"+(curweek-1)).style.display!="table-row") {
			for (count=-2;count<curweek;count++) {
				document.getElementById("row"+count).style.display="table-row";
			}
		/*} else {
			for (count=-2;count<0;count++) {
				document.getElementById("row"+count).style.display="table-row";
			}
			
		}*/
		document.getElementById("revealer").style.display="none";
	}
	
}
