var xPos = 20;
var step = 6;
var delay = 50;
var yPos = 0;
var height = 0;
var offset = 0;
var yon = 0;
var open2 = 0;
var unit = 0;
var move=0

      NS = (document.layers) ? 1 : 0;
        IE = (document.all) ? 1: 0;
var FF = (document.getElementById && !document.all)? 1 : 0;


//        self.onError=null;

function getSize () {
	if (NS) {WinW= window.innerWidth;
	WinH= window.innerHeight;}
	else {WinW= parseInt(document.body.clientWidth);
	WinH= parseInt(document.body.clientHeight);
	}
	
	xPos=parseInt(WinW - 170 - offset - 15);
	yPos=offset
};
getSize();

function winOpen () {
forma= open("form.html","form","width=150,height=300,status=no,toolbar=no,menubar=0,screenX=150,screenY=300")
}


function getBlock () {
	if (NS) {block= document.layers;}
	else if (IE) {block= document.all}
};

getBlock ();


function showLay () {
	if (NS) {
		winOpen ();		
		block["point1"].visibility="hide"
		}
	else if (IE) {
		winOpen ();
		block("point1").style.visibility="hidden"
		}
};



function pageGo () {
if (IE) {
document.write('<div id="point1" STYLE="position:absolute;visibility:visible">');
document.write('<table border="0"><tr><td><div style="position:relative"><div style="position:absolute; z-index:10; top:3; left:3"><img src="http://www.tourua.com/close.gif" style="cursor:hand" onClick="close_banner()"></div>');
document.write('<div style="position:relative"><div style="position:absolute; z-index:9; top:0; left:0"><a href="http://avanta-travel.com.ua/" target=_blank><img border=0 name=image_set src="http://www.tourua.com/res/0.gif" width=150 height=300></a></div>');
document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write('CODEBASE="http://active.macromedia.com/flash2/cabs/swflash.cab#version=5,0,0,0"');
document.write('ID="flash_banner" WIDTH="150" HEIGHT="300">');
document.write('<PARAM NAME=movie VALUE="http://www.tourua.com/pic/banner/A.swf">');
document.write('<param name=scale value="noScale">');
document.write('<param name=salign value="TR">');
document.write('<PARAM NAME=quality VALUE=high><PARAM NAME=wmode VALUE=transparent>');
document.write('<PARAM NAME=bgcolor VALUE=#FEFEDD>');
document.write('<EMBED SRC="http://www.tourua.com/pic/banner/A.swf" QUALITY=high BGCOLOR=#FEFEDD WIDTH="150" HEIGHT="300"');
document.write('TYPE="application/x-shockwave-flash"');
document.write('PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
document.write('</EMBED>');
document.write('</OBJECT></div>');
document.write('</td></tr></table></div>');
}
else {
document.write("<layer name=\"point1\" position=\"absolute\" visibility=\"show\" z-index=\"10000\">");
document.write("<table border=0><tr><td><iframe width=10 height=10><font size=\"-2\" face=\"arial\"><a href=\"javascript:showLay();\"><img src=\"divnet.gif\" width=150 height=300 border=0></a></iframe></td></tr></table></layer>");
}
}

pageGo ();

if (IE) {
yPos = document.body.clientHeight;
point1.style.top = yPos;
}
else {
yPos = window.innerHeight;
document.layers["point1"].top = yPos;
document.layers["point1"].visibility = "show";
}

function changePos() {
if (yon == 0) {
yPos = yPos - step;
}
else {
yPos = yPos + step;
}
if (IE) {
height = document.body.clientHeight;
offset = point1.offsetHeight;
}
else {
height = window.innerHeight;
offset = document.point1.clip.height;
}
if (yPos < 0) {
yon = 1;
yPos = 0;

}
if (yPos >= (height - offset)) {
yon = 0;
move=0;
yPos = (height - offset);

}

if(yon==1 && yPos >= (height - offset)/3 && move==0){
move=1;
change_size(1);
}
//if(yon==1 && yPos >= (height - offset)*2/3 && move==1){
//if(yon==1 && yPos >= (height - offset)*2/3 && move==1){
//move=0;
//change_size(0);
//}
if (IE) {
point1.style.left = xPos;
point1.style.top = yPos + document.body.scrollTop;
}
else {
document.point1.pageX = xPos;
document.point1.pageY = yPos + window.pageYOffset;
   }
//open++;
//if(open==250){point_down.innerHTML="<img src=http://www.tourua.com/res/logo.png width=173 height=85 alt=TourUA.com border=0 align=left>";
//point_flash.innerHTML="<img src=http://www.tourua.com/res/logo.png width=173 height=85 alt=TourUA.com border=0 align=left>";
//};   
}
function init()
{
if (NS) {
document.point1.visibility = "visible";
}
loopfunc();
}
function loopfunc()
{
	if(WinW<=850){return false;};
changePos();
m=setTimeout('loopfunc()',delay);
}



// document.write('<div id=\"anketa\" STYLE=\"position:absolute; top: 0; left: 0; visibility: hidden; z-index: 1500;\">');
// document.write('<form><table border=0 cellpadding=10 width=300 bgcolor=\"#FF7837\">');
// document.write('<tr><td colspan=2><font size=\"+1\" face=\"arial\"><b>Заполните анкету, получите приз!</b></font></td></tr>');
// document.write('<tr><td><font size=\"-1\" face=\"arial\">Ваше имя:</font></td><td><font size=\"-1\" face=\"arial\"><input type=\"text\" size=\"15\"></font></td></tr>');
// document.write('<tr><td><font size=\"-1\" face=\"arial\">E-mail:</font></td><td><font size=\"-1\" face=\"arial\"><input type=\"text\" size=\"15\"></font></td></tr>');
// document.write('<tr><td><font size=\"-1\" face=\"arial\">Ваше имя:</font></td><td><font size=\"-1\" face=\"arial\"><input type=\"text\" size=\"15\"></font></td></tr>');
// document.write('<tr><td colspan=2><font size=\"-1\" face=\"arial\"><center><input type=\"submit\" value=\"отправить\" onSubmit=\"javascript:hideLay();\"></center></font></td></tr>');
// document.write('</table></form></div>');

init ();
function change_size(variable){
	
	if(variable == 0){
		window.document.flash_banner.height=300;
		window.document.image_set.height=300;
		step = 6;
		delay=50;
		unit=1;
		window.document.flash_banner.SetVariable("_root.vars","begin");
		//setTimeout('change_size(1)',3000);
		}
	if(variable == 1){
		window.document.flash_banner.height=300;
		window.document.image_set.height=300;
		step = 0;
		delay=45;
		unit=0;
		window.document.flash_banner.SetVariable("_root.vars","end");
		window.document.flash_banner.SetVariable("_root.vars","end");
		t=setTimeout('change_size(0)',10000);
		}	
	}
change_size(0);

function close_banner(){

		if (NS) {
		block["point1"].visibility="hide"
		}
	else if (IE) {
		block("point1").style.visibility="hidden"
		}
		clearTimeout(t);
		clearTimeout(m);
		point1.innerHTML="";
		step=0;
		delay=10000;
		
};


function closes(){

		if (NS) {
		block["point1"].visibility="hide"
		}
	else if (IE) {
		block("point1").style.visibility="hidden"
		}
		
		point1.innerHTML="";
		step=0;
		delay=10000;
		
};

if(WinW<=955){closes();};
