var g_ROOTPATH = "/chn/";

function setRootPath( p_sPath ){
	g_ROOTPATH = p_sPath;
}

function LTrim( p_string ){
	var sRet = p_string.replace( /　*/g, "" );	
	return sRet.replace(/^\s*/g, "");
}

//实现滚动图片效果 dmy@2005-3-5
function newPicArray(_picWidth, _picHspace, _picStart, _pic, _alts){
	this.picWidth = _picWidth;
 	this.picHspace = _picHspace;
 	this.picStart = _picStart;
 	this.pic = _pic;
	this.alts = _alts;
 	this.newPic;
 	this.picString = ""; 
}

newPicArray.prototype.getNewPicArray = function(){
 	var picLen = this.pic.length;
 	this.newPic = new Array();
 	for(var i=0;i<picLen;i++){
  		this.newPic[i] = this.pic[i];
 	}
 	for(var i=0;i<(picLen+1-this.picStart);i++){
  		this.newPic[i] = this.pic[i+this.picStart-1];
 	}
 	for(var i=0;i<this.picStart-1;i++){
  		this.newPic[picLen+1-this.picStart+i] = this.pic[i];  
 	}
 	return this.newPic;
}

newPicArray.prototype.getNewPicString = function(){
 	var picArray = this.getNewPicArray();
 	var loop = 2;
 	for(var i=0;i<loop;i++){
  		for(var j=0;j<picArray.length;j++){
   			this.picString += "<img src='" + picArray[j].src + "' width='" + this.picWidth + "' hspace='" + this.picHspace + "' alt='" + this.alts[j] + "' border='0' style='cursor:hand'>";
  		}
	} 
 	return this.picString;
}

function marquee(_speed, _scrollArea, _newPicArray){
 	this.speed = _speed;
 	this.scrollArea = _scrollArea;
 	this.newPicArray = _newPicArray;
 	this.arrayWidth;
}

marquee.prototype.setPicArrayWidth = function(){
 	var picLen = this.newPicArray.pic.length;
 	this.arrayWidth = picLen*(this.newPicArray.picWidth + 2*this.newPicArray.picHspace);
 	this.scrollArea.style.display = "inline";
}

marquee.prototype.startMarquee = function(){
 	if(this.arrayWidth - this.scrollArea.scrollLeft <=0){
  		this.scrollArea.scrollLeft -= this.arrayWidth;
 	}
 	else{this.scrollArea.scrollLeft++;} 
}
 
function scrollPic(aMarquee, targetHref){
 	aMarquee.setPicArrayWidth();
 	aMarquee.startMarquee();
 	var timer = setInterval("aMarquee.startMarquee()", aMarquee.speed);
 	aMarquee.scrollArea.onmouseover = function(){ clearInterval(timer);}
	aMarquee.scrollArea.onclick = function(){ window.location.href = targetHref;}
 	aMarquee.scrollArea.onmouseout = function(){timer = setInterval("aMarquee.startMarquee()",aMarquee.speed);}
}
