
function fixHeight() {
    // Get browsers inner size
    var innerSize = getInnerSize();

    // Get footer properties
    var footer = document.getElementById("footer");
    var footerHeight = footer.offsetHeight;
    var footerTop = footer.offsetTop;

    // If footer is not align at bottom of page
    if (footerTop < (innerSize[0] - footerHeight)) {
        footer.style.position = "absolute";
        footer.style.top = (innerSize[0] - footerHeight) + "px";
    }

    // Show footer
    footer.style.visibility = "visible";
}

// Get the inner size of the browser window
function getInnerSize() {
    var winHeight;

    if (self.innerHeight) // all except Explorer
    {
        winHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
    {
        winHeight = document.documentElement.clientHeight;
    }
    else if (document.body) // other Explorers
    {
        winHeight = document.body.clientHeight;
    }

    //return [x,y];
    return [winHeight, 0];
}

function tagCloudHover(tag) { }

function tagCloudUnhover() { }

function loadEvents() {
    fixHeight();
    window.onresize = fixHeight;
}



  /// Create the JSON request , call backand deal with the results when we got em
        function search(q) {
            var requestStr = "http://api.search.live.net/json.aspx?"
            + "AppId=" + AppId
            + "&Query=" + q + "  site:" + Site
            + "&Sources=Web"
            + "&Version=2.1"
            + "&video.count=10"
            + "&Market=en-us"
            + "&Adult=Moderate"
            + "&JsonType=callback"
            + "&JsonCallback=?";
            $.getJSON(requestStr, function(response) {
                $("#results").empty();
                var results = response.SearchResponse.Web.Results;  
                if(response.SearchResponse.Web.Total > 0)
				{
                if (results.length > 0) $("#results").fadeIn("slow");
                for (var i = 0; i < results.length; i++) {
                    addToResults(results[i]);
                }
                }
                
            });
        }
        /// display the results
        function addToResults(result) {
            var container = $("#results");
            var row = "<a href=\""
                  + result.Url
                  + "\">"
                  + result.Title
                  + "</a>"
                  + "<p>"
                  + result.Description +
                  "</p>"
            var item = $("<div class='hit'>").html(row);
            container.append(item);
        }
