if(!mb_image_max_width) {
	var mb_image_max_width = 516;
}

mb_resizeLinkedImages = function() {

	var images = new Array();
	images = document.getElementsByTagName('img');

	for(var i = 0; i < images.length; i++) {
		
		if(images[i].className == 'bbc_url' || images[i].className == 'bbc_img') {
			
			var w = images[i].width;
			var h = images[i].height;
			
			if(w > mb_image_max_width) {
				
				//
				images[i].width = mb_image_max_width;
				images[i].setAttribute('style', 'cursor:pointer;');

				// 
				if(images[i].parentNode.nodeName != 'A') {
					images[i].setAttribute('onClick', "mb_showFullImage('"+images[i].src+"',"+(w+10)+","+(h+10)+")");
				}
			}
		}
	}
	
}

mb_showFullImage = function(url, w, h) {

	if(w > screen.availWidth) {
		w = screen.availWidth - 20;
	}
	
	if(h > screen.availHeight) {
		h = screen.availHeight - 20;
	}

	var posX=((screen.availWidth / 2) - w / 2);
	var posY=((screen.availHeight / 2) - h / 2);

	var popup = window.open(url,'maximized_mb_image','toolbar=,location=,directories=,status=,menubar=,scrollbars=auto,resizable=auto,fullscreen=,width='+w+',height='+h+',top='+posY+',left='+posX);   

	popup.resizeTo(w,h);
	popup.moveTo(posX,posY);
	
	if(parseInt(navigator.appVersion) >= 4){popup.window.focus();}
	else {popup.focus();}
}

window.onload = mb_resizeLinkedImages;