function maxWidth(){
	if(navigator.appName == "Netscape")
		return window.innerWidth-55;
	return document.body.offsetWidth-55;
}
function scaleImg(){
	ref = document.getElementById('curImg');
	imgH = ref.height; 
	imgW = ref.width;
	if(fitsWin()) return;
	if(ref.width == maxWidth()){
		ref.width = imgW;
		ref.height = imgH;
	} else {
		ref.style.cursor = "pointer";
		ref.width = maxWidth();
		ref.height = (imgH/imgW) * ref.width;
	}
}
function setImgWidth(){
	if(fitsWin())return;
	document.getElementById('curImg').width = maxWidth();
}
function fitsWin(){
	ref = document.getElementById('curImg');
	var imgW = ref.width;
	if(imgW < maxWidth()){
		return true;
	} else {
		return false;
	}
}
function showImg(ref){
	ref = document.getElementById('curImg');
	if(imgW == ref.width) return scaleImg();
	else if (imgW > ref.width){
		ref.width = imgW;
		ref.height = imgH;
	}
}