$(document).ready(function() {

    var flashvars = {};
    var params = {};
    //params.wmode = "transparent";
    params.scale = "noScale";
    params.align = "center";

    var attributes = {};
    attributes.id = "flashContainer";
    attributes.name = "flashContainer";
    
    var rndm = Math.floor(Math.random()*9999999999);
    while (String(rndm).length < 10) {
        rndm = '0' + rndm;
    }
    //swfobject.embedSWF("/flash/header.swf?random="+rndm, "flashContainer", "100%", "258", "9.0.0","/expressInstall.swf", flashvars, params, attributes);
    swfobject.embedSWF("/flash/header.swf", "flashContainer", "100%", "258", "9.0.0","/expressInstall.swf", flashvars, params, attributes);

    $("#searchMod label").each(function (i) {
        $(this).next().find("input").attr("value",$(this).html()+"...");
        $(this).hide();
    });
    
    $("#searchMod input").focus(function() {
        if($(this).parent().prev("label").html()+"..." == this.value){
            this.value = "";
        }
    });
    
    $("#searchMod input").blur(function() {
        if(this.value == ""){
            this.value = $(this).parent().prev("label").html()+"...";
        }
    });
    
    $("#updates-signup").validate();
    $("#contactForm form").validate();
    
    $('#embed_code').focus(function() {
        //alert('embed download');
        //var entryID = $("#entryID").val();
       // $.post("/_api/_addDownload/", { entry_id: entryID } );
        // Check for the change
        if(this.value == this.defaultValue){
            this.select();
        }
    });    
    
    //$('a[@href*=#]').click(function() {
    $('a.btt_link').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
        var $target = $(this.hash);
        $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
        if ($target.length) {
            var targetOffset = $target.offset().top;
            $('html,body').animate({scrollTop: targetOffset}, 750);
            return false;
        }
    }
    });    
    

});
