var posted = false;

function validateComment() {

    if (!document.getElementById("name")) {
        return !!document.getElementById("text");
    }

    var name = document.getElementById("name").value;
    var comment = document.getElementById("text").value;
    var url = document.getElementById("url").value;

    var required = /\s*\w+\s*/;
    var uri = /\s*http:\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?\s*/;
    var valid =
        (name.match(required) && comment.match(required)) &&
        (url.match(uri) || url.match(/^\s*$/));

    if (!valid) {

        if (!document.getElementById("error")) {
            var errorBlock = document.createElement("div");
            errorBlock.id = "error";
            errorBlock.appendChild(document.createTextNode("Name and comment " +
                                                           "are required. URL must be valid " +
                                                           "if provided."));

            var commentForm = document.getElementById("addComment");
            commentForm.getElementsByTagName("fieldset").item(0).
                insertBefore(errorBlock, commentForm.getElementsByTagName("label").item(0));
        }

        valid = false;
    }

    if (valid) {
        if (posted) {
            valid = false;
        } else {
            posted = true;
        }
    }

    return valid;
}

function dot(e) {
    {var w=window;w.CdTl=e;w.l=w.location;w.SdP='';w.bU=(w.l.protocol=='https:'?'https://'+w.SdP:'http://')+'bluedot.us';w.eUC=encodeURIComponent;function fBkF(){w.l.href=w.bU+'/Authoring.aspx?u='+w.eUC(w.l.href)+'&amp;t='+w.eUC(document.title);}w.gT=w.setTimeout(fBkF,6999);w.d=w.document;w.sT=w.d.body;w.o=w.d.createElement('scri'+'pt');if(typeof w.o!='object')fBkF();w.o.setAttribute('src',w.bU+'/js/Authoring.js');w.o.setAttribute('type','text/javascript');void(w.sT.appendChild(w.o));}
    return false;
}

function play(e, path) {
    var c = e;
    while ((c = c.parentNode) && c.className != "screencast");

    var so = new SWFObject(path, null, c.style.width, c.style.height, "5");
    so.addParam("menu", "false");
    so.write(c);

    urchinTracker(path);

    return false;
}
