/*
#=============================================================#
#                                                             #
#           Powered by Dvbbs.PHP 2.0.0                        #
#           function  DownLoad 效益                           #
#           author    IvanSky                                 #
#           date      2007-9-3                                #
#                                                             #
#=============================================================#
*/
	var dv_adstr
	dv_adstr = '<div id="dvtopLayer" style="position:absolute;background:#999999;top:0px;display:none;z-index:9999;"> <div id="dv_close" style="   position:absolute;top:0px;background:trasparent;font-size:20px; font-weight:bold; color:green;text-align :right;z-index:10000;width:100%;CURSOR:hand;" onclick="dvhideEdit()"><img src="templates/default/images/close.gif" border="0"/></div>'
	dv_adstr += '	<table width=100% height=100% bgcolor="#FFFFFF" style="position:relative;top:-5px;left:-5px;border:solid #999999 1px;"> ';
	dv_adstr += '	  <tr> ';
	dv_adstr += '	    <td><center><div id="ad_content" style="display:none;"></div></center></td> ';
	dv_adstr += '	  </tr> ';
	dv_adstr += '	</table> ';
	dv_adstr += '</div> ';	

	document.writeln(dv_adstr);	
	document.writeln('<iframe frameborder="0" height="0" marginheight="0" marginwidth="0" width="0" name="if_dotDegree" src="#"></iframe> ');	

function dv_dotDegree (DB_id) //统计点击
{
	var dotDB_id = DB_id;
	document.if_dotDegree.location.href='DownLoad_benefit_preview.php?dotCount=1&dotDB_id='+dotDB_id;
}


function dv_adDownLoad(event,DB_id,DB_File,DB_File_type,DB_width,DB_height,DB_second,DB_name,DB_linkurl,DB_type,DB_HTML)
{ 
	var ad_strfileInnerHTML=null;
	if (DB_type==1)
	{
	   ad_strfileInnerHTML = dv_adLoadContent (DB_File_type,DB_width,DB_height,DB_File,DB_name,DB_linkurl);//得到广告显示
	}else if (DB_type==2)
	{
	   ad_strfileInnerHTML = DB_HTML;
	}
	dv_dotDegree (DB_id);//统计点击
	//dvshowEdit(DB_second);//显示广告、多少秒掩藏DownLoad 效益广告
	var obj = event.target ? event.target : event.srcElement;
	obj.id = !obj.id ? 'DB_' + Math.random() : obj.id;

	if (document.all["dvtopLayer"].style.display!="none")
	{
		document.all.ad_content.innerHTML = ad_strfileInnerHTML;
		document.all["ad_content"].style.display="";
		
		if ( !isNaN(DB_width) && DB_width > 0 )
		{
			document.all.dvtopLayer.style.width = DB_width+'px';
		}else{
			document.all.dvtopLayer.style.width = '600px';
		}
		if ( !isNaN(DB_height) && DB_height > 0 )
		{
			document.all.dvtopLayer.style.height = DB_height+'px';		
		}else{
			document.all.dvtopLayer.style.height = '600px';		
		}
	}
	
}

function dv_adLoadContent (DB_File_type,DB_width,DB_height,DB_File,DB_name,DB_linkurl)
{
	var strFileType = DB_File_type;
	var strW = DB_width;
	var strH = DB_height;
	var strUrl = DB_File;
	var ContentText;

	if ( strFileType == 'swf' )
	{
		
		return ContentText = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="' + strW + '" height="' + strH + '"><param name=movie value="'+ strUrl +'"><PARAM NAME=wmode VALUE=opaque><param name=quality value=autolow><embed src="'+ strUrl +'" quality=autolow pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + strW + '" height="' + strH + '" wmode="opaque"></embed></object>';
	
	}else if ( ( strFileType == 'gif' ) ||  (strFileType == 'jpg') )
	{
		 return ContentText = '<A HREF="'+ DB_linkurl +'" target=_blank><IMG SRC="'+ strUrl +'" WIDTH="'+ strW +'" HEIGHT="'+ strH +'" ALT="'+DB_name+'" BORDER="0"></A>';
	
	}
	if (ContentText==undefined)
	{
		 return ContentText = 'Error: DownLoad 效益 Url 失效';
	}

}

function dvshowEdit(DB_second)
{ 
	var serSecond = DB_second; 

	if(typeof(document.all["dvbgLayer"])!="undefined" && typeof(document.all["dvtopLayer"])!="undefined")  
	{
		document.all["dvbgLayer"].style.display=""; 
		document.all["dvbgLayer"].style.height=document.body.scrollHeight; 
		document.all["dvtopLayer"].style.display=""; 
		timer=setInterval(dvmove,"50"); 

		if ( !isNaN(serSecond))
		{
			setTimeout("dvhideEdit()",serSecond*1000);
		}else{
			setTimeout("dvhideEdit()",3000);
		}
	}
} 
function dvhideEdit()
{ 
	if(typeof(document.all["dvbgLayer"])!="undefined" && typeof(document.all["dvtopLayer"])!="undefined")  
	{
		clearInterval(timer); 
		document.all["dvbgLayer"].style.display="none"; 
		document.all["dvtopLayer"].style.display="none"; 
	}
} 
function dvmove()
{ 
	try
	{
		var bodyheight= 0;
		var bodywidth= 0;
		if(typeof (window.innerWidth)=="number")
		{
			bodyheight= window.innerHeight;
			bodywidth= window.innerWidth;
		}
		else
		{
			if(document.documentElement&&document.documentElement.clientHeight){
				bodyheight= document.documentElement.clientHeight;
				bodywidth= document.documentElement.clientWidth;
			}
			else if(document.body&&document.body.clientHeight){
				bodyheight= document.body.clientHeight;
				bodywidth= document.body.clientWidth;
			}
		}
	}
	catch(e){}
	if (document.body){
		dvtopLayer.style.top=(bodyheight*0.5)/2 + document.body.scrollTop + 'px';
	}
	if (document.documentElement){
		dvtopLayer.style.top=(bodyheight*0.5)/2 + document.documentElement.scrollTop + 'px';
		dvtopLayer.style.left=(bodywidth*0.5)/2 + document.documentElement.scrollLeft + 'px';
	}

} 
