function goToSite(site) {
if (site) {
	self.location=site;
	}
}

function goToDate(rootPath,month,day,year) {
  site = rootPath+"/eventlist.php?year="+year+"&month="+month+"&day="+day;
  self.location=site;
}

function goToMonth(month,year) {
  var form = document.smallCalendar;
  form.smonth.value = month;
  form.syear.value = year;
  form.submit();
}

function addNewList(rootPath,listID,ID) {
  if (typeof(listID.length)=="undefined") {
  	site = rootPath+"/event.php?action=addList&ID="+ID+"&ListID="+listID;
  } else {
  	listID = document.getElementById('EventAddList[]');
  	var listIDs = '';
  	for (i=0; i<listID.length; ++i) {
  		if (listID.options[i].selected == true) {
  			if (listIDs != '') listIDs += "_";
	  		listIDs += listID.options[i].value;
	  	}
  	}
  	site = rootPath+"/event.php?action=addList&ID="+ID+"&ListID="+listIDs;  	
  }
  self.location=site;
}

function editEvent(eventID, dateID, listID) {
    if (dateID == 0) {
        dateID = "";
    }
    if (listID == 0) {
        listID = "";
    }
 	newWindow = window.open('', 'EditEvent' + eventID.toString(), 'width=900, height=600, left=10, top=10, location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no');
	newWindow.location = document.getElementById('rootPath').value + "/index.php?mainpage=" + escape("event.php?action=edit&ID=" + eventID.toString() + "&ListID=" + listID.toString() + "&DateID=" + dateID.toString());
	newWindow.focus();
}

function editVenue(venueID, eventID) {
 	newWindow = window.open('', 'EditVenue' + venueID.toString(), 'width=900, height=600, left=10, top=10, location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no');
	newWindow.location = document.getElementById('rootPath').value + "/admin/venue.php?action=edit&ID=" + venueID.toString() + "&EventID=" + eventID.toString();
	newWindow.focus();
}

function showVenueEvents(venueID) {
 	newWindow = window.open('', 'VenueEvents' + venueID.toString(), 'width=900, height=600, left=10, top=10, location=no, menubar=no, resizable=yes, scrollbars=yes, status=yes, toolbar=no');
	newWindow.location = document.getElementById('rootPath').value + "/index.php?mainpage=" + escape("eventlist.php?all=1&venue=" + venueID.toString() + "&nav=0");
	newWindow.focus();
}

function reviewInNewWindow(form) {
	var ran_number=Math.round(Math.random()*10000) + '';
	form.target = "newWin" + ran_number;
	form.submit();
}

function resetTarget(form) {
	form.target = "";
	form.submit();
}

function showFunkyDate() {
 	funkyDateWindow = window.open('', 'funkyDate', 'width=400, height=300, left=100, top=300, location=no, menubar=no, resizable=yes, scrollbars=no, status=no, toolbar=no');
	funkyDateWindow.location = document.getElementById('rootPath').value + "/funkyDate.php";
	funkyDateWindow.focus();
}

