// JavaScript Document

var subAlpha=new Array();
var thumbAlpha=new Array();

function checkFrame() {
	if (document.location==top.location) top.location='site.php';
}

function setAlpha(id,a) {
	if (a>99) a=99;
	t=document.getElementById(id);
	if (t) {
		t.style.filter = 'alpha(opacity='+a+')';
		t.style.opacity = a/100;
	}
}

function fadein(i) {
	subAlpha[i]=subAlpha[i]+2;
	if (subAlpha[i]>100) subAlpha[i]=100;
	setAlpha("sub_"+i,subAlpha[i]);
	if (subAlpha[i]<100) {
		setTimeout("fadein("+i+")",10);
	}
}
function fadeinT(i) {
	thumbAlpha[i]=thumbAlpha[i]+2;
	if (thumbAlpha[i]>100) thumbAlpha[i]=100;
	setAlpha("thumb_"+i,thumbAlpha[i]);
	if (thumbAlpha[i]<70) {
		setTimeout("fadeinT("+i+")",10);
	}
}

function startSub(t) {
	for (i=1; i<=t; i++) {
		subAlpha[i]=0;
		setAlpha("sub_"+i,subAlpha[i]);
		setTimeout("fadein("+i+")",80*i);
	}
}
function startThumb(t,s) {
	if (s=='') s=0; else s=100;
	for (i=1; i<=t; i++) {
		thumbAlpha[i]=s;
		setAlpha("thumb_"+i,thumbAlpha[i]);
		setTimeout("fadeinT("+i+")",80*i);
	}
}

function mover(i,txt) {
	document.getElementById('ballon').style.display='';
	document.getElementById('ttText').value=txt;
	setAlpha("thumb_"+i,100);
}
function mout(i) {
	document.getElementById('ballon').style.display='none';
	setAlpha("thumb_"+i,70);
}

function menu(id) {
	if (id=='') id='menu';
	t=document.getElementById("mainmenu");
	t.src='menu/'+id+'.gif';
}

var theEvent;

function ballon(evt) {
	x = evt.clientX;
	y = evt.clientY;
	t=document.getElementById('ballon');
	t.top=y;
	t.left=x;
	setTimeout("ballon(event)",5000);
}

function ballon2(evt) {
	theEvent=evt;
	setTimeout("ballon2(evt)",50);
}

// Simple follow the mouse script

var divName = 'ballon';
var offX = 4;
var offY = 10;

function mouseX(evt) {if (!evt) evt = window.event; if (evt.pageX) return evt.pageX; else if (evt.clientX)return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); else return 0;}
function mouseY(evt) {if (!evt) evt = window.event; if (evt.pageY) return evt.pageY; else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop); else return 0;}

function follow(evt) {if (document.getElementById) {var obj = document.getElementById(divName).style; 
obj.left = (parseInt(mouseX(evt))+offX) + 'px';
obj.top = (parseInt(mouseY(evt))+offY) + 'px';}}
//document.onmousemove = follow;
