function smartRollover() {
    if (document.getElementsByTagName) {
        var images = document.getElementsByTagName("img");

        for (var i = 0; i < images.length; i++) {
            if (images[i].getAttribute("src").match("_off.")) {
                images[i].onmouseover = function () {
                    this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
                }
                images[i].onmouseout = function () {
                    this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
                }
            }
        }
    }
}

(function($) {
    $.fn.heightAdjust = function(row, child) {
        this.each(function(){
            var elems = $(child, this);
            var nelems = elems.length;
            var heights = new Array(nelems);
            var setHeight = function(){
                for (var i = 0; i < nelems; i++) {
                    elems[i].style.height = "";
                    heights[i] = $(elems[i]).height();
                }
                var max = 0;
                for (var i = 0; i < nelems; i++) {
                    if(0 == i % row){
                        max = Math.max.apply(Math, heights.slice(i, i + row));
                    }
                    heights[i] = max;
                }
                for (var i = 0; i < nelems; i++) {
                    elems[i].style.height = heights[i] + "px";
                }
            }
            setHeight();
            if($("#font-checker").length == 0){
                $("body").append('<div id="font-checker" style="position:absolute;left:-9999px;top:0;">&nbsp;</div>');
            }
            var baseSize = $("#font-checker").height();
            var checkSize = 0;
            setInterval(function() {
                checkSize = $("#font-checker").height();
                if(baseSize !== checkSize){
                    setHeight();
                    baseSize = checkSize;
                }
            }, 1000);
        });

    }
})(jQuery);

$(function () {
	smartRollover();
    $(".btn input[type='image']").hover(function () {
        $(this).attr('src', '/user_data/packages/sembikiya/img/under/cart_btn_on.gif');
    }, function () {
        $(this).attr('src', '/user_data/packages/sembikiya/img/under/cart_btn_off.gif');
    });
	$("tr:nth-child(2n+1)", "table.company-profile").addClass("odd");
	$("#menu-example").heightAdjust(6, "li");

    $("a[rel='popup-01']").click(function(){
        window.open(this.href, 'popup', 'width=500, height=600, scrollbars=yes');
        return false;
    });

    $("a[rel='popup-02']").click(function(){
        window.open(this.href, 'popup', 'width=740, height=600, scrollbars=yes');
        return false;
    });

    $("a[rel='popup-03']").click(function(){
        window.open(this.href, 'popup', 'width=600, height=600, scrollbars=yes');
        return false;
    });
});



