
	Effect.QueueThis = Class.create();
	Object.extend( Object.extend( Effect.QueueThis.prototype, Effect.Base.prototype ), 
	{
	    initialize: function(element) {
	        this.element = element;
	        this.func = arguments[1];
	        this.start(arguments[2]);
	    },
	    finish: function(position){
	        this.func(this.element);
    }
	});


	
	function mfGetData(action,id, statusId,data, containerId)
	{	
		
			//containerId = typeof(containerId) != 'undefined' ? containerId : 'filesContent_' + id.substring(id.indexOf('-')+1);
		
			if ($(id).visible() )
			{
				return true;
			}
			
			elements = $$('div.ajax');  

			if (elements.size() > 0)
			{
				elements.each
				(
					function(i)
					{
						if ( i.id != id  && i.visible())
						{
							if (i.id.substr(0,5) != 'video' && i.id.substr(0,5) != 'sound'){
								Effect.BlindUp(i,{queue: 'front'});}
							else
							{
								$(i.id.substr(0,5) + 'Player-' + i.id.substring(i.id.indexOf('-')+1)).hide();
								$(i.id.substr(0,1) +'Close_' + i.id.substring(i.id.indexOf('_')+1)).hide();
								Effect.BlindUp(i.id.substr(0,5) +'s-'+ i.id.substring(i.id.indexOf('-')+1),{queue: 'front'});
							}
						}
						
					}
				);
		
					
				if ( elements.indexOf($(id) )> -1 )
					Effect.BlindDown(id,{queue: 'end'});
				else
				    handleMfRequest(action,id,statusId, data);
			}
			else
			{
				handleMfRequest(action,id,statusId, data);
			}
		}
		
		function handleMfRequest(action, id,statusId, data)
		{
			contentId = id.substring(id.lastIndexOf('_')+1);
			new Ajax.Request(action,
			{
				method:'post',
				parameters: {
					content_id: contentId,
					data: data
				},   
				onLoading: function(){
					$(statusId).show();
				},
				onSuccess: function(obj){
					$(statusId).hide();
					$(id).innerHTML = obj.responseText;  
					Effect.BlindDown(id,{queue: 'end'});
					if (!$(id).hasClassName())
						$(id).addClassName("ajax"); 
					 
				},     
				onFailure: function(){
					 alert('Ajax error');
					}   
			});
		}
		
		function mfShowHide(id,playerPath, xmlPath, type)
		{
			
			//containerId = typeof(containerId) != 'undefined' ? containerId : 'filesContent_' + id;
			
			if ($(type+'s-'+id).visible() )
			{
				return true;
			}
			
			elements = $$('div.ajax');

			if (elements.size() > 0)
			{
				elements.each
				(
					function(i)
					{
					
						if ( i.id != id  && i.visible())
						{
								
							if ($(type+'s-'+id))
							{
								if (!$(type+'s-'+id).visible())
								{
									
									switch (type)
									{
										case 'video':
											$('soundPlayer-'+id).hide();
										break;
										
										case 'sound':
											$('videoPlayer-'+id).hide();
										break;
									}
									
									if (i.id.substr(0,5) != 'video' && i.id.substr(0,5) != 'sound'){
										Effect.BlindUp(i,{queue: 'front'});}
									else
									{
										$(i.id.substr(0,5) + 'Player-' + i.id.substring(i.id.indexOf('-')+1)).hide();
										$(i.id.substr(0,1) +'Close_' + i.id.substring(i.id.indexOf('_')+1)).hide();
										Effect.BlindUp(i.id.substr(0,5) +'s-'+ i.id.substring(i.id.indexOf('-')+1),{queue: 'front'});
									}
									
								}
							}
							else
							{
								if (i.id.substr(0,5) != 'video' && i.id.substr(0,5) != 'sound'){
									Effect.BlindUp(i,{queue: 'front'});}
								else
								{
									$(i.id.substr(0,5) + 'Player-' + i.id.substring(i.id.indexOf('-')+1)).hide();
									$(i.id.substr(0,1) +'Close_' + i.id.substring(i.id.indexOf('_')+1)).hide();
									Effect.BlindUp(i.id.substr(0,5) +'s-'+ i.id.substring(i.id.indexOf('-')+1),{queue: 'front'});
								}
								Effect.BlindDown(type+'s-'+id,{queue: 'end'});
								statsContentId = id.substring(id.lastIndexOf('_')+1);
								statsMfType = type;
							}
							
						}
					}
				);
				
				Effect.BlindDown(type+'s-'+id,{queue: 'end'});
				statsContentId = id.substring(id.lastIndexOf('_')+1);
				statsMfType = type;
				switch (type)
				{
					case 'video':
						new Effect.QueueThis( 
					    	$(type+'s-'+id), 
						    function () { showVideoPlayer(id,playerPath, xmlPath); } ,
						    { queue: 'end'   }
						);
									
					break;
										
					case 'sound':
						new Effect.QueueThis( 
						    $(type+'s-'+id), 
						    function () { showSoundPlayer(id,playerPath, xmlPath); } ,
						    { queue: 'end'   }
						);
					break;
				}
					if (!$(type+'s-'+id).hasClassName())
						$(type+'s-'+id).addClassName("ajax"); 
				
			}
			else
			{
				Effect.BlindDown(type+'s-'+id,{queue: 'end'});
									
					switch (type)
					{
						case 'video':
							new Effect.QueueThis( 
						    $(type+'s-'+id), 
						    function () { showVideoPlayer(id,playerPath, xmlPath); } ,
						    { queue: 'end'   }
							);
							
						break;
						
						case 'sound':
							new Effect.QueueThis( 
						    $(type+'s-'+id), 
						    function () { showSoundPlayer(id,playerPath, xmlPath); } ,
						    { queue: 'end'   }
							);
							
						break;
					}
					statsContentId = id.substring(id.lastIndexOf('_')+1);
					statsMfType = type;
				if (!$(type+'s-'+id).hasClassName())
					$(type+'s-'+id).addClassName("ajax"); 
			}
		
		
		}
		
		function showVideoPlayer(id,playerPath, xmlPath)
		{
		
			$("videoPlayer-"+id).show();
			var s1 = new SWFObject(playerPath,"videomp_"+id.substring(id.lastIndexOf('_')+1),"300","280","7");
			s1.addParam("allowfullscreen","true");
			s1.addVariable("enablejs","true");
			s1.addVariable("javascriptid","videomp_"+id.substring(id.lastIndexOf('_')+1));
			s1.addVariable("displayheight","200");
			s1.addVariable("file",xmlPath);
			s1.write("videoPlayer-"+id);
			$('vClose_'+id.substring(id.lastIndexOf('_')+1)).show();
		}
		
		function showSoundPlayer(id,playerPath, xmlPath)
		{
		
			$("soundPlayer-"+id).show();
			var s1 = new SWFObject(playerPath,"soundmp_"+id.substring(id.lastIndexOf('_')+1),"300","50","7");
			s1.addVariable("enablejs","true");
			s1.addVariable("javascriptid","soundmp_"+id.substring(id.lastIndexOf('_')+1));
			s1.addVariable("displayheight","0");
			s1.addVariable("file",xmlPath);
			s1.write("soundPlayer-"+id);
			$('sClose_'+id.substring(id.lastIndexOf('_')+1)).show();
		}
		
		function handleMfStats(action,file,type)
		{
			new Ajax.Request(action , {
			method: 'post',
			parameters: 'mode=stats&file='+file+'&type='+type,
			onComplete: function()
			{
				return true;
			},
			onFailure: function()
			{
				return false;
			}
		});
		}
		function closeMfDiv(idd)
		{
			idx = $(idd).up('div').id;
		
			if (!idx)
				return false;
			$(idx).addClassName('ajaxClosed');
			$(idx).removeClassName('ajax');
			Effect.BlindUp(idx,{queue: 'front'});
		}
		
		function closeMfPlayerDiv(idd)
		{
			idx = $(idd).up('div').id;
	
			if (!idx)
				return false;
			$(idx).addClassName('ajaxClosed');
			$(idx).removeClassName('ajax');
			$(idx.substr(0,5) + 'Player-' + idx.substring(idx.indexOf('-')+1)).hide();
			$(idx.substr(0,1) +'Close_' + idx.substring(idx.indexOf('_')+1)).hide();
			Effect.BlindUp(idx.substr(0,5) +'s-'+ idx.substring(idx.indexOf('-')+1),{queue: 'front'});
		}
