﻿//  To use the block request add the following code to your control
//  <script type="text/javascript"
//        src="/desktopmodules/summit.website.controls/javascript/requestblock.js">
//    </script>

//    <div id='busyWithRequestSpanImage' style="display: none;">
//        <asp:Image ID="imgBusyWithRequestGraphic" CssClass="normal" ImageUrl="~/images/dnnanim.gif" AlternateText="busy with request" runat="server" />
//    </div>
//    <div id='busyWithRequestSpan' style="display: none; filter: alpha(opacity=10);">
//    </div>

function jsConfirm(control, question) {
        if (confirm(question))
        {
            
             showBusyWithRequestImage();
            return true;
        }
        else 
        {
            return false;
        }
    }
    
    function showBusyWithRequestImage() {
        try 
        {
        var x,y;
 	    var test1 = document.body.scrollHeight;
 	    var test2 = document.body.offsetHeight;
	    if (test1 > test2) 
	    {
 		    // all but Explorer Mac
 		    x = document.body.scrollWidth;
 		    y = document.body.scrollHeight;
 		    
 		} else 
 		{
 		    x = document.body.offsetWidth;
 		    y = document.body.offsetHeight;
 		}

            var graphicSpan = document.getElementById('busyWithRequestSpan');
            var graphicSpan2 = document.getElementById('busyWithRequestSpanImage');
            if (graphicSpan != null)
            {
                graphicSpan.style.display = 'block';
                graphicSpan.style.zIndex = '2000'; 
                graphicSpan.style.position = 'absolute';
                graphicSpan.style.left = '0px';
                graphicSpan.style.top = '0px';
                graphicSpan.style.width = x;
                graphicSpan.style.height = y; 
                graphicSpan.style.backgroundColor = 'gray';
               
                graphicSpan2.style.display = 'block';
                graphicSpan2.style.position = 'absolute';
                graphicSpan2.style.zIndex = '2001';
                graphicSpan2.style.left = x/2-10;
                graphicSpan2.style.top = y/2-10;
                graphicSpan2.style.width = 20;
                graphicSpan2.style.height = 20; 
                
                setTimeout("UpdateImage();",50);
                
                document.body.style.cursor='wait';
            }
        }
        catch (error) { }
    }    
    
      function UpdateImage() 
    {
        var img = getFirstImgChild(document.getElementById('busyWithRequestSpanImage'));
        if (img != null)
    		img.src = img.src;
    }
    
    function getFirstImgChild(span)
    {
        return span.childNodes[0];
    }
    
    
