﻿function ShowAds()
{
	var div=document.getElementById('zim-img-ads');
	div.style.visibility = 'visible';
	div.style.display = 'block';
	div.style.top = FromTop() + ScreenHeight() - 72 + "px";
	div.style.left = ScreenWidth() - 140 + "px";
	
	div=document.getElementById('zim-txt-ads');
	div.style.visibility = 'visible';
	div.style.display = 'block';
	div.style.top = FromTop() + ScreenHeight() - 24 + "px";
	div.style.left = ScreenWidth() - div.offsetWidth - 140 + "px";
}

function HideAds()
{
	var div=document.getElementById('zim-img-ads');
	div.style.visibility = 'hidden';
	div.style.display = 'none';
	
	div=document.getElementById('zim-txt-ads');
	div.style.visibility = 'hidden';
	div.style.display = 'none';
}

function FromTop()
{
	var ScrollTop = document.body.scrollTop;
	if (ScrollTop == 0)
	{
	    if (window.pageYOffset)
	        ScrollTop = window.pageYOffset;
	    else
	        ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}
	return ScrollTop;
}

function ScreenWidth() {
	var result = 2000;

	if (window.innerWidth) {
		// all except Explorer
		result = parseInt(window.innerWidth);
	} else if (document.documentElement && document.documentElement.clientWidth) {
		// Explorer 6 Strict Mode
		result = parseInt(document.documentElement.clientWidth);
	} else if (document.body) {
		// other Explorers
		result = parseInt(document.body.clientWidth);
	}
	if (isNaN(result)) {
		result = 2000;
	}
	return result;
}

function ScreenHeight() {
	var result = 2000;

	if (window.innerHeight) {
		// all except Explorer
		result = parseInt(window.innerHeight);
	} else if (document.documentElement && document.documentElement.clientHeight) {
		// Explorer 6 Strict Mode
		result = parseInt(document.documentElement.clientHeight);
	} else if (document.body) {
		// other Explorers
		result = parseInt(document.body.clientHeight);
	}
	if (isNaN(result)) {
		result = 2000;
	}
	return result;
}
