// JScript File
    function GetWindowHeight()
    {
            var y = 0;
            if (self.innerHeight)
            {
                    y = self.innerHeight;
            }
            else if (document.documentElement && document.documentElement.clientHeight)
            {
                    y = document.documentElement.clientHeight;
            }
            else if (document.body)
            {
                    y = document.body.clientHeight;
            }
            return y;
    }

    function pageLoad()
    {
        /* Image Gallery Popup box */
        var ctl06_ctl00_AlbumImagePopupExtender = $find('ctl06_ctl00_AlbumImagePopupExtender');
        if(ctl06_ctl00_AlbumImagePopupExtender != null)
        {
            window.onresize = ImageGalleryPopupOnShow; 
            ImageGalleryPopupOnShow();
        }
    }

    
    function ImageGalleryPopupOnShow()
    {
        var allTbl_Popup = getElementsByClassName(document, "table", "AlbumImagePopup");
        var allDivScrollerMainImage = getElementsByClassName(document, "div", "AlbumImageScrollerMainImage");
        var allDivScrollerThumbnails = getElementsByClassName(document, "div", "AlbumImageScrollerThumbnails");
        
        for(i = 0; i < allTbl_Popup.length; i++)
        {
            var tbl_Popup = allTbl_Popup[i];
            var ctrlDivScrollerMainImage = allDivScrollerMainImage[i];
            var ctrlDivScrollerThumbnails = allDivScrollerThumbnails[i];
            
            if( (tbl_Popup!=null) && (ctrlDivScrollerMainImage!=null) && (ctrlDivScrollerThumbnails!=null) )
            {
                var currentWindowHeight = GetWindowHeight();
                
                if(currentWindowHeight<620)
                {
                    var newHeight = Math.round(currentWindowHeight);
                    ctrlDivScrollerMainImage.style.height = (newHeight-70) + "px";
                    ctrlDivScrollerThumbnails.style.height = (newHeight-70) + "px";
                }
                else
                {
                    var newHeight = Math.round(620);
                    ctrlDivScrollerMainImage.style.height = (newHeight-70) + "px";
                    ctrlDivScrollerThumbnails.style.height = (newHeight-70) + "px";
                }
                
            }
        }
    }
    
    
    function ShowFileDescription()
    {
        var allImageGalleryFileDescriptionBox = getElementsByClassName(document, "div", "AlbumImageFileDescriptionBox");
        for(i = 0; i < allImageGalleryFileDescriptionBox.length; i++)
        {
            //var divFileDescription = document.getElementById("divFileDescription");
            var divFileDescription = allImageGalleryFileDescriptionBox[i];
            divFileDescription.style["display"] = "block";
        }
    }
    
        function HideFileDescription()
    {
        var allImageGalleryFileDescriptionBox = getElementsByClassName(document, "div", "AlbumImageFileDescriptionBox");
        for(i = 0; i < allImageGalleryFileDescriptionBox.length; i++)
        {
            //var divFileDescription = document.getElementById("divFileDescription");
            var divFileDescription = allImageGalleryFileDescriptionBox[i];
            divFileDescription.style["display"] = "none";
        }
    }
    
    
    
    function getElementsByClassName(oElm, strTagName, strClassName){
	    var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	    var arrReturnElements = new Array();
	    strClassName = strClassName.replace(/\-/g, "\\-");
	    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	    var oElement;
	    for(var i=0; i<arrElements.length; i++){
		    oElement = arrElements[i];
		    if(oRegExp.test(oElement.className)){
			    arrReturnElements.push(oElement);
		    }
	    }
	    return (arrReturnElements)
    }
    
//    function client_thumbnail_click(thumbnail)
//    {
//        var btn_SelectImage = thumbnail;

//        var divScrollerThumbnails = btn_SelectImage.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
//        var UpdatePanel1 = divScrollerThumbnails.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
//        var divScrollerThumbnails_ScrollPosition = divScrollerThumbnails.scrollTop;
//        
//        StoreLastScrollPosition(divScrollerThumbnails_ScrollPosition);
//    }

//    function StoreLastScrollPosition(value)
//    {
//        //Check if there is a hdn_LastScrollPosition on the page
//        var hdn_LastScrollPosition = document.getElementById("hdn_LastScrollPosition");
//        if(hdn_LastScrollPosition == null)
//        {
//              //Add this element
//              var body_tag = document.getElementsByTagName('body') [0];
//              var new_label = document.createElement('label');
//              var new_label_id = 'hdn_LastScrollPosition';
//              var new_label_class= 'HiddenLastScrollPositionValue';
//              new_label.setAttribute('id',new_label_id);
//              new_label.setAttribute('class',new_label_class);
//              new_label.innerHTML = value;
//              body_tag.appendChild(new_label);
//        }
//        else
//        {
//           hdn_LastScrollPosition.innerHTML = value;
//        }
//    }
    
    //Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
    //function EndRequestHandler(sender, args) 
    //{
    //    SetScrollPosition();
    //} 
//   
//    function SetScrollPosition()
//    {
//        var allDivScrollerThumbnails = getElementsByClassName(document, "div", "AlbumImageScrollerThumbnails");
//        for(i = 0; i < allDivScrollerThumbnails.length; i++)
//        {
//            var ctrlDivScrollerThumbnails = allDivScrollerThumbnails[i];
//            
//            if (ctrlDivScrollerThumbnails!=null) 
//            {                              
//                //set the previous scroll position
//                //Check if there is a hdn_LastScrollPosition on the page
//                var hdn_LastScrollPosition = document.getElementById("hdn_LastScrollPosition");
//                if(hdn_LastScrollPosition != null)
//                {
//                    var intScrollPosition = parseInt( hdn_LastScrollPosition.innerHTML );
//                    ctrlDivScrollerThumbnails.scrolltop = intScrollPosition;
//                }
//           }
//       }
//    }


        

