// GLOBAL VARIABLES

var eventWindow		= new DHTMLSuite.windowWidget();

// FUNCTIONS

function unhide(divID) {
	var item = document.getElementById(divID);
	if (item) {
		item.className=(item.className=='hidden')? 'unhidden':'hidden';
	}
}

function PostForm(formID, myaction) {
  //The form data is sent to the given URL using a POST method, 
  //rather than a GET by using the dojo.xhrPost function.
  dojo.xhrPost({
    url: myaction,
    load: function(response, ioArgs){
      dojo.byId("content").innerHTML = response;
      
      var div = document.getElementById("content");
      div.innerHTML = response;
      var x = div.getElementsByTagName("script"); 
      for(var i=0;i<x.length;i++)
      {
      		//alert(x[i].text);
		eval(x[i].text);
	}
      //Dojo recommends that you always return(response); to propagate 
      //the response to other callback handlers. Otherwise, the error 
      //callbacks may be called in the success case.
      return response;
    },
    error: function(response, ioArgs){
      dojo.byId("toBeReplaced").innerHTML = 
        "An error occurred, with response: " + response;
      return response;
    },
    
    //Setting the 'form' parameter to the ID of a form on the page
    //submits that form to the specified URL
    form:"eventForm"
  });
  eventWindow.close();
}
