/*****************************************************************************/
//                                   Main
//      (Code belows runs right after this file is loaded by the browser)
/*****************************************************************************/
//startignore
var GBS = //endignore
{   //startignore
    PrintCaseDetails : //endignore
    function(docketEntries) 
    {
        if (typeof(docketEntries) != "object") return;

        if (docketEntries.ShowingAll) 
        {
            window.print();
            return;
        }

        docketEntries.ShowAllThenPrint();        
    },
    
    //startignore
    PrintPage : //endignore
    function() 
    {
        try
        {
		    var iframe = window.document.createElement('IFRAME');
	        var links = window.document.getElementsByTagName('LINK');
		    var printDocument = null;

		    // Create hidden IFRAME
		    iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';

		    document.body.appendChild(iframe);
		    printDocument = iframe.contentWindow.document;

	        for(var i = 0; i < links.length; i++)
	        {
		        if(links[i].rel.toLowerCase() != 'stylesheet') continue;
			    printDocument.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
            }

		    printDocument.write(window.document.body.innerHTML);
		    printDocument.close();

		    iframe.contentWindow.focus();
		    iframe.contentWindow.print();

            alert('printing...');
            
		    document.body.removeChild(iframe);
		}
		catch(err)
		{
		    alert(err.message);
		}
    },

    //startignore
    ShowHelp : //endignore
    function(helpContentId)
    {
	    var helpContent = YAHOO.util.Dom.get(helpContentId + "_helpContent");
	    var helpContainer = YAHOO.util.Dom.get('helpContainer');
	    var helpCanvas = YAHOO.util.Dom.get('helpCanvas');

	    if (helpContainer == null) return;

	    if (helpContent != null)
	    {
		    helpContainer.innerHTML = helpContent.innerHTML;
		    helpContainer.style.display = '';
		    helpCanvas.className = 'FIELDHELP';
	    }
	    else
	    {
		    helpContainer.style.display = 'none';
		    helpCanvas.className = '';
	    }        
    },

    //startignore
    OpenWindow : //endignore
    function(url)
    {
        var newWindow;
	    if (window.navigator.appName.indexOf("Explorer") >=0) 
	    {
		    newWindow = window.open(url, "", "toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=600,top=100,left=300");
	    } 
	    else 
	    {
		    newWindow = window.open(url, "", "toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=600,x=100,y=300");
		    newWindow.moveTo(0,0);
	    }
	    newWindow.focus();
    },

    //startignore
    PageEvents : //endignore
    {
        //startignore
        OnLoad : //endignore
        function()
        {
            var waitPanel = new YAHOO.widget.Panel(
                "wait",  
                { 
                    //startignore
                    width:"300px", 
                    fixedcenter:
                    true, 
                    close:false, 
                    draggable:false, 
                    modal:true,
                    visible:false
                    //endignore
                } 
            );

            waitPanel.setBody('Processing your request, please wait...');
            waitPanel.render(document.body);

            if (typeof(__doPostBack) == "function")
            {
                var doPostBackRef = __doPostBack; 

                __doPostBack = function(eventTarget, eventArgument)
                {
		            waitPanel.show();
                    doPostBackRef(eventTarget, eventArgument);
                }
            }
        }
    }
};

YAHOO.namespace("GBS");
YAHOO.util.Event.addListener(window, "load", GBS.PageEvents.OnLoad);
