//
// init
//
$(document).ready(function() {

    // preload idx photo to scroll-align within div to match thumb crop
    var imgIndex = new Image();
    $(imgIndex).load(function() {
        var iH = imgIndex.height;
        var iW = imgIndex.width;
        var iMinXY = Math.min(iW, iH);
        var iBoxW = $("#divIdxPhoto").width();
        if (iH > iW) {
            var iS = parseInt(((iH - iMinXY) * 0.25) * (iBoxW / iW));
            $("#divIdxPhoto").scrollTop(iS);
        }
    }).attr("src", $("#divIdxPhoto img").attr("src"));

    // idx photo colorbox
    if ($.fn.colorbox) {
        $("#divIdxPhoto a[href*='../media/pub/']").colorbox({ overlayClose: true, opacity: 0.7 });
    }

    // right-click = standard click
    $("#divIdxPhoto a").bind("contextmenu", function(e) {
        $(this).click();
        return false;
    });

    // format tables
    $("#tblStats td:empty").parent().hide();
    $("#tblIMs td:empty").parent().hide();
    $("#tblStats td:odd").css("text-align", "right");
    $("#tblIMs td:odd").css("text-align", "right");

});


//
// enote
//
function bcEnote(iMID, sSubj) {
    var sUrl = "../enotes/send_pop.aspx?tid=" + iMID + "&sj=" + escape(((sSubj != null) ? sSubj : "Saw your profile..."));
    return bcShowModal({ href: sUrl, innerWidth: 500, innerHeight: 500 });
}


//
// email
//
function bcEmail(iMID) {
    var sUrl = "../email/send_pop.aspx?tid=" + iMID + "&sj=Saw+your+profile...";
    return bcShowModal({ href: sUrl, innerWidth: 500, innerHeight: 500 });
}


//
// flirt
//
function bcFlirt(iMID, iFID) {
    var sUrl = "../citizens/flirt_pop.aspx?id=" + iMID + "&fid=" + iFID;
    return bcShowModal({ href: sUrl, innerWidth: 300, innerHeight: 270 });
}


//
// bcShowModal (in master.js)
//



