function img_resize(selector,x,y)

{

    $(selector).each(function() {

        var h = $(this).height();
        var w = $(this).width();
        //var ch = $(this).parent().parent().height();
        //var cw = $(this).parent().parent().width();


	ch=y;
	cw=x;

        if (h > 100 && w > 100 && w != 186 && h != 186)

        {

            if (h > w)

            {

                $(this).width(cw);

                w = cw;

                h = $(this).height();

                mtop = Math.round((h - ch) / 2);


                $(this).css('marginTop', -mtop);

            }

            else

            {

                $(this).height(ch);

                h = ch;

                w = $(this).width();

                mleft = Math.round((w - cw) / 2);

                $(this).css('marginLeft', -mleft);

            }

        }

    });

}


function img_resize2(selector,x,y)

{

    $(selector).each(function() {

        var h = $(this).height();
        var w = $(this).width();
        //var ch = $(this).parent().parent().height();
        //var cw = $(this).parent().parent().width();


	ch=y;
	cw=x;

        if (h > 40 && w > 40 && w != 186 && h != 186)

        {

            if (h > w)

            {

                $(this).width(cw);

                w = cw;

                h = $(this).height();

                mtop = Math.round((h - ch) / 2);


                $(this).css('marginTop', -mtop);

            }

            else

            {

                $(this).height(ch);

                h = ch;

                w = $(this).width();

                mleft = Math.round((w - cw) / 2);

                $(this).css('marginLeft', -mleft);

            }

        }

    });

}

