﻿// JScript 文件
 //判断是否是IE浏览器

 document.write('<script src="/js/swfobject.js" language="JavaScript"></script>');

function isIE(){ //ie?  
   if (window.navigator.userAgent.toLowerCase().indexOf("msie")>=0)  
    return true;  
   else  
    return false;  
}  
//输出WMV播放器代码(兼容ie6,7,8,firefox)     <param name="EnableContextMenu" value="0">禁止右键弹出窗口
function mediaPlayer(mediaURL, mediaTitle, mediaWidth, mediaHeight) {  

 if(mediaURL.indexOf(".flv")>=0)
    {
        mediaURL="http://download.kgedu.net/"+mediaURL;
        document.write('<div id=\"flvplayer\" style=\"width:"' + (mediaWidth || 640) + '"; margin:0px\" ></div>');
        document.write('<script type="text/javascript">var s5 = new SWFObject("/flash/FlvPlayer.swf","playlist","'+mediaWidth+'","'+mediaHeight+'","8");');
	    document.write('s5.addParam("allowfullscreen","true");');
	    document.write('s5.addVariable("autostart","true");');
	    document.write('s5.addVariable("logotitle","www.kgedu.net");');
	    document.write('s5.addVariable("image","'+mediaTitle+'");');
	    document.write('s5.addVariable("file","'+mediaURL+'");');
	    document.write('s5.addVariable("width","'+mediaWidth+'");');
	    document.write('s5.addVariable("height","'+mediaHeight+'");');
	    document.write('s5.write("flvplayer");</script>');
	}
    else if(mediaURL.indexOf("mms:")<0&&mediaURL!="")
    {
        mediaURL="mms://tv.kgedu.net/"+mediaURL;
//        if(isIE()) 
//        {   
//             document.write('<object id="mediaPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="' + (mediaWidth || 640) + '" height="' + (mediaHeight || 480) + '" viewastext><param name="fileName" value="' + mediaURL + '"><param name="autoStart" value="-1"><param name="showControls" value="1"><param name="AudioStream" value="0"><param name="AutoSize" value="0"><param name="Balance" value="0"><param name="EnableContextMenu" value="1"></object>'); 
//        } 
//        else 
//        {   
            document.write('<embed src="' + mediaURL + '" mce_src="' + mediaURL + '" type="application/x-mplayer2" standby="Loading Windows Media Player components..." width="' + (mediaWidth || 640) + '" height="' + (mediaHeight || 480) + '" title="' + (mediaTitle || '') + '" autostart="1" loop="1"  EnableContextMenu="-1" SHOWCONTROLS= "-1" title="'+mediaTitle+'"  />');   
//        } 
    } 
    else
    {
//        if(isIE()) 
//            {   
//                 document.write('<object id="mediaPlayer" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="' + (mediaWidth || 640) + '" height="' + (mediaHeight || 480) + '" viewastext><param name="fileName" value="' + mediaURL + '"><param name="autoStart" value="-1"><param name="showControls" value="1"><param name="AudioStream" value="0"><param name="AutoSize" value="0"><param name="Balance" value="0"><param name="EnableContextMenu" value="1"></object>'); 
//            } 
//            else 
//            {   
                document.write('<embed src="' + mediaURL + '" mce_src="' + mediaURL + '" type="application/x-mplayer2" standby="Loading Windows Media Player components..." width="' + (mediaWidth || 640) + '" height="' + (mediaHeight || 480) + '" title="' + (mediaTitle || '') + '" autostart="1" loop="1"  EnableContextMenu="-1" SHOWCONTROLS= "-1" title="'+mediaTitle+'" />');   
//            } 
      }
    
}

function flash(ur,w,h){  
    if(ur.indexOf(".swf")>=0)
    {
        if(isIE()) 
        { 
            document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">');
            document.write('<param name="movie" value="'+ur+'"');
            document.write('<param name="quality" value="high">');
            document.write('<embed src="'+ur+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>');
            document.write('</object>');
        }
        else
        {
           document.write('<embed src="'+ur+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>');
        }
    }
}
//flv视频播放
function FLVPlayer(url,w,h,imgUrl)
{  
    if(url.indexOf("http://tv.kgedu.net/")<0)
    {
        url="http://tv.kgedu.net/"+url;
    }
   document.write('<script type="text/javascript">var s5 = new SWFObject("/flash/FlvPlayer.swf","playlist","'+w+'","'+h+'","7");');
	document.write('s5.addParam("allowfullscreen","true");');
	document.write('s5.addVariable("autostart","false");');
	document.write('s5.addVariable("image","'+imgUrl+'");');
	document.write('s5.addVariable("file","'+url+'");');
	document.write('s5.addVariable("width","'+w+'");');
	document.write('s5.addVariable("height","'+h+'");');
	document.write('s5.write("flvplayer");</script>');
}



