﻿function PopupPic(sPicURL)
{ 
	window.open("/_layouts/SevenEye/PopupPic.htm?" + encodeURIComponent(sPicURL), null, "resizable=1,HEIGHT=200,WIDTH=200,scrollbars=yes");
}
function PopupPrint()
{
    window.open("/_layouts/SevenEye/PopupPrint.htm?" + encodeURIComponent(document.title), null, "resizable=1,HEIGHT=600,WIDTH=600,scrollbars=yes,menubar=yes");
}

var Scroller = function(frameId,contentId,direction,tempo,w,h)
{

    var thisObj 		= this;
    this.nXlocation 	= 0;
    this.nYlocation 	= 0;
    this.nFrameHeight 	= h;
    this.nFrameWidth	= w;
    this.nTempo			= tempo;
    this.oTempo			= tempo;
    this.nStrDirection	=	direction;
    this.oStrDirection	=	direction;
    this.scrollerStat	= true;
    this.objFrame		= document.getElementById(contentId);
    this.Interval


    f = document.getElementById(frameId);
    f.style.height 	= h+'px';
    f.style.width 	= w+'px';

    this.MoveScroller = function()
    {

        switch(this.nStrDirection)
        {
            case 'u':	// moving up
            this.nXlocation--;
            this.objFrame.style.top=this.nXlocation+"px";
            break;
            case 'd':	// moving down
            this.nXlocation++;
            this.objFrame.style.top=this.nXlocation+"px";
            break;
        }

    }

    this.CheckScroller = function()
    {
        switch(this.nStrDirection)
        {
            case 'u':
            if ((0-this.nXlocation) > this.objFrame.offsetHeight)
            this.nXlocation = this.nFrameHeight;
            break;
            case 'd':
            if (this.nXlocation > this.nFrameHeight)
            this.nXlocation = -this.objFrame.offsetHeight;
            break;
        }
    }

    this.RunScroll = function()
    {
        if (this.scrollerStat)
        {
            this.MoveScroller();
            this.CheckScroller();
        }
    }

    this.StartScroll = function()
    {
        this.Interval = setInterval(function() { thisObj.RunScroll(); },thisObj.nTempo);
    }

    /*this.StartSpeedScroll = function(direction, tempo)
    {
        clearInterval(this.Interval);
        this.nTempo = tempo;
        this.nStrDirection = direction;
        this.StartScroll();
    }
    this.EndSpeedScroll = function()
    {	
        clearInterval(this.Interval);
        this.nTempo = this.oTempo;
        this.nStrDirection = this.oStrDirection;
        this.StartScroll();
    }*/
    
    this.ToggleScrollStat = function()
    {
        this.scrollerStat = !this.scrollerStat;
    }

}
