﻿
function submitForm(id) {
    var elm = document.getElementById(id.toString());
    
    if(typeof(elm) != 'undefined' && elm != null)
    {
        if (id == "checkOut")
            elm.action = elm.action + "#chkout";
            
        elm.submit(); 
        return false;
    }
    
    return true;
}

function submitFormAction(id, action) {
    var elm = document.getElementById(id.toString());

    if (typeof (elm) != 'undefined' && elm != null) {
        elm.action = elm.action + '?type=' + action;
        return submitForm(id);
    }

    return true;
}

$(document).ready(function() {

    $("input").keypress(function(e) {
        if (event.which || event.keyCode) {
            if ((event.which == 13) || (event.keyCode == 13)) {
                $(this).parents("form").submit();
            }
        }
    });

    /*$("textarea").keypress(function(e) {
        if (event.which || event.keyCode) {
            if ((event.which == 13) || (event.keyCode == 13)) {
                $(this).parents("form").submit();
            }
        }
    });*/
});

function formValidate(form) {
    if (document.getElementById('paymentform').target != 'myNewWin') {
        return true;
    }

    formvalidate = function(f) {
        return true;
    }

    window.open("", "myNewWin", "width=650,height=580,menubar=no,location=yes,resizable=yes,scrollbars=yes,status=no,titlebar=no,toolbar=no");
    var a = window.setTimeout("document.getElementById('paymentform').submit();", 500);
    return false;
} 