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 > 30 && w > 30)
        {
        	

            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);

            }

        }

    });

}


