
var FlashAD = Class.create();
	FlashAD.prototype = {
		initialize:function(fShowUrl,fShowWidth,fShowHeight){
			this.fUrl = fShowUrl;
			this.fHeightText = 20;
			this.fWidth = fShowWidth;
			this.fHeight1 = fShowHeight;
			this.fHeight = fShowHeight + this.fHeightText;
			this.fTime = 5;//切换的时间间隔
			this.fAimage=new Array();
			this.fAlink=new Array();
			this.fAtext=new Array();
			this.FlashVars='';
			this.fType = 1;
		},
		Load:function(){
			var fAimages="", fAlinks="", fAtexts="";

			for(var i=1; i<this.fAimage.length; i++){
				fAimages += ("|"+this.fAimage[i]);
				fAlinks += ("|"+this.fAlink[i]);
				fAtexts += ("|"+this.fAtext[i]);
			}

			fAimages=fAimages.substring(1);
			fAlinks=fAlinks.substring(1);
			fAtexts=fAtexts.substring(1);

			//this.FlashVars = 'bcastr_file='+fAimages+'&bcastr_link='+fAlinks+'&bcastr_title='+fAtexts+'&bcastr_config=0xffffff|2|0x8CA2AD|60|0xffffff|0xff9900|0x000033|6|3|1|_blank';
			this.FlashVars = 'bcastr_file='+fAimages+'&bcastr_link='+fAlinks+'&bcastr_config=0xffffff|2|0x8CA2AD|60|0xffffff|0xff9900|0x000033|'+this.fTime+'|3|1|_blank';
			if(this.fType == 2){
				this.FlashVars = 'pics='+fAimages+'&links='+fAlinks+'&texts='+fAtexts+'&borderwidth='+this.fWidth+'&borderheight='+this.fHeight1+'&textheight='+this.fHeightText;
			}
			document.write('<object width="'+ this.fWidth +'" height="'+ this.fHeight +'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase=" http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">');
			document.write('<param name="movie" value="'+this.fUrl+'">');
			document.write('<param name="quality" value="high">');
			document.write('<param name="menu" value="false">');
			document.write('<param name=wmode value="opaque">');
			document.write('<param name="FlashVars" value="'+this.FlashVars+'">');
			document.write('<embed src="'+this.fUrl+'"  width="'+ this.fWidth +'" height="'+ this.fHeight +'" FlashVars="'+this.FlashVars+'" menu="false" wmode="opaque" quality="high" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer" />');
			document.write('</object>');
		},
		Echo:function(){
			alert(this.FlashVars);
		}
	}

var CoupletsAD = Class.create();
	CoupletsAD.prototype = {
		initialize:function(CLName,CRName,cLContent,cRContent){
			this.CLName=CLName;
			this.CRName=CRName;
			this.CLStyle="left:3px;position:absolute;top:100px;";
			this.CRStyle="right:3px;position:absolute;top:100px;";
			this.lastScrollY_ = 0;
			document.write("<div id='" + this.CLName + "' style='" + this.CLStyle + "'>" + cLContent + "</div>");
			document.write("<div id='" + this.CRName + "' style='" + this.CRStyle + "'>" + cRContent + "</div>");
		},
		Load:function(){
			var diffY_;
			if (document.documentElement && document.documentElement.scrollTop){
				diffY_ = document.documentElement.scrollTop;
			} else if (document.body) {
				diffY_ = document.body.scrollTop
			} else {
			}
			percent=.1*(diffY_ - this.lastScrollY_);
			if(percent>0)percent=Math.ceil(percent);
			else percent=Math.floor(percent);
			document.getElementById(this.CLName).style.top=parseInt(document.getElementById(this.CLName).style.top)+percent+"px";
			document.getElementById(this.CRName).style.top=parseInt(document.getElementById(this.CRName).style.top)+percent+"px";
			this.lastScrollY_=this.lastScrollY_+percent;
		},
		Echo:function(){
			alert(this.CLName);
		}
	}

function scrollObject(marqueesHeight,elemId) {
	var stopscroll = false;
	var scrollElem = document.getElementById(elemId);
	var divs = scrollElem.getElementsByTagName('div');
	var scrollmessage1;
	var scrollmessage2;
	var currentTop = 0;
	var stoptime   = 0;
	var delaytime  = 120;
	with (scrollElem) {
		style.height    = marqueesHeight;
		style.overflow  = 'hidden';
		noWrap          = true;
	}
	scrollElem.onmouseover = function() {
		stopscroll = true;
	}
	scrollElem.onmouseout = function() {
		stopscroll = false;
	}
	if (divs.length > 0) {
		scrollmessage1 = divs[0];
		scrollmessage2 = scrollmessage1.cloneNode(true);
		scrollElem.appendChild(scrollmessage2);
	}
	function init_srolltext() {
		scrollElem.scrollTop = 0;
	}
	this.start = function(s, delay) {
		init_srolltext();
		setDelay(delay);
		setInterval(s + '.scrollUp()', 10);
	}
	function setDelay(delay) {
		if (delay > 0) {
			delaytime = delay;
		}
	}
	this.scrollUp = function() {
		if (stopscroll) {
			return;
		}
		currentTop ++;
		if (currentTop == marqueesHeight + 1) {
			stoptime ++;
			currentTop --;
			if(stoptime == delaytime) {
				currentTop = 0;
				stoptime = 0;
			}
		} else {
			if (scrollmessage2.offsetHeight - scrollElem.scrollTop <= 0) {
				scrollElem.scrollTop -= scrollmessage1.offsetHeight;
				scrollElem.scrollTop ++;
			} else {
				scrollElem.scrollTop ++;
			}
		}
	}
}

