function adWidgetCheckHeight() {
	var thisElem = $(this);
	if(!thisElem.hasClass('advertisement')) {
		thisElem = $('.widget.advertisement');
	}
	if(thisElem.length > 1) {
		thisElem.each(function() {
			var useThisElem = $(this);
			if(useThisElem.height() > 0) {
				useThisElem.css('margin-bottom', '10px');
			} else {
				useThisElem.css('margin-bottom', '0');
			}
		});
	} else {
		if(thisElem.height() > 0) {
			thisElem.css('margin-bottom', '10px');
		} else {
			thisElem.css('margin-bottom', '0');
		}
	}
}

$(document).ready(function() {
	var useElems = $('.widget.advertisement');
	adWidgetCheckHeight(useElems);
	useElems.resize(adWidgetCheckHeight);
});
