﻿/// <reference path="~/desktopmodules/intevista/js/jquery-1.3.2.min.vsdoc.js"/>

$(window).load(function () {
    $(".iv_left a img").each(function () {
        var l = $(this).closest(".iv_left");
        var r = l.siblings(".iv_right");
        r.css("margin-left", "180px");
    });
});

$(document).ready(function() {

    $("abbr.timeago").timeago();

    $(".iv_public_listings_index .iv_items").each(function() {
        var item = $(this);
        var img = item.find(".iv_right .iv_header img");
        img.qtip({ content: { url: "/desktopmodules/intevista/public/listings/social.aspx", data: { listingkey: img.attr("key")} }, position: { adjust: { screen: true }, corner: { target: "rightTop"} }, show: { when: "click", solo: true }, hide: "unfocus", style: { width: { min: 100 }, border: { width: 1, radius: 5}} });
    });

    $("div[published=false]").closest("div.iv_right").find("div.iv_header").prepend("<img src='/desktopmodules/intevista/img/icons/exclamation.png' />");


    $("a[defaulttabid=0]").attr("href", "javascript:void(0);");
    $(".iv_buttons .iv_details[defaulttabid!=0]").click(function() { window.location = $(this).attr("href"); });
    $(".iv_buttons .iv_action_enabled").click(function() { window.open($(this).attr("href")); });
    $(".iv_buttons .iv_schedule").siblings(".iv_action_enabled, .iv_action_disabled").hide();

    $(".iv_buttons .iv_schedule").click(function(e) {
        var oCalendar = $(this).closest(".iv_items").next();
        if ($(this).hasClass("calendarvisible"))
            oCalendar.hide();
        else {
            oCalendar.show();
            oCalendar.find("div:first").fullCalendar("render");
        }

        $(this).toggleClass("calendarvisible");
        return false;
    });


});