
/********************************************************************************

Name:                 Flash embed
Description:        Writeout flash code. Fixes Eolas update for IE as well.
@param    swf        String path to swf file
@param    width        Number value of movie width
@param    height    Number value of movie height

*********************************************************************************/

flash = new Object();
flash.insert = function(swf,width,height) {    
    document.write('<embed src="'+swf+'" menu="false" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');    
}

function sendBack() {
    window.history.go(-1);
    return false;
}

function sendValidate() {
    // Validate input
    var fromName = document.sendForm.sFromName.value;
    if (fromName != null) {
        // name must consist only of a-z, 0-9, _, ., - and space
        if (!fromName.match(/[\w\d\s\.-]+/)) {
            alert("Please enter your name");
            document.sendForm.sFromName.focus();
            return false;
        }
    }
    else {
        return false;
    }
    var fromEmail = document.sendForm.sFromEmail.value;
    if (fromEmail != null) {
        if (!fromEmail.match(/^[\w\d\._%-]+@[\w\d\._%-]+\.[\w]+$/)) {
            alert("Please enter your valid email");
            document.sendForm.sFromEmail.focus();
            return false;
        }
    }
    else {
        return false;
    }
    var toName = document.sendForm.sToName.value;
    if (toName != null) {
        // name must consist only of a-z, 0-9, _, ., - and space
        if (!toName.match(/[\w\d\s\.-]+/)) {
            alert("Please enter your friend's name");
            document.sendForm.sToName.focus();
            return false;
        }
    }
    else {
        return false;
    }
    var toEmail = document.sendForm.sToEmail.value;
    if (toEmail != null) {
        if (!toEmail.match(/^[\w\d\._%-]+@[\w\d\._%-]+\.[\w]+$/)) {
            alert("Please enter your friend's valid email");
            document.sendForm.sToEmail.focus();
            return false;
        }
    }
    else {
        return false;
    }

    return true;
}

function jumpSelect(form, selectId) {
    var url = form[selectId].options[form[selectId].selectedIndex].value;
    if (url != "" && url != "null") {
        // open external links and pdfs in new window
        if (url.indexOf("http://") == 0 || url.indexOf(".pdf") == (url.length-4)) {
            window.open(url);
        }
        else {
            document.location = url;
        }
    }
    else {
        alert("Please select an option first");
         form[selectId].focus();
    }

    return false;
}


