﻿$(document).ready(function() {
    chageTitle();
    bindDetails();
    $(".sideLeft").pngfix();
    $(".sideRight").pngfix();
    $("#infoDiv").show();
    showInfo();
});
function showInfo() {
    var info = $("#infoDiv");
    var btn = $(".div_title_btn:first");
    info.css("left", btn.offset().left + btn.width());
    info.css("top", btn.offset().top - 20);
    info.css("width", $("#info").width() + 33);
}
function chageTitle() {
    var self = $("[@mark]");
    self.each(function() {
        var objLength = $(this).text().length;
        if (objLength > 111) {
            $(this).addClass("div_title2");
        }
        else {
            $(this).addClass("div_title3");
        }
    })
};

function bindDetails() {
    $(".div_text").each(function() {
        $(this).css("display", "none");
    });
    $(".div_title_btn").find("a").each(function() {
        $(".div_text").each(function() {
            $(this).hide();
        });
        $(this).toggle(function() {
            $(this).find("img").each(function() {
                $("#info" + $(this).attr("id")).show("slow");
                $(this).attr("src", "img/arrowUp.png");
            });
            //$("#info" + $(this).find("img").attr("id")).show("slow");
            //$(this).find("img").attr("src", "img/arrowUp.png");
            $("#infoDiv").hide();
        }, function() {
            $(this).find("img").each(function() {
                $("#info" + $(this).attr("id")).hide("slow");
                $(this).attr("src", "img/arrowDown.png");
            });
            //$("#info" + $(this).find("img").attr("id")).hide("slow");
            //$(this).find("img").attr("src", "img/arrowDown.png");
            $("#infoDiv").show();
            showInfo();
        })
    });
};
$(window).resize(function() {
    showInfo();
});