//
function $(id){
	return document.getElementById(id);	
}
function h(obj,url){obj.style.behavior='url(#default#homepage)';obj.setHomePage(url);}

function LoadImg(baocuo_dir,w,h){
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="object_flash_player" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"  width="'+w+'" height="'+h+'"><param name="movie" value="'+baocuo_dir+'template/skin4/images/g_js/pic.swf"><param name="quality" value="high"><PARAM   NAME="wmode"   VALUE="transparent"><param name="allowScriptAccess" value="always"><param name="allowFullScreen" value="true"><param name="FlashVars" value="bcastr_xml_url='+baocuo_dir+'template/skin4/images/g_js/pic.xml"><embed src="'+baocuo_dir+'template/skin4/images/g_js/pic.swf" flashvars="bcastr_xml_url='+baocuo_dir+'template/skin4/images/g_js/pic.xml" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" width="'+w+'" height="'+h+'"></object>');
}

function DrawImage(ImgD,iwidth,iheight){
	//参数(图片,允许的宽度,允许的高度)
	var image=new Image();
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
	flag=true;
	if(image.width/image.height>= iwidth/iheight){
		if(image.width>iwidth){  
		ImgD.width=iwidth;
		ImgD.height=(image.height*iwidth)/image.width;
		}else{
		ImgD.width=image.width;  
		ImgD.height=image.height;
		}
		//ImgD.alt=image.width+"×"+image.height;
		}
	else{
		if(image.height>iheight){  
		ImgD.height=iheight;
		ImgD.width=(image.width*iheight)/image.height;        
		}else{
		ImgD.width=image.width;  
		ImgD.height=image.height;
		}
		//ImgD.alt=image.width+"×"+image.height;
		}
	}
}	

/********************************************
Basis of dwsFramework , Writen by qingtianpic.cn
*********************************************/
function by(id)
{
	return document.getElementById(id);
}
Array.prototype.remove = function(dx) {
    if(isNaN(dx) || dx>this.length){return false;}
    this.splice(dx,1);
}
String.prototype.getNumber = function() {return this.replace(/[^\d]/g,""); }
String.prototype.replaceAll = stringReplaceAll;
function stringReplaceAll(AFindText,ARepText){
 var raRegExp = new RegExp(AFindText.replace(/([\(\)\[\]\{\}\^\$\+\-\*\?\.\"\'\|\/\\])/g,"\\$1"),"ig");
 return this.replace(raRegExp,ARepText);
}
var dwsFw = {};
var dwsBrowser = {};
dwsBrowser.agt = navigator.userAgent.toLowerCase();
dwsBrowser.isW3C = document.getElementById ? true:false;
dwsBrowser.isIE = ((dwsBrowser.agt.indexOf("msie") != -1) && (dwsBrowser.agt.indexOf("opera") == -1) && (dwsBrowser.agt.indexOf("omniweb") == -1));
dwsBrowser.isNS6 = dwsBrowser.isW3C && (navigator.appName=="Netscape") ;
dwsBrowser.isOpera = dwsBrowser.agt.indexOf("opera") != -1;
dwsBrowser.isGecko = dwsBrowser.agt.indexOf("gecko") != -1;
dwsBrowser.ieTrueBody  =function (){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}
var dwsElement={
  addClassName: function(element, className) {
    if (!(element = $(element))) return;
	dwsElement.delClassName(element, className);
	element.className=element.className+" "+className;
  },
  delClassName: function(element, className) {
    if (!(element = $(element))) return;
	var arrClssOld=element.className.replaceAll("  "," ");
	arrClssOld=arrClssOld.split(" ");
	for (var i=arrClssOld.length-1;i>=0;i--){
	 if (className==arrClssOld[i]){
	 arrClssOld.remove(i);
	 }
	}
	element.className=arrClssOld.join(" ");
  },
	isChild		: function(cNode,pNode){
		while(cNode!=null){
			cNode=cNode.parentNode;
			if(cNode==pNode) return true; 
		}
		return false;
	},
	getChild	: function(oChild,oParent){
		oParent.appendChild(oChild);
	},
	rePos	: function(obj,nLt,nTop){
		var o=$(obj);
		o.style.left	= nLt + "px";
		o.style.top		= nTop + "px";
	},
	getXYWH	: function(o){
		var nLt=0;
		var nTp=0;
		var offsetParent = o;
		while (offsetParent!=null && offsetParent!=document.body) {
			nLt+=offsetParent.offsetLeft;
			nTp+=offsetParent.offsetTop;
			if(dwsBrowser.isIE){
				parseInt(offsetParent.currentStyle.borderLeftWidth)>0?nLt+=parseInt(offsetParent.currentStyle.borderLeftWidth):"";
				parseInt(offsetParent.currentStyle.borderTopWidth)>0?nTp+=parseInt(offsetParent.currentStyle.borderTopWidth):"";
			}
			offsetParent=offsetParent.offsetParent;
		}
		return {"X":nLt, "Y":nTp, "W":o.offsetWidth, "H":o.offsetHeight}
	}
}
var dwsPosition={
	rePos	: function(obj,nLt,nTop){
		var o=$(obj);
		o.style.left	= nLt + "px";
		o.style.top		= nTop + "px";
	}
}
function $(element) {
	return document.getElementById(element)?document.getElementById(element):element;
}
document.getElementsByClassName = function(className,oBox) {
	 this.d= oBox || document;
	 var children = this.d.getElementsByTagName('*') || document.all;
	 var elements = new Array();
	 for (var i = 0; i < children.length; i++) {
		 var child = children[i];
		 var classNames = child.className.split(' ');
		 for (var j = 0; j < classNames.length; j++) {
			 if (classNames[j] == className) {
				 elements.push(child);
				 break;
			 }
		 }
	 }
	 return elements;
}

$Cls = document.getElementsByClassName ;
var dwsTAB = {
	idSuffix		: "_Tabs",
	tabTagName		: "li",
	activeClassName	: "active",
	waitInterval	: null,
	delayTime		: 30,
	tempTAB			: null
}
dwsTAB.init = function(){
	for(var i=0;i<arguments.length;i++) {
			var oTabBox=document.getElementById(arguments[i]+dwsTAB.idSuffix);
			var arrTabs=oTabBox.getElementsByTagName(dwsTAB.tabTagName);	
			var oCurrTAB=null;
			for(var j=0;j<arrTabs.length;j++) {
				oCurrTAB=arrTabs[j];
				if(oCurrTAB.parentNode!=oTabBox) continue;
				var oTabLink=oCurrTAB.getElementsByTagName("a")[0];
				var sDataStaut=oTabLink.getAttribute("rel");
				oCurrTAB.setActive=function(bactive){
					var oDataId = this.getElementsByTagName("a")[0].getAttribute("urn");
					if(bactive){
						this.status="active";
						dwsElement.addClassName(this,dwsTAB.activeClassName);
						dwsElement.delClassName($(oDataId),"hidden");
					}else{
						this.status="normal";
						dwsElement.delClassName(this,dwsTAB.activeClassName);
						dwsElement.addClassName($(oDataId),"hidden");
					}
				}
				oCurrTAB.getTabData=function(){
					this.setActive(true);
					this.parentNode.activetab.setActive(false);
					this.parentNode.activetab=this;					
					var oTabLink=this.getElementsByTagName("a")[0];
				}
				oCurrTAB.onmouseover=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var fm=myEvent.fromElement;
					if(dwsElement.isChild(fm,this) || fm==this) return;
					if(this.status=="active") return;
					dwsTAB.tempTAB=this;
					clearTimeout(dwsTAB.waitInterval);
					dwsTAB.waitInterval=window.setTimeout("dwsTAB.tempTAB.getTabData();",dwsTAB.delayTime);
				}
				oCurrTAB.onmouseout=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var em=myEvent.toElement;
					if(dwsElement.isChild(em,this) || em==this) return;
					if(this.status=="active") return;
					clearTimeout(dwsTAB.waitInterval);
				}
				if(sDataStaut.indexOf("#default")!=-1){
					oCurrTAB.setActive(true);
					oTabBox.activetab=oCurrTAB;
				} else {
					oCurrTAB.setActive(false);
				}

			}
		if(oTabBox.activetab==null) oTabBox.activetab=arrTabs[0];
	}
}

dwsTAB.init2 = function(){
	for(var i=0;i<arguments.length;i++) {
			var oTabBox=document.getElementById(arguments[i]+dwsTAB.idSuffix);
			var arrTabs=oTabBox.getElementsByTagName(dwsTAB.tabTagName);	
			var oCurrTAB=null;
			for(var j=0;j<arrTabs.length;j++) {
				oCurrTAB=arrTabs[j];
				if(oCurrTAB.parentNode!=oTabBox) continue;
				var oTabLink=oCurrTAB.getElementsByTagName("a")[0];
				var sDataStaut=oTabLink.getAttribute("rel");
				oCurrTAB.setActive=function(bactive){
					var oDataId = this.getElementsByTagName("a")[0].getAttribute("urn");
					if(bactive){
						this.status="active";
						dwsElement.addClassName(this,dwsTAB.activeClassName);
						dwsElement.delClassName($(oDataId),"hidden");
					}else{
						this.status="normal";
						dwsElement.delClassName(this,dwsTAB.activeClassName);
						dwsElement.addClassName($(oDataId),"hidden");
					}
				}
				oCurrTAB.getTabData=function(){
					this.setActive(true);
					this.parentNode.activetab.setActive(false);
					this.parentNode.activetab=this;					
					var oTabLink=this.getElementsByTagName("a")[0];
				}
				oCurrTAB.onclick=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var fm=myEvent.fromElement;
					if(dwsElement.isChild(fm,this) || fm==this) return;
					if(this.status=="active") return;
					dwsTAB.tempTAB=this;
					dwsTAB.tempTAB.getTabData();
					//clearTimeout(dwsTAB.waitInterval);
					//dwsTAB.waitInterval=window.setTimeout("dwsTAB.tempTAB.getTabData();",dwsTAB.delayTime);
				}
				if(sDataStaut.indexOf("#default")!=-1){
					oCurrTAB.setActive(true);
					oTabBox.activetab=oCurrTAB;
				} else {
					oCurrTAB.setActive(false);
				}

			}
		if(oTabBox.activetab==null) oTabBox.activetab=arrTabs[0];
	}
}

dwsFw.setHome = function(o,s){
	if (dwsBrowser.isIE) {
		o.style.behavior='url(#default#homepage)';
		o.setHomePage(s);
		return(false);
	}
}
dwsFw.addFavUrl = function(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( dwsBrowser.isIE ) {
		window.external.AddFavorite( url, title);
	} else if(dwsBrowser.isOpera && window.print ) {
		  var elem = document.createElement('a');
		  elem.setAttribute('href',url);
		  elem.setAttribute('title',title);
		  elem.setAttribute('rel','sidebar');
		  elem.click();
	}
}
var oldBoxNo=0;
function nextFace(sParentId,sSubBoxTag,n){
var arrFaceBox=$(sParentId).getElementsByTagName(sSubBoxTag);
var nNewBoxNo=oldBoxNo+n;
nNewBoxNo<0?nNewBoxNo=(arrFaceBox.length-1):"";
nNewBoxNo>=arrFaceBox.length?nNewBoxNo=0:"";
for (var i=0;i<arrFaceBox.length;i++ ) {
 arrFaceBox[i].style.display=i==nNewBoxNo?"":"none";/**/
}
oldBoxNo=nNewBoxNo;
}
var dwsPopMsg = {};
dwsPopMsg.show = function(o,sId,nOffX,nOffY){
this.offX = nOffX || 0;
this.offY = nOffY || 0;
var oBox = $(sId);
var nPos = dwsElement.getXYWH(o);
var nLt,nTop;
nLt = nPos.X + (nPos.W/2) + this.offX;
nTop = nPos.Y + this.offY;
dwsElement.rePos(oBox,nLt,nTop);
dwsElement.delClassName(oBox,"hidden");
//alert(nPos.X);
}
dwsPopMsg.close = function(sId){
var oBox = $(sId);
dwsElement.addClassName(oBox,"hidden");
}
function chgInp(o){
	o.value=o.value==o.defaultValue?"":o.value;
	o.onblur= function(){
		this.value=this.value==""?this.defaultValue:this.value;
	}
}

// search input
var dwsSearch = {
	hoverBtn	: function(o,s){
		dwsElement.addClassName(o,s);
		o.onmouseout = function(){
			dwsElement.delClassName(this,s);
		}
	},
	doInput	: function(o){
		if (o.value==o.defaultValue) {
			o.value="";
		}
		o.onblur = function(){
			o.value==""?o.value=o.defaultValue:"";
		}
	}
}

function socheck(obj) {
	if(document.search.keywords.value=='') { 
		alert('请输入关键字');
		document.search.keywords.focus();
		return false;
	} 

	obj.disabled=true; 
	document.search.submit();
}

/* ads code*/
function loadAds(c, s)
{
	try
	{
		document.getElementById(c).innerHTML = document.getElementById(s).innerHTML;
		document.getElementById(s).innerHTML = "";
	}
	catch (e)
	{/*do not*/}
} 

function setAdsSize(s, w, h)
{
	try
	{
		document.getElementById(s).style.width = w;
		document.getElementById(s).style.height = h;
	}
	catch (e)
	{/*do not*/}
}

/*hideText*/
function hideText(e, conLen, str1, str2)
{
	textBox = document.getElementById(e);
	if ("" == conText)
	{
		conText = textBox.innerHTML;
	}

	if(navigator.appName.indexOf("Explorer") > -1)
	{
		if (textBox.innerText.length < conLen)
		{
			return;
		}
		textBox.innerHTML = textBox.innerText.substr(0, conLen);    
	}
	else
	{
		if (textBox.textContent.length < conLen)
		{
			return;
		}
		textBox.innerHTML = textBox.textContent .substr(0, conLen);
	}
	textBox.innerHTML += '...&nbsp;&nbsp;<a href="javascript:;" onclick="showText(\'' + e + '\',\'' + conLen + '\', \'' + str1 + '\', \'' + str2 + '\');return false" target="_self">' + str1 + '</a>';
}

function showText(e, conLen, str1, str2)
{
	textBox = document.getElementById(e);;
	textBox.innerHTML = conText + '&nbsp;&nbsp;<a href="javascript:;" onclick="hideText(\'' + e + '\', \'' + conLen + '\', \'' + str1 + '\', \'' + str2 + '\');return false" target="_self">' + str2 + '</a>';
}

function copyUrl(url){
var content='';
window.clipboardData.setData("Text",url);
alert("复制成功，请粘贴到你的QQ/MSN上推荐给你的好友");
}


function makeTagsColor(tagName)
{
	var colors = Array("#51975B", "#7391DD", "#666666", "#FF0033", "#BB408F", "#E07230");
	var tag = document.getElementById(tagName);
	tag = tag.getElementsByTagName("a");
	for (var i = 0; i < tag.length ; ++i)
	{
		n = parseInt(colors.length * Math.random());
		tag[i].style.color = colors[n];
	}
}

function Get_Index_(v){
	var ii
	for(var i=0;i<document.getElementById("nav_list_menu").childNodes[0].childNodes.length;i++){
		ii=	document.getElementById("nav_list_menu").childNodes[0].childNodes[i];
		ii.className=""
	}
	var s=document.getElementById("headli_ndtv_"+v)
	if(s)
		document.getElementById("headli_ndtv_"+v).className="posl active"
}