/*-- PNG 图片透明代码码开始 --*/
function correctPNG()  
{ 
for(var i=0; i<document.images.length; i++) 
{ 
  var img = document.images[i] 
  var imgName = img.src.toUpperCase() 
  if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
  { 
   var imgID = (img.id) ? "id='" + img.id + "' " : "" 
   var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
   var imgStyle = "display:inline-block;" + img.style.cssText  
   if (img.align == "left") imgStyle = "float:left;" + imgStyle 
   if (img.align == "right") imgStyle = "float:right;" + imgStyle 
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle   
   var strNewHTML = "<span " + imgID + imgClass + imgTitle 
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"  
   img.outerHTML = strNewHTML 
   i = i-1 
  } 
} 
} 
window.attachEvent("onload", correctPNG);
/*-- PNG 图片透明代码结束 --*/

/*-- 打印指定内容开始 */
function printpage(myDiv)
{  
	var newstr = document.all.item(myDiv).innerHTML;
    var oldstr = document.body.innerHTML;
    document.body.innerHTML = newstr;
    window.print();
    document.body.innerHTML = oldstr;
    return false;
} 
/*-- 打印指定内容结束 --*/

/*-- QQLive播放窗口开始 --*/
var objQQLive;
function ChangChannel(vChannel)
{
	var objCtrl = objQQLive.getCtrl();
	objCtrl.Play(vChannel);	
}
/*-- QQLive播放窗口结束 --*/



/*-- 影片播放窗口开始 --*/
var isIe=(document.all)?true:false;

//弹出方法
function showMessageBox(wTitle,content,wWidth)
{
	closeWindow();

	//透明遮罩背景
	var back=document.createElement("div");
	back.id="back";
	var styleStr="top:0px;left:0px;position:absolute;background:#666;width:100%;height:100%;";
	styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
	back.style.cssText=styleStr;
	document.body.appendChild(back);
	showBackground(back,50);

	//播放窗口
	var mesW=document.createElement("div");
	mesW.id="mesWindow";
	mesW.className="mesWindow";
	mesW.innerHTML="<div class='playRim'><div class='playMenu'><div class='playTitle'>" + wTitle + "</div><div class='playClose'><a href='#' onclick='closeWindow();'>关闭</a></div></div><div class='playContent'>" + content + "</div></div>";
	styleStr="left:"+(document.documentElement.scrollWidth/2-wWidth/2)+"px;top:100px;position:absolute;width:"+wWidth+"px;";

	mesW.style.cssText=styleStr;
	document.body.appendChild(mesW);
}

//让背景渐渐变暗
function showBackground(obj,endInt)
{
	if(isIe)
	{
		obj.filters.alpha.opacity+=5;
		if(obj.filters.alpha.opacity<endInt)
		{
			setTimeout(function(){showBackground(obj,endInt)},5);
		}
	}
	else
	{
		var al=parseFloat(obj.style.opacity);al+=0.01;
		obj.style.opacity=al;
		if(al<(endInt/100))
		{
			setTimeout(function(){showBackground(obj,endInt)},5);
		}
	}
}

//关闭窗口
function closeWindow()
{
	if(document.getElementById('back')!=null)
	{
		document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
	}
	if(document.getElementById('mesWindow')!=null)
	{
		document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
	}
}

//测试弹出
function PlayBox(title,filePath)
{
	messContent="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='480' height='360'>";
	messContent+="<param name='movie' value='../swf/FilmPlay.swf?filePath=" + filePath + "' />";
	messContent+="<param name='quality' value='high' />";
	messContent+="<embed src='../swf/FilmPlay.swf' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='480' height='360'></embed>";
	messContent+="</object>";

	showMessageBox(title,messContent,500);
}
/*-- 影片播放窗口结束 --*/
