$(document).ready(function() {

    //Welcome Video Link
    $("#welcome").click(function() {
        $("#lbl").attr("src", "images/lblWelcomevid.png");
            $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="video.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="NSvideo=welcome.flv"/>');
    });
    
    //Early Childhood Link
    $("#early").click(function() {
        $("#lbl").attr("src", "images/lblearly.png");
            $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="video.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="NSvideo=ssearly.flv"/>');
    });
    
    //Elementary School Link
    $("#elem").click(function() {
        $("#lbl").attr("src", "images/lblelem.png");
            $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="video.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="NSvideo=sselementary.flv"/>');
    });
    
    //Intermediate School Link
    $("#inter").click(function() {
        $("#lbl").attr("src", "images/lblinter.png");
            $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="video.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="NSvideo=ssinter.flv"/>');
    });
        
    //Middle School Link
    $("#middle").click(function() {
        $("#lbl").attr("src", "images/lblmiddle.png");
            $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="video.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="NSvideo=ssmiddle.flv"/>');
    });
            
    //High School Link
    $("#high").click(function() {
        $("#lbl").attr("src", "images/lblhigh.png");
            $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="video.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="NSvideo=sshighschool.flv"/>');
    });
        
    //Autism Link
    $("#autism").click(function() {
        $("#lbl").attr("src", "images/lblAutism.png");
        document.getElementById('flash').style.backgroundImage = "url(images/autismload.jpg)";
        $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="autism.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="externalinterface=1"/>');
    });
    
    //Room 2
    $("#room2").click(function() {
        $("#lbl").attr("src", "images/lblsensory.png");
        document.getElementById('flash').style.backgroundImage = "url(images/sensoryload.jpg)";
        $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="sensoryday.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="externalinterface=1"/>');
    });
    
    //Room3
    $("#room3").click(function() {
        $("#lbl").attr("src", "images/lblmoderate.png");
        document.getElementById('flash').style.backgroundImage = "url(images/mentload.jpg)";
        $("#flash").html('<embed width="574" height="327" type="application/x-shockwave-flash" wmode="transparent" src="mentally.swf" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="externalinterface=1"/>');
    });
    
    //Share Button Link
    $("#share").click(function() {
        if ($("#stf-container").css("display") == 'none') {
            $("#stf-container").show(function() {
                $("#stf").css("left", "-0px");
            });
        }
        else {
            $("#stf-container").hide(function() {
                $("#stf").css("left", "-0px");
            });
        }
    });
    
    $("#txtName").focus(function() {
        if (document.getElementById('txtName').value == "Name") {
            document.getElementById('txtName').value = "";
        }
    });
    $("#txtName").blur(function() {
        if (document.getElementById('txtName').value == "") {
            document.getElementById('txtName').value = "Name";
        }
    });
    
    $("#txtEmail").focus(function() {
        if (document.getElementById('txtEmail').value == "Your Email") {
            document.getElementById('txtEmail').value = "";
        }
    });
    $("#txtEmail").blur(function() {
        if (document.getElementById('txtEmail').value == "") {
            document.getElementById('txtEmail').value = "Your Email";
        }
    });
    
    $("#txtMsg").focus(function() {
        if (document.getElementById('txtMsg').value == "Message") {
            document.getElementById('txtMsg').value = "";
        }
    });
    $("#txtMsg").blur(function() {
        if (document.getElementById('txtMsg').value == "") {
            document.getElementById('txtMsg').value = "Message";
        }
    });
    
    $("#txtFriend1").focus(function() {
        if (document.getElementById('txtFriend1').value == "Friend Email 1") {
            document.getElementById('txtFriend1').value = "";
        }
    });
    $("#txtFriend1").blur(function() {
        if (document.getElementById('txtFriend1').value == "") {
            document.getElementById('txtFriend1').value = "Friend Email 1";
        }
    });
    
    $("#txtFriend2").focus(function() {
        if (document.getElementById('txtFriend2').value == "Friend Email 2") {
            document.getElementById('txtFriend2').value = "";
        }
    });
    $("#txtFriend2").blur(function() {
        if (document.getElementById('txtFriend2').value == "") {
            document.getElementById('txtFriend2').value = "Friend Email 2";
        }
    });
    
    $("#txtFriend3").focus(function() {
        if (document.getElementById('txtFriend3').value == "Friend Email 3") {
            document.getElementById('txtFriend3').value = "";
        }
    });
    $("#txtFriend3").blur(function() {
        if (document.getElementById('txtFriend3').value == "") {
            document.getElementById('txtFriend3').value = "Friend Email 3";
        }
    });
    
    $("#txtFriend4").focus(function() {
        if (document.getElementById('txtFriend4').value == "Friend Email 4") {
            document.getElementById('txtFriend4').value = "";
        }
    });
    $("#txtFriend4").blur(function() {
        if (document.getElementById('txtFriend4').value == "") {
            document.getElementById('txtFriend4').value = "Friend Email 4";
        }
    });
    
    $("#close").click(function() {
        $("#stf-container").hide(function() {
                $("#stf").css("left", "-0px");
            });
    });
    
    $("#send").click(function() {
        
        name = document.getElementById('txtName').value;
        email = document.getElementById('txtEmail').value;
        msg = document.getElementById('txtMsg').value;
        friend1 = document.getElementById('txtFriend1').value;
        friend2 = document.getElementById('txtFriend2').value;
        friend3 = document.getElementById('txtFriend3').value;
        friend4 = document.getElementById('txtFriend4').value;
        
        $.ajax({
                type: "POST",
				url: "send.php",
				dataType: "html",
				data: "name="+name+"&email="+email+"&msg="+msg+"&friend1="+friend1+"&friend2="+friend2+"&friend3="+friend3+"&friend4="+friend4,
				success: function (data) {
				    alert(data);
				}
            });
        
    });
});

function clear() {
    $("#lbl").attr("src", "images/lblwelcome.png");
    document.getElementById('flash').style.backgroundImage = "url(images/main.jpg)";
    document.getElementById('flash').innerHTML = '';
}