﻿// JScript File
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Mr J | http://www.huntingground.net/ */

scrollStep=1

timerLeft=""
timerRight=""

function toLeft(id){
  document.getElementById(id).scrollLeft=0
}

function scrollDivLeft(id){
  clearTimeout(timerRight) 
  document.getElementById(id).scrollLeft+=scrollStep
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10)
}
function scrollIncreaseSpeed(){

  scrollStep++
}
function scrollDivRight(id){
  clearTimeout(timerLeft)
  document.getElementById(id).scrollLeft-=scrollStep
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10)
}

function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth
}

function stopMe(){
  clearTimeout(timerRight) 
  clearTimeout(timerLeft)
}

function ScrollNormal(Ele)
{   scrollStep=1
    Ele.style.opacity="3.0";
    Ele.style.filter="alpha(opacity=30)";
}
function ScrollOriginal(Ele)
{   scrollStep=1
    Ele.style.opacity="1.0";
    Ele.style.filter="alpha(opacity=100)";
}
function scrollPImgDivLeft(id){
    document.getElementById("containerImg").scrollLeft+=285
    document.getElementById("containerEnlgImg").scrollLeft+=100
}
function scrollPImgDivRight(id){
  document.getElementById("containerImg").scrollLeft-=285
  document.getElementById("containerEnlgImg").scrollLeft-=100
}


function onMouseWheel()
{var delta = 0;

    if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
document.getElementById("container").scrollLeft-=(delta*10)
}
function onMouseWheel1()
{var delta = 0;

    if (event.wheelDelta) { /* IE/Opera. */
                delta = event.wheelDelta/120;
                /** In Opera 9, delta differs in sign as compared to IE.
                 */
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) { /** Mozilla case. */
                /** In Mozilla, sign of delta is different than in IE.
                 * Also, delta is multiple of 3.
                 */
                delta = -event.detail/3;
        }
document.getElementById("container1").scrollLeft-=(delta*10)
}

var Drag = {

	obj : null,

	init : function(o)
	{
	    obj=o;
		o.onmousedown	= Drag.start;

		o.onDragStart	= new Function();
		o.onDragEnd	    = new Function();
		o.onDrag		= new Function();
	},
	start : function(e)
	{
		var o = obj;
		e = Drag.fixE(e);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;


		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.top);
		var x = parseInt(o.left);
		var nx, ny;

		nx = ((ex - o.lastMouseX) * 1);
		ny = ((ey - o.lastMouseY) * 1);

        document.getElementById("container").scrollLeft-=((parseFloat(nx)*1)/5)

		return false;
	},

	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		
		Drag.obj = null;

	},

	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};
