var map;
function initialize()
{
	var latlng = new google.maps.LatLng(55.02430751921737, 82.91952356884386);
	var myOptions = {
		zoom: 16,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP,
		mapTypeControl: true,
		mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
		navigationControl: true,
		navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}
	};

	map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

	var marker = new google.maps.Marker({
		position: latlng, 
		map: map, 
		draggable: false
	});
}

window.onresize = resizeBody;

var timer;

$(document).ready(function(){

initialize();
resizeBody();
$("#ml").html( $("#ml").html()+"@"+"aksilon.ru" );

$("table td").click(function(){
	$("#logoAColor").animate({ backgroundColor: "#ffc000" }, 1000)
	.delay(1000)
	.animate({ backgroundColor: "#2dc0c9" }, 1000);
});

}); 

window.onscroll = function (){
	animateScroll();
	clearTimeout(timer);
	timer = setTimeout("moveScroll(findScroll())",1000);
};

function animateScroll()
	{
		var currS = $(window).scrollLeft();
		var currentD;
		var sizeFont = new Array(20, 20, 20);
		var opacityDiv = new Array(0.2, 0.2, 0.2)
		var i;

		//if (currS >= 1500) 				  currentD = 3;
		if (currS >= 900) currentD = 2;
		if (currS >= 300 && currS < 900)  currentD = 1;
		if (currS < 300) 				  currentD = 0;
		for (i = 0; i < 3; i++)
				{
					if (i == currentD)
						{
							sizeFont[i] = 44 - Math.round(0.08*Math.abs(findScroll() - currS));
							opacityDiv[i] = 1 - 0.0026*Math.abs(findScroll() - currS);
						}
					
					$("#menu" + (i + 1)).css("font-size", sizeFont[i] + 'px');
					$("#cell" + (i + 1)).css("opacity", opacityDiv[i]);
					
					if (sizeFont[i] >= 44) 
						{
							$("#menu" + (i + 1)).css('color',"#66bdac");
						}
					else 
						{
							$("#menu" + (i + 1)).css('color',"#000");
						}
				}
	}
	
function findScroll()
	{
		var currentScroll = $(window).scrollLeft();
		//var menu = new Array(0 , 600, 1200, 1800);
		var menu = new Array(0 , 600, 1200);
		var i;
		var _min;
		var index = 0;
		_min = Math.abs(menu[0] - currentScroll);
		for (i = 1; i < 3; i++)
					{
						if (_min > Math.abs(menu[i] - currentScroll))
							{
								_min = Math.abs(menu[i] - currentScroll);
								index = i;
							}
					}
		if ($.browser.msie && $.browser.version <= 6)
			{
				var dx = 300;
			}
		else
			{
				$("#plate").css("left", parseInt(0.35*currentScroll) + ($(window).width()/2 - 300) + 'px');
			}
		if (index == 2) $("#plate").css('width', '280px');
		else $("#plate").css('width', '230px');
		
		return menu[index];
	}

function moveScroll(moveToPosition)
{
	Scroll.to(window,{ 'x' : moveToPosition}, 400);
}

function resizeBody()
	{
		var k = 300;
		if (!($.browser.msie && $.browser.version <= 6))
			{
				var width = parseInt(document.body.clientWidth);
				if (width < 999) width = 999;
				var halfWidth = Math.round(width/2);
				document.getElementById("header").style.left = (halfWidth - k) + 'px';
				document.getElementById("content").style.left = (halfWidth - k) + 'px';
				document.getElementById("logoAColor").style.left = (halfWidth - k - 200) + 'px';
				document.getElementById("logoKsilonColor").style.left = (halfWidth - k - 175) + 'px';
				
				document.getElementById("content").style.width = 1800 + Math.round(halfWidth/1.45) + 'px';
				
				$("#plate").css("left", parseInt(0.35*$(window).scrollLeft()) + (width/2 - 300) + 'px');
			}
	}
function for6IE(dx)
	{
		var width = parseInt(document.body.clientWidth);
		if (width < 999) width = 999;
		var halfWidth = Math.round(width/2);
		return document.getElementsByTagName("HTML")[0].scrollLeft + (halfWidth - dx) + "px";
	}
	
function for6IE2()
	{
		var width = parseInt(document.body.clientWidth);
		if (width < 999) width = 999;
		
		return document.getElementsByTagName("HTML")[0].scrollLeft + width - 50 + "px";
	}
	
/*function for6IEplate(dx)
	{
		var width = parseInt(document.body.clientWidth);
		if (width < 999) width = 999;
		var halfWidth = Math.round(width/2);
		var temp = document.getElementsByTagName("HTML")[0].scrollLeft;
		document.getElementById("val").value = temp;
		return temp + halfWidth + parseInt(0.3*temp + document.body.clientWidth/2 - dx) + "px";
	}*/
	

