// JavaScript Document
var f=1, i=0, m=1, fImage, bImage, cnt, obj2, time, word, scrollplace=0, aButton;
var images=new Array(10);
var pagesLenght=new Array(16);
var pageColors=new Array(16);
pagesLenght[0]=11;
pagesLenght[1]=9;
pagesLenght[2]=8;
pagesLenght[3]=6;
pagesLenght[4]=9;
pagesLenght[5]=2;
pagesLenght[6]=10;
pagesLenght[7]=32;
pagesLenght[8]=8;
pagesLenght[9]=9;
pageColors[0]="#49bfee";
pageColors[1]="#4596b9";
pageColors[2]="#5c70b5";
pageColors[3]="#7d7ebb";
pageColors[4]="#64499a";
pageColors[5]="#9f509b";
pageColors[6]="#c9569c";
pageColors[7]="#a13785";
pageColors[8]="#a3c73b";
function getX(object) {
	var x=0;
	while (object) {
		x+=object.offsetLeft;
		object=object.offsetParent;
	}
	return x;
}

function getY(object) {
	var y=0;
	while (object) {
		y+=object.offsetTop;
		object=object.offsetParent;
	}
	return y;
}

function Hscroll() {
	if (navigator.appName == "Microsoft Internet Explorer") {
		document.getElementById('block').style.top=document.body.scrollTop+"px";
		blk=document.getElementById('block');
		blk.style.position="absolute";
	}
}

function init(p) {
	aButton=p;
	document.getElementById("menuItem"+aButton).style.background="url(images/menu"+lng+"/color"+aButton+"R.png) no-repeat center top";
	if (p == 1) {
		document.body.style.backgroundColor="#fbe1d8";
	}
	if (p == 2) {
		document.body.style.backgroundColor="#f0dfe5";
	}
	if (p == 3) {
		document.body.style.backgroundColor="#cee8dc";
	}
	if (p == 4) {
		document.body.style.backgroundColor="#d5ede3";
	}
	if (p == 5) {
		document.body.style.backgroundColor="#f4c2c1";
	}
	if (p == 6) {
		document.body.style.backgroundColor="#eaf9ff";
		document.getElementById('area').style.background="url(images/tranparent1.png)";
	}
	if (p == 7) {
		document.body.style.backgroundColor="#cadbe2";
		document.getElementById('area').style.background="url(images/tranparent2.png)";
	}
	if (p == 8) {
		document.body.style.backgroundColor="#ced0d8";
		document.getElementById('area').style.background="url(images/tranparent3.png)";
	}
	if (p == 9) {
		document.body.style.backgroundColor="#dbdbe7";
		document.getElementById('area').style.background="url(images/tranparent4.png)";
	}
	if (p == 10) {
		document.body.style.backgroundColor="#cec7dc";
		document.getElementById('area').style.background="url(images/tranparent5.png)";
	}
	if (p == 11) {
		document.body.style.backgroundColor="#ddc0dc";
		document.getElementById('area').style.background="url(images/tranparent6.png)";
	}
	if (p == 12) {
		document.body.style.backgroundColor="#f8d2e9";
		document.getElementById('area').style.background="url(images/tranparent7.png)";
	}
	if (p == 13) {
		document.body.style.backgroundColor="#d7b4ce";
		document.getElementById('area').style.background="url(images/tranparent8.png)";
	}
	if (p == 14) {
		document.body.style.backgroundColor="#f0ffc6";
		document.getElementById('area').style.background="url(images/tranparent9.png)";
	}
	if (p == 15)
		document.body.style.backgroundColor="#f2f3bf";
	if (p == 16)
		document.body.style.backgroundColor="#fad5c1";
	if (p == 17)
		document.body.style.backgroundColor="#f4f1d3";
	if (p == 18)
		document.body.style.backgroundColor="#fbe1d8";
	if (p==19 || p==21)
		document.body.style.backgroundColor="#f9ecd8";
	document.getElementById('flags').style.left=getX(document.getElementById('headFront'))+178;
	BOTTOM=document.getElementById('bottom');
	BOTTOM2=document.getElementById('bottomSpace');
	var b1=getY(BOTTOM);
	var B1=getY(BOTTOM2);
	BOTTOM.style.position='fixed';
	BOTTOM.style.bottom='0px';
	var b2=getY(BOTTOM);
	var b3=b2-b1;
	if (b3 > 0) {
		BOTTOM.style.position='absolute';
		BOTTOM.style.top=b1+b3+'px';
		BOTTOM2.style.position='absolute';
		BOTTOM2.style.top=B1+b3+'px';
	}
	else
		BOTTOM.style.position='relative';
}

function animate() {
	cnt++;
	cnt=cnt%9;
	bImage=cnt;
	fImage=bImage-1;
	if (fImage == -1)
		fImage=8;
	for (i=1; i<=100; ++i) {
		setTimeout("document.getElementById('headFront').style.opacity=(1-0.01*m); m++;", i*10);
		setTimeout("document.getElementById('headFront').style.filter='alpha(opacity='+(100-m)+')'; m++;", i*10);
	}
	setTimeout("document.getElementById('headFront').style.background=images[fImage]; m=1;", 1000);
	setTimeout("document.getElementById('headBack').style.background=images[bImage];", 1000);
	setTimeout("document.getElementById('headFront').style.opacity=1;", 1000);
	setTimeout("document.getElementById('headFront').style.filter='alpha(opacity=100)';", 1000);
	setTimeout("animate();", 2500);
}

function set(param) {
	var param2;
	if (param < 10)
		param2="0"+param;
	else
		param2=param;
	document.getElementById('current').style.background="url(images/head"+lng+"/head"+param2+".png)";
	document.getElementById('current').style.left=getX(document.getElementById('headFront'));
	document.getElementById('current').style.display='inline';
}

function unset() {
	document.getElementById('current').style.display='none';
}

function menuShow(param) {
	document.getElementById("menuItem"+param).style.background="url(images/menu"+lng+"/color"+param+"H.png) no-repeat center top";
}

function menuHide(param) {
	if (param != aButton)
		document.getElementById("menuItem"+param).style.background="url(images/menu"+lng+"/color"+param+".png) no-repeat center top";
	else
		document.getElementById("menuItem"+param).style.background="url(images/menu"+lng+"/color"+param+"R.png) no-repeat center top";
}

function dropDownAction() {
	++time;
	obj2.style.height=time+"px";
	if (time < 25)
		setTimeout("dropDownAction()", 3);
}

function dropDown(param) {
	var obj=document.getElementById("MenuList"+param);
	obj.style.background="url(images/menuBig/"+cntPage+"/H"+param+".png)";
	obj2=document.getElementById("menuDrop"+param);
	var X=obj.offsetLeft;
	var Y=obj.offsetTop;
	Y+=170;
	obj2.style.display="inline";
	obj2.style.top=Y+"px";
	obj2.style.left=X+"px";
	time=0;
	dropDownAction();
}
function dropUp(param) {
	time=25;
	document.getElementById("MenuList"+param).style.background="url(images/menuBig/"+cntPage+"/"+param+".png)";
	document.getElementById("menuDrop"+param).style.display="none";
}

function initDrop(page) {
	var cycle;
	for (cycle=1; cycle<=pagesLenght[page-1]; ++cycle) {
		document.getElementById("menuDrop"+cycle).style.background="url(images/menuBig/"+cntPage+"/drop.png) no-repeat";
	}
	for (cycle=1; cycle<=pagesLenght[page-1]; ++cycle) {
		var obj=document.getElementById("MenuList"+cycle);
		obj2=document.getElementById("menuDrop"+cycle);
		var X=obj.offsetLeft;
		var Y=obj.offsetTop;
		Y+=170;
		obj2.style.top=Y+"px";
		obj2.style.left=X+"px";
		obj2.style.display="none";
	}
}

function moveIcons() {
	++scrollplace;
	if (scrollplace == 901)
		scrollplace=0;
	document.images.icon.style.bottom=scrollplace+"px";
}

function scrolling() {
	setInterval("moveIcons()", 50);
	var bottom=document.getElementById('bottom');
	var bottomX=getX(bottom);
	var bottomY=getY(bottom);
	bottom.style.position="absolute";
	bottom.style.left=bottomX+"px";
	bottom.style.top=bottomY+"px";
	bottom=document.getElementById('bottomSpace');
	bottomX=getX(bottom);
	bottomY=getY(bottom);
	bottom.style.position="absolute";
	bottom.style.left=bottomX+"px";
	bottom.style.top=bottomY+"px";
}

function moveMovie() {
	var idIconPlace=document.getElementById('iconsPlace');
	var iconX=getX(idIconPlace);
	var iconY=getY(idIconPlace);
	var idIcon=document.getElementById('icons');
	idIcon.style.left=iconX+"px";
	idIcon.style.top=iconY+"px";
	if (navigator.appName == "Microsoft Internet Explorer")
		idIconPlace.style.bottom="29px";
}
