﻿

    function loadImageBig(sURL)
    {
        var obj = document.getElementById('digi-Menu-Pic');
        
        var sHTML = '<img id=\"imgPic\" src=\"' + sURL + '\" alt=\"\" />';
        obj.style.display = 'none';
        obj.innerHTML = sHTML;    
        Effect.Appear(obj.id), {duration: 12.0, from: 0.0, to: 1.0};
        obj.style.border = 'solid 2px #4198b0';
        
        loadTextDescription(sURL);
    }

    function loadTextDescription(sURL) {
        var now = new Date();
        var objAjax = new GetXmlHttpObject();
        if (objAjax == null) {
            alert("Your Browser does not support HTTP Requests");
            return;
        }

        var url = '?t=' + sURL + '&sAction=loadTXT' + "&time=" + now.getMinutes() + now.getSeconds();
        objAjax.open("GET", url, false); //synchronous !
        objAjax.send(null);
        var sString = objAjax.responseText;
        document.getElementById("ImgExplanation").innerHTML = sString;
        objAjax = null;
    }
    
    function loadImages(sGallery)
    {
        document.getElementById('sAction').value = 'load';
        document.getElementById('sGallery').value = sGallery;
        document.forms[0].submit();
    }
    
    function slideImagesToLeft()
    {
        var obj = document.getElementById('ImageContainer');
        var objSlider = document.getElementById('SliderContent');
        if (document.all){
            if ((parseInt(parseInt(obj.currentStyle.left.replace(/px/,'')) - parseInt(80))*-1) > parseInt(obj.currentStyle.width.replace(/px/,''))){
            }else{
                obj.style.left = parseInt(obj.currentStyle.left.replace(/px/,'')) - parseInt(80) + 'px';
            }
        }else{
            if ((parseInt(parseInt(window.getComputedStyle(obj,'').left.replace(/px/,'')) - parseInt(80))*-1) > parseInt(window.getComputedStyle(obj, '').width.replace(/px/,''))){
            }else{
                obj.style.left = parseInt(window.getComputedStyle(obj,'').left.replace(/px/,'')) - parseInt(80) + 'px';
            }
        }
    }

    function slideImagesToRight()
    {
        var obj = document.getElementById('ImageContainer');
        var objSlider = document.getElementById('SliderContent');
        if (document.all){            
            if (parseInt(parseInt(obj.currentStyle.left.replace(/px/,'')) + parseInt(80)) > parseInt(objSlider.currentStyle.width.replace(/px/,''))){
            }else{
                obj.style.left = parseInt(obj.currentStyle.left.replace(/px/,'')) + parseInt(80) + 'px';
            }
        }else{
            if (parseInt(parseInt(window.getComputedStyle(obj, '').left.replace(/px/,'')) + parseInt(80)) > parseInt(window.getComputedStyle(objSlider,'').width.replace(/px/,''))){
            }else{
                obj.style.left = parseInt(window.getComputedStyle(obj,'').left.replace(/px/,'')) + parseInt(80) + 'px';
            }
        }
    }
    
    function hoverImage(obj)
    {
        obj.style.borderLeft = 'solid 1px #4198b0';
        obj.style.borderRight = 'solid 1px #4198b0';
        
        if (document.all){
            obj.style.filter = 'alpha(opacity=45)';
        }else{
            obj.style.opacity = '.45';
        }
    }
    
    function releaseImage(obj)
    {
        obj.style.border = '0px';
        if (document.all){
            obj.style.filter = '';
        }else{
            obj.style.opacity = '';
        }
    }
    
    function hoverMenu(obj)
    {
        if (obj.style.color == '#4198b0'){
            obj.style.color = '#72c9dc';
        }
    }
    
    function releaseMenu(obj)
    {
        if (obj.style.color == '#72c9dc'){
            obj.style.color = '#4198b0';
        }
    }


    /* Ajax */
    function GetXmlHttpObject() {
        var objXMLHttp = null;
        if (window.XMLHttpRequest) {
            objXMLHttp = new XMLHttpRequest();
        }
        else if (window.ActiveXObject) {
            objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        return objXMLHttp;
    }
