﻿// javascript File

function openPopupWindow(URL, windowName)
{
    openWindow(URL, windowName, 900, 800, 1, 1);
}

function openPrintWindow(URL, windowName)
{
    var width = 900;
    var height = 800;
    var scroller = 1;
    var resizable = 1;
    var menubar = 1;

	if (popupWindow1 && !popupWindow1.closed) {
		popupWindow1.close();
	}
	// To debug the source use the normal window options.
	// popupWindow1 = window.open(URL, windowName);
	popupWindow1 = window.open(URL, windowName, "toolbar=1, location=1, status=1, menubar=" + menubar + ", top=0, left=0, screenX=0, screenY=0,  scrollbars =" + scroller + " , width=" + width + ", height=" + height + ", resizable=" + resizable);	
	//popupWindow1.moveTo(0,0);	
    
}

// Pop Up
var popupWindow1 = null;

function openWindow(URL, windowName, width, height, scroller, resizable) {
	if (popupWindow1 && !popupWindow1.closed) {
		popupWindow1.close();
	}
	// To debug the source use the normal window options.
	// popupWindow1 = window.open(URL, windowName);
	popupWindow1 =  window.open(URL, windowName, "toolbar=1, location=0, status=0, menubar=0, top=0, left=0, screenX=0, screenY=0,  scrollbars =" + scroller + " , width=" + width + ", height=" + height + ", resizable=" + resizable);	
	//popupWindow1.moveTo(0,0);	
}

// Used to close the window.
function closeWindow() {
	// Force the Parent window to refresh.
	//refreshParent();
    
	if (popupWindow1 && !popupWindow1.closed) 
	{
		popupWindow1.close();
	}
	else
	{
	    // Since most of the calls will come from a postback the popupWindow1 will be null.
	    // Just default to close the current window.
	    window.close();
	}	
}

// Causes the Parent window to reload
function refreshParent()
{    
    if (window.opener != null && !window.opener.closed)
    {
        //alert(window.opener.location);
        // Foces a full page reload/rebind.
        window.opener.location = window.opener.location;
        // Doesn't cause the rebind
        //window.opener.document.forms[0].submit();
        // We could use a GetPostBackEventReference for one of the
        // buttons on the form but will do this in the future if time permits.
    }
    else
    {
        //alert("opener is null");
    }
}



// AJAX test functions.

