function AllMyUGC(){
	new Ajax.Updater( 'myugc',
		'mod-user-generated/ajax/selections.php', 
		{
			method:"post", 
			encoding:'ISO 8859-1',	
			evalScripts:true,		
			parameters:'url=-1' 
		} 
	);	
}
function DeleteUGC( id ){
	var vHtmlElt = 'UGC_'+id ;	
	ShowIndicator();
	$('buttonclosing').hide();
	new Ajax.Updater( '_INFODIV',
						   'mod-system/ajax/deleteselection.php', { 
								onComplete:HideIndicator, 
								method: "post", 
								evalScripts:true,
								parameters:{playlist:'UGC', HtmlElt:vHtmlElt, todelete:id}
								}
						  );		
}	
	var currPage= new Array();
	currPage['last'] = 1;
	currPage['mv'] = 1;
	currPage['md'] = 1;
	currPage['top'] = 1;
	currPage['My_'] = 1;
	function UpdateVideoListing( aHtml, aType, aPage ){
		ShowIndicator();
		if (aPage == -1 ) aPage = currPage[ aType ] ; // update current page after delete
		currPage[ aType ] = aPage;
		new Ajax.Updater( aHtml,
								'mod-user-generated/ajax/selections.php', { 
									onComplete:HideIndicator, 
									method: "post", 
									evalScripts:true,
									parameters:{action:aType, page: aPage, Html:aHtml}
									}
							  );				
	}

	var vlast = new Array() ;
	vlast[''] = 'last' ;
	vlast['My_'] = 'My' ;
	function togglesub( b, a ){
		if ( vlast[b] != a ){
			$(b+'m'+a).className="";
			$(b+'m'+vlast[b]).className="sel";
			vlast[b] = a ;
			UpdateVideoListing( b+'video_grid', a, currPage[a] );
		}
	}

	function ChangeBrowseMode( b, aMode ){
		if ( aMode == 'G' ) {
			$(b+'video_grid').className="GridView";
			$(b+'BmodeG').className="modeGOff";
			$(b+'BmodeL').className="modeL";
		}else{
			$(b+'video_grid').className="ListView";
			$(b+'BmodeG').className="modeG";
			$(b+'BmodeL').className="modeLOff";
		}
}
function showSearch(){
	$('BmodeG').show() ;
	$('BmodeL').show() ;
	$('m3').show() ;
	$('menu1').show() ;
	$('SSi').hide() ;
}

function CannotSubscribe(){
	ShowIndicator();
	new Ajax.Updater( '_INFODIV',
						   'mod-user-generated/ajax/selections.php', { 
								onComplete:ShowInfo, 
								method: "post", 
								evalScripts:true,
								parameters:{action:'CannotSubscribe'}
								}
						  );		
}

function AddPlaylist( aContent ){
	ShowIndicator();
	new Ajax.Updater( 'myugc', 
		'mod-user-generated/ajax/selections.php', 
		{
			onComplete:HideIndicator, 
			method:"post", 
			evalScripts:true,		
			parameters:{action:'addPL', id_content:aContent} 
		} 
	);		
}
function ViewVideo( aContent ){
	ShowIndicator();
	new Ajax.Updater( '_INFODIV',
						   'mod-user-generated/ajax/selections.php', { 
								onComplete:ShowInfo, 
								method: "post", 
								evalScripts:true,
								parameters:{action:'videoinfo', id_content:aContent }
								}
						  );		
}

function EditVideo( aContent ){
	ShowIndicator();
	$('buttonclosing').hide();
	new Ajax.Updater( '_INFODIV',
						   'mod-user-generated/ajax/selections.php', { 
								onComplete:ShowInfo, 
								method: "post", 
								evalScripts:true,
								parameters:{action:'myvideoinfo', id_content:aContent }
								}
						  );		
}

function ReallyDelete( id ){
	var vHtmlElt = 'MyUGC_'+id ;	
	ShowIndicator();
	$('buttonclosing').hide();
	new Ajax.Updater( '_INFODIV',
						   'mod-system/ajax/deleteselection.php', { 
								onComplete:HideIndicator, 
								method: "post", 
								evalScripts:true,
								parameters:{playlist:'MyUGC', HtmlElt:vHtmlElt, todelete:id}
								}
						  );		
}
function valideVideoInfo(){
	if( trim($('mo_src_title').value) == "")
	{
		alert("Please, enter a title!");
		$('mo_src_title').focus();
		return false;
	}
	if( trim($('mo_src_description').value) == "")
	{
		alert("Please, enter a description!");
		$('mo_src_description').focus();
		return false;
	}
	if( document.form_upload.mo_src_category.options[document.form_upload.mo_src_category.selectedIndex].value == -1)
	{
		alert("Please, select a video category!");
		$('mo_src_category').focus();
		return false;
	}		
	return true ;
}
function UpdateVideoInfo(){
	if ( valideVideoInfo() ){
		ShowIndicator();
		new Ajax.Updater( 'error',
								'mod-user-generated/ajax/selections.php', { 
									onComplete:HideInfo, 
									method: "post", 
									evalScripts:true,
									parameters:$('form_upload').serialize(true) 
									}
							  );		
	}
}
function InvertPublic( aContent ){
	ShowIndicator();
	new Ajax.Updater( 'error',
						   'mod-user-generated/ajax/selections.php', { 
								onComplete:HideIndicator, 
								method: "post", 
								evalScripts:true,
								parameters:{action:'invertpub', id_content:aContent }
								}
						  );		
}


function MoreVideoFrom( aHtml, aIdUser, aPage, aSlide){
	ShowIndicator();
	new Ajax.Updater( aHtml,
						   'mod-user-generated/ajax/selections.php', { 
								onComplete:HideIndicator, 
								method: "post", 
								evalScripts:true,
								parameters:{action:'getvideoFrom', id_user:aIdUser, page:aPage, Slide:aSlide, Container:aHtml }
								}
						  );		
}
function VideoFrom( aIdUser ){
	ShowIndicator();
	new Ajax.Updater( '_INFODIV',
						   'mod-user-generated/ajax/selections.php', { 
								onComplete:ShowInfo, 
								method: "post", 
								evalScripts:true,
								parameters:{action:'getvideoFrom', id_user:aIdUser, page:1, Slide:0, Container:'_INFODIV'}
								}
						  );		
}
