﻿
            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() {
                var bws = getBrowserHeight();
                document.getElementById("shadow").style.width = "974px";
              document.getElementById("shadow").style.width = bws.width + "px";
                document.getElementById("shadow").style.height = (750) + "px";

            }






function closeGallery() {
    document.getElementById('gallery').style.display  = 'none'; 
    
}


function openGallery(i) {
  //  setLayerPosition();
    document.getElementById('galleryPicture').src = i ;
    document.getElementById('gallery').style.display  = 'block';
}

function closeProjectGallery() {
   
  document.getElementById('ProjectGalleryPicture').src = '/images/wait.gif';
   document.getElementById('ProjectGallery').style.display  = 'none'; 
 }


function openProjectGallery(i) {
  //  setLayerPosition();
    document.getElementById('projectGalleryPicture').src = '/images/wait.gif';
    document.getElementById('projectGalleryPicture').src = i ;
 //   document.getElementById('ProjectGallery').style.display  = 'block';
}
        
function moveObj(i) {
    newPosition = currPosition + i ;  
            
    if (newPosition < - ((imageCount * imageWidth) - (800)) ) { currPosition = -((imageCount * imageWidth) - (800)) }
    else if (newPosition > (imageCount * imageWidth) ) { }
    else if (newPosition >= 0) { currPosition = 0;}
    else { currPosition = newPosition ; }
                
    document.getElementById(imageListID).style.left=  currPosition + "px" ;        
                  
} //function


        function SwapMainImage(WhichImage) {
        document.getElementById('mainimage').src = WhichImage;
        HighlightProduct('product1');
        }
        function HighlightProduct(WhichTable) {
         document.getElementById(WhichTable).className='productboxselected';
        }
        function nextImage(){    
            currentImage +=1;
            if (currentImage > (imageList.length -1)) {currentImage = 0 };
            updateImages();
        }
        
        function prevImage(){
            currentImage -=1;
            if (currentImage < 0) {currentImage = (imageList.length-1) }
            updateImages();
        }        
        function updateImages () {
            document.getElementById('mainimage').src = imageList[currentImage];
            document.getElementById("imageCount").innerHTML = (currentImage + 1) + " of " + imageList.length ;
            highlightproducts();

        }
        function highlightproducts() { 
            resetproducts(); 
            var temp = productList[currentImage];
            var tempArray = temp.split(",");    
           	for (var i=0; i < (tempArray.length); i++) {
		        document.getElementById(tempArray[i]).className="productboxselected";
		    }  
        }
        function resetproducts() {
		for (var i=0; i < (productsArray.length); i++) {
		    document.getElementById(productsArray[i]).className="productbox";
		}

        }