// Spellex Spelling Server
// SubmissionScript.js:
// Client-side script used to submit a form to the server for
// spell-checking using Spellex Spelling Server.
// Copyright (c) 2003 Spellex Corporation
// www.spellex.com
// Copyright (c) 2002 Wintertree Software Inc.
// $Id: SubmissionScript.js,v 1.7 2003/07/08 17:48:06 wsi Exp wsi $

var spellCheckWin = null;

function onCheckSpellingBtn(formNum) {
    if (spellCheckWin != null && !spellCheckWin.closed) {
        // The spell-check form is active. Bring it to the front.
        spellCheckWin.focus();
        return;
    }

    // Retrieve the option settings and user dictionary from a cookie.
    var options = 0;
    var cookies = document.cookie;
    var pos = cookies.indexOf("spellcheck=");
    var s;
    if (pos >= 0) {
        var start = pos + 11;
        var end = cookies.indexOf(";", start);
        if (end < 0) {
            end = cookies.length;
        }
        var scCookie = unescape(cookies.substring(start, end));
        end = scCookie.indexOf(":");
        if (end < 0) {
            end = scCookie.length;
        }
        s = scCookie.substring(0, end);
        options = s - 0;
        if (options != 0) {
            document.forms[formNum].SPXOptions.value = options;
        }
        if (end != scCookie.length) {
            start = end + 1;
            s = scCookie.substring(start, scCookie.length);
            document.forms[formNum].SPXUserDictionary.value = s;
        }
    }

    // When the Check Spelling button is pressed, submit the form to spellcheck.asp
    document.forms[formNum].action = "spellcheck.asp";
    spellCheckWin = window.open("", "spellWin",
      'toolbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1,width=620,height=260');
    document.forms[formNum].target = "spellWin";
    document.forms[formNum].submit();
}

function onSubmitBtn(formNum) {
    // When the Submit button is pressed, submit the form to default.asp
    document.forms[formNum].action = "default.asp";
    document.forms[formNum].target = "_self";
    document.forms[formNum].submit();
}


