﻿function EnterPressedToTab() {
    if (event.keyCode == 13) {
        event.keyCode = 9;
    } else {
        return true;
    }
}

function EnterPressedSubmit(btnName) {
    var x = document.getElementById(btnName).value;
    if (event.keyCode == 13) {
        document.getElementById(btnName).focus();
    } else {
        return true;
    }
}

function checkMail(ctrlName) {
    var x = document.getElementById(ctrlName).value;

    if (x == "") {
    }
    else {
        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        if (filter.test(x)) {
        }
        else {
            alert('Invalid Email Address!');
            document.getElementById(ctrlName).focus();
            document.getElementById(ctrlName).value = "";
        }
    }
}

function openWindow(urlPage, winName, winWidth, winHeight, winResize, winScroll, winCenter) {
    // Set Window POSITION to center screen
    var xPos, yPos
    xPos = 0; yPos = 0;
    if ((parseInt(navigator.appVersion) >= 4) && (winCenter)) {
        xPos = (screen.width - winWidth) / 2;
        yPos = (screen.height - winHeight) / 2;
    }

    // Set Window PARAMETERS
    var winPrm
    winPrm = ""
	+ "width=" + winWidth + ","
	+ "height=" + winHeight + ","
	+ "resizable=" + winResize + ","
	+ "scrollbars=" + winScroll + ","

	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "menubar=0,"
	+ "status=1,"
	+ "hotkeys=0,"
	+ "location=0,"

	+ "left=" + xPos + ","     //IE Only
	+ "top=" + yPos;           //IE Only
+"screenx=" + xPos + ","  //NN Only
	+ "screeny=" + yPos + ","  //NN Only

    window.open(urlPage, winName, winPrm);
}

function Calc_Total(ctrlName, ctrlName2) {
    var x = document.getElementById(ctrlName).value;
    if (x > 1) {
        var y = parseFloat(100.00 * x);
        document.getElementById(ctrlName2).innerHTML = "$" + y.toFixed(2);
    } else {
    document.getElementById(ctrlName2).innerHTML = "$100.00";
    }
}

function NextBox(ObjID, ObjLength, ObjNext) {
    var x = document.getElementById(ObjID).value.length;
    var y = document.getElementById(ObjID).value;

    if (x == ObjLength) {
        document.getElementById(ObjNext).focus();
    }
}

function Bookmark(urlStr) {
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {

        var url = urlStr;
        var title = "The Garden Party Foundation";

        document.write('<A HREF="javascript:window.ext');
        document.write('ernal.AddFavorite(url,title);" ');
        document.write('onMouseOver=" window.status=');
        document.write("'Add our site to your favorites!'; return true ");
        document.write('"onMouseOut=" window.status=');
        document.write("' '; return true ");
        document.write('">Add our site to your favorites!</a>');
    }
    else {
        var msg = "Don't forget to bookmark us!";
        if (navigator.appName == "Netscape") msg += " (CTRL-D)";
        document.write(msg);
    }
}

