//<![CDATA[   

var bLoggedin = true;

var kManagedEventTag = "ManageEventID";
var kManagedDeleteTag = "DeleteEventID";

$(document).ready(function() {
		
	
	// Setup login/account info box clicks ====================================

	$("#homelink").click(function() { document.location.href="/main.aspx"; });
	
	
	$("#fCancel").click( function () {
			
		if (!confirm("Are you sure you want to cancel? Any unsaved changes on this page will be lost."))
			return;
		
		window.location.href = "/main.aspx";
		
		return false;
		
	});//end click
	
	$("#LoginLink").click(function() {
		
		gLogin();
		
	});
	
	$("#SignoutLink").click(function() {
		
		gWrapProcessLinkFunc("Are you sure you want to signout?", function() {
		
			document.location.href = "/signout.aspx";
			
		});//end wrap		
		
		return false;
		
	});
	
	// Toolbox items ==================================================
	
	if (bCompanyPortalAccess)
		$(".TopNavMenu #ManageEventsLink").show();
	else
		$(".TopNavMenu #ManageEventsLink").hide();
	
	
	// Alert Dialog ===================================================
	
	$("#ERDialog").dialog({ title: 'Oops!', autoOpen: false, width: 400, modal: true, resizable: true,
						overlay: { backgroundColor: '#000', opacity: 0.5 }, close: ERAlertOKHandler
					});//end dialog
	
	
	$("#fERAlertOKButton").click(function() {
		
		ERAlertOKHandler();
		
		return false;
		
	});//end click
	
});	// End doc ready

function ERDisplayAlert(inMessage)
{
	$("#ERDialogContent").html(inMessage);
	$("#ERDialog").dialog("open");

}//end ERDisplayAlert

function ERAlertOKHandler()
{
	if (iERMasterEventID > 0)
		document.location.href = gURLNoCache("/events/EventOverview.aspx?fEID=" + iERMasterEventID);
	else
		document.location.href = "/default.aspx";

}//end ERAlertOKHandler

function DisplayCOPPA(inEventID)
{
	var sURL = "/data/docs/COPPADisplay.aspx";
	
	if (inEventID != null && inEventID > 0)
		sURL = sURL + "?fEID=" + inEventID;
		
	gProcessAjaxGet(gURLNoCache(sURL), DisplayCOPPAHandler);

}//end gDisplayCOPPA

function DisplayCOPPAHandler(inData, inError) {

	if (gProcessReportError(inError, true, "errormsg"))
		return;
	
	var data = inData;
	
	data = '<div onclick="$.unblockUI();"><strong>Click anywhere in this window to close it</strong>' + 
		'<div style="text-align: left;">' + data + '</div>' + 
		'<div><a href="javascript: $.unblockUI()">Close this window</a></div>' + 
		'</div>';
	
	$.blockUI({ message: data, css: { top: '20%', left: '30%', width: '500px', height: '300px', overflow: 'scroll', fontSize: '12px'} });
	
}//end DisplayCOPPAHandler

//]]>

