﻿// JScript File
function getQueryVariable(variable) 
    {
     var query = window.location.search.substring(1);
     var vars = query.split("&");
     for (var i=0;i<vars.length;i++)
      {
           var pair = vars[i].split("=");
           if (pair[0] == variable) 
           {
             return pair[1];
           }
      } 
     return null;
   }
   

//////////////////////////////        
        //bookshowing
        
         function BookShowingArea(){
 
        iOldSTop = ws_ScrollTop(document,false);
        iOldSLeft = ws_ScrollLeft(document,false);
        iOldWWidth = ws_WindowWidth();
        iOldWHeight = ws_WindowHeight();
      //  document.getElementById('bookShowing').onclick = function anony() { closeMessage(); };
        document.getElementById('bookShowing').style.width = ws_WindowWidth() + 'px';
        document.getElementById('bookShowing').style.height = ws_WindowHeight() + 'px';
        document.getElementById('bookShowing').style.left = ws_ScrollLeft(document,false) + 'px';
        document.getElementById('bookShowing').style.top = ws_ScrollTop(document,false) + 'px';
        document.getElementById('bookShowing').onclick = function anony() { closeMessage(); };
        document.getElementById('bookShowing').style.display = 'inline';
        document.getElementById('bookShowing').style.zIndex = 999;   
        document.getElementById('bookShowing').width = ws_WindowWidth()/10;
        document.getElementById('bookShowing').height = ws_WindowHeight()/3;
                    
        chkScrollMessage();
    }


    function closeMessage(){      
        document.getElementById('bookShowing').style.display = 'none';       
        nochkScroll();
        window.close();
    }
    function chkScrollMessage(){
        if (ws_ScrollTop(document,false)!=iOldSTop)closeMessage();
        if (ws_ScrollLeft(document,false)!=iOldSLeft)closeMessage();
        if (ws_WindowWidth()!=iOldWWidth)closeMessage();
        if (ws_WindowHeight()!=iOldWHeight)closeMessage();
      
        scrolldelay = setTimeout('chkScrollMessage()',100);
  
    }

///////////////////////////////////////////////////////////////////////
function openFormArea( inode){       
        iOldSTop = ws_ScrollTop(document,false);
        iOldSLeft = ws_ScrollLeft(document,false);
        iOldWWidth = ws_WindowWidth();
        iOldWHeight = ws_WindowHeight();
        document.getElementById('imgBack').style.width = ws_WindowWidth() + 'px';
        document.getElementById('imgBack').style.height = ws_WindowHeight() + 'px';
        document.getElementById('imgBack').style.left = ws_ScrollLeft(document,false) + 'px';
        document.getElementById('imgBack').style.top = ws_ScrollTop(document,false) + 'px';
        document.getElementById('imgBack').onclick = function anony() { closeFormArea(inode); };
        document.getElementById('imgBack').style.display = 'inline';
        document.getElementById('imgBack').style.zIndex = 999;
  //      document.getElementById('bigImage').src = inode ;//+ '&width=' + ws_WindowWidth()/4 + '&height=' + ws_WindowHeight()/3;
        document.getElementById('imgBack').width = ws_WindowWidth()/4;
        document.getElementById('imgBack').height = ws_WindowHeight()/3;
       
       // document.getElementById(inode).onclick = function anony() { closeFormArea(inode); };
        document.getElementById(inode).style.width = ws_WindowWidth()/2.2 + 'px';
        document.getElementById(inode).style.height = ws_WindowHeight()/1.1 + 'px';
        document.getElementById(inode).style.left = '' + (ws_WindowWidth()/2-(ws_WindowWidth()/3)+ws_ScrollLeft(document,false)) + 'px';
        document.getElementById(inode).style.top = '' + (ws_WindowHeight()/2-(ws_WindowHeight()/2.2)+ws_ScrollTop(document,false)) + 'px';
        document.getElementById(inode).style.display = 'inline';
        document.getElementById(inode).style.zIndex = 999;
          if(inode!='bookshowingzoom')
        {                    
            chkFormAreaScroll(inode);
        }
    }
    
        function closeFormArea(inode){
        document.getElementById(inode).src = 'images/back_logo.png';
        document.getElementById('imgBack').style.display = 'none';
        document.getElementById(inode).style.display = 'none';
        nochkFormAreaScroll();
    }
    function chkFormAreaScroll(inode){
        if (ws_ScrollTop(document,false)!=iOldSTop)closeFormArea(inode);
        if (ws_ScrollLeft(document,false)!=iOldSLeft)closeFormArea(inode);
        if (ws_WindowWidth()!=iOldWWidth)closeFormArea(inode);
        if (ws_WindowHeight()!=iOldWHeight)closeFormArea(inode);      
        scrolldelay = setTimeout('chkFormAreaScroll(\''+inode+'\')',100);
  
    }
    function nochkFormAreaScroll() {
        clearTimeout(scrolldelay);              
        }