﻿function centering() {
	if(navigator.appName.charAt(0)=="M"&& navigator.userAgent.indexOf("Opera")==-1){
		var IE_width = document.body.clientWidth;
		if(document.getElementById){
			var IE_side = (IE_width/2) - document.getElementById("logo").width/2;
			document.getElementById("container").style.left=(IE_side+"px");
		}
	} else {
		var NN_width = window.innerWidth;
		if(document.getElementById) {
			var NN_side = (NN_width/2)-document.getElementById("logo").width/2;
			document.getElementById("container").style.left=(NN_side+"px");
		}
	}
}

function shiftOpacity(id, millisec) {
	opacity(id, 0, 200, millisec);
}

function opacity(id, countStart, countEnd, millisec) {
	var speed = Math.round(millisec/100);
	var timer = 0;

	for(var i = countStart; i <= countEnd; i++) {
		setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));
		timer++;
	}
}
function changeOpac(counter, id) {
	var object = document.getElementById(id).style;
	if(counter<=100) {
		object.opacity = (counter/100);
		object.MozOpacity = (counter/100);
		object.KhtmlOpacity = (counter/100);
		object.filter = "alpha(opacity="+counter+")";
	}else if(counter>=200){
		moveToTop();
	}
}

function moveToTop() {
	document.location="html/top.html";
}


window.onload = function(){centering();shiftOpacity('logo', 2000);};