﻿//判断浏览器ie6创建的div的样式和非ie6创建的div的样式
//创建div
function show(w,h){
var isIE = (document.all) ? true : false;
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
var newbox=document.createElement("div");
newbox.style.width=w+"px";
newbox.style.height=h+"px";
newbox.style.border="1px solid #000";
newbox.style.background="#fff"
newbox.style.zIndex="9999";
newbox.id = 'newnewbox';
document.body.appendChild(newbox);  
newbox.style.position = !isIE6 ? "fixed" : "absolute";
newbox.style.top =newbox.style.left = "50%";
newbox.style.marginTop = - newbox.offsetHeight / 2 + "px";
newbox.style.marginLeft = - newbox.offsetWidth / 2 + "px";
if(isIE6){
newbox.style.marginTop = document.documentElement.scrollTop - newbox.offsetHeight / 2 + "px";
newbox.style.marginLeft = document.documentElement.scrollLeft - newbox.offsetWidth / 2 + "px";
window.attachEvent("onscroll",function(){
newbox.style.marginTop = document.documentElement.scrollTop - newbox.offsetHeight / 2 + "px";
newbox.style.marginLeft = document.documentElement.scrollLeft - newbox.offsetWidth / 2 + "px";
})
}
}

//显示层
function showPop(bigDivId,videoUrl,videoTitle,videoDesc){
	setVideoUrl(videoUrl,videoTitle,videoDesc);
var isIE = (document.all) ? true : false;
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
var newbox=document.getElementById(bigDivId);
//var videobox = document.getElementById(videoDivId);
newbox.style.zIndex="9999";
newbox.style.display="block"
newbox.style.position = !isIE6 ? "fixed" : "absolute";
newbox.style.top =newbox.style.left = "50%";
newbox.style.marginTop = - newbox.offsetHeight / 2 + "px";
newbox.style.marginLeft = - newbox.offsetWidth / 2 + "px";  

//videobox.style.display="block";
var layer=document.createElement("div");
layer.id="layer";
layer.style.width=layer.style.height="100%";
layer.style.position= !isIE6 ? "fixed" : "absolute";
layer.style.top=layer.style.left=0;
layer.style.backgroundColor="#000";
layer.style.zIndex="9998";
layer.style.opacity="0.6";
document.body.appendChild(layer);
function layer_iestyle(){      
layer.style.width=Math.max(document.documentElement.scrollWidth, document.documentElement.clientWidth)

+ "px";
layer.style.height= Math.max(document.documentElement.scrollHeight, document.documentElement.clientHeight) +

"px";
}
function newbox_iestyle(){      
newbox.style.marginTop = document.documentElement.scrollTop - newbox.offsetHeight / 2 + "px";
newbox.style.marginLeft = document.documentElement.scrollLeft - newbox.offsetWidth / 2 + "px";
}
if(isIE){layer.style.filter ="alpha(opacity=60)";}
if(isIE6){  
layer_iestyle()
newbox_iestyle();
window.attachEvent("onscroll",function(){                              


newbox_iestyle();
})
window.attachEvent("onresize",layer_iestyle)          
}  
var mClose = document.getElementById("close"); 
	mClose.onclick=function(){
	newbox.style.display="none";
	layer.style.display="none";
	getVcastr().videoStop();
	//playerStop
	}

}

 function getVcastr() {
	 	 //alert(document.getElementById("vcastr3").height+'');
         if (navigator.appName.indexOf("Microsoft") != -1) {
             return window["vcastr3"];
         } else {
             return document["vcastr3"];
         }
     }

function setVideoUrl(videoUrl,videoTitle,videoDesc)
{
	//getVcastr();
	var videoBox = document.getElementById("videoBox");
	videoBox.innerHTML="<object id='vcastr3' data='/flash/vcastr3.swf' height='410' type='application/x-shockwave-flash' width='580'><param name='movie' value='/flash/vcastr3.swf'/><param name='allowFullScreen' value='true' /><param name='FlashVars' value='xml=<vcastr><plugIns><javaScriptPlugIn><url>/flash/javaScriptPlugIn.swf</url></javaScriptPlugIn></plugIns><channel><item><source>"+videoUrl+"</source></item></channel></vcastr>' /></object>";	
	if(videoDesc.length>45)
		videoDesc = videoDesc.substr(0,45);
	document.getElementById("videoTitle").innerHTML = videoTitle;
	document.getElementById("videoDesc").innerHTML = videoDesc;
}

function showp(id) {
	var obj = document.getElementById(id);
	obj.style.display = 'block';
	//document.getElementById("video_big_1").style.backgroundColor="#E2E0E1";
}

function hidep(id) {
	var obj = document.getElementById(id);
	obj.style.display = 'none';
	//document.getElementById("video_big_1").style.backgroundColor="#FFF";
}
	
//获得flashplayer的版本
function getFlashVer() {
 var f="",n=navigator; 
 if (n.plugins && n.plugins.length) {
  for (var ii=0;ii<n.plugins.length;ii++) {
   if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
    f=n.plugins[ii].description.split('Shockwave Flash ')[1];
    break;
   }
  }
 } else if (window.ActiveXObject) {
  for (var ii=10;ii>=2;ii--) {
   try {   
    var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
    if (fl) {f=ii + '.0'; break; }
   }
   catch(e) {}
  }
 }
 document.write("您的FlashPlayer版本为" + f);
 if(f<=8.0){
 	document.write("；<br><font color='#FF0000'>请点击左侧图标至Adobe网站更新Flash插件</font>");
 }else{
 	document.write("；<br>您无需更新插件，可以正常浏览。");
 }
}

