﻿function PopupForm(objForm)
{
    var strAction = objForm.action;
    var strMethod = objForm.method;
    
    if (strMethod == "get")
    {
        var strSerialised = Form.serialize(objForm,false);
        //window.open(strAction + "?" + strSerialised,'','resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,width=850,height=550,status');
        return PopupHref(strAction + "?" + strSerialised,'formwindow');
    }
    else
    {
        //can't handle a post window correctly, so just let the form do it, itself
        return true;
    }
}
//"<a onClick=""window.open(this.href,'','resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,width=850,height=550,status'); return false;""  target=""_blank"" class=""menu5"" href=""/admin/edit/default.asp"">Add a new Page</a>"
function PopupLink(objLink,width,height)
{
    var strHref = objLink.href;
    var strTarget = objLink.target;

    if ((strTarget == '') || (strTarget == '_blank'))
    {
        strTarget = 'newwindow';
    }
    return PopupHref(objLink.href,strTarget,width,height);
}

function PopupHref(strHref, strTarget,width,height)
{
    try
    {
        if (width == null) width = 850;
        if (height == null) height = 550;
        
        window.open(strHref,strTarget,'resizable=yes,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no,dependent=no,width=' + width + ',height=' + height);
        return false; //seems backwards, but basically we don't want the link to do it's normal thing unless the popup fails.
    }
    catch (e)
    {
        return true;
    }
}
