// index_banner.js
var img_h=55;	//定义广告图片高度
var html_1='<div id="banner_img" class="banner_0" style="margin-top:0;width:920px;position:relative;'+img_h+'px; ">';
html_1+='<img src="http://www.rad.cn/index_banner/920x55_gysbook.png" width="920" height="55" class="banner_3" style="position:absolute; left:0; top:0;z-index:1;"  />';	//广告图片

html_1+='<a id="button_link" href="http://www.rad.cn/gyssoft.html"  target="_blank" class="banner_4" style="background:url(http://www.rad.cn/index_banner/920x55_gysbook.png) no-repeat 0px 0px;left:0px;top:0px;width:650px;height:55px;display:block;z-index:2;position:absolute;"></a>';	//广告链接
html_1+='<a id="button_link" href="http://shop.cdcc.cn/gysbook.html"  target="_blank" class="banner_4" style="left:680px;top:0px;width:200px;height:55px;display:block;z-index:2;position:absolute;"></a>';	//广告链接

html_1+='<a id="button_guan" href="javascript:" class="banner_5" style="background:url(http://www.rad.cn/index_banner/920x55_gysbook.png) no-repeat -885px -2px;left:885px;top:2px; width:24px;height:24px;display:block; position:absolute;z-index:3;"></a>';	//关闭按钮

html_1+='</div>';	//定义显示广告图片的HTML代码
var on_off1=true;	//定义是否显示广告，true为显示广告,false不显示广告

show_banner(); 

//显示广告图片函数
function show_banner()
{
$xy("banner").innerHTML=html_1;
$xy("banner").style.height="55px";

$xy("button_guan").onclick=function()
{
banner_play($xy("banner_img"))
}
}

function banner_play(obj)
{
var timer_1=setInterval(function()
{

if(obj.style.marginTop!="-"+img_h+"px")
{
var mtop=parseInt(obj.style.marginTop)-2;
if(mtop<-img_h)mtop=-img_h;
var heih=parseInt($xy("banner").style.height)-2;
if(heih<-0)heih=0;
obj.style.marginTop=mtop+"px";
$xy("banner").style.height=heih+"px";
}
else
{
clearInterval(timer_1);
}
},20);
}

function $xy(id)
{
return document.getElementById(id);
}
// xmlhttprequest对象封装
function imshe_ajax1()
{
var ajaxreq;

try {
ajaxreq= new XMLHttpRequest();
} catch (error) {
try {
ajaxreq = new ActiveXObject("Microsoft.XMLHTTP");
} catch (error) {

}
}

this.htsj;

var dx;
this.init=function(filename,name,queryString,fs){

dx=this;
this.htsj=name.zhixing;
//如果是异步通信方式(true)，客户机就不等待服务器的响应

if (fs== "get")
      {
ajaxreq.open("GET",filename,true);
}
else
{
//几个请求同时执行时为true时，则回调函数顺序为反，为false时则正确
ajaxreq.open("POST",filename, true);
ajaxreq.setRequestHeader("Method", "POST "+filename+" HTTP/1.1");
ajaxreq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}

ajaxreq.onreadystatechange =this.ajaxResponse;
ajaxreq.send(queryString);

}
this.ajaxResponse=function()
{

if (ajaxreq.readyState !=4) return;
if (ajaxreq.status==200) {
dx.htsj(ajaxreq);
} 
else 
{alert("Request failed: " + ajaxreq.statusText)
};

try{

ajaxreq=null;

}catch(e){}

}
}
// xmlhttprequest对象封装

