﻿function imgSize(fol,obj,w,h){
	var newImg = new Image();
	var imgw, imgh

	newImg.src = fol + obj;

	imgw = newImg.width;
	imgh = newImg.height;
	
	if(imgw > w) {
		hh = eval(imgh)/(eval(imgw)/eval(w))
		if (hh>h){
			document.boardimg.height = h;
		}else{
			document.boardimg.width = w;
		}
	}
	if(imgh > h) {
		ww = eval(imgw)/(eval(imgh)/eval(h))
		if (ww>w){
			document.boardimg.width = w;
		}else{
			document.boardimg.height = h;
		}
	}
}

function imgSize2(fol,obj,w,h,imgName){
	var newImg = new Image();
	var imgw, imgh

	newImg.src = fol + obj;

	imgw = newImg.width;
	imgh = newImg.height;
	
	if(imgw > imgh) document.all[imgName].width = w;
	else document.all[imgName].height = h;
}

function imgSize3(fol,obj,w,h,imgName){
	var newImg = new Image();
	var imgw, imgh

	newImg.src = fol + obj;

	imgw = newImg.width;
	imgh = newImg.height;
	
	if(imgw > w) {
		hh = eval(imgh)/(eval(imgw)/eval(w))
		if (hh>h){
			document.all[imgName].height = h;
		}else{
			document.all[imgName].width = w;
		}
	}
	if(imgh > h) {
		ww = eval(imgw)/(eval(imgh)/eval(h))
		if (ww>w){
			document.all[imgName].width = w;
		}else{
			document.all[imgName].height = h;
		}
	}
}

