
function GoOpenAlbumList(argURL) { if(!isNull(argURL)) { location.href = argURL; } }
// 
function ScrollCtrl()
{
this.sVersion		= "1.0";			//
this.sName			= "ScrollCtrl";		// 
this.sHeight		= 100;				//
this.sWidth			= 100;				// 
this.sCurSpeed		= 0;				//
this.sSpeed			= 100;				//
this.sTimeDelay		= 1000;				//
this.sStopMouseOver	= false;			//
this.sStop			= false;			//
this.sType			= 1;				//
this.sItemList		= new Array();		//
this.sItemCnt		= 0;				//
// 
this.LTAdd = function ()
{
var argText = arguments[0];
this.sItemList[this.sItemCnt] = argText;
this.sItemCnt = this.sItemCnt + 1;
};
//
this.Start = function ()
{
if( this.sItemCnt == 1 )
{
this.LTAdd(this.sItemList[0]);
}
this.LTShow();
this.sCurSpeed = this.sSpeed;
if( this.sType == 1 || this.sType == 2 )
{
this.sStop = true;
setTimeout(this.sName+'.Scroll()',this.sCurSpeed);
window.setTimeout(this.sName+".sStop = false", this.sTimeDelay);
}
else if( this.sType == 3 )
{
this.sStop = true;
setTimeout(this.sName+'.Rolling()',this.sCurSpeed);
window.setTimeout(this.sName+".sStop = false", this.sTimeDelay);
}
};
//
this.LTShow = function ()
{
document.write('<div id="'+this.sName+'" style="height:'+this.sHeight+'; width:'+this.sWidth+'; position:relative; overflow:hidden; " OnMouseOver="'+this.sName+'.onMouseOver(); " OnMouseOut="'+this.sName+'.onMouseOut(); ">');
for(var i = 0; i < this.sItemCnt; i++)
{
if( this.sType == 1 )
{
document.write('<div id="'+this.sName+'sItemList'+i+'"style="left:0px; width:'+this.sWidth+'; position:absolute; top:'+(this.sHeight*i)+'px; ">');
document.write(this.sItemList[i]);
document.write('</div>');
}
else if( this.sType == 2 || this.sType == 3 )
{
document.write('<div id="'+this.sName+'sItemList'+i+'"style="left:'+(this.sWidth*i)+'px; width:'+this.sWidth+'; position:absolute; top:0px; ">');
document.write(this.sItemList[i]);
document.write('</div>');
}
}
document.write('</div>');
};
//
this.Scroll = function ()
{
if( this.pause == true )
{
window.setTimeout(this.sName+".Scroll()",this.sTimeDelay);
this.pause = false;
}
else
{
this.sCurSpeed = this.sSpeed;
if( !this.sStop )
{
for(i = 0; i < this.sItemCnt; i++)
{
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
if( this.sType == 1 )
{
objTarget.top = parseInt(objTarget.top) - 1;
if( parseInt(objTarget.top) <= this.sHeight * (-1) ) objTarget.top = this.sHeight * (this.sItemCnt-1);
if( parseInt(objTarget.top) == 0 ) this.sCurSpeed = this.sTimeDelay;
}
else if( this.sType == 2 )
{
objTarget.left = parseInt(objTarget.left) - 1;
if( parseInt(objTarget.left) <= this.sWidth * (-1) ) objTarget.left = this.sWidth * (this.sItemCnt-1);
if( parseInt(objTarget.left) == 0 ) this.sCurSpeed = this.sTimeDelay;
}
}
}
window.setTimeout(this.sName+".Scroll()",this.sCurSpeed);
}
};
//
this.Rolling = function ()
{
if( this.sStop == false ) { this.Next(); }
window.setTimeout(this.sName+".Rolling()",this.sSpeed);
}
//
this.onMouseOver = function ()
{
if( this.sStopMouseOver ) { this.sStop = true; }
};
// 
this.onMouseOut = function ()
{
if( this.sStopMouseOver ) { this.sStop = false; }
};
// 
this.Next = function()
{
for(i = 0; i < this.sItemCnt; i++)
{
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
if( this.sType == 1 )
{
if( parseInt(objTarget.top) < 1 ) {
sHeight = this.sHeight + parseInt(objTarget.top);
break;
}
}
else if( this.sType == 2 || this.sType == 3 )
{
if( parseInt(objTarget.left) < 1 ) {
sWidth = this.sWidth + parseInt(objTarget.left);
break;
}
}
}
for(i = 0; i < this.sItemCnt; i++)
{
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
if( this.sType == 1 ) {
objTarget.top  = ( parseInt(objTarget.top) < 1 ) ? this.sHeight * (this.sItemCnt-1) : parseInt(objTarget.top) - sHeight;
}
else if( this.sType == 2 || this.sType == 3 ) {
objTarget.left = ( parseInt(objTarget.left) < 1 ) ? this.sWidth * (this.sItemCnt-1) : parseInt(objTarget.left) - sWidth;
}
}
}
// 
this.Prev = function()
{
for(i = 0; i < this.sItemCnt; i++)
{
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
if( this.sType == 1 ) {
if( parseInt(objTarget.top) < 1 ) {
sHeight = parseInt(objTarget.top) * (-1);
break;
}
}
else if( this.sType == 2 || this.sType == 3 ) {
if( parseInt(objTarget.left) < 1 ) {
sWidth = parseInt(objTarget.left) * (-1);
break;
}
}
}
if( this.sType == 1 )
{
if( sHeight == 0 ) {
sTotalHeight = this.sHeight * (this.sItemCnt-1);
for(i = 0; i < this.sItemCnt; i++) {
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
objTarget.top = ( parseInt(objTarget.top) + 1 > sTotalHeight ) ? 0 : parseInt(objTarget.top) + this.sHeight;
}
}
else {
for(i = 0; i < this.sItemCnt; i++) {
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
objTarget.top = ( parseInt(objTarget.top) < 1 ) ? 0 : parseInt(objTarget.top) + sHeight;
}
}
}
else if( this.sType == 2 || this.sType == 3 )
{
if( sWidth == 0 ) {
sTotalWidth = this.sWidth * (this.sItemCnt-1);
for(i = 0; i < this.sItemCnt; i++) {
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
objTarget.left = ( parseInt(objTarget.left) + 1 > sTotalWidth ) ? 0 : parseInt(objTarget.left) + this.sWidth;
}
}
else {
for(i = 0; i < this.sItemCnt; i++) {
objTarget = document.getElementById(this.sName+'sItemList'+i).style;
objTarget.left = ( parseInt(objTarget.left) < 1 ) ? 0 : parseInt(objTarget.left) + sWidth;
}
}
}
}
//
this.LTNext = function () {
this.onMouseOver();
this.Next();
window.setTimeout(this.sName+".onMouseOut()",this.sTimeDelay);
}
//
this.LTPrev = function () {
this.onMouseOver();
this.Prev();
window.setTimeout(this.sName+".onMouseOut()",this.sTimeDelay);
}
}
