﻿function openpopup(popurl) {
    var winpops = window.open(popurl, "", "width=650,height=400,status=1,toolbar=0,location=0,menubar=0");
}

var buttonpress = function() {
    var myAct = this.get('href');
    if (myAct.contains('javascript:')) {
        myTmp = myAct.split(":");
        myAct = myTmp.pop();
        eval(myAct);
    }
    else {
        window.location = myAct;
    }
}

window.addEvent('domready', function() {
    $$('.button').each(function(myBtn) {
        if (myBtn.get('href').contains('javascript:')) {
            var myBtnId = myBtn.get('id');
            var myPar = myBtn.getParent('div, table');
            myPar.getElements('input').each(function(myIn) {
                if ((myIn.get('type') == 'text') || (myIn.get('type') == 'password')) {
                    myIn.addEvent('keypress', function(e) {
                        if (e.key == 'enter') {
                            e.stop();
                            e.stopPropagation();
                            thisBtn = this.getParent('div, table').getElement('.button');
                            buttonpress.delay(100, thisBtn, e);
                        }
                    });
                }
            });
        }
    });
});