﻿function getImg(id,obj){
    obj.parentNode.parentNode.parentNode.childNodes[0].childNodes[0].childNodes[0].src="../"+document.getElementById("hid_"+id).value;
    
}


$(document).ready(function() {
    $(".imgItem").each(function(i, item) {
        $("img", item).each(function(ii, iitem) {
            iitem.index = ii;

            $(iitem).mouseover(function() {
                $(this).parent().parent().find("img").each(function() {
                    if (this.index == iitem.index) {
                        $(this).parent().addClass("on");
                    } else {
                        $(this).parent().removeClass("on");
                    }
                });
            }).click(function() {
                var picContainer = $("img", $(this).parent().parent().parent())[0]
                picContainer.src = "../" + $(this).parent().find("input")[0].value;
                if (picContainer.width >= this.height) {
                    picContainer.style.width = "320px";
                    this.style.height = "auto";
                } else {
                    picContainer.style.width = "auto";
                    picContainer.style.height = "175px";
                }
                picContainer.style.marginTop = (175 - picContainer.height) / 2 + "px";

            });
        });
    });

});