

function ImgLoadError_tv(obj)
{
	//alert(obj.width);
	//alert(obj.height);
	//alert(obj.ImgIndex);
	//alert(obj.id);
	obj.src = "http://tv.co.kr/image/movie/review/Noimage.gif";
}

function ImgLoadError_widetv(obj)
{
	//alert(obj.width);
	//alert(obj.height);
	//alert(obj.ImgIndex);
	//alert(obj.id);
	obj.src = "http://tv.co.kr/drama/list/images/noimg130.gif";
}


function ImgLoadError(obj)
{
	//alert(obj.width);
	//alert(obj.height);
	//alert(obj.ImgIndex);
	//alert(obj.id);
	obj.src = "http://tv.co.kr/image/movie/review/Noimage.gif";
}

function ImgLoadError2(obj)
{
	//alert(obj.width);
	//alert(obj.height);
	//alert(obj.ImgIndex);
	//alert(obj.id);
	obj.src = "http://tv.co.kr/image/board/noImage_100.gif";
}


function imageSetSize(target_img,maxWidth,maxHeight,standard){

	var newHeight, newWidth, standard;
	var newImg;

	newImg = new Image();
	newImg.src = target_img.src;
	imgw = newImg.width;
	imgh = newImg.height;

	if (imgw < 5) {
		newWidth = 60;
		newHeight = 70;
	} else {
		switch (standard) {
			case "width":
				if (imgw > maxWidth)
				{
				    newWidth = maxWidth;
				    newHeight = Math.round((imgh*newWidth)/imgw);
				}
				else
				{
				    newWidth = imgw;
				    newHeight = imgh;
				}
				break;

			case "height":
				if (imgh > maxHeight)
				{
				    newHeight = maxHeight;
				    newWidth = Math.round((imgw*newHeight)/imgh);
				}
				else
				{
				    newWidth = imgw;
				    newHeight = imgh;
				}

				break;

			case "both":

				if (imgw > maxWidth || imgh > maxHeight)
				{
				    if(imgw > imgh)
				    {
				        if(imgw > maxWidth)
				            newWidth = maxWidth;
				        else
				            newWidth = imgw;
				        newHeight = Math.round((imgh*newWidth)/imgw);
				    }
				    else
				    {
				        if(imgh > maxHeight)
				            newHeight = maxHeight;
				        else
				            newHeight = imgh;
				        newWidth = Math.round((imgw*newHeight)/imgh);
				    }
				}
				break;

		}
	}

	target_img.onload = null;
	target_img.src = newImg.src;
   	target_img.width = newWidth;
    target_img.height = newHeight;
}
