// JavaScript Document
/* popup script */
var gmyWin=null;
var pW = ',left ='+ (screen.availWidth - 710); // sets popup to right of screen less integer
function myOpenWindow(winURL, winName, winFeatures, winObj) {
	//alert(winURL);
	var theWin = window.open(winURL, winName, winFeatures);
	//for writing title text specific to each document
	//document.form1.helpText.value = winText; 
	// first check to see if the window already exists
	if (winObj != null) {
		// the window has already been created, but did the user close it?
		// if so, then reopen it. Otherwise make it the active window.
		if (!winObj.closed) {
			winObj.focus();
			return winObj;
		}
	}
	// otherwise fall through to the code below to re-open the window  
	// if we get here, then the window hasn't been created yet, or it  
	// was closed by the user.  

	//window.new.getElementById('helpText').innerHTML = 'sample static help text';
	return theWin; 
}

function closeNamedWindow(winName)
{
    var win = window.open('', winName, 'width=1,height=1,screenx=0,left=0,screeny=0,top=0,location=no,menubar=no,scrollbars=no,status=no,titlebar=no');
    if (win)
    {
        win.close();
    }
}

function openNamedWindow(winURL, winName, winFeatures)
{
    var str1 = winURL.split("target=", 2);
    if (str1.length > 1)
    {
        var str2 = str1[1].split("\&", 1)[0];
        var str3 = 'target='+str2;
        
        winURL = winURL.replace(str3+'&','');
        winURL = winURL.replace('&'+str3,'');
        winURL = winURL.replace('?'+str3,'');
    
        if (str2 == '_self' || str2 == '_top')
        {
            window.location.href = winURL;
        }
        else
        {
	        var win = window.open(winURL, str2)
	        if (win)
	        {
                win.focus();
            }
        }
    }
    else
    {
	    var win = window.open(winURL, winName, 'toolbar=0,scrollbars=1,statusbar=0,menubar=0,resizable=1,' + winFeatures)
	    if (win)
	    {
            win.focus();
        }
    }
}
