﻿     function services(id,pid,sid)
          {
            window.location.href="/hotel/gallery/?id="+id+"&pid="+pid+"&sid="+sid;
          }
        function getPhoto(curId,photoId,langId)
          {
            
            setBigPhoto(curId,photoId);
            var title = document.getElementById("imageTitle");
            title.innerHTML="Загрузка данных";
            var descr = document.getElementById("imageDescr");
            descr.innerHTML="Загрузка данных";
           
            Sys.Net.WebServiceProxy.invoke('/hotels/hotel.asmx', 'GetPhoto', false,{"photoId":photoId,"langId":langId} , SucceededCallback, FailedCallback); 
          }
        function setBigPhoto(curId,photoId)
        {
            activeGalleryId=document.getElementById("activeGalleryId").value;
            var activeGalleryImg = document.getElementById(activeGalleryId);
            activeGalleryImg.className="";
            var curImg=document.getElementById(curId);
            curImg.className="active";
            document.getElementById("activeGalleryId").value= curId;
            var bigImg = document.getElementById("imgBid");
            bigImg.src=document.getElementById("imagesPath").value + photoId.toString() + ".jpg";
        }
        function SucceededCallback(result)
        {
            var title = document.getElementById("imageTitle");
            title.innerHTML=result[0];
            var descr = document.getElementById("imageDescr");
            descr.innerHTML=result[1];
        }
        function FailedCallback(error)
        {
            // Display the error.  
            alert(error.get_message());  
        }     
        if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
        
        var current_pic=1;
        var scrolling=false;
        function show_Next()
        {
            scrolling=true;
            setTimeout("showNext()",150);
        }
        function stop_Next()
        {
            scrolling=false;
        }
        function show_Prev()
        {
            scrolling=true;
            setTimeout("showPrev()",150);
        }
        function stop_Prev()
        {
            scrolling=false;
        }
        function showNext()
        {
            pic_count=parseInt(document.getElementById("gallery_pic_count").value);
            if(document.getElementById("current_pic").value=="updated")
            {
                current_pic=1;
                document.getElementById("current_pic").value="ok";
            }
            if(current_pic<pic_count)
            {
                document.getElementById("pic_nav").style.left=(parseInt(document.getElementById("pic_nav").style.left)-58)+"px";
                current_pic++;
                if(scrolling)
                {
                    setTimeout("showNext()",150);
                }
            }
            if(current_pic==pic_count)
            {
                document.getElementById("i1").style.display="none";
            }
            if(current_pic>1)
            {
                document.getElementById("i2").style.display="block";
            }
            
        } 
        
        function showPrev()
        {
        
            if(current_pic>1)
            {
                document.getElementById("pic_nav").style.left=(parseInt(document.getElementById("pic_nav").style.left)+58)+"px";
                current_pic--;
                if(scrolling)
                {
                    setTimeout("showPrev()",150);
                }
                
            }
            if(current_pic<pic_count)
            {
                document.getElementById("i1").style.display="block";
            }
            if(current_pic==1)
            {
                document.getElementById("i2").style.display="none";
            }
        } 
         
