/*
jQuery(document).ready(function(){
    bcount=0;
    jQuery(".image_with_border").each(function(){
        bcount++;
        var image_border = document.createElement("div");
        image_border.id="the_border_"+bcount;
        //image_border = document.createElement('</div>');
        document.body.appendChild(image_border);
        var offset;
        offset = jQuery(this).offset();
        jQuery("#the_border_"+bcount).css({
            "position":"absolute",
            "left":offset.left-6,
            "top":offset.top-6,
            "width":jQuery(this).attr("width")+12,
            "height":jQuery(this).attr("height")+12
        });
        jQuery("#the_border_"+bcount).html('<div style="width: 100%; height: 100%; position: relative;"><div style="position: absolute; left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(template/r_left_top.png);"></div><div style="position: absolute; left: 0px; bottom: 0px; width: 12px; height: 12px; background-image: url(template/r_left_bottom.png);"></div><div style="position: absolute; right: 0px; top: 0px; width: 12px; height: 12px; background-image: url(template/r_right_top.png);"></div><div style="position: absolute; right: 0px; bottom: 0px; width: 12px; height: 12px; background-image: url(template/r_right_bottom.png);"></div><div style="position: absolute; top: 12px; bottom: 12px; width: 6px; left: 0px; background-image: url(template/r_left.png);"></div><div style="position: absolute; top: 12px; bottom: 12px; width: 6px; right: 0px; background-image: url(template/r_right.png);"></div><div style="position: absolute; top: 0px; left: 12px; height: 6px; right: 12px; background-image: url(template/r_top.png);"></div><div style="position: absolute; bottom: 0px; left: 12px; height: 6px; right: 12px; background-image: url(template/r_bottom.png);"></div></div>');
    });
});
*/

jQuery(".image_with_border").load(function() {
    bcount=0;
    jQuery(".image_with_border").each(function() {
        bcount++;
        var image_border = document.createElement("div");
        image_border.id="the_border_"+bcount;
        //image_border = document.createElement('</div>');
        document.body.appendChild(image_border);
        var offset;
        offset = jQuery(this).offset();
        jQuery("#the_border_"+bcount).css({
            "position":"absolute",
            "left":offset.left-6,
            "top":offset.top-6,
            "width":jQuery(this).attr("width")+12,
            "height":jQuery(this).attr("height")+12
        });
        jQuery("#the_border_"+bcount).html('<div style="width: 100%; height: 100%; position: relative;"><div style="position: absolute; left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(template/r_left_top.png);"></div><div style="position: absolute; left: 0px; bottom: 0px; width: 12px; height: 12px; background-image: url(template/r_left_bottom.png);"></div><div style="position: absolute; right: 0px; top: 0px; width: 12px; height: 12px; background-image: url(template/r_right_top.png);"></div><div style="position: absolute; right: 0px; bottom: 0px; width: 12px; height: 12px; background-image: url(template/r_right_bottom.png);"></div><div style="position: absolute; top: 12px; bottom: 12px; width: 6px; left: 0px; background-image: url(template/r_left.png);"></div><div style="position: absolute; top: 12px; bottom: 12px; width: 6px; right: 0px; background-image: url(template/r_right.png);"></div><div style="position: absolute; top: 0px; left: 12px; height: 6px; right: 12px; background-image: url(template/r_top.png);"></div><div style="position: absolute; bottom: 0px; left: 12px; height: 6px; right: 12px; background-image: url(template/r_bottom.png);"></div></div>');

    });
});
