var MAX_IMAGE_WIDTH = 620;
function doResImg(){
	var imgsToRes = document.getElementsByClassName("linked-image",'img');
	var resdiv = document.createElement("div");
	resdiv.title = "Click to view full image";
	resdiv.style.padding = "1px";
	resdiv.style.cursor =  "pointer";
	resdiv.style.backgroundColor = "#000000";
	resdiv.style.border = "0px";
	resdiv.style.color = "#FFFFFF";
	resdiv.style.fontSize = "10px";
	resdiv.style.MozBorderRadiusTopleft = "7px";
	resdiv.style.MozBorderRadiusTopright = "7px";
	resdiv.style.borderTopRightRadius = "7px";
	resdiv.style.borderTopLeftRadius = "7px";
	resdiv.style.marginTop = "10px";
	var sHtml = '<img src="style_images/ip.boardpr/img-resized.png" style="vertical-align: middle;" alt="" border="0">';
	for(i=0;i<imgsToRes.length;i++){
		var tImg = imgsToRes[i];
		w = tImg.clientWidth;
		h = tImg.clientHeight;
		if(w>MAX_IMAGE_WIDTH){
			tImg.height = (h/w)*MAX_IMAGE_WIDTH;
			tImg.width = MAX_IMAGE_WIDTH;
			tImg.style.border = "1px solid black";
			tImg.style.marginBottom = "10px";
			var thisdiv = resdiv.cloneNode(true);
			thisdiv.innerHTML = sHtml + "Reduced: "+Math.round((MAX_IMAGE_WIDTH/w)*100)+"% of original size [ "+w+" x "+h+" ] - Click to view full image";
			thisdiv.style.width = MAX_IMAGE_WIDTH+"px";
			thisdiv._imgW = w;
			thisdiv._imgH = h;
			thisdiv._imgSrc = tImg.src;
			thisdiv.onclick = function(){ 
				window.open(this._imgSrc,'viewFullImg','width='+this._imgW+',height='+this._imgH+',location=no,status=no,menubar=no,directories=no,toolbar=no,resizable=yes,scrollbars=yes');
			};
			
			
			var p = tImg.parentNode;
			p.insertBefore(thisdiv,tImg);
		}	
	}
}
