﻿
function AdjustWidth(objImg, iteration) {
	if (objImg.offsetWidth == 0) {
		if (iteration != null && iteration > 10)
			return;

		if (iteration == null)
			iteration = 0;
		else
			++iteration;

		setTimeout(function() { AdjustWidth(objImg, iteration) }, 1500);
		return;
	}

		
	if (objImg.offsetWidth > 220) {
		objImg.width = 220;
	}
	else {
		objImg.width = objImg.offsetWidth;
	}

	objContainer = objImg.parentNode.parentNode; //document.getElementById(containerId);
	objContainer.style.width = 220 + "px";
	if (objImg.height > 375) {
		objContainer.style.height = 375 + "px";
	}
	else {
		objContainer.style.height = objImg.height + "px";
	}
	objContainer.style.overflow = "hidden"
}

function OpenImageList(url, articleIdQueryName, articleId) {
    var specialSymbol = '';
    
    if (url.indexOf('?') == -1)
        specialSymbol = '?';
    else
        specialSymbol = '&';

    window.open(url + specialSymbol + articleIdQueryName + '=' + articleId, 'Bildspecial', 'width=844,height=692, left=20, top=20, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=No,copyhistory=no');
}         


