function showNews( word, cid )
{
	
	var url = "/ajax/GetNewsTagLinks.aspx?tags="+ word +"&id=1";
	var html = getText( url );

	if( html == "" )
	{
		html = "暂无相关新闻";
	}
	else
	{
		while( html.indexOf( ")|<" ) >= 0 )
		{
			html = html.replace( ")|<", ")<br><" );
		}
	}
	
	var div = document.getElementById(cid);
	if( div != null )
		div.innerHTML = html;
}
//---------------------------------------------------
// 是不是firefox
//---------------------------------------------------
function isFF()
{
	var bname = "ie";
	if( navigator.userAgent.indexOf("Firefox")>0)
	{
		bname= "firefox";
	}
	return (bname == "firefox") ? true : false;
}

// get back ground
function getBackground()
{
	var div = document.createElement("div" );
	div.id = "black_screen";
	div.style.width = document.body.offsetWidth + "px";
	div.style.height = document.body.offsetHeight + "px";
	div.style.position = "absolute";
	div.style.top = "0px";
	div.style.left = "0px";
	div.style.zIndex = "0";
	if( isFF())
	{
		div.style.opacity = "0.7";
	}
	else
	{
		div.style.filter = "alpha(opacity = 70)";
	}
	div.style.backgroundColor = "#000000";

	return div;
}

//---------------------------------------------------
// 显示图片
//---------------------------------------------------
function showImage( filepath )
{
	var div = getBackground();
	//
	document.body.appendChild( div );
	
	//
	// 加载具体内容
	var con = document.createElement( "div" );
	con.id = "img_container";
	con.style.border = "1px solid #000000";
	con.style.padding = "10px";
	con.style.position = "absolute";
	con.style.backgroundColor = "#333333";
	con.innerHTML = "<div align='center' style='padding:40px; width:200px; height:120px'><br><br><font color='white'>下载中</font><br><img src='/home/gamezone/load_bar.gif' vspace=10></div>";
	con.style.left = (document.body.offsetWidth - 200)/2 + "px";
	con.style.top = document.documentElement.scrollTop + 100 + "px";

	document.body.appendChild( con );
	window.onscroll = changeTop;
	
	// load
	loadImage(con, filepath);
}

function loadImage( div, filepath )
{
	var pic = new Image();
	
	pic.onclick = new Function( "closeFile(this, 'black_screen')");
	pic.onload = function()
	{
		pic.style.cursor = "pointer"
		pic.setAttribute( "title", "点击关闭" );
	
		div.innerHTML = "";
		div.appendChild( pic );
		div.style.left = (document.body.offsetWidth - pic.width)/2 + "px";
		div.style.top = document.documentElement.scrollTop + 50 + "px";
	}
	
	pic.src = filepath;
	//var h = "<img src='"+ filepath +"' style='cursor:pointer' title='点击关闭' onload=\"fixImgContainer(this, '"+ con.id +"')\" onclick=\"closeFile(this, '"+ div.id +"')\">";
}

function closeFile( img, id )
{
	window.onscroll = null;
	document.body.removeChild( img.parentNode );
	
	var div = document.getElementById( id );

	if( div != null )
	{
		div.innerHTML = null;
		document.body.removeChild( div );
	}
}

function changeTop()
{
	var div = document.getElementById("img_container");
	if( div != null )
	{
		div.style.top = document.documentElement.scrollTop + 50 + "px";
	}
}
