var ajaxObj = new AjaxProxy("Sage.Resources.Events");
ajaxObj.$AddFunction("Register",onReturn,onReturn);

function onReturn(status,rtn){
	Notify.RemoveAll();
	//Notify.HideShade();

	switch(rtn.value){
		case "sage.permission.denied":
			Notify.Alert("You do not have permission to perform this action.");
			break;
		case "sage.event.saveToList":
			Notify.MsgCustom("Your seat has been reserved. You will get a confirmation email soon.",notifyBtn);
			break;
		case "sage.event.saveToWait":
			Notify.MsgCustom("You have been placed on the waiting list for this event.",notifyBtn);
			break;
		case "sage.event.onlist":
			Notify.MsgCustom("You already have a seat reserved.",notifyBtn);
			break;
		case "sage.event.onwait":
			Notify.MsgCustom("You already have been placed on the waiting list for this event.",notifyBtn);
			break;
		default :
			Notify.Alert(JSON.Encode(rtn));
			break;
	}//switch
}//func

function Register(id){						
	Notify.Process("Submitting Request...");
	Notify.ShowShade();
	ajaxObj.Register(id);
}//func


var notifyBtn = ["[ OK ]",
	function(){
		Notify.HideShade();
		Notify.Remove(this.parentNode.id);
		
		var itm = document.getElementById("GrayBtnCont");
		if(itm != null) itm.style.display = "none";
		return false;
	}
];

//==============================================================
oCntDown = null;
Page.AddLoadEvent(function(){		
	oCntDown = new CountDown("ctl00_PageContent_ctl00_lbEventTimer");
	oCntDown.Start();
});