/* Class for Menu*/
var menu = new Object();
menu.items = new Array ('avt_online', 'avt_ticket', 'avt_russia', 'avt_world', 'avt_jd', 'avt_hotel', 'avt_auto');
menu.links = new Array ('http://sirena.avtru.ru', 'http://avt16.ru/content.php', 'http://sirena.avtru.ru/sirenabooking/reservation/', 'http://amadeus.avt16.ru/plnext/AIEBCQNBCQN/StartOver.action?TYPE_FLOW=air&LANGUAGE=RU&SITE=BCQNBCQN', 'http://rzd.avt16.ru/', 'http://www.avt16.ru/content.php?sid=543', 'http://wftc2.e-travel.com/plnext/AIEBCQNBCQN/StartOver.action;jsessionid=TlftKysTG3JLbLRL1nyZSlvRdnlTLqCxQJR5ThnQrccJ2H6yQHx1!988541046!-1779062821?TYPE_FLOW=hotel&LANGUAGE=RU&SITE=BCQNBCQN');
menu.intervalHandler = new Array();
menu.clearInterval = function (id) {
	if (menu.intervalHandler[id])
	{
		clearInterval(menu.intervalHandler[id]);
	}

}

menu.getLinkById = function(id) {
	for(var i=0; i<this.items.length;i++)
	{
		if (this.items[i]==id)
		{
			return this.links[i];
		}
	}
	return null;
}

menu.onClick = function () {
	location.href = menu.getLinkById(this.id);
}

menu.onMouseOver = function () {
	this.className = 'selector_item_active';
	var id = this.id;
	menu.clearInterval(id+'_above');

	var reflection = document.getElementById(id+'_ref');
	reflection.className = 'selector_item_ref_active';

	var above = document.getElementById(id+'_above');
	above.className = 'selector_item_above_active';

	menu.intervalHandler[id+'_above'] = setInterval('menu.fadeIn(\''+id+'_above\')',50);

}

menu.onMouseOut = function () {

	
	this.className = 'selector_item';
	var id = this.id;

	menu.clearInterval(id+'_above');

	var reflection = document.getElementById(id+'_ref');
	reflection.className = 'selector_item_ref';

	menu.intervalHandler[id+'_above'] = setInterval('menu.fadeOut(\''+id+'_above\')',50);
}

menu.fadeIn = function (objId) {

	var opacity = parseFloat(document.getElementById(objId).style.opacity ? document.getElementById(objId).style.opacity : 0);
	if (opacity < 1.0)
	{
		document.getElementById(objId).style.opacity = opacity + 0.1;
	}
	else
	{
		menu.clearInterval(objId);
	}
}

menu.fadeOut = function (objId) {
	var opacity = parseFloat(document.getElementById(objId).style.opacity ? document.getElementById(objId).style.opacity : 0);
	if (opacity > 0.0)
	{
		document.getElementById(objId).style.opacity = opacity - 0.1;
	}
	else
	{
		menu.clearInterval(objId);
		var above = document.getElementById(objId);
		above.className = 'selector_item_above';
		above.style.opacity = '';
	}
}

/*Basic Class*/
var main = new Object();
main.init = function () {
	
	for (var i=0; i<menu.items.length; i++)
	{
		document.getElementById(menu.items[i]).onclick = menu.onClick;
		document.getElementById(menu.items[i]).onmouseover = menu.onMouseOver;
		document.getElementById(menu.items[i]).onmouseout = menu.onMouseOut;
	}
}
