var contScrollers = new Array();
var counter = 0;
function registercontentsScroller(oScroller) {
	contScrollers[contScrollers.length] = oScroller;
}
function ContentsScroller() {
	ContentsScroller.iemarquee="scroller";
	ContentsScroller.width = "430px";
	ContentsScroller.marqueeheight = "250";
	ContentsScroller.marqueespeed = 5;
	ContentsScroller.stopOnMouse = 1;
	ContentsScroller.copyspeed=0;
	ContentsScroller.pausespeed=0;
	ContentsScroller.marqueecontent = "This is a Contents Scroller Object.......";
	ContentsScroller.iedom=document.all||document.getElementById;
	ContentsScroller.actualheight='';
	ContentsScroller.cross_marqueeId="test1";
	ContentsScroller.ns_marqueeId="test2";
	ContentsScroller.ns_marquee2Id="test3";
	ContentsScroller.cross_marquee=null;
	ContentsScroller.ns_marquee=null;
	ContentsScroller.ns_marquee2=null;
}
function populate(nScroller){
	var oContScroller = contScrollers[nScroller];
	if (oContScroller.iedom){
		oContScroller.cross_marquee=document.getElementById ?
												document.getElementById(oContScroller.iemarqueeId) :
												eval("document.all.oContScroller." + iemarqueeId);
		oContScroller.cross_marquee.style.top=0;//parseInt(oContScroller.marqueeheight) + 8 + "px";
		oContScroller.cross_marquee.innerHTML=oContScroller.marqueecontent;
		var tdHeight = parseInt(document.getElementById('TDScroller_0').height);
		var divHeight = parseInt(oContScroller.marqueeheight);
		if(tdHeight >= divHeight) {
			//oContScroller.actualheight=tdHeight;
		}
		else {
			//oContScroller.actualheight=tdHeight*3 + (divHeight - tdHeight);		
		}
	}
	else if (document.layers) {
		oContScroller.ns_marquee=document.ns_marquee.document.ns_marquee2;
		oContScroller.ns_marquee.top=0//parseInt(oContScroller.marqueeheight) + 8;
		oContScroller.ns_marquee.document.write(oContScroller.marqueecontent);
		oContScroller.ns_marquee.document.close();
		oContScroller.actualheight=oContScroller.ns_marquee.document.height;
	}
	lefttime=setInterval("scrollmarquee(" + nScroller + ")",40);
}
function scrollmarquee(nScroller){
	var oContScroller = contScrollers[nScroller];
	if (oContScroller.iedom){
		if (parseInt(oContScroller.cross_marquee.style.top)>(oContScroller.actualheight * (-1) + 8)) {
			oContScroller.cross_marquee.style.top=parseInt(oContScroller.cross_marquee.style.top)-oContScroller.copyspeed+"px";
		}
		else {
			oContScroller.cross_marquee.style.top=parseInt(oContScroller.marqueeheight) + 8 + "px";
		}
	}
	else if (document.layers) {
		if (oContScroller.ns_marquee.top>(oContScroller.actualheight * (-1) + 8)) {
			oContScroller.ns_marquee.top-=oContScroller.copyspeed;
		}
		else {
			oContScroller.ns_marquee.top=parseInt(oContScroller.marqueeheight) + 8;
		}
	}
}
function createContentsScrollerCode(oContScroller) {
	registercontentsScroller(oContScroller);
	var nContScroller = contScrollers.length - 1;
	if (oContScroller.iedom||document.layers) {
		with (document) {
			if (oContScroller.iedom) {
				write('<div style="position:relative;width:' + oContScroller.marqueewidth +
										';height:' + oContScroller.marqueeheight +
										';overflow:hidden" onMouseover="javascript:switchSpeed(1,' + nContScroller + ');" onMouseout="javascript:switchSpeed(2,' + nContScroller + ');">');
				write('<div id="' + oContScroller.iemarqueeId +
										'" style="position:absolute;left:0px;top:0px;width:100%;height:' + oContScroller.marqueeheight + ';">');
				write('</div></div>');
			}
			else if (document.layers) {
				write('<ilayer width=' + oContScroller.marqueewidth +
								' height=' + oContScroller.marqueeheight + ' name="' + oContScroller.ns_marqueeId + '">');
				write('<layer name="' + oContScroller.ns_marquee2Id +
								'" width=' + oContScroller.marqueewidth +
								' height=' + oContScroller.marqueeheight +
								' left=0 top=0 onMouseover="javascript:switchSpeed(1,' + nContScroller + ');" onMouseout="javascript:switchSpeed(2,' + nContScroller + ');"></layer>');
				write('</ilayer>')
			}
		}
	}
}
function replaceChar(text,charToReplace,replaceWith) {
	var tmp = "";
	for(x=0; x<text.length;x++) {
		if(text.charAt(x) != charToReplace) {
	  		tmp += text.charAt(x);
		}
		else {
		  tmp += replaceWith;
		}
	}
	return tmp;
}
function switchSpeed(type,nScroller) {
	var oContScroller = contScrollers[nScroller];
	switch(type) {
		case 1:
			oContScroller.copyspeed=oContScroller.pausespeed;
		break;
		case 2:
			oContScroller.copyspeed=oContScroller.marqueespeed;
		break;
	}
}