function checkBatch() {
     if ($('#butch_val').val() != 'Supplier e-mail or url') {
        document.location.href = "/check/batch/value/" + encodeURIComponent($('#butch_val').val()) + '/';
     } else {
         alert('Please enter supplier email or web-address')
     }
}

function checkSupplier() {
     if ($('#sup').val() != 'Supplier e-mail or url') {
        document.location.href = "/check/supplier/value/" + encodeURIComponent($('#sup').val()) + '/';
     } else {
         alert('Please enter supplier email or web-address')
     }
}

$('#checkButchButton').hover(function() {
    $('#checkButchButton').css("cursor", 'pointer');
});
$('#checkButchButton').click(function() {
    checkBatch();
});
$('#butch_val').keyup(function(evt) {
    var key;
    key = (evt.keyCode) ? evt.keyCode : evt.which;

    if (!evt.altKey && !evt.ctrlKey)
    {
        switch (key)
        {
            case 13:    //enter
                checkBatch();
                return false;
        }
    }

    //evt.stopPropagation ? evt.stopPropagation() : evt.cancelBubble = true;
    //evt.preventDefault();

    return false;
});


$('#checkSupButton').hover(function() {
    $('#checkSupButton').css("cursor", 'pointer');
});
$('#checkSupButton').click(function() {
    checkSupplier();
});
$('#sup').keyup(function(evt) {
    var key;
    key = (evt.keyCode) ? evt.keyCode : evt.which;

    if (!evt.altKey && !evt.ctrlKey)
    {
        switch (key)
        {
            case 13:    //enter
                checkSupplier();
                return false;
        }
    }

    //evt.stopPropagation ? evt.stopPropagation() : evt.cancelBubble = true;
    //evt.preventDefault();

    return false;
});

try
{
    var exists = document.getElementById('supplier_form_page').innerHTML;
    if(exists)
    {
        $('.supplier_form').text('');
        $('.supplier_col').text('');
    }
}
catch(err)
{

}

