/*
JavaScript Browser, OS, and Flash Version Detection Engine
Copyright © 2005 Phizz Graphic Design Studio
*/

var isIE = false;
var isNS = false;
var isFlash5 = false;
var isFlash6 = false;
var isFlash7 = false;

// Browser Detection
isIE = (navigator.appName.indexOf('Microsoft') == 0);
isNS = (navigator.appName.indexOf('Netscape') == 0);
isMac = (window.navigator.appVersion.indexOf("Mac") != -1);
isWindows = navigator.userAgent.indexOf("Windows 95") != -1 || navigator.userAgent.indexOf("Windows 98") != -1 || navigator.userAgent.indexOf("Windows NT") != -1;
isUNIX = (window.navigator.appVersion.indexOf("X11") != -1) || (window.navigator.appVersion.indexOf("Linux") != -1) || (window.navigator.appVersion.indexOf("SunOS") != -1) || (window.navigator.appVersion.indexOf("IRIX") != -1) || (window.navigator.appVersion.indexOf("HP-UX") != -1);
isMacIE = (isMac && isIE);

// Flash Version
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]  && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
    if (navigator.plugins && navigator.plugins["Shockwave Flash"] && (versionIndex = navigator.plugins["Shockwave Flash"].description.indexOf(".")) != - 1) {
        var versionString = navigator.plugins["Shockwave Flash"].description.substring(versionIndex-1, versionIndex);
        versionIndex = parseInt(versionString);
        isFlash5 = (versionIndex >= 5);
        isFlash6 = (versionIndex >= 6);
        isFlash7 = (versionIndex >= 7);
    }
} else if (isIE && isWindows) {
    document.write('<script language="VBScript">\n');
    document.write('on error resume next\n');
    document.write('isFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))\n');
    document.write('isFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))\n');
    document.write('isFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7")))\n');
    document.write('</script>\n');
}

function SubmitMailingList() {
    if (document.getElementById("txtMLName").value == "") {
        alert ("Please give a value for the Name field");
        document.getElementById("txtMLName").focus();
    } else if (document.getElementById("txtMLEmail").value == "") {
        alert ("Please give a value for the Email field");
        document.getElementById("txtMLEmail").focus();
    } else if (document.getElementById("txtMLEmail").value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != 0) {
        alert ("The email address you entered does not appear to be valid. Please check it and try again.");
        document.getElementById("txtMLEmail").focus();
    } else {
        window.location.href = "MailingList.aspx?action=add&name=" + escape(document.getElementById("txtMLName").value) + "&email=" + escape(document.getElementById("txtMLEmail").value);
    }
}

function WriteTitle() {
    if (isFlash6) {
        document.write(
            "<div style=\"width:780px;height:174px;margin-bottom:2px;\">"
            + "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"780\" height=\"174\" id=\"swfTitle\" align=\"middle\">"
            + "<param name=\"allowScriptAccess\" value=\"sameDomain\" />"
            + "<param name=\"movie\" value=\"title.swf\" />"
            + "<param name=\"loop\" value=\"false\" />"
            + "<param name=\"menu\" value=\"false\" />"
            + "<param name=\"quality\" value=\"high\" />"
            + "<param name=\"bgcolor\" value=\"#ffffff\" />"
            + "<embed src=\"title.swf\" loop=\"false\" menu=\"false\" quality=\"high\" bgcolor=\"#ffffff\" width=\"780\" height=\"174\" name=\"Header\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />"
            + "</object>"
            + "</div>"
        );
    } else {
        document.write("<img src=\"i/title.jpg\" width=780 height=174 />");
    }
}

