﻿/// <reference name="MicrosoftAjax.js"/>
/// <reference path="jquery-1.3.2-vsdoc.js" />


// Static framework functionality
var 
    Framework = new Object(),
    GoogleAnalyticsCategories =
    {
        search :
        {
            name : "Search",
            actions :
            {
                suggest : "Suggest search",
                normal : "Normal search"
            }
        }
    };

Framework.notifyRecognitionClick = function(recognitionId, weight)
{
    $.ajax
    (
        {
            type : 'POST',
            url : '/Support/IncreaseRecognitionPopularity',
            data : ({ 'recognitionId' : recognitionId, 'weight' : weight ? weight : 1 })
        }
    );
};



jQuery.scheduleMethodInvocation = function(context, methodName, milliSeconds)
{
    jQuery.abortMethodInvocation(context);
    
    var invocationArguments = '';
    
    if (arguments.length > 3)
    {
        for (var i = 3; i < arguments.length; i++)
        {
            invocationArguments += (typeof(arguments[i]) == 'string' ? "'" + arguments[i] + "'" : arguments[i].toString()) + ",";
        }
        
        if (invocationArguments.endsWith(","))
        {
            invocationArguments = invocationArguments.substr(0, invocationArguments.length - 1);
        }
    }
    
    context.timeoutID = window.setTimeout(String.format("{0}({1})", methodName, invocationArguments), milliSeconds);
};

jQuery.abortMethodInvocation = function(context)
{
    if (context.timeoutID)
    {
        window.clearTimeout(context.timeoutID);
    }
};



// jQuery extensions
(function($) {
    $.fn.initialText = function(text)
    {
        this.each(function() {
            if (this.value == "")
            {
                this.value = text;
            }
        });
        this.blur(function(e) {
            if (this.value == "")
            {
                this.value = text;
            }
        });
        this.focus(function(e) {
            if (this.value == text)
            {
                this.value = "";
            }
        });

        return this;
    };
})(jQuery);

    $(document).ready(function() {
         $(window).scroll(function () {
          if( $(window).scrollTop() > 100){     
                $('#scroll-div').addClass('fixed-class').removeClass('absolute-class')
          }else{
                $('#scroll-div').addClass('absolute-class').removeClass('fixed-class')
          }

    });
});
