﻿
function SetCookie(cookieName, cookieValue) {
    var today = new Date();
    var expire = new Date();

    expire.setTime(today.getTime() + 3600000 * 24 * 14);
    document.cookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString();
}


function ReadCookie(cookieName) {
    var theCookie = "" + document.cookie;
    var ind = theCookie.indexOf(cookieName);
    if (ind == -1 || cookieName == "") return "";
    var ind1 = theCookie.indexOf(';', ind);
    if (ind1 == -1) ind1 = theCookie.length;
    return unescape(theCookie.substring(ind + cookieName.length + 1, ind1));
}


var cookiesEnabled = false;
SetCookie('AreCookiesEnabled', 'IBL');
if ('IBL' == ReadCookie('AreCookiesEnabled'))
    cookiesEnabled = true;
else cookiesEnabled = false;



function getBrowserHeight() {
    var intH = 0;
    var intW = 0;

    if (typeof window.innerWidth == 'number') {
        intH = window.innerHeight;
        intW = window.innerWidth;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        intH = document.documentElement.clientHeight;
        intW = document.documentElement.clientWidth;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        intH = document.body.clientHeight;
        intW = document.body.clientWidth;
    }

    return { width: parseInt(intW), height: parseInt(intH) };
}

function setLayerPosition() {
 //.   document.getElementById("shadow").style.width = "974px";
 //.   document.getElementById("shadow").style.height = (750) + "px";

}



function openCatRequest(i) {
    setLayerPosition();
    document.getElementById('shadow').style.display = 'block';
    document.getElementById('gallery').style.display = 'block';
}
function closeCatRequest() {
    document.getElementById('gallery').style.display = 'none';
    document.getElementById('shadow').style.display = 'none';

}


function closeGallery() {
    document.getElementById('gallery').style.display = 'none';
    document.getElementById('shadow').style.display = 'none';

}

function closeAccesGallery() {
    document.getElementById('accesGallery').style.display = 'none';
    document.getElementById('shadow').style.display = 'none';

}
function closeSymbolGallery() {
    document.getElementById('symbolGallery').style.display = 'none';
    document.getElementById('shadow').style.display = 'none';

}
function openGallery(i) {
    setLayerPosition();
    document.getElementById('galleryPicture').src = i;
    document.getElementById('shadow').style.display = 'block';
    document.getElementById('gallery').style.display = 'block';
}
function openSymbolGallery() {
    setLayerPosition();
    document.getElementById('shadow').style.display = 'block';
    document.getElementById('symbolGallery').style.display = 'block';

}

function openAccesGallery(i) {
    setLayerPosition();
    // document.getElementById('AccesgalleryPicture').src = i ;
    document.getElementById('shadow').style.display = 'block';
    document.getElementById('accesGallery').style.display = 'block';
}

function moveObj(i) {
    //    var Iconname;
    //  Iconname = 'Icon' + i;
    //   document.getElementById(Iconname).style.border =  '1px solid #555555';     

    newPosition = (i - 1) * imageWidth;
    if (newPosition == -(currPosition)) { }
    else if (newPosition > -(currPosition)) {
        if (newPosition - -(currPosition) > 101) { currPosition -= 70; }
        else { currPosition -= 10; }
        document.getElementById(imageListID).style.left = currPosition + "px";
        if (-(currPosition) <= newPosition) { window.setTimeout("moveObj(" + i + ");", 0); }
    }
    else {
        if (newPosition - -(currPosition) < -101) { currPosition += 70; }
        else { currPosition += 10; }
        document.getElementById(imageListID).style.left = currPosition + "px";
        if (-(currPosition) >= newPosition) { window.setTimeout("moveObj(" + i + ");", 0); }
    }

} //function
