// configuration
StartDelay		= 22;			// seconds
MotionDelay		= 0.001;		// seconds
CloseDelay		= 10;			// seconds
//PopUpURL		= 'http://www.smsina.ru/';

rnd = Math.round(Math.random() * 100);
if (rnd < 20) {
	PopUpURL		= 'http://top.fone.ru/';
} else if (rnd < 40) {
	PopUpURL		= 'http://partner.flirts.ru/link.phtml?pid=26150240&lid=1460';
} else if (rnd > 60) {
	PopUpURL		= 'http://3gp.smsina.ru/';
} else if (rnd > 80) {
	PopUpURL		= 'http://www.bend.ru/';
} else {
	PopUpURL		= 'http://www.smsina.ru/';
}

VerticalStep	= 3;
HorisontalStep	= 4;
StopWidth		= 253;
HorisontalTab	= 50;
VerticalTab		= 65;
// functions
function Init() {
	document.getElementById('PopUpFrame').src = PopUpURL;
	document.getElementById('PopUpDiv').style.top = document.body.offsetHeight / 2;
	document.getElementById('PopUpDiv').style.left = document.body.offsetWidth / 2;
	document.getElementById('PopUpDiv').style.display = 'block';
	document.getElementById('PopUpFrame').style.border = 'solid 1px #D15814';
	StartGrow();
}
function ClosePopUp() {
	document.getElementById('PopUpDiv').style.display = 'none';
	clearTimeout(GrowTimeOut);
}
function StartGrow() {
	if (document.body.offsetWidth > 0) {
		dw = parseInt(document.getElementById('PopUpFrame').width);
		dh = parseInt(document.getElementById('PopUpFrame').height);
		if (dw < document.body.offsetWidth - HorisontalTab || dh < document.body.offsetHeight - VerticalTab) {
			if (dw < document.body.offsetWidth - HorisontalTab) {
				document.getElementById('PopUpFrame').width = dw + HorisontalStep;
				document.getElementById('PopUpDiv').style.left = (document.body.offsetWidth - dw + (HorisontalStep / 2)) / 2;
			}
			if (dh < document.body.offsetHeight - VerticalTab) {
				document.getElementById('PopUpFrame').height = dh + VerticalStep;
				document.getElementById('PopUpDiv').style.top = (document.body.offsetHeight - dh + (VerticalStep / 2)) / 2;
			}
			if (dw == StopWidth) {
				timeout = CloseDelay * 1000;
				document.getElementById('PopUpDivClose').style.display = 'block';
			} else {
				timeout = MotionDelay * 1000;
			}
			GrowTimeOut = setTimeout('StartGrow()', timeout);
		} else {
			document.location.href = PopUpURL;
		}
	}
}
document.onload = setTimeout('Init();', StartDelay * 1000);
str = '<div id="PopUpDiv" style="position: absolute; display: none; top: 0; left: 0;">';
str += '<iframe id="PopUpFrame" frameborder="0" scrolling="No" width="1" height="1" src="about:blank"></iframe>';
str += '<div id="PopUpDivClose" style="display: none; text-align: right; font-family: verdana, arial, sans-serif; font-size: 11px; background-color: #ffffff;"><b>[<a href="#" onclick="ClosePopUp(); return false;" style="color:#cc0000;">закрыть</a>]</b></div>';
str += '</div>';
document.write(str);
