﻿Ext.ns("AV");

	AV.EditorLauncher =
{
	contentWinLoaded	: false,
	useCompression		: !AV.scriptDebug && (_beta.indexOf('compress~') > -1),

	showLoading: function()
	{
		if (!AV.BodyLoadingMask) {
			
			AV.BodyLoadingMask = Ext.DomHelper.append(Ext.getBody(), {
				 cls		: 'page-loading-mask', 
				 style	: 'height: ' + Ext.lib.Dom.getViewHeight(true) + 'px; width: ' + Ext.lib.Dom.getViewWidth(true) + 'px;'
			}, true);

			AV.BodyLoadingMaskSpinner = Ext.DomHelper.append(Ext.getBody(), {
				 cls		: 'page-loading-spinner'
			}, true);

			AV.BodyLoadingMask.hide = function() {
				this.setVisible(false);
				AV.BodyLoadingMaskSpinner.hide();
			};
			
			/*
			AV.BodyLoadingMask = new Ext.Window({
					html				: '<div style="text-align: center; margin-top:15px;">' +
													'<img width="65" height="13" border="0" src="/images/progress/progressBar.gif" />' +
													'<br/><br/><strong>Loading Editor...</strong>' +
												'</div>',
					modal				:	true,
					width				:	200,
					height			:	100,
					shadow			:	true,
					collapsible	: false,
					closable		:	false, 
					resizable		: false,
					layout			: 'fit',
					header			: true,
					title				: 'Loading',
					closeAction	: 'hide', 
					bodyStyle		: 'background-color:#FFFFFF;'
			});
			*/
			
		}
		AV.BodyLoadingMaskSpinner.setTop(Ext.getBody().getScroll().top);
		AV.BodyLoadingMaskSpinner.show();
		AV.BodyLoadingMask.show();
	},
	
	loadContentWindow: function(callback)
	{
		var self = this;
		var url = AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUICommon : '/library/script/AV.ContentWindowTS.js');

		// Session Check
		Ext.Ajax.request({
			url							: '/SessionCheck.asp',
			disableCaching	: true, 
			scope						: this,

			callback				: function(options, success, resp) {
				
				if (success && resp.responseText === "OK") {

					// Only show the mask if we're not coming from AV.editWin
					if (!AV.ContentWindowTS || AV.ContentWindowTS.window.hidden) { this.showLoading(); }

					if (!this.contentWinLoaded) 
					{
						// (strUrl, strType, strObj, callBack, scope)
						AV.Loader.load(url, 'js', 'AV.ContentWindowTS', callback, self);
						this.contentWinLoaded = true;
					}
					else { callback.call(self); }
				}

				else {
					Ext.Msg.show({
						title			: 'Session Expired',
						msg				: 'Your session has expired. Please sign in and attempt the action again.',
						buttons		: Ext.Msg.OK,
						//fn				: processResult,
						icon			: Ext.MessageBox.INFO	
					});
				}
			}
			
		});

	},

	//#region showParentItemEditWarning
	showParentItemEditWarning	: function(itemName, viewUrl, assnId, itemId, itemType) {
		
		// Ajax Security check and return parent URL

		var msg = '<div style="padding:7px;">' +
							'This item was created in the parent (or sub) site and can only be edited from the site in which it was created. ';

		if (viewUrl) {
			msg = msg + 'To view and/or edit this item click on the link below. By clicking on the link, ' + 
									'you will be redirected to the site in which the element was created. <br/><br/>' +  
									'<div><a href="' + viewUrl + '">' +itemName + '</a></div></div>';
		}

		Ext.Msg.show({
			title		: 'Item Created in a Different Site', 
			msg			: msg, 
			buttons	: Ext.Msg.CANCEL, 
			icon		: Ext.Msg.INFO
		});
	},
	//#endregion

	//#region Edit Window ============================================================================
	editWin: function()
	{
		var url = AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIEditorWin : '/library/publish/AV.editWin.js');
		
		// Make sure to clear out any data from a previous launch
		Ext.ns('AV.editWin');
		delete AV.editWin.data; 

		var config = 
		{
			height				: 540,
			width					: 700,
			title					: 'Edit Content',
			edit					: false,
			add						: false,
			showCancel		: true,
			loadFn				: function() 
				{
					var obj = new AV.editWin.gridPanel( { winContainer:  AV.ContentWindowTS } );
					obj.loadData(AV.editWin.data);

					return obj;
				},
			oCssJsLoader	: 
				{
					scripts: 
					[
						{ src: '/library/publish/AV.editWin.data.js.asp', type: 'ajax', objStr: 'AV.editWin.data' },
						{ src: url, type: 'script', objStr: 'AV.editWin.gridPanel' }
					]
				}
		};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show); 
	},
	//#endregion

	//#region Alert ==================================================================================
	alert: function(alertId, alertTitle, target) 
	{
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIAlert : '/alert/script/AV.AlertForm.js'),		
				config	= {
					height				: 340,
					width					: 515,
					title					: alertId ? 'Edit Alert': 'Create Alert',
					helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/11",
					hideDelete		: (alertId === '' ? true : false),
					showCancel		: true, 
					target				: target,
					loadFn				: function() 
						{
							var obj = new AV.AlertForm( { winContainer:  AV.ContentWindowTS, data: AV.alert.data  } );
							return obj;	
						},
					oCssJsLoader	: 
						{
							scripts: 
							[
								{ src: '/alert/script/AV.AlertForm_Data.js.asp?alert_id=' + alertId, type: 'ajax', objStr: 'AV.alert.data' },
								{ src: url, type: 'script', objStr: 'AV.AlertForm' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);

	}, 
	//#endregion

	//#region Calendar ===============================================================================
	calendar: function(calId, calTitle, target, createAssnId) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUICalendar : '/cal2/script/AV.CalendarForm.js'),	
				config	= {
					height			: 580,
					width				: 760,
					title				: calId ? 'Edit Calendar' : 'Create Calendar',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/21",
					hideDelete	: (calId === '' ? true : false),
					showCancel	: true,
					target			: target,
					loadFn			: function()
												{
													var obj = new AV.CalendarForm( { winContainer:  AV.ContentWindowTS, data: AV.calendar.data } );
													return obj;
												},
					oCssJsLoader: {
						scripts: [
							{ src: '/cal2/script/AV.CalendarForm_Data.js.asp?cal_id=' + calId, type: 'ajax', objStr: 'AV.calendar.data' },
							{ src: url, type: 'script', objStr: 'AV.CalendarForm' }
						]
					}
				};
		
		function show() { AV.ContentWindowTS.show(config); }

		if (createAssnId && (createAssnId != AV.assn_id)) {
			AV.EditorLauncher.showParentItemEditWarning(calTitle, '/cal2/CalendarGet.asp?cal_id=' + calId + '&assn_id=' + createAssnId);
		}
		else { this.loadContentWindow(show); }
	},
	//#endregion

	//#region Calendar Event =========================================================================
	calendarEvent: function(eventId, eventDateId, calId, eventTitle, target, createAssnId) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIEvent : '/cal2/script/AV.EventForm.js'),
				config = 
				{
					height			: 710,
					width				: 760,
					title				: eventId ? 'Edit Event': 'Create Event',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/21",
					hideDelete	: (eventId === '' ? true : false),
					showCancel	: true,
					target			: target,
					loadFn			: function()
												{
													var obj = new AV.EventForm( { winContainer:  AV.ContentWindowTS, data: AV.calendarEvent.data } );
													return obj;
												},
					oCssJsLoader: {
						scripts: [
							{ src: '/cal2/script/AV.EventForm_Data.js.asp?cal_id=' + calId + '&event_date_id=' + eventDateId, type: 'ajax', objStr: 'AV.calendarEvent.data' },
							{ src: url, type: 'script', objStr: 'AV.EventForm' }
						]
					}
		};
		
		function show() { AV.ContentWindowTS.show(config); }

		if (createAssnId && (createAssnId != AV.assn_id)) {
			var pq = new PageQuery(location.search);
			pq.setValue('assn_id', createAssnId);

			AV.EditorLauncher.showParentItemEditWarning(eventTitle, '/cal2/EventShow.asp?' + pq.buildQueryString());
		}
		else { this.loadContentWindow(show); }
	},
	//#endregion

	//#region Calendar Event Types ===================================================================
	calendarEventTypes: function() {
		var  arScripts = this.useCompression ? 
		    	[ 
		    		{ src: AV.cdnUrl + AV.ClientUrls.GUIEventTypes, type: 'script', objStr: 'AV.CalendarEventTypes' }
					] : 
		    	[
						{ src: AV.cdnUrl + '/library/script/Ext.ux.grid.CheckColumn.js', type: 'script', objStr: 'Ext.ux.grid.CheckColumn' },							
						{ src: AV.cdnUrl + '/library/script/Ext.form.ColorField.js', type: 'script', objStr: 'Ext.form.ColorField' },
						{ src: AV.cdnUrl + '/cal2/script/AV.CalendarEventTypes.js', type: 'script', objStr: 'AV.CalendarEventTypes' }						
					],
		    	
				config	= {
					height				: 530,
					width					: 610,
					title					: 'Calendar Categories',
					helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/21",
					edit					: true,
					add						: true,
					showCancel		: true,
					hideDelete		: true,
					loadFn				: function() 
					{
			
						var jsonStore = new Ext.data.JsonStore({		
							autoLoad			: false,
							autoDestroy		: true,			
							url						: '/cal2/script/AV.CalendarEventTypes_data.asp',
							idProperty		: 'event_type_id',
							fields				: ['assn_id', 'event_type_id', 'event_type_name', 'legend_color', 'apply_to_subs'],
							root					: 'events',
							sortInfo			: {
								field			: 'event_type_name',
								direction	:	'ASC'
							}
						});	

						var obj = new AV.CalendarEventTypes( { winContainer:  AV.ContentWindowTS, store:  jsonStore} );				
						return obj;
					},
					oCssJsLoader	: 
						{
							scripts: arScripts
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	},
	//#endregion

	//#region Classified =============================================================================
	classified: function (classifiedId, classifiedName, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIClassified : '/classified/script/AV.ClassifiedForm.js'),	
				config	=
				{
					height			: 640,
					width				: 760,
					title				: classifiedId ? 'Edit Classified' : 'Create Classified',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/26",
					hideDelete	: (classifiedId === '' ? true : false),
					showCancel	: true, 
					target			: target,
					loadFn			: function() 
						{
							// Need to recreate the object each time due to markup being left in the containers
								var obj = new AV.ClassifiedForm( { winContainer: AV.ContentWindowTS , data: AV.classified.data } );	
								return obj;	
						},
					oCssJsLoader	: 
						{
							scripts: 
							[
								{ src: '/classified/script/AV.ClassifiedForm_Data.js.asp?classified_id=' + classifiedId, type: 'ajax', objStr: 'AV.classified.data' },
								{ src: url, type: 'script', objStr: 'AV.ClassifiedForm' }						
							]
						}
					};

			function show() { AV.ContentWindowTS.show(config); }

			this.loadContentWindow(show);
	},
	//#endregion

	//#region Classified Categories ==================================================================
	classifiedCategories: function(target)
	{
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIClassifiedCategories : '/classified/script/AV.ClassifiedCategories.js'),	
				config = 
				{
					height				: 430,
					width					: 500,
					title					: 'Classified Categories',
					helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/26",
					showCancel		: true,
					hideDelete		: true,
					target				: target, 
					loadFn				: function() 
					{
			
						var jsonStore = new Ext.data.JsonStore({		
							autoLoad			: false,
							autoDestroy		: true,			
							url						: '/classified/script/AV.ClassifiedCategories_Data.asp',
							idProperty		: 'cat_id',
							fields				: ['cat_id','cat_name'],
							root					: 'cats',
							sortInfo			: {
								field			: 'cat_name',
								direction	: 'ASC'
							}
						});	
		
						var obj = new AV.ClassifiedCategories( { winContainer:  AV.ContentWindowTS, store:  jsonStore} );				
						return obj;
					},
					oCssJsLoader	: 
						{
							scripts: 
							[
								{ src: url, type: 'script', objStr: 'AV.ClassifiedCategories' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	},
	//#endregion

	//#region Discussion =============================================================================
	discussion: function(forumId, forumTitle, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIDiscussion : '/Discussion/script/AV.DiscussionForm.js'),	
				config =
				{
					height				: 305,
					width					: 480,
					title					: forumId ? 'Edit Discussion Group' : 'Create Discussion Group',
					helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/42",
					hideDelete		: (forumId === '' ? true : false),
					showCancel		: true, 
					target				: target,
					loadFn				: function() 
						{
							// Need to recreate the object each time due to markup being left in the containers
							var obj = new AV.DiscussionForm( { winContainer:  AV.ContentWindowTS, data: AV.discussion.data } );
							return obj;	
						},
					oCssJsLoader	: 
						{
							scripts: 
							[
								{ src: '/Discussion/script/AV.DiscussionForm_Data.js.asp?forum_id=' + forumId, type: 'ajax', objStr: 'AV.discussion.data' },
								{ src: url, type: 'script', objStr: 'AV.DiscussionForm' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);

	}, 
	//#endregion

	//#region Discussion Topic =======================================================================
	discussionTopic: function (postId, forumId, groupId, type, postTitle, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIDiscussionTopic : '/Discussion/script/AV.DiscussionTopicForm.js'),
				config =
				{
					width				: 720,
					height			:	535,
					title				: postId ? 'Edit Discussion Post' : 'Create Discussion Post',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/42",
					hideDelete	: (postId === '' || type !== 'edit'),
					showCancel	: true,
					target			: target,
					loadFn			: function () {
						// Need to recreate the object each time due to markup being left in the containers
						var obj = new AV.DiscussionTopicForm({ winContainer: AV.ContentWindowTS, data: AV.discussionTopic.data });
						return obj;
					},
					oCssJsLoader:
						{
							scripts:
							[
								{ src: '/Discussion/script/AV.DiscussionTopicForm_Data.js.asp?post_id=' + postId + '&forum_id=' + forumId + '&group_id=' + groupId + '&type=' + type, type: 'ajax', objStr: 'AV.discussionTopic.data' },
								{ src: url, type: 'script', objStr: 'AV.DiscussionTopicForm' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	}, 
	//#endregion

	//#region Document ===============================================================================
	document: function(docId, docCatId, docTitle, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIDocument : '/doc/script/AV.ResourceItem.js'),
				config	= {
					width				: 760,
					height			:	635,
					title				: docId ? 'Edit Resource Item' : 'Create Resource Item',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/80",
					hideDelete	: (docId === ''),
					showCancel	: true,
					target			: target,
					loadFn			: function () {
						// Need to recreate the object each time due to markup being left in the containers
						var obj = new AV.ResourceItem({ winContainer: AV.ContentWindowTS, data: AV.document.data });
						return obj;
					},
					oCssJsLoader:
						{
							scripts:
							[
								{ src: '/doc/script/AV.ResourceItem_Data.js.asp?doc_id=' + docId + '&doc_cat_id=' + docCatId, type: 'ajax', objStr: 'AV.document.data' },
								{ src: url, type: 'script', objStr: 'AV.ResourceItem' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	},

	//#endregion

	//#region Document Folder ========================================================================
	documentFolder: function(docCatId, docParentCatId, docCatTitle, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIDocumentFolder : '/doc/script/AV.ResourceFolder.js'),
				config = {
					width				: 760,
					height			:	470,
					title				: docCatId ? 'Edit Resource Folder' : 'Create Resource Folder',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/80",
					hideDelete	: (docCatId === ''),
					showCancel	: true,
					target			: target,
					loadFn			: function () {
						// Need to recreate the object each time due to markup being left in the containers
						var obj = new AV.ResourceFolder({ winContainer: AV.ContentWindowTS, data: AV.documentFolder.data });
						return obj;
					},
					oCssJsLoader:
						{
							scripts:
							[
								{ src: '/doc/script/AV.ResourceFolder_Data.js.asp?doc_cat_id=' + docCatId + '&doc_parent_cat_id=' + docParentCatId, type: 'ajax', objStr: 'AV.documentFolder.data' },
								{ src: url, type: 'script', objStr: 'AV.ResourceFolder' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	},
	//#endregion

	//#region Form ===================================================================================
	form: function(addFormTitle, target, frmId) {
		if (frmId) {
			location.href = '/forms/formbuilder.asp?frm_id=' + frmId + '&type=form&assn_id=' + AV.assn_id;
			return;
		}

		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIForm : '/forms/script/AV.AddForm.js'),
				config = {
					height			: 545,
					width				: 600,
					title				: 'Create Form',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/49",
					hideDelete	: true,
					showCancel	: true,
					target			: target,
					loadFn: function() {
						var obj = new AV.AddForm({ winContainer: AV.ContentWindowTS, data: AV.addForm.data });
						return obj;
					},
					oCssJsLoader: {
							scripts: [
								{	src: '/forms/script/AV.AddForm_data.js.asp', type: 'ajax', objStr: 'AV.addForm.data' },
								{ src: url, type: 'script', objStr: 'AV.AddForm' }
							]
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);

	},
	//#endregion

	//#region Image Gallery ==========================================================================
	gallery: function (imgGalleryId, galleryName, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIGallery : '/gallery/script/AV.GalleryForm.js'),
				iHeight = imgGalleryId === "" ? 540 : 600,
				config	= {
					height			: iHeight,
					width				: 760, 
					title				: imgGalleryId ? 'Edit Photo Gallery' : 'Create Photo Gallery',			
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/292",
					hideDelete	: (imgGalleryId === '' ? true : false),
					showCancel	: true,
					target			: target,

					loadFn			: function () {
						// Need to recreate the object each time due to markup being left in the containers
						var obj = new AV.GalleryForm({ winContainer: AV.ContentWindowTS, data: AV.gallery.data });
						return obj;
					},
					oCssJsLoader:
						 {
							scripts:
							[
								{ src: '/gallery/script/AV.GalleryForm_Data.js.asp?img_gallery_id=' + imgGalleryId, type: 'ajax', objStr: 'AV.gallery.data' },
								{ src: url, type: 'script', objStr: 'AV.GalleryForm' }
							]
					}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	},
	//#endregion

	//#region Image Gallery Image ====================================================================
	image: function (fisDocId, title, target) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUIGalleryImage : '/gallery/script/AV.Gallery.Image.js'),
				iHeight = 280,
				iWidth	= 560,
		    
				config	= 	{
					height			: iHeight,
					width				: iWidth,
					title				: fisDocId ? 'Edit Photo': 'Add Photo',
					helpUrl			: "/Help/ASPTOASPX.asp?topic_full_path=/0/69/174",
					hideDelete	: (fisDocId === '' ? true : false),
					showCancel	: true,
					target			: target,

					loadFn: function () {
						// Need to recreate the object each time due to markup being left in the containers
						//To be modified - data: down below
						var obj = new AV.Gallery.Image({ winContainer: AV.ContentWindowTS, data: AV.gallery.image.data });
						return obj;
					},
					oCssJsLoader:
						 {
							scripts:
							[
								{ src: '/gallery/script/AV.Gallery.Image_Data.js.asp?img_id=' + fisDocId, type: 'ajax', objStr:'AV.gallery.image.data' },
								{ src: url, type: 'script', objStr: 'AV.Gallery.Image' }
							]
						 }
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);
	},
	//#endregion

	//#region Messaging Text Message =================================================================
	msgText: function(target) 
	{
		var data			= { src: '/messenger/scripts/AV.Msg_Data.js.asp', type: 'ajax', objStr: 'AV.msg.data' },
				arScripts = this.useCompression ? 
		    	[ 
		    		data,
		    		{ src: AV.cdnUrl + AV.ClientUrls.GUIMsgText, type: 'script', objStr: 'AV.MsgText' }
					] : 
		    	[
		    		data, 
						{ src: AV.cdnUrl + '/messenger/scripts/AV.MsgCommon.js', type: 'script', objStr: 'AV.MsgCommon' },							
						{ src: AV.cdnUrl + '/messenger/scripts/AV.MsgText.js', type: 'script', objStr: 'AV.MsgText' }						
					],
		
				config = 	{
					height				: 340,
					width					: 515,
					title					: 'Send Text Message',
					//helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/11",
					hideDelete		: true, 
					showCancel		: true, 
					target				: target,
					loadFn				: function() 
						{
							var obj = new AV.MsgText( { winContainer:  AV.ContentWindowTS, data: AV.msg.data  } );
							return obj;	
						},
					oCssJsLoader	: 
						{
							scripts: arScripts
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);

	}, 
	//#endregion

	//#region Messaging Voice Message ================================================================
	msgVoice: function(target) 
	{
		var data			= { src: '/messenger/scripts/AV.Msg_Data.js.asp', type: 'ajax', objStr: 'AV.msg.data' },
				arScripts = this.useCompression ? 
		    	[ 
		    		data,
		    		{ src: AV.cdnUrl + AV.ClientUrls.GUIMsgVoice, type: 'script', objStr: 'AV.MsgVoice' }
					] : 
		    	[
		    		data,
						{ src: AV.cdnUrl + '/messenger/scripts/AV.MsgCommon.js', type: 'script', objStr: 'AV.MsgCommon' },							
						{ src: AV.cdnUrl + '/messenger/scripts/AV.MsgVoice.js', type: 'script', objStr: 'AV.MsgVoice' }						
					],
		
				config = {
					height				: 380,
					width					: 520,
					title					: 'Send Voice Message',
					//helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/11",
					hideDelete		: true, 
					showCancel		: true, 
					target				: target,
					loadFn				: function() 
						{
							var obj = new AV.MsgVoice( { winContainer:  AV.ContentWindowTS, data: AV.msg.data  } );
							return obj;	
						},
					oCssJsLoader	: 
						{
							scripts: arScripts
						}
				};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);

	}, 
	//#endregion

	//#region News ===================================================================================
	news: function(announcementId, announcementTitle, target, newsAssnId) {
		var url			= AV.cdnUrl + (this.useCompression ? AV.ClientUrls.GUINews : '/news/script/AV.NewsForm.js'),
				config	= {
					height				: 670, //Ext.getBody().getHeight() - 50,
					width					: 760,
					minWidth			: 700, 
					title					: announcementId ? 'Edit News Article' : 'Create News Article',
					helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/69",
					hideDelete		: (announcementId === '' ? true : false),
					showCancel		: true, 
					target				: target,
					loadFn				: function() 
						{
							// Need to recreate the object each time due to markup being left in the containers
							var obj = new AV.NewsForm( { winContainer:  AV.ContentWindowTS, data: AV.news.data } );
							return obj;	
						},
					oCssJsLoader: {
						scripts: [
							{ src: '/news/script/AV.NewsForm_Data.js.asp?announcement_id=' + announcementId, type: 'ajax', objStr: 'AV.news.data' },
							{ src: url, type: 'script', objStr: 'AV.NewsForm' }
						]
					}
				};

		function show() { AV.ContentWindowTS.show(config); }

		if (newsAssnId && newsAssnId != AV.assn_id) { //ignore jslint - type coercion intended
			this.showParentItemEditWarning(announcementTitle, '/news/AnnounceShow.asp?announcement_id=' + announcementId + '&assn_id=' + newsAssnId);
			return;
		}

		this.loadContentWindow(show);
	}, 
	//#endregion

	//#region WebPublisher ===========================================================================
	webPublisher: function(linkId, typeId, linkTitle, target) {
		var data			= { src: '/link/script/AV.WebPublisher_Data.js.asp?link_id=' + linkId + '&type=' + typeId, type: 'ajax', objStr: 'AV.webPublisher.data' },
				arScripts = this.useCompression ? 
		    	[ 
		    		data,
		    		{ src: AV.cdnUrl + AV.ClientUrls.GUIWebPublisher, type: 'script', objStr: 'AV.WebPublisherForm' }
					] : 
		    	[
		    		data,
						{ src: AV.cdnUrl + '/link/script/AV.WebPublisherMeta.js', type: 'script', objStr: 'AV.WebPublisherMeta' },							
		    		{ src: AV.cdnUrl + '/link/script/AV.WebPublisher.js', type: 'script', objStr: 'AV.WebPublisherForm' }
					],
		    
				iWidth = 760, 
				iHeight	= 600;
		
		if (typeId == '2') { //ignore jslint
			iHeight = 375;	
		}
		else if (typeId == '3') { //ignore jslint
			iHeight = 350;
		}

		Ext.ns('AV.webPublisher');
		delete AV.webPublisher.data;

		var config =
		{
			height				: iHeight,
			width					: iWidth,
			//minWidth		: 700, 
			title					: (linkId ? 'Edit' : 'Create') + ' Web Page, Module, or Menu Item',
			helpUrl				: "/Help/ASPTOASPX.asp?topic_full_path=/0/98",
			hideDelete		: (linkId === '' ? true : false),
			showCancel		: true, 
			target				: target,
			loadFn				: function() 
				{
					// Need to recreate the object each time due to markup being left in the containers
					var obj = new AV.WebPublisherForm( { winContainer:  AV.ContentWindowTS, data: AV.webPublisher.data } );
					return obj;	
				},
			oCssJsLoader: {
				scripts: arScripts
			}
		};

		function show() { AV.ContentWindowTS.show(config); }

		this.loadContentWindow(show);

	} 
	//#endregion
};


