//filter_ad start
var brOK=false;
var mie=false;
var aver=parseInt(navigator.appVersion.substring(0,1));
var aname=navigator.appName;

function checkbrOK()
{if(aname.indexOf("Internet Explorer")!=-1)
   {if(aver>=4) brOK=navigator.javaEnabled();
    mie=true;
   }
 if(aname.indexOf("Netscape")!=-1)
   {if(aver>=4) brOK=navigator.javaEnabled();}
}


// 图片组数
var vmin=1;
var vmax=5;
var vr=2;
var timer;

function Chip(chipname,width,height)
{this.named=chipname;
 this.vx=vmin+vmax*Math.random();
 this.vy=vmin+vmax*Math.random();
 this.w=width;
 this.h=height;
 this.xx=0;
 this.yy=0;
 this.timer1=null;
}

function movechip(chipname)
{
 if(brOK)
  {eval("chip="+chipname);
   if(!mie)
    {pageX=window.pageXOffset;
     pageW=window.innerWidth;
     pageY=window.pageYOffset;
     pageH=window.innerHeight;
    }
   else
    {pageX=window.document.body.scrollLeft;
     pageW=window.document.body.offsetWidth-8;
     pageY=window.document.body.scrollTop;
     pageH=window.document.body.offsetHeight;
    }
   chip.xx=chip.xx+chip.vx;
   chip.yy=chip.yy+chip.vy;
   chip.vx+=vr*(Math.random()-0.5);
   chip.vy+=vr*(Math.random()-0.5);
   if(chip.vx>(vmax+vmin))  chip.vx=(vmax+vmin)*2-chip.vx;
   if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx;
   if(chip.vy>(vmax+vmin))  chip.vy=(vmax+vmin)*2-chip.vy;
   if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy;
   if(chip.xx<=pageX)
     {chip.xx=pageX;
      chip.vx=vmin+vmax*Math.random();
     }
   if(chip.xx>=pageX+pageW-chip.w)
     {chip.xx=pageX+pageW-chip.w;
      chip.vx=-vmin-vmax*Math.random();
     }
   if(chip.yy<=pageY)
     {chip.yy=pageY;
      chip.vy=vmin+vmax*Math.random();
     }
   if(chip.yy>=pageY+pageH-chip.h)
     {chip.yy=pageY+pageH-chip.h;
      chip.vy=-vmin-vmax*Math.random();
     }
   if(!mie)
      {eval('document.'+chip.named+'.top ='+chip.yy);
       eval('document.'+chip.named+'.left='+chip.xx);
      }
   else
      {eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx);
       eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy);
      }
   chip.timer1=setTimeout("movechip('"+chip.named+"')",300);
  }
}

function stopme(chipname)
{if(brOK)
  {
   eval("chip="+chipname);
   if(chip.timer1!=null)
    {clearTimeout(chip.timer1)}
  }
}

var chip1;

function pagestart()
{checkbrOK();
 chip1=new Chip("chip1",60,80);
 if(brOK)
   { movechip("chip1");   }
}

// 属性设置
var E_strIFaderTransType = 'reveal'; // 'reveal' | 'blend'
var Filter_number = 23;       // 滤镜种数
var change_time = 0.000;    // 滤镜转换过程为3.0秒延迟
var wait_time  = 10000;     // 两种滤镜之间为5秒延迟

var obj_Timer;
var count_temp = 0; //记录当前是第几幅图片
var Img_arry = new Array(); //图片数组
var E_ie4 = document.all?true:false;
var E_nn4 = document.layers?true:false;

function Filt_set() //设置滤镜
{
	if(!E_ie4 && !E_nn4) return;
	if(E_ie4) {
		var theImg = document.all['idImgFading'];
		if(theImg == null) return;
		with(document.all['idImgFading']) {
			style.filter = (E_strIFaderTransType == 'reveal')?'revealTrans':'blendTrans';
			style.filter.duration = change_time;
			style.filter.transition = Filter_number;
		}
	}
	obj_Timer = window.setInterval('use_Filter()',wait_time);
}

function use_Filter() //滤镜的启动
{
	if(E_ie4) {
		with(document.all['idImgFading']) {
			if(E_strIFaderTransType == 'reveal') {
				filters(0).transition = Filter_number;
			}
			if(count_temp == (Img_arry.length - 1)) {
				count_temp = -1;
			}
			count_temp++;
			title = Img_arry[count_temp].sAlt;

			filters(0).apply();
			src = Img_arry[count_temp].sImgUrl;
		        strurl = Img_arry[count_temp].command;
			//alert(title)

			filters(0).play();
			geturl.href="javascript:clickit('"+strurl+"')"
		}
	}
	else if(E_nn4) {
		if(count_temp == (Img_arry.length - 1)) {
			count_temp = -1;
		}
		count_temp++;
		document.images['idImgFading'].src = Img_arry[count_temp].sImgUrl;
	}
}

function obj_ClearTime() {
	window.clearInterval(obj_Timer);
}
window.onunload = obj_ClearTime;//取消计时器，释放系统资源

function Img_obj(sImgUrl,command,sAlt,sTarget)
{
	this.sImgUrl = (sImgUrl == null)?'':sImgUrl;
	//this.command = (command == null || command == 'url')?'url':command; command ='url'
	this.command = (command == null )?'':command;
	this.sAlt = (sAlt == null)?'':sAlt;
	this.sTarget = (sTarget == null || sTarget == '')?'_self':sTarget;
}

function clickit(imgurl){  window.open(imgurl);  }

// 定义图像来源
//Img_arry[0] = new Img_obj('<EMBED src="/p5w/home/adimages/logo.swf" quality=high  WIDTH=120 HEIGHT=100 TYPE="application/x-shockwave-flash"></EMBED>','#','广告2','_blank');
//Img_arry[0] = new Img_obj('/p5w/home/adimages/20040226f.jpg','http://www.cninfo.com.cn/zspt/index.html','广告','_blank');
//Img_arry[0] = new Img_obj('/p5w/home/adimages/20041227fb.gif','http://roadshow.p5w.net/rs2004/zy/','广告','_blank');
//Img_arry[0] = new Img_obj('<EMBED src="/p5w/home/adimages/20040513f.swf" quality=high  WIDTH=80 HEIGHT=80 TYPE="application/x-shockwave-flash"></EMBED>','#','广告2','_blank');

var interval = 2.5; // delay between rotating images (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

//定义层
//document.writeln('<DIV id=chip1 style="HEIGHT: 75; POSITION: absolute; WIDTH: 47px">');
//document.writeln('<A id=geturl href="'+Img_arry[0].command+'"><IMG  name=idImgFading border=0 src="'+Img_arry[0].sImgUrl+'" ></A> ')
//document.writeln('<EMBED src="http://www.p5w.net/p5w/home/adimages/20051121f.swf" quality=high  WIDTH=100 HEIGHT=100 TYPE="application/x-shockwave-flash"></EMBED>')
//document.write('<a href="http://bjzr.gfzr.com.cn/bjzr/tzzy.htm " target="_blank"><img src="http://www.p5w.net/p5w/home/adimages/060428floater.gif" WIDTH=100 HEIGHT=100 border=0></a>'+'\n');

//document.writeln('</DIV>');

var image_index = 0;
image_list = new Array();
image_list[image_index++] = new imageItem("http://www.p5w.net/gif/chart1.gif");
image_list[image_index++] = new imageItem("http://www.p5w.net/gif/chart2.gif");
image_list[image_index++] = new imageItem("http://www.p5w.net/gif/chart3.gif");
image_list[image_index++] = new imageItem("http://www.p5w.net/gif/chart4.gif");
image_list[image_index++] = new imageItem("http://www.p5w.net/gif/chart5.gif");
var number_of_image = image_list.length;

function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
}

function get_ImageItemLocation(imageObj) {
return(imageObj.image_item.src)
}

function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}

function getNextImage() {
if (random_display) {
image_index = generate(0, number_of_image-1);
}
else {
image_index = (image_index+1) % number_of_image;
}
var new_image = get_ImageItemLocation(image_list[image_index]);
return(new_image);
}

function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
setTimeout(recur_call, interval);
}

//filter_ad  end