var originalWidth;
var originalHeight;
var doResize;

function toggleImageResize(theIMG){
	
	if(Cookies['doResize']==1){
		document.cookie="doResize=0";
		Cookies['doResize']=0;
	}else{
		document.cookie="doResize=1";
		Cookies['doResize']=1;
	}
	imageResize(theIMG)
}
function imageResize(theIMG){
	if(!originalWidth) originalWidth=theIMG.width;
	if(!originalHeight) originalHeight=theIMG.height;
	if(theIMG && document.all && Cookies['doResize'] == 1){		
		var realWidth=document.body.clientWidth-200;
		var realHeight=originalHeight / originalWidth * realWidth;
		if(realHeight>document.body.clientHeight-70){
			realHeight=document.body.clientHeight-70;
			realWidth=originalWidth/originalHeight * realHeight;
		}
		//if(realHeight<=originalHeight && realWidth<=originalWidth){
			theIMG.height=realHeight;
			theIMG.width=realWidth;
		//}else{
			//theIMG.height=originalHeight;
			//theIMG.width=originalWidth;			
		//}
	}else if(theIMG && document.all){
		theIMG.height=originalHeight;
		theIMG.width=originalWidth;
	}
}