﻿/***********************************************
* Auto Maximize Window Script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for this script and 100's more.
***********************************************/
function maximize()
{
    top.window.moveTo(0,0);
    if (document.all)
    {
        top.window.resizeTo(screen.availWidth,screen.availHeight);
    }
    else if (document.layers||document.getElementById)
    {
        if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
        {
            top.window.outerHeight = screen.availHeight;
            top.window.outerWidth = screen.availWidth;
        }
    }

}

function OpenW(aspx,qs,width,height,scrollbars, toolbar, status, resizable,menubar)
{
    if (aspx=='')
        aspx='wp_popup.aspx';
        
    if (qs!='')
        qs = '?' + qs;
    
    return window.open(aspx + qs,'','height=' + height + ',width=' + width + ',top=' + (screen.height - height)/2 + ',left=' + (screen.width - width)/2 + ',scrollbars=' + scrollbars + ',toolbar=' + toolbar + ',status=' + status + ',resizable=' + resizable + '');
}
function bloccaBackspace(e)
{
    var keyCode;
    if (document.all)
    { 
        keyCode=e.keyCode
    }
    else
    {
        keyCode=e.which
    }
    
    if(keyCode != 8) return true;
    if(e.srcElement.tagName.toUpperCase() == 'INPUT')
    {
        if (e.srcElement.type.toUpperCase()=='TEXT' || e.srcElement.type.toUpperCase()=='PASSWORD') return true;
    }
    if(e.srcElement.tagName.toUpperCase() == 'TEXTAREA') return true;
    return false;
}
function closeWindow(motivo, activeentitykey)
{
    try
    {
        if (motivo!='')
        {
            var campohidden_motivopostback;
            var campohidden_activeentitykey;
            campohidden_motivopostback = window.opener.document.getElementById('campohidden_motivopostback');
            campohidden_activeentitykey = window.opener.document.getElementById('campohidden_activeentitykey');
            campohidden_motivopostback.value = motivo;
            campohidden_activeentitykey.value = activeentitykey;
        }
        window.opener.document.forms[0].submit();
    }
    catch(err)
    {
    }
    self.close();
}

