var baseHREF="http://campustransformation.com/sign_up/";

function rollover(id){
	if(document.getElementById(id).src.indexOf("ro")>0)
		document.getElementById(id).src = document.getElementById(id).src.replace("ro","");
	else
		document.getElementById(id).src = document.getElementById(id).src.replace(".jpg","ro.jpg");
}

function showmenu(elmnt){
	document.all(elmnt).style.visibility="visible"
}

function hidemenu(elmnt){
	document.all(elmnt).style.visibility="hidden"
}

function followLink(page){
	if( page.indexOf("http")>=0 )
		location.href = page;
	else 
		location.href = baseHREF+page;
}

selectedCell="";

function deselectPreviousCell(){
	if(selectedCell!="")
		selectedCell.className = document.getElementById("hidden"+selectedCell.id).value;
}

function selectCell(element_id, page, school_id){
	element = document.getElementById(element_id);
	backup = document.getElementById("hidden"+element_id);
	
	if(element.className == "empty"){
		alert("Your school is not signed up for this date!");
		return;
	}
	
	deselectPreviousCell();
		
	if(element.className == "selected"){
		element.className = backup.value;
		selectedCell = "";
	}
	else{
		element.className = "selected";
		selectedCell = element;
	}
	
	setIframeSrc(page, school_id);
}

function setIframeSrc(page, school_id){
	if(document.getElementById("iframe").src.indexOf(selectedCell.id) < 0){
		document.getElementById("iframe").src = page + "?school_id=" + school_id + "&date=" + selectedCell.id + "&dayType=" + document.getElementById("hidden"+selectedCell.id).value;
	}
}

function flipStyle(element_id){
	element = document.getElementById(element_id);
	backup = document.getElementById("hidden"+element_id);
	if(element.style.background == selectedColor + " none repeat scroll 0% 0%"){
		element.style.background = backup.value;
		//input.value = "selected";
	}
	else{
		element.style.background = selectedColor;
		//input.value = "";
	}
}

function reload(){
	//window.location.href = unescape(window.location.pathname);
	window.location.reload( false );
}