$(document).ready(function() {

    //WRITE THE HTML ON THE PAGE
    var htmlCopy;
    htmlCopy = "<div id='flashMessage'>";
    htmlCopy = htmlCopy + "<div id='alertIcon'><img src='/css/flashDetect/alertIcon.jpg' /></div>";
    htmlCopy = htmlCopy + "<div id='alertMessage'></div>";
    htmlCopy = htmlCopy + "<div id='alertClose'><img src='/css/flashDetect/alertClose.gif' /></div>";
    htmlCopy = htmlCopy + "<div id='dontAsk'><img src='/css/flashDetect/dontAsk_nor.gif'  style='display:none;' id='dontAskNoCheck'/><img src='/css/flashDetect/dontAsk.gif' id='dontAskCheck'/></div>";
    htmlCopy = htmlCopy + "</div>";

    //alert(htmlCopy);
    $('body').prepend(htmlCopy);
    
    hideAlert();

    //BEGIN FLASH DETECTION
    var flashVersion = swfobject.getFlashPlayerVersion();

    //Uncomment the following line to reset the cookie.  FOR TESTING ONLY
    //$.cookie('EQTRemind', 'true');  

    if ($.cookie('EQTRemind') == "true" || $.cookie('EQTRemind') == null) {
        //If the reminder cookie is true then proceed 
        //flashVersion.major = 7;
        //flashVersion.release = 10;
        if (flashVersion.major <= 9 && flashVersion.release < 155) {
            //If the Flash version is less than our specified version then proceed
            if (flashVersion.major == 0) {
                $("#flashMessage").slideDown("1000");
                $("#alertIcon").fadeIn("700");
                $("#alertMessage").html("THIS SITE IS ENHANCED USING ADOBE FLASH. WE HAVE DETECTED THAT YOU DO NOT HAVE THE ADOBE FLASH PLAYER INSTALLED. <a href='http://www.adobe.com/go/EN_US-H-GET-FLASH' target='_blank'>CLICK HERE TO INSTALL THE FLASH PLAYER</a>");
                //$("#alertMessage").html("<img src='/css/flashDetect/alertMessage.gif' border='0' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='533,0,711,7' href='http://www.adobe.com/go/EN_US-H-GET-FLASH' target='_blank' alt='Get Flash' /></map>");
                $("#alertMessage").fadeIn("700");
                $("#dontAsk").fadeIn("700");
                $("#alertClose").fadeIn("700");
            }
            else {
                //If there is no Flash then proceed  
                $("#flashMessage").slideDown("1000");
                $("#alertIcon").fadeIn("700");
                //Easiest way to detect what has been checked on the "Don't Ask Again" box.
                //$("#alertMessage").html("<img src='/css/flashDetect/alertMessageUpgrade.gif' border='0' usemap='#Map' /><map name='Map' id='Map'><area shape='rect' coords='458,0,665,7' href='http://www.adobe.com/go/EN_US-H-GET-FLASH' target='_blank' alt='Get Flash' /></map>");
                $("#alertMessage").html("THIS SITE IS ENHANCED USING ADOBE FLASH. WE HAVE DETECTED THAT YOU DO NOT HAVE THE LATEST ADOBE FLASH PLAYER INSTALLED. <a href='http://www.adobe.com/go/EN_US-H-GET-FLASH' target='_blank'>CLICK HERE TO INSTALL THE FLASH PLAYER</a>");
                $("#alertMessage").fadeIn("700");
                $("#dontAsk").fadeIn("700");
                $("#alertClose").fadeIn("700");
            }
        }
    }

    $("#dontAsk").click(function() {
        $("#dontAsk img").toggle();
    });

    $("#alertClose").click(function() {
        if ($("#dontAskNoCheck").css("display") == "block" || $("#dontAskNoCheck").css("display") == "inline") {
            $.cookie('EQTRemind', 'true');
        }
        if ($("#dontAskCheck").css("display") == "block" || $("#dontAskCheck").css("display") == "inline") {
            $.cookie('EQTRemind', 'false');
        }
        $("#flashMessage").slideUp("600");
    });


}); 
// END FLASH DETECTION  

function hideAlert(){
    $("#flashMessage").hide();
    $("#alertIcon").hide();    
    $("#alertMessage").hide();
    $("#dontAsk").hide();
    $("#alertClose").hide();
	
//	$("#flashMessage").show();
//	$("#alertIcon").show();    
//	$("#alertMessage").show();
//	$("#dontAsk").show();
//	$("#alertClose").show();
}     
