var current_button='';
var current_play_id='';

function resizeBlock(id,sw,sh,dw,dh,spd,func)
{
	
	de(id).style.width=dw;
	de(id).style.height=dh;
	
	if (func)
	{
		eval(func);
	}
}

function pause(id)
{
	de('pfplayer').SetVariable("play_status","pause");
	de('player'+id+'_ctrl').innerHTML='<input class="mb_play" type="button" id="play_btn'+id+'" onclick="play(&quot;'+id+'&quot;)" /><input class="mb_stop" type="button" id="stop_btn'+id+'" onclick="stop(&quot;'+id+'&quot;)"  />';
}

function play(id)
{
	de('pfplayer').SetVariable("play_status","play");
	de('player'+id+'_ctrl').innerHTML='<input type="button" id="pause_btn'+id+'" onclick="pause(&quot;'+id+'&quot;)" class="mb_pause"/><input class="mb_stop" type="button" id="stop_btn'+id+'" onclick="stop(&quot;'+id+'&quot;)" />';
}

function stop(id)
{
	de('pfplayer').SetVariable("play_status","stop");
	de('player'+id+'_ctrl').innerHTML='<input class="mb_play" type="button" id="play_btn'+id+'" onclick="play(&quot;'+id+'&quot;)" />';
}

function splay(id,next_id,old_id,fn)
{
	if ((current_play_id)&&(current_button!=''))
	{
		de('player'+current_play_id+'_ctrl').innerHTML=current_button;
		de('player'+current_play_id).innerHTML='';
	}
	current_button=de('player'+id+'_ctrl').innerHTML;
	current_play_id=id;
	de('player'+id+'_ctrl').innerHTML='<input type="button" id="pause_btn'+id+'" onclick="pause(&quot;'+id+'&quot;)" class="mb_pause" /><input class="mb_stop" type="button" id="stop_btn'+id+'" onclick="stop(&quot;'+id+'&quot;)" />';
	pj.sendDataArray('player'+id,{'m':'music','f':'ga','action':'showPlayer','module':'music','id':id,'nid':next_id,'fn':fn});

}


function vplay(id)
{
	if ((current_play_id)&&(current_button!=''))
	{
		de('player'+current_play_id+'_ctrl').innerHTML=current_button;
		de('player'+current_play_id+'_box').style.backgroundColor='';
		de('player'+current_play_id+'_box').className='vqueue';
		if (de('player'+current_play_id))
		{
			de('player'+current_play_id).innerHTML='';
			//de('player'+current_play_id).style.height='0px';
			resizeBlock('player'+current_play_id,400,240,400,0,10,func);
		}
		
	}
	current_button=de('player'+id+'_ctrl').innerHTML;
	current_play_id=id;
	de('player'+id+'_ctrl').innerHTML='<input type="button" id="pause_btn'+id+'" onclick="pause(&quot;'+id+'&quot;)" class="mb_pause" /><input class="mb_stop" type="button" id="stop_btn'+id+'" onclick="stop(&quot;'+id+'&quot;)" />';
	de('player'+id+'_box').className='vplaying';

	var func='';
	if (de('player'+id))
	{
		func="pj.sendDataArray('player"+id+"',{'m':'video','f':'ga','action':'showPlayer','module':'video','id':'"+id+"'})";
		resizeBlock('player'+id,400,0,400,240,10,func);
	}
	else
	{
		func="pj.sendDataArray('player0',{'m':'video','f':'ga','action':'showPlayer','module':'video','id':'"+id+"'})";
		resizeBlock('player0',400,0,400,240,10,func);
	}
}

		function initUpload(session_id) {
			var _swfu = new SWFUpload({
			// Backend Settings
			upload_url: "../swfupload.php",	// Relative to the SWF file
			post_params: {"PHPSESSID": session_id},

			// File Upload Settings
			file_size_limit : "10240",	// 2MB
			file_types : "*.*",
			file_types_description : "Upload files",
			file_upload_limit : "0",

			// Event Handler Settings - these functions as defined in Handlers.js
			//  The handlers are not part of SWFUpload but are part of my website and control how
			//  my website reacts to the SWFUpload events.
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			upload_start_handler : uploadStartHandler,

			// Flash Settings
			flash_url : "images/swfu.swf",	// Relative to this file

			custom_settings : {
				upload_target : "divFileProgress"
			},
			
			// Debug Settings
			debug: false
			});
			return _swfu;
		}
