////////////////////////////////////////////////////////////////////////
function popUp(mylink, windowname, features)
{
    if (!window.focus)
    {
        return true;
    }

    var href;                              
    
    if (typeof(mylink) == 'string')
    {
       href = mylink;
    }
    else
    {
       href = mylink.href;
    }
    mywin = window.open(href, windowname, features);
    mywin.focus();
    return false;
}

////////////////////////////////////////////////////////////////////////
function popupform(myform, windowname)
{
	if (!window.focus)
		return true;
	window.open('', windowname, 'height=200, width=400, scrollbars=yes');
	myform.target = windowname;
	
	return true;
}
                    
                    
////////////////////////////////////////////////////////////////////////
function targetopener(mylink, closeme, closeonly)
{
    if (! (window.focus && window.opener))
        return true;
    window.opener.focus();
    if (! closeonly)
        window.opener.location.href = mylink.href;
    if (closeme)
        window.close();      

    return false;
}

////////////////////////////////////////////////////////////////////////
// No reload
function popupnr(mylink, windowname, refocus)
{
    var mywin, href;
    
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    mywin = window.open('', windowname, 'width=400,height=200,scrollbars=yes');
    
    // if we just opened the window
    if (
       mywin.closed || 
       (! mywin.document.URL) || 
       (mywin.document.URL.indexOf("about") == 0)
       )
       mywin.location=href;
    else if (refocus)
       mywin.focus();
       
    return false;    
}


// <A HREF="rbex.html"  onClick="return targetopener(this)">my page</A>  //Popup Windows: Targeting the Opener
// <A HREF="rbex.html" onClick="return targetopener(this,true)">main page</A>   // Popup Windows: Closing When They Go to the Opener
// <A HREF="rbex.html" onClick="return targetopener(this,true,true)">close</A> // Popup Windows: Closing The Popup

// <FORM METHOD=POST ACTION="http://www.idocs.com/cgi-bin/mypopupcgi.pl" onSubmit="javascript:popupform(this, 'join')">
