/// <reference path="core.js" />
var brOK = false;
var mie=false;
var aver=Int.Parse(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();
	}
}
checkbrOK();

//**************************浮动广告程序脚本BEGIN***************************************
function ADBox(){
	this.obj=new Object();
	this.x=0;
	this.y=0;
	this.width=0;
	this.height=0;
	this.type="img";
	this.link="#";
	this.src="";
	this.reSrc=/{\$src}/ig;
	this.reWidth=/{\$width}/ig;
	this.reHeight=/{\$height}/ig;
	this.reLink=/{\$link}/ig;
	this.reTarget=/{\$target}/ig;
	this.reAdBody=/{\$adBody}/ig;
	this.ADTemplate="<div style=\"text-align:right;height:auto;overflow:hidden;\"><a style=\"background:#fff;color:#000;\" href=\"javascript:void(null)\" onclick=\"ad01.hide()\">[X]</a></div><div style=\"filter:alpha(opacity=80);-moz-opacity:0.8;opacity: 0.8;width:auto;height:auto;\">{$adBody}</div>";
	this.flashTemplate="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"{$width}\" height=\"{$height}\"><param name=\"movie\" value=\"{$src}\"><param name=quality value=high><param name=\"wmode\" value=\"transparent\"><embed src=\"{$src}\" wmode=Transparent quality=high pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"{$width}\" height=\"{$height}\"></embed> </object>";
	this.imgTemplate="<img width=\"{$width}\" height=\"{$height}\" src=\"{$src}\" border=\"0\" />";
	this.linkTemplate="<a href=\"{$link}\" target=\"{$target}\">{$adBody}</a>";
	this.iframeTemplate="<iframe width=\"{$width}\" height=\"{$height}\" src=\"{$src}\" border=\"0\" allowtransparency='true' frameborder='0'></iframe>";
	this.hide=function(){
		if (this.obj.panel!=null)
		{
			this.obj.panel.isHidden=true;
			this.obj.panel.style.display="none";
			//document.body.removeChild(this.obj.panel);
		}
	}
	this.start=function(){
		if (this.src.substring(this.src.lastIndexOf(".")).toLowerCase()==".swf")
		{
			this.obj.html=this.ADTemplate.replace(this.reAdBody,this.flashTemplate.replace(this.reWidth,this.width).replace(this.reHeight,this.height).replace(this.reSrc,this.src))
		}
		else{
			switch (this.type){
				case "img":
					this.obj.html=this.ADTemplate;
					if (this.link!="#"&&this.link!="")
					{
						this.obj.html=this.obj.html.replace(this.reAdBody,this.linkTemplate.replace(this.reLink,this.link).replace(this.reTarget,this.target));
					}
					this.obj.html=this.obj.html.replace(this.reAdBody,this.imgTemplate.replace(this.reWidth,this.width).replace(this.reHeight,this.height).replace(this.reSrc,this.src))
					break;
				case "web":
					this.obj.html=this.ADTemplate.replace(this.reAdBody,this.iframeTemplate.replace(this.reWidth,this.width).replace(this.reHeight,this.height).replace(this.reSrc,this.src))
					break;
			}
		}
		this.obj.loaded=false;
		this.obj.params=this;
		this.obj.panel=null;
		MoveAdBox(this.obj);
	}
}
function MoveAdBox(obj){
	if (document.body!=null)
	{
		if (obj.isHidden)
			return;
		if (!obj.loaded)
		{
			var div=document.createElement("DIV");
			div.innerHTML=obj.html;
			obj.panel=div;
			document.body.appendChild(div);	
			//alert(obj);
			div.x=obj.params.x;
			div.y=obj.params.y;
			if (Page.windowWidth - obj.params.x < obj.params.x) {
			    div.setAttribute("fixX",Page.windowWidth-obj.params.x);
			    div.setAttribute("alginleft","true");
			}
			else{
			    div.setAttribute("fixX",obj.params.x);
			    div.setAttribute("alginleft","false");
			}
			if (Page.windowHeight - obj.params.y < obj.params.y) {
			    div.setAttribute("fixY", Page.windowHeight - obj.params.y);
			    div.setAttribute("alginTop","true");
			}
			else{
			    div.setAttribute("fixY",obj.params.y);
			    div.setAttribute("alginTop","false");
			}
			obj=div;
			obj.loaded=true;
			
			with (obj.style){			
				position='absolute';
				display='block';
				visibility='visible';
				top="-200px";
				left="-200px";
			}
		}
		var pos = Func.GetObjPos(obj);
		var scrollPos=getScroll();
		var fixY = (obj.getAttribute("alginTop") == "false") ? Int.Parse(obj.getAttribute("fixY")) : Page.windowHeight - Int.Parse(obj.getAttribute("fixY"));
		var fixX = (obj.getAttribute("alginleft") == "false") ? Int.Parse(obj.getAttribute("fixX")) : Page.windowWidth - Int.Parse(obj.getAttribute("fixX"));
		if (Page.windowHeight >= obj.offsetHeight && fixY + obj.offsetHeight > Page.windowHeight)
		    fixY = Page.windowHeight - obj.offsetHeight;
		if (Page.windowWidth >= obj.offsetWidth && fixX + obj.offsetWidth > Page.windowWidth)
		    fixX = Page.windowWidth - obj.offsetWidth;
		var diff = (pos.y - scrollPos.top-fixY)*.40; 
		var diff1 = (pos.x - scrollPos.left-fixX)*.40; 
		var y = pos.y - diff;
		var x= pos.x-diff1;
		obj.style.top=y+"px";
		obj.style.left=x+"px";
	}
	setTimeout(function(){MoveAdBox(obj)},30)
}
//**************************浮动广告程序脚本END***************************************

//**************************飘动广告程序脚本BEGIN*************************************
function Chip(){
	this.obj=new Object();
	this.vmin=2;
	this.vmax=5;
	this.vr=2;
	this.vx=this.vmin+this.vmax*Math.random();
	this.vy=this.vmin+this.vmax*Math.random();
	this.xx=0;
	this.yy=0;
	this.timer=null;
	this.width=0;
	this.height=0;
	this.link="#";
	this.src="";
	this.reSrc=/{\$src}/ig;
	this.reWidth=/{\$width}/ig;
	this.reHeight=/{\$height}/ig;
	this.reLink=/{\$link}/ig;
	this.reTarget=/{\$target}/ig;
	this.reAdBody=/{\$adBody}/ig;
	this.ADTemplate="<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td bgcolor=\"#FF0000\"></td>{$adBody}</td></tr></table>";
	this.flashTemplate="<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"{$width}\" height=\"{$height}\"><param name=\"movie\" value=\"{$src}\"><param name=quality value=high><param name=\"wmode\" value=\"transparent\"><embed src=\"{$src}\" wmode=Transparent quality=high pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"{$width}\" height=\"{$height}\"></embed> </object>";
	this.imgTemplate="<img width=\"{$width}\" height=\"{$height}\" src=\"{$src}\" border=\"0\" />";
	this.linkTemplate="<a href=\"{$link}\" target=\"{$target}\">{$adBody}</a>";
	this.start=function(){
		if (this.src.substring(this.src.lastIndexOf(".")).toLowerCase()==".swf")
		{
			this.obj.html=this.ADTemplate.replace(this.reAdBody,this.flashTemplate.replace(this.reWidth,this.width).replace(this.reHeight,this.height).replace(this.reSrc,this.src));
		}
		else{
			this.obj.html=this.ADTemplate;
			if (this.link!="#"&&this.link!="")
			{
				this.obj.html=this.obj.html.replace(this.reAdBody,this.linkTemplate.replace(this.reLink,this.link).replace(this.reTarget,this.target));
			}
			this.obj.html=this.obj.html.replace(this.reAdBody,this.imgTemplate.replace(this.reWidth,this.width).replace(this.reHeight,this.height).replace(this.reSrc,this.src))
		}
		this.obj.loaded=false;
		this.obj.params=this;
		movechip(this.obj);
	}
}
function movechip(obj){
	if (document.body!=null)
	{		
		if(brOK){
			if (!obj.loaded)
			{
				var div=document.createElement("DIV");
				div.innerHTML=obj.html;
				document.body.appendChild(div);	
				//alert(obj);
				div.xx=obj.params.xx;
				div.yy=obj.params.yy;
				div.vx=obj.params.vx;
				div.vy=obj.params.vy;
				div.vr=obj.params.vr;
				div.vmax=obj.params.vmax;
				div.vmin=obj.params.vmin;
				div.timer=obj.params.timer;
				div.width=obj.params.width;
				div.height=obj.params.height;
				obj=div;
				obj.loaded=true;
				
				with (obj.style){			
					position='absolute';
					display='block';
					visibility='visible';
					posTop = -200;
					posLeft= -200;
				}
			}
			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-20;
				pageY=window.document.body.scrollTop;
				pageH=window.document.body.offsetHeight;
			}
			obj.xx=obj.xx+obj.vx;
			obj.yy=obj.yy+obj.vy;
			obj.vx+=obj.vr*(Math.random()-0.5);
			obj.vy+=obj.vr*(Math.random()-0.5);
			if(obj.vx>(obj.vmax+obj.vmin))  obj.vx=(obj.vmax+obj.vmin)*2-obj.vx;
			if(obj.vx<(-obj.vmax-obj.vmin)) obj.vx=(-obj.vmax-obj.vmin)*2-obj.vx;
			if(obj.vy>(obj.vmax+obj.vmin))  obj.vy=(obj.vmax+obj.vmin)*2-obj.vy;
			if(obj.vy<(-obj.vmax-obj.vmin)) obj.vy=(-obj.vmax-obj.vmin)*2-obj.vy;
			if(obj.xx<=pageX){
				obj.xx=pageX;
				obj.vx=obj.vmin+obj.vmax*Math.random();
			}
			if(obj.xx>=pageX+pageW-obj.width){
				obj.xx=pageX+pageW-obj.width;
				obj.vx=-obj.vmin-obj.vmax*Math.random();
			}
			if(obj.yy<=pageY){
				obj.yy=pageY;
				obj.vy=obj.vmin+obj.vmax*Math.random();
			}
			if(obj.yy>=pageY+pageH-obj.height){
				obj.yy=pageY+pageH-obj.height;
				obj.vy=-obj.vmin-obj.vmax*Math.random();
			}
			obj.style.posLeft=obj.xx;
			obj.style.posTop=obj.yy;
			obj.timer=setTimeout(function(){movechip(obj)},100);
		}
	}
}
//**************************飘动广告程序脚本END***************************************


//**************************浮动广告BEGIN***************************************
/*var ad02=new ADBox();
ad02.src="/flash/20060928.swf";
//ad02.link="http://club.online.cq.cn/act/20060925";
ad02.width=101;
ad02.height=205;
ad02.x=884;
ad02.y=130;
ad02.start();

/*var ad01=new ADBox();
ad01.src="/ad/20060901/index.htm";
ad01.type="web";
ad01.width=103;
ad01.height=180;
ad01.x=884;
ad01.y=357;
ad01.start();*/

//**************************浮动广告END*****************************************

//**************************飘动广告BEGIN***************************************
/*var chip01=new Chip();
chip01.src="/ad/images/20060807.gif";
chip01.link="http://219.153.4.138/login/buy_ticket.jsp";
chip01.width=150;
chip01.height=150;*/
//chip01.start();
//**************************飘动广告END*****************************************