

function stdScrollImg(){
	this.strID          =  arguments[0];//
	this.strDivID          =  arguments[1];//

	this.iImgHeight		= 0;
	this.iImgWidth		= 0;
	this.iImgTotalWidth = 0;
	this.iImgTotalHeight = 0;
	this.iStep = 0;
}


stdScrollImg.prototype.Init=function(){
//obj
		var iWidth,iHeight,iLeft,iTop;
		var obj;
		strID=this.strID;
		var objTemp=document.createElement("div")
		objTemp.setAttribute("id",this.strID);
		objTemp.style.visibility = "hidden";
		objTemp.style.position = "absolute";
		obj = objTemp;
//shade
		var objShade;
		iWidth		= arguments[0][0] ;
		iHeight		= arguments[0][1] ;
		iLeft		= arguments[0][2] ;
		iTop		= arguments[0][3] ;
		objTemp=document.createElement("div")
		objTemp.setAttribute( "id" , this.strID+"Shade" );
		objTemp.style.position	= "absolute";
		objTemp.style.overflow	= "hidden";
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.left		= iLeft+"px";
		objTemp.style.top		= iTop+"px";
		objShade = objTemp;
		obj.appendChild(objTemp);
//imglist1
		var objImgList1;
		objTemp=document.createElement("div");
		objTemp.setAttribute("id",this.strID+"ImgList1");
		objTemp.style.position	= "absolute";
		objTemp.style.width		= "0px";
		objTemp.style.height	= "0px";
		objTemp.style.left		= "0px";
		objTemp.style.top		= "0px";
		objImgList1 = objTemp;
		objShade.appendChild(objTemp);
//imglist2
		var objImgList2;
		objTemp=document.createElement("div");
		objTemp.setAttribute("id",this.strID+"ImgList2");
		objTemp.style.position	= "absolute";
		objTemp.style.width		= "0px";
		objTemp.style.height	= "0px";
		objTemp.style.left		= "0px";
		objTemp.style.top		= "0px";
		objImgList2 = objTemp;
		objShade.appendChild(objTemp);

//leftbtn
		iWidth		= arguments[1][0] ;
		iHeight		= arguments[1][1] ;
		iLeft		= arguments[1][2] ;
		iTop		= arguments[1][3] ;
		objTemp=document.createElement("div");
		objTemp.setAttribute( "id",this.strID+"LeftBtn" );
		objTemp.style.overflow	= "hidden";
		objTemp.style.position	= "absolute";
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.left		= iLeft+"px";
		objTemp.style.top		= iTop+"px";
		objBtn = objTemp;
		objShade.appendChild( objTemp );

		strBgImg	= arguments[1][4] ;
		iWidth		= arguments[1][5] ;
		iHeight		= arguments[1][6] ;
		objTemp=document.createElement("img");
		objTemp.setAttribute('src',strBgImg);
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objBtn.appendChild( objTemp );
//RightBtn
		iWidth		= arguments[2][0] ;
		iHeight		= arguments[2][1] ;
		iLeft		= arguments[2][2] ;
		iTop		= arguments[2][3] ;
		objTemp=document.createElement("div");
		objTemp.setAttribute( "id",this.strID+"RightBtn" );
		objTemp.style.overflow	= "hidden";
		objTemp.style.position	= "absolute";
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.right		= iLeft+"px";
		if (document.all)
		{
			objTemp.style.right		= (iLeft-1)+"px";
		}
		objTemp.style.top		= iTop+"px";
		objBtn = objTemp;
		objShade.appendChild( objTemp );

		strBgImg	= arguments[2][4] ;
		iWidth		= arguments[2][5] ;
		iHeight		= arguments[2][6] ;
		objTemp=document.createElement("img");
		objTemp.setAttribute('src',strBgImg);
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objBtn.appendChild( objTemp );
//step
		objTemp=document.createElement("input");
		objTemp.setAttribute("id",this.strID+"Step");
		objTemp.setAttribute("type","hidden");
		objTemp.setAttribute("value","0");
		objShade.appendChild(objTemp);
//stepvalue
		objTemp=document.createElement("input");
		objTemp.setAttribute("id",this.strID+"StepValue");
		objTemp.setAttribute("type","hidden");
		objTemp.setAttribute("value","2");
		objShade.appendChild(objTemp);

		$(this.strDivID).appendChild(obj);

}
stdScrollImg.prototype.AddImg=function(){

		var iWidth,iHeight,strImg;
		strImg		= arguments[0][0] ;
		strValue	= arguments[0][1] ;
		iWidth		= arguments[0][2] ;
		iHeight		= arguments[0][3] ;
		var obj;
		var objTemp=document.createElement("img")
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.cursor	= "pointer";
		objTemp.setAttribute('src',strImg);
		objTemp.setAttribute('value',strValue);
		obj = objTemp;
		$( this.strID + "ImgList1" ).appendChild(obj);

		var objTemp=document.createElement("img")
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.cursor	= "pointer";
		objTemp.setAttribute('src',strImg);
		objTemp.setAttribute('value',strValue);
		obj = objTemp;
		$( this.strID + "ImgList2" ).style.left =(  parseInt( $( this.strID + "ImgList2" ).style.left ) + iWidth  )+"px";
		$( this.strID + "ImgList2" ).appendChild(obj);

		this.iImgTotalWidth		= this.iImgTotalWidth   + iWidth;
		this.iImgTotalHeight	= iHeight;
}
stdScrollImg.prototype.AddImg2=function(){

		var iWidth,iHeight,strImg;
		strImg		= arguments[0][0] ;
		strValue	= arguments[0][1] ;
		iWidth		= arguments[0][2] ;
		iHeight		= arguments[0][3] ;
		var strValue= arguments[0][4] ;
		//alert(strOnClick);
		var obj;
		var objTemp=document.createElement("img")
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.cursor	= "pointer";
		objTemp.setAttribute('src',strImg);
		objTemp.setAttribute('value',strValue);
		obj = objTemp;
		$( this.strID + "ImgList1" ).appendChild(obj);

		var objTemp=document.createElement("img")
		objTemp.style.width		= iWidth+"px";
		objTemp.style.height	= iHeight+"px";
		objTemp.style.cursor	= "pointer";
		objTemp.setAttribute('src',strImg);
		objTemp.setAttribute('value',strValue);
		obj = objTemp;
		$( this.strID + "ImgList2" ).style.left =(  parseInt( $( this.strID + "ImgList2" ).style.left ) + iWidth  )+"px";
		$( this.strID + "ImgList2" ).appendChild(obj);

		this.iImgTotalWidth		= this.iImgTotalWidth   + iWidth;
		this.iImgTotalHeight	= iHeight;
}
stdScrollImg.prototype.SetShade=function(){
	//alert(this.iImgTotalWidth);
		$( this.strID + "ImgList1" ).style.width	= this.iImgTotalWidth  + "px";
		$( this.strID + "ImgList1" ).style.height	= this.iImgTotalHeight + "px";
		$( this.strID + "ImgList2" ).style.width	= this.iImgTotalWidth  + "px";
		$( this.strID + "ImgList2" ).style.height	= this.iImgTotalHeight + "px";
}
stdScrollImg.prototype.Visible=function(){
		$( this.strID ).style.visibility	= "visible";
}
stdScrollImg.prototype.Run=function(){

	iStep = parseInt( $(strID+"Step").value );
	//left
	if ( iStep > 0 )
	{
		
		
		iLeft = parseInt( $( strID + "ImgList1" ).style.left );
		if ( iLeft >= this.iImgTotalWidth   )
		{
			$( strID + "ImgList1" ).style.left = (-1)*(this.iImgTotalWidth)+"px";
		}
		iLeft = parseInt( $( strID + "ImgList2" ).style.left );
		if ( iLeft >=  this.iImgTotalWidth   )
		{
			$( strID + "ImgList2" ).style.left = (-1)*(this.iImgTotalWidth)+"px";
		}
		$( strID + "ImgList1" ).style.left =( parseInt( $( strID + "ImgList1" ).style.left )+iStep) +"px";
		$( strID + "ImgList2" ).style.left =( parseInt( $( strID + "ImgList2" ).style.left )+iStep) +"px";
	}
	if ( iStep < 0 )
	{
		iLeft = parseInt( $( strID + "ImgList1" ).style.left );
		if ( iLeft <= (-1)*this.iImgTotalWidth   )
		{
			$( strID + "ImgList1" ).style.left = this.iImgTotalWidth + "px";
		}
		iLeft = parseInt( $( strID + "ImgList2" ).style.left );
		if ( iLeft <= (-1)*this.iImgTotalWidth   )
		{
			$( strID + "ImgList2" ).style.left =this.iImgTotalWidth + "px";
		}
		$( strID + "ImgList1" ).style.left =( parseInt( $( strID + "ImgList1" ).style.left )+iStep) +"px";
		$( strID + "ImgList2" ).style.left =( parseInt( $( strID + "ImgList2" ).style.left )+iStep) +"px";
	}


}
stdScrollImg.prototype.InitEvent=function(){
		strStep = arguments[0];
		strStepValue = arguments[1];
		f = arguments[2];
		var strL =  strID + "LeftBtn";
		var strR =  strID + "RightBtn";
		$(strID+"Step").value = strStep;
		$(strID+"StepValue").value = strStepValue;
		fInitEvent( this.strID , f,strL,strR );
}
stdScrollImg.prototype.InitEvent2=function(){
		strStep = arguments[0];
		strStepValue = arguments[1];
		f = arguments[2];
		var strL =  strID + "LeftBtn";
		var strR =  strID + "RightBtn";
		$(strID+"Step").value = strStep;
		$(strID+"StepValue").value = strStepValue;
		fInitEvent2( this.strID , f,strL,strR );
}
function fInitEvent(){
	strID	= arguments[0];
	f		= arguments[1];
	var strIDLeftBtn = arguments[2];
	var strIDRightBtn = arguments[3];
	$( strIDLeftBtn ).onmouseover=function(a){
		$(strID+"Step").value = $(strID+"StepValue").value;
	}
	$( strIDRightBtn ).onmouseover=function(a){
		$(strID+"Step").value = "-"+$(strID+"StepValue").value;
	}
	$( strIDLeftBtn ).onmouseout=$( strIDRightBtn ).onmouseout=function(a){
		$(strID+"Step").value = "0";
	}
	
	var lis = $( strID + "ImgList1" ).getElementsByTagName("IMG");
		for (var i=0; i<lis.length; i++) {
			lis[i].onclick=function() {
				f(this.getAttribute("value"));
			}
		}
	var lis = $( strID + "ImgList2" ).getElementsByTagName("IMG");
		for (var i=0; i<lis.length; i++) {
			lis[i].onclick=function() {
				f( this.getAttribute("value") );
			}
		}
}
function fInitEvent2(){
	strID	= arguments[0];
	f		= arguments[1];
	var strIDLeftBtn = arguments[2];
	var strIDRightBtn = arguments[3];
	$( strIDLeftBtn ).onmouseover=function(a){
		$(strID+"Step").value = $(strID+"StepValue").value;
	}
	$( strIDRightBtn ).onmouseover=function(a){
		$(strID+"Step").value = "-"+$(strID+"StepValue").value;
	}
	$( strIDLeftBtn ).onmouseout=$( strIDRightBtn ).onmouseout=function(a){
		$(strID+"Step").value = "0";
	}
	
	var lis = $( strID + "ImgList1" ).getElementsByTagName("IMG");
		for (var i=0; i<lis.length; i++) {
			lis[i].onclick=function() {
				var strValue = this.getAttribute("value");
				var arr = strValue.split("|");
				f( arr[0] ,arr[1] , arr[2] );
			}
		}
	var lis = $( strID + "ImgList2" ).getElementsByTagName("IMG");
		for (var i=0; i<lis.length; i++) {
			lis[i].onclick=function() {
				var strValue = this.getAttribute("value");
				var arr = strValue.split("|");
				f( arr[0] ,arr[1] , arr[2] );
			}
		}
}