	function playVideo( filter_type, media_id ) {
		d = new dialog( {width:770, height:450, onclose:'d.close()', ismodel:true, isdrag:false, isclose:false} );	
		d.sethtml('Loading...');
		d.show();
		
		$.ajax({
				type : "POST",
				url	 : g_site_path+"ajax/get-play-video",
				data : 'filter_type='+filter_type+'&media_id='+media_id+'&rand='+Math.random(),
				dataType : 'html',
				success: function( data ) {
					d.sethtml( data );
				}
		   });	
	}	
	
	function embedPlayer( options ) {

		var so = new SWFObject(g_tool_path+'MPlayer.swf','mpl','738','388','9');
		so.addParam('allowscriptaccess','always');
		so.addParam('allowfullscreen','true');
		so.addParam('autoStart','true');
		so.addParam('flashvars','&videoPath='+options.video+'&videoTitle='+options.name+'&autoStart=true&image='+options.thumb);
		so.write('app-player');				
		return;	

		var flashvars = {};
		flashvars.VideoPath = options.video;
		flashvars.VideoName = options.name;
		flashvars.autostart = true;
		flashvars.image = options.thumb;
		
		var params = {};
		params.play = "true";
		params.menu = "false";
		params.quality = "high";
		params.scale = "noscale";
		params.wmode = "opaque";
		params.bgcolor = "#869ca7";
		params.allowscriptaccess = "always";
		var attributes = {};
		attributes.align = "middle";
		alert( g_tool_path+"MPlayer.swf" )
		swfobject.embedSWF(g_tool_path+"MPlayer.swf", "app-player", "738", "388", "9.0.0", false, flashvars, params, attributes);
		//swfobject.createCSS("#app-pyp","outline:none"); 
	}
	
	function funBaseName( pmPath ){
		vSource      = pmPath;
		vStartCount  = vSource.lastIndexOf("/");
		vBaseName    = vSource.substring(vStartCount+1);
		
		return vBaseName;
	}
	function resetAudioPlayBacks(){
		$('.audio_playback').each(function(){
			var html = $(this).html();
			if ( html != '' ){
				$(this).html('');
				var refid = $(this).attr('id');
				var medid = refid.substr(refid.lastIndexOf('_')+1)
				funStopPlayingAudioFile('audio_play_'+medid, refid);				
			}
		});
	}
	function funPlayAudioFile( pmValue, pmImgId, pmDivId){				
		vSrc  = funBaseName( $('#'+pmImgId).attr('src') );
		vStop = funBaseName( g_template_img+'stop.gif' );
		if ( vSrc == vStop  )
			funStopPlayingAudioFile( pmImgId, pmDivId);	
		else{
			resetAudioPlayBacks();
			$('#'+pmImgId).attr('src',g_template_img+'stop.gif');	
			vString  = '<OBJECT id="Audio" width="200" height="200" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"';
			vString += 'type="application/x-oleobject">';
			vString += '<PARAM NAME="URL" VALUE="'+pmValue+'">';
			vString += '<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">';
			vString += '<PARAM NAME="AutoStart" VALUE="True">';
			vString += '<PARAM name="uiMode" value="none">';
			vString += '<PARAM name="PlayCount" value="1">';
			vString += '</OBJECT>';			
			$('#'+pmDivId).html(vString);
		}
	}
	
	function funStopPlayingAudioFile( pmImgId, pmDivId ){
		$('#'+pmDivId).html('');
		$('#'+pmImgId).attr('src',g_template_img+'play.gif');
	}
	
	function downloadMediaFromServer( path, mediaid ){
		if ( parseInt(mediaid) > 0 ){
			window.location.href = path+'?media_id='+mediaid;
		}
	}
