function setOriginalSize(w, h, ex, mw){picWidth = w;picHeight = h;extra = ex;minwidth = mw}

function scaleImg(){
	var img = document.getElementById("image");
	if (pictureFits()){
		img.style.cursor = "default";
		img.width = picWidth;
		img.height = picHeight;
		return;}
	if (img.width == resizeWidth()){ 
		img.style.cursor = "pointer";
		img.width = picWidth;
		img.height = picHeight;}
	else{
		img.style.cursor = "pointer";
		img.width = resizeWidth();
		img.height = picHeight * resizeWidth()/picWidth;}
}

function doResize(){
	var img = document.getElementById('image');	
	if (resizeWidth() < picWidth && resizeWidth() > minwidth){
		img.style.cursor = "pointer";
		img.width = resizeWidth();
		img.height = picHeight * img.width/picWidth;}
	else if (resizeWidth < minwidth || resizeWidth() == minwidth){
		img.style.cursor = "pointer";
		img.width = minwidth;
		img.height = picHeight * img.width/picWidth;}
	else{
		img.style.cursor = "default";
		img.width = picWidth;
		img.height = picHeight;}
}

function pictureFits(){return picWidth < resizeWidth();}

function resizeWidth(){
	var win;
	if (navigator.appName == "Netscape") win = window.innerWidth - 15;
	else win = document.body.offsetWidth;
	return win - extra}

onresize = doResize;