﻿/*

M�todo que permite redimensionar uma imagem baseado nas dimens�es m�ximas permitidas.

*/

function resize(obj, width, height) {

// Obt�m a imagem a apresentar

var _thumb = new Image();

_thumb.src = obj.src;



if ((_thumb.width > width) || (_thumb.height > height)) {

// Verifica o formato da imagem

if (_thumb.width >= _thumb.height) {

obj.width = width;
obj.height=height;

} else {

obj.height = width;
obj.width = height;

}

}

}



/*

M�todo que configura a imagem a apresentar quando n�o for poss�vel descarregar a imagem do servidor.

*/

function preview(obj, size) {

obj.onerror = null;

switch (size) {

case "90,60":

obj.src = "/Images/noPic/noPic_90x60.jpg";

break;

case "140,105":

obj.src = "/Images/noPic/noPic_140x105.jpg";

break;

case "180,135":

obj.src = "/Images/noPic/noPic_180x135.jpg";

break;

case "200,150":

obj.src = "/Images/noPic/noPic_200x150.jpg";

break;

case "300,225":

obj.src = "/Images/noPic/noPic_300x225.jpg";

break;

case "500,375":

obj.src = "/Images/noPic/noPic_500x375.jpg";

break;

}

}