//IMAGE RESIZING
confMaxDim = 350; // pixelben

function _resize(obj) {
	imgStaticWidth = obj.width;
	thisWidth = obj.width;
	thisHeight = obj.height;

	if(thisWidth > thisHeight) thisMaxDim = thisWidth;
	else thisMaxDim = thisHeight;

	if(thisMaxDim > confMaxDim) {
		thisMinDim = Math.round((((thisWidth > thisHeight)?thisHeight:thisWidth) * confMaxDim) / thisMaxDim);

		if(thisWidth > thisHeight) {
			thisWidth = confMaxDim;
			thisHeight = thisMinDim;
		} else {
			thisHeight = confMaxDim;
			thisWidth = thisMinDim;
		}
	} // if(thisMaxDim > confMaxDim)

	obj.height = thisHeight;
	obj.width = thisWidth;

	if(imgStaticWidth > confMaxDim){
		bottomPara = document.createElement('p');
		bottomPara.setAttribute('style', 'text-align: center;width:' + obj.width + 'px;');
		bottomPara.setAttribute('class', 'resizedImageLink');
		bottomPara.innerHTML = '<a href="'+ obj.src +'" rel="external">Kattints ide a teljes kép megtekintéséhez - Click here to view the picture in original size</a>';
		obj.parentNode.appendChild(bottomPara);
	}
}

