/*
*************************************************************************
* 
* CAPTUAL TECHNOLOGIES CONFIDENTIAL
* _________________________________
* 
*  2008 - 2011 Captual Technologies Inc. 
*  All Rights Reserved.
* 
* NOTICE:  All information contained herein is, and remains
* the property of Captual Technologies Incorporated and its suppliers,
* if any.  Dissemination of this information or reproduction of this 
* material is strictly forbidden unless prior written permission is 
* obtained from Captual Technologies Incorporated.
*
*************************************************************************
*/

/// <reference path="~/Content/js/lib/jquery/jquery.min.js" />

$(document).ready(function () {
    $(".login_button").click(function () {
        $(".c_login .lightbox .floating_window").showFloater(0.8, true);
        $(".c_login .lightbox .floating_window #login_username").focus();
    });

    $(".join_button").click(function () {
        $(".c_join .lightbox .floating_window").showFloater(0.8, true);
        $(".c_join .lightbox .floating_window #user\\.Email").focus();
    });

    if (!$.browser.msie || $.browser.msie && $.browser.version > 6) {
        $(".rounded_topmenuarea").corner({ tr: false, tl: false, br: false });
        $(".emphasis_button").corner({ tr: false, tl: false, br: false });
    }

    $(".search_field").autocomplete({
        source: siteRoot + "/" + communityId + "/Ajax/Search.aspx",
        select: function (event, ui) {
            location.href = StringFormat("{0}/{1}/watch/{2}.aspx", siteRoot, communityId, ui.item.id);
        }
    });
});

function formatItem(row) {
    // 0: Name, 1: Type, 2: Id, 3: First In Set (true/false)
    var type = "";
    if (row[3] == "true") type = row[1];
    return $("<div class='ac_result_container'><div class='ac_result_container'><div class='ac_identifier'>" + type + "</div><div class='ac_val'>" + row[0] + "</div></div></div>").html();
}

function formatResult(row) {
    return row[0];
}
