// JavaScript Document
farmAdminVideo={
    Version: '0.1',
    appear:function(){
    },
    play:function(flv){
        new Ajax.Request("/mediatar.php", {
            method: 'POST',
            parameters: {
                act:'stat',
                'videoid': flv
            }
        });
    },
    adv_appear:function(flv)
    {
    /*if(!$('count_advvideo'))
		{
			var s=document.createElement('IFRAME');
			s.src="count_advvideo.html";
			s.style["position"]="absolute";
			s.style["left"]="-10000px";
			s.id="count_advvideo";
			document.body.insertBefore(s, document.body.firstChild);
		}*/
    },
    setVolume:function(value)
    {
        setCookie('FlvPlayerVolume', value, 365);
    },
    getVolume:function()
    {
        var r=getCookie('FlvPlayerVolume');
        if(r==null)r=0.75;
        return r;
    },
    get_flvplayer:function (videoid,videourl,picurl,videodesc,autowidth,mode,preurl,posturl,hqurl,hdurl)
    {
        //var r=0.5625;
        var r=0.5625;
        var width="440";
        //var width="560";
        var height="350";
        //var height="342";
        videodesc=escape(videodesc);
        if(autowidth!="default")
        {
            if(autowidth==0)
            {
            //width="100%";
            //height="100%";
            }
            else
            {
                width=autowidth;
                height=Math.round(width*r)+30;
            }
        }
        var advvideostr='';

        if(preurl!='') advvideostr=advvideostr+'&prelink='+preurl;
        if(posturl!='') advvideostr=advvideostr+'&postlink='+posturl;

        var ret='<object data="/flash/snagplayer.swf" name="movieflash" id="movieflash" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="440" height="350">';
        ret+='<param value="#000000" name="bgcolor">';
        ret+='<param value="true" name="allowFullScreen">';
        ret+='<param value="window" name="wmode">';
        ret+='<param value="high" name="quality">';
        ret+='<param value="always" name="allowScriptAccess">';
        ret+='<param value="/flash/snagplayer.swf" name="movie">';

        ret+='<param value="1_jscallmode=1&1_enablejscall=true&1_prefixjs=divatVideo2&1_videoid='+videoid+'&1_urlvideosd='+videourl+'&1_urlpic='+picurl+(hqurl ? '&1_urlvideohq='+hqurl :'')+(hdurl ? '&1_urlvideohd='+hdurl : '')+'&1_imagescalemode=1&1_defaultquality=2&1_enablechangequality=true&1_autostart=false&1_enableembedcode=false&numvideo=1&urlskin=/flash/farmskin.swf" name="flashvars">';
        ret+='<embed name="movieflash" src="/flash/snagplayer.swf" bgcolor="#000000" FlashVars="1_jscallmode=1&1_enablejscall=true&1_prefixjs=divatVideo2&1_videoid='+videoid+'&1_urlvideosd='+videourl+'&1_urlpic='+picurl+(hqurl ? '&1_urlvideohq='+hqurl :'')+(hdurl ? '&1_urlvideohd='+hdurl : '')+'&1_imagescalemode=1&1_defaultquality=2&1_enablechangequality=true&1_autostart=false&1_enableembedcode=false&numvideo=1&urlskin=/flash%2Ffarmskin.swf" quality="high" allowFullScreen=true type="application/x-shockwave-flash" allowScriptAccess="always" width="'+width+'" height="'+height+'">';


        ret+='</object>';
        return(ret);
    },
    print_flvplayer:function (videoid,videourl,picurl,videodesc,autowidth,mode,preurl,posturl)
    {
        document.write(this.get_flvplayer(videoid,videourl,picurl,videodesc,autowidth,mode,preurl,posturl));
    },
    set_flvplayer:function (element,videoid,videourl,picurl,videodesc,autowidth,mode,preurl,posturl,hqurl,hdurl)
    {
        $(element).update(this.get_flvplayer(videoid,videourl,picurl,videodesc,autowidth,mode,preurl,posturl,hqurl,hdurl));
    }
}