

	/**
	 * mayaFish.modules.video
	 */

	if (!mayaFish.modules.video)
	{
		mayaFish.modules.video = 
		{
			'_embedTpl': '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width=":WIDTH" height=":HEIGHT" id="webriqplayer" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="allowFullScreen" value="true" /><param name="movie" value=":EMBED_URL" /><param name="wmode" value="opaque" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><embed src=":EMBED_URL" menu="false" quality="high" bgcolor="#000000" width=":WIDTH" height=":HEIGHT" name="webriqplayer" align="middle" wmode="opaque" allowFullScreen="true" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>',
			'initEmbedCode': function(embedUrl)
			{
				this._embedTpl = this._embedTpl.replace(/:EMBED_URL/g,embedUrl);
			},
			'setEmbedCode':	function (wh)
			{
				var _dim = wh.split('x');
				var _code = this._embedTpl.replace(/:WIDTH/g,_dim[0]);
				_code = _code.replace(/:HEIGHT/g,_dim[1]);		
				document.getElementById('embedCodeDisplay').value = _code;
			},
			'sendVideoByEmail': function( vid, form )
			{
				var emailValid = form.recipient.value.match(/[a-zA-Z0-9_\.-]+@[a-zA-Z0-9_\.-]+\.[a-z]{2,4}/);
				if( emailValid )
				{
					document.getElementById('videoShareByEmailMessage').innerHTML = mayaFish.translations('common','please_wait');
					document.getElementById('videoShareByEmailMessage').style.display = 'block';
					document.getElementById('videoShareByEmail').style.display = 'none';
					mayaFish.httpRequest(
					{
						 url: '/video/sendByEmail',
						 params: { 'vid': vid, 'r': form.recipient.value, 'm': form.message.value },
						 method: 'post',
						 parse:  'text',
						 onSuccess: function(response) 
						 {
							document.getElementById('videoShareByEmailMessage').innerHTML = response;
							document.getElementById('videoShareByEmail').style.display = 'block';
						 }
					});	
				}
				else
				{
					alert( mayaFish.translations('data','invalid_email_format') );
				}
			},
			'hideActionMessage': function()
			{
				document.getElementById('videoActionMessage').style.display = "none";
			},
			'showActionMessage': function( vid )
			{
				document.getElementById('videoActionMessage').style.display = "block";
			},
			'turnShare': function()
			{
				if( mayaFish.$id('videoShare').style.display == 'none' )
				{
					mayaFish.$id('videoShare').style.display  = 'block';
					mayaFish.$id('videoShareTitle').className = 'title';
				}
				else
				{
					mayaFish.$id('videoShare').style.display  = 'none';
					mayaFish.$id('videoShareTitle').className = 'title closed';}
			}
		};
	}