function imageAds() {
	if (!(adsshow <= adscounter)) {
		return;
	}
	var imageWidth = $('myImage').width;
	var imageHeight = $('myImage').height;
	
	if (imageWidth > imageMaxWidth || imageHeight > imageMaxHeight) {
		if (imageMaxWidth != 0) var div1 = imageMaxWidth / imageWidth;
		else var div1 = 1;
		if (imageMaxHeight != 0) var div2 = imageMaxHeight / imageHeight;
		else var div2 = 1;
					
		if (div1 < div2) {
			imageWidth = imageMaxWidth;
			imageHeight = Math.round(imageHeight * div1);
		}
		else {
			imageHeight = imageMaxHeight;
			imageWidth = Math.round(imageWidth * div2);
		}
	}
	if (imageWidth > 350 && imageHeight > 350) {
		$('adsimage').style.width = imageWidth+"px";
		$('adsimage').style.height = imageHeight+"px";
		$('adsimage').style.display = "block";
	}
}

function imageAdsClose() {
	window.setTimeout(imageAdsCloseX,500);
}

function imageAdsCloseX() {
	$('adsimage').style.display = "none";
}

window.setTimeout(imageAds,1000);