﻿var restarea = 6 //1) width of the "neutral" area in the center of the gallery in px
var maxspeed = 7 //2) top scroll speed in pixels. Script auto creates a range from 0 to top speed.
var endofgallerymsg = "" //3) message to show at end of gallery. Enter "" to disable message.

function enlargeimage(path, optWidth, optHeight) { //function to enlarge image. Change as desired.
    var actualWidth = typeof optWidth != "undefined" ? optWidth : "600px" //set 600px to default width
    var actualHeight = typeof optHeight != "undefined" ? optHeight : "500px" //set 500px to  default height
    var winattributes = "width=" + actualWidth + ",height=" + actualHeight + ",resizable=yes"
    window.open(path, "", winattributes)
}

var iedom = document.all || document.getElementById
var scrollspeed = 0
var movestate = ""

var actualheight = ''
var actualwidth = ''
var actualwidthMagazine = ''

var cross_scroll
var loadedyes = 0



function ietruebody() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}

function creatediv() {
    statusdiv = document.createElement("div")
    statusdiv.setAttribute("id", "statusdiv")
    document.body.appendChild(statusdiv)
    statusdiv = document.getElementById("statusdiv")
    statusdiv.innerHTML = endofgallerymsg
}

function showhidediv(what) {
    if (endofgallerymsg != "")
        statusdiv.style.visibility = what
}

function getposOffset(what, offsettype) {
    var totaloffset = (offsettype == "left") ? what.offsetLeft : what.offsetTop;
    var parentEl = what.offsetParent;
    while (parentEl != null) {
        totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
        parentEl = parentEl.offsetParent;
    }
    return totaloffset;
}

function contains_ns6(a, b) {
    while (b.parentNode)
        if ((b = b.parentNode) == a)
        return true;
    return false;
}

function stopmotion(e) {
    if ((window.event && !crossmain.contains(event.toElement)) || (e && e.currentTarget && e.currentTarget != e.relatedTarget && !contains_ns6(e.currentTarget, e.relatedTarget))) {
        if (window.downtime) clearTimeout(downtime)
        if (window.uptime) clearTimeout(uptime)
        movestate = ""
    }
}

function Stop() {
    if (window.downtime) clearTimeout(downtime)
    if (window.uptime) clearTimeout(uptime)
    movestate = ""
}

