// Function to dynamically write out the flash code to work around the IE flash "white box" issue.

function flashBanner(name, width, height, wmode) {
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '" id="' + name + '" align="middle">');
    document.write('    <param name="allowScriptAccess" value="sameDomain" />');
    document.write('    <param name="movie" value="/swf/' + name + '" />');
    document.write('    <param name="quality" value="high" />');
    document.write('    <param name="bgcolor" value="#000000" />');
    document.write('    <param name="wmode" value="' + wmode + '" />');
    document.write('    <embed src="swf/' + name + '" quality="high" bgcolor="#000000" width="' + width + '" height="' + height + '" name="' + name + '" wmode="' + wmode + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
    document.write('    </embed>');
    document.write('</object>');
}

//SHOW STUFF
function showstuff(boxid){document.getElementById(boxid).style.visibility="visible";}
function hidestuff(boxid){document.getElementById(boxid).style.visibility="hidden";}


// Function to create dynamic pop up window, currently set to center window on screen.

function newWindow(url, name, wid, hgt, scr, res, stat, loc, mnu, tool, x, y) {
    if (screen) {
        widthOfScreen = screen.width;
        heightOfScreen = screen.height;
    }
    if ((x == null) || (y == null)) {
        midX = widthOfScreen / 2;
        midY = heightOfScreen / 2;
        midWid = wid / 2;
        midHgt = hgt / 2;
        x = midX - midWid;
        y = midY - midHgt;
    }

    windowOpts = "width=" + wid + ",height=" + hgt + ",scrollbars=" + scr + ",resizable=" + res + ",status=" + stat + ",location=" + loc + ",menubar=" + mnu + ",toolbar=" + tool + ",left=" + x + ",top=" + y;
    popUpWindow = window.open(url, name, windowOpts);
}

function validatePoll(obj) {
    formId = document.getElementById(obj);

    if (formId.fname.value.length < 1) {
        alert("Please enter your first name.");
        formId.fname.focus();
        return false;
    }
    if (formId.lname.value.length < 1) {
        alert("Please enter your last name.");
        formId.lname.focus();
        return false;
    }
    if ((formId.email.value.indexOf("@") == -1) || (formId.email.value.indexOf(".") == -1) || (formId.email.value.length < 5))  {
        alert("Please enter a valid email.");
        formId.email.focus();
        return false;
    }
    if (formId.zip_code.value.length < 5) {
        alert("Please enter your zip code.");
        formId.zip_code.focus();
        return false;
    }
    return true;

}