//for default properties setup when creating a new channel
var IDS_WIN_CREATECHANNELDLG_NAME = "WBC_winCreateChannelDlg";
var IDS_WIN_CREATECHANNELDLG_FEATURES = "width=650,height=280,resizable,scrollbars,status=yes" + 100; //IDS_DEFAULT_OPEN_POSITION;

//Delete Channel confirm UI dialogs
var IDS_DELETE_CHANNEL_CONFIRM = "Deleting this Channel will remove it permanently from the system. Continue?";

/// <summary>
/// Javascript function in repsonse to "Delete Channel" Console link in
/// the PresentationUnpublished mode.
/// </summary>
function CMS_onClickChannelDelete()
{
	// put up confirm() dialog first!
	return confirm(IDS_DELETE_CHANNEL_CONFIRM);
}

/// <summary>
/// Javascript function in response to "Create Channel"
/// Console link clicked in any Authoring case.
/// </summary>
function CMS_openWindowCreateChannel( strDlgURL )
{	
	// open a blank window and set the form target to that window
	WBC_openWindowOnFocus(strDlgURL, IDS_WIN_CREATECHANNELDLG_NAME, IDS_WIN_CREATECHANNELDLG_FEATURES);
}

var g_ChannelCreateDlgForm;

// ---- [Public] Set up default variables
function WBC_onLoadHandler() 
{	
	// TODO: give form a better name
	g_ChannelCreateDlgForm = window.document.ChannelCreateDlgForm;
}

//	---- [Public] Transfer content to authoring form from ChannelCreateDlg so that when authoring does
//  a submit, it also has the information that is from the ChannelCreateDlg
function WBC_onOkayClick()
{
    //	Check if the informatin in the ChannelCreateDlg.aspx is valid or not.
	var pChannelCreateDlgName;
	pChannelCreateDlgName = g_ChannelCreateDlgForm.NC_intxtName;
	
	// If data on the ChannelCreateDlg is valid
	if (WBC_verifyInputName(pChannelCreateDlgName))
	{
		g_ChannelCreateDlgForm.submit();
		
	}
	else
	{
		alert(IDS_INVALID_NAME);	
	    return false;
	}
}
