// -- Functions for Video Recorder (are executed from flash) -- //

var VideoComment = {
	show : function (contentID, parentID) {
		Overlay.notify('ovlAddVideoComment', 'passParam', contentID, parentID);
		Overlay.show('ovlAddVideoComment', '<%=AddVideoOverlayUrl%>');
	}
}

function GetWidgetVideoGuid() {
	return videoRec.getVideoGuid();
}

function VideoRecordReady() {
	videoRec.ready = true;
}
// -- /Functions for Video Recorder (are executed from flash) -- //

var commentEditorHelpers = {
	_initialize: function() {
		//this.containerId = containerId;
	},
	_onload: function () {
		this.setDeleteButtonsAlert();
	},
	setEditorPosition: function (commentEditorId, parentId, hiddenIds) {
		//debugger;
		var commentEditor = $(commentEditorId);
		var parentPlaceholder = $(parentId);
		var idsArr;
		if( commentEditor && parentPlaceholder ) {
			commentEditor.style.display = 'block';
			parentPlaceholder.style.height = commentEditor.offsetHeight + 'px';
			Position.clone(parentPlaceholder, commentEditor, { 
					setWidth: true,
					setHeight: false
				}
			);
		}
		if(hiddenIds) {
			idsArr = hiddenIds.split(",");
			this.hideElements(idsArr);
			Position.clone(parentPlaceholder, commentEditor, { 
					setWidth: true,
					setHeight: false
				}
			);
		}
	},
	setDeleteButtonsAlert: function (containerId) {
		var itemList = $(containerId);
		if( itemList ) {
			itemList.select(".commentDeleteButton").each(function(el) {
				Event.observe(el, 'click', this.deleteButtonAlert.bindAsEventListener(this));
			}.bind(this));
		}
	},
	deleteButtonAlert: function(e) {
		if( confirm('Are you sure you want to delete this comment?') ) {
			return true;
		} else {
			Event.stop(e);
			return false;
		}
	},
	hideElements: function(idsArr) {
		for( var i = 0; i < idsArr.length; i++){
			var hiddenElement = $(idsArr[i]);
			if( hiddenElement ) hiddenElement.style.display = 'none';
		}
	}
};

// [AtlasScript]
if(typeof(Sys)!="undefined")
	Sys.Application.notifyScriptLoaded();

// [/AtlasScript]

