function StarvRealPlayer(){
	var _this = this;
	this.is_fullscreen = false;
	this.v_id = '';		//播放器ID
	this.rect_w = 352;	//原始宽（仅用于确定画面比例，所以此处也可以写比例因子）
	this.rect_h = 288;	//原始高（仅用于确定画面比例，所以此处也可以写比例因子）
	this.size_w = 493;
	this.size_h = 403;
	this.c_id = '';		//容器ID
	this.video_url = '';
	var playbutton_id = '';
	var playstatu_id = '';
	var obj_esc_fullscreen = null;
	
	//参数说明
	//renderto	:	容器ID
	//player_id	:	播放器的ID
	//r_w, r_h	:	画面的原始尺寸（宽，高）
	//vw, vh	:	画面尺寸（宽，高）
	this.init = function(renderto, player_id, r_w, r_h, vw, vh) {
		this.v_id = player_id;
		this.c_id = '_starv_' + player_id + '_container';
		playbutton_id = '_starv_' + player_id + '_playbutton';
		playstatu_id = '_starv_' + player_id + '_statu';
		this.rect_w = r_w;
		this.rect_h = r_h;
		this.size_w = vw;
		this.size_h = vh;
		
		var ctl_id = ''
		
		var strx = '<div id="' + _this.c_id + '" style="position:inherit; left:0px; top:0px; text-align:center;">';
		

		strx += '<OBJECT ID="' + player_id + '" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT=' + vh + ' WIDTH=' + vw + '>';
		strx += '<param name="_ExtentX" value="9313">';
		strx += '<param name="_ExtentY" value="7620">';
		strx += '<param name="AUTOSTART" value="0">';
		strx += '<param name="SHUFFLE" value="0">';
		strx += '<param name="PREFETCH" value="0">';
		strx += '<param name="NOLABELS" value="0">';
		strx += '<param name="SRC" value="">';
		strx += '<param name="CONTROLS" value="ImageWindow">';
		strx += '<param name="CONSOLE" value="Clip1">';
		strx += '<param name="LOOP" value="0">';
		strx += '<param name="NUMLOOP" value="0">';
		strx += '<param name="CENTER" value="0">';
		strx += '<param name="MAINTAINASPECT" value="0">';
		strx += '<param name="BACKGROUNDCOLOR" value="#000000">';
		strx += '<embed name="' + player_id + '" SRC="" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ImageWindow" HEIGHT="' + vh + '" WIDTH="' + vw + '" AUTOSTART="false"></embed>';
		strx += '</OBJECT>';

		
		strx += '<table cellpadding="0" cellspacing="0">';
		strx += '<tr>';
		strx += '<td width="44">';
		strx += '<OBJECT ID="'+playbutton_id+'" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" WIDTH="44" HEIGHT="26">';
		strx += '<PARAM NAME="CONTROLS" VALUE="PlayButton"><PARAM NAME="CONSOLE" VALUE="Clip1">';
		strx += '<EMBED WIDTH=44 HEIGHT=26 CONTROLS="PlayButton" CONSOLE="Clip1"></EMBED>';
		strx += '</OBJECT>';
		strx += '</td>';
		strx += '<td>';
		strx += '<OBJECT ID="'+playstatu_id+'" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" WIDTH="' + (vw-44) + '" HEIGHT="26">';
		strx += '<PARAM NAME="CONTROLS" VALUE="StatusBar"><PARAM NAME="CONSOLE" VALUE="Clip1">';
		strx += '<EMBED HEIGHT=26 WIDTH=' + (_this.vw-44) + ' CONTROLS="StatusBar" CONSOLE="Clip1"></EMBED>';
		strx += '</OBJECT>';
		strx += '</td>';
		strx += '</tr>';
		strx += '</table>';
		
		strx += '</div>';
		
		$(renderto).innerHTML = strx;
		
		//$(player_id).setWantErrors(true);		//出错时不显示对话框
		$(player_id).SetEnableContextMenu(false);
	}
	
	this.play = function(url) {
		if (typeof(url)=='undefined' || url==null) url = _this.video_url;
		if (url.length==0) {alert('提供的视频地址为空，无法播放'); return false;}
		
		var vdo = $(_this.v_id);
		vdo.DoStop();
		vdo.setSource(url);
		vdo.DoPlay();
	}
	
	this.stop = function() {
		var vdo = $(_this.v_id);
		vdo.DoStop();
	}
	
	this.setSize = function(w, h){		
		var vdo = $(_this.v_id);
	
		if ((typeof(w)=='undefined' || w==null) && (typeof(h)=='undefined' || h==null)){
			var w = Cookies.get('starv_video_size_w', 0);
			var h = Cookies.get('starv_video_size_h', 0);
		}
		
		if (w==0) w = _this.size_w;
		if (h==0) h = _this.size_h;
		
		Cookies.set('starv_video_size_w',w,null,null);
		Cookies.set('starv_video_size_h',h,null,null);
		
		if (w!=0 && h!=0){
			vdo.width = w;
			vdo.height = h;
			
			$(playstatu_id).width = w-44;	//状态条宽度
		}
	}
	
	this.setFullScreen = function(){
        var obj = $(_this.c_id);
        var vdo = $(_this.v_id);

        if (_this.is_fullscreen==false){
            document.body.style.overflow='hidden';
            
            //扩大背景层
            obj.style.position = "absolute";
            obj.style.top = document.body.scrollTop;
            obj.style.width = document.documentElement.clientWidth;
            obj.style.height = document.documentElement.clientHeight;
            obj.style.backgroundColor = '#000000';
            
            //计算视频新大小
            var h = document.documentElement.clientHeight-26-20;
            var w = Math.ceil(_this.rect_w * h / _this.rect_h);
            vdo.width = w;
            vdo.height = h;
            
            //显示退出全屏
            obj_esc_fullscreen = document.createElement('div');
            obj_esc_fullscreen.height=20;
            obj_esc_fullscreen.setAttribute('style', 'text-align:center;');
            obj_esc_fullscreen.innerHTML = '<span class="clickable" onclick="starvplayer.setFullScreen()" style="color:#949290;">退出全屏</span>';
            obj.appendChild(obj_esc_fullscreen);
            
            $(playstatu_id).width = w-44;	//状态条宽度
            
            _this.is_fullscreen = true;
        }
        else{
            document.body.style.overflow='auto';
            
            //还原背景层
            obj.style.position = "";
            obj.style.top = 0;
            obj.style.width = 493;
            obj.style.height = 429;
            obj.style.backgroundColor = 'transparent';
            
            //还原视频大小
            _this.setSize();
            
            //销毁退出全屏
            if (obj_esc_fullscreen) obj_esc_fullscreen.parentNode.removeChild(obj_esc_fullscreen);
            
            _this.is_fullscreen = false;
        }
	}
	
	var $ = function(id) {
		return document.getElementById(id);
	}
}