﻿
var Result;

function directLink(element) {
    $.ajax({
        type: "POST",
        contentType: "application/json; charset=utf-8",
        url: "Database.asmx/VerifyFixture",
        data: "{'param':'" + element.value.replace(/[\\']/, "") + "'}",
        dataType: "json",
        success: function(msg) {
            Result = eval(msg);
            if (Result.valid == "true") {
                if (Result.brandId == BrandId) {
                    window.location = "fixture.aspx?catalogId=" + Result.catalogId.toString()
                }
                else {
                    Boxy.load("errBrand.htm", { title: "Incorrect Brand", unloadOnHide: true, x: 120, modal: true });
                }
            }
            else {
                Boxy.load("errInvalid.htm", { title: "Not Found", unloadOnHide: true, x: 120, modal: true });
            }
        },
        error: function(e) {
            alert("failed: " + e.statusText);
        }
    });
    return false;
}
function processKey(element, e) {
    var key;
    if (window.event)
        key = window.event.keyCode
    else
        key = e.which;
    if (key == 13)
        return directLink(element);
}