/*
 * @file: lanit.js @author: Webway IT Labs, 2008 (www.webway.ru)
 *
 */

// Init main/sub menu on DOM Ready
$(function() {
	// Main page:
	___switchBank(1);

	var cRelMenuItems = $('.m-menu > li').size();

	$('.m-menu > li').each(function(i) {
		// Hide sub-menu and set it default position
		$('.sub-menu', this).css({
			display : 'none',
			position : 'absolute'
		});

		// Fix fo IE's z-index bug
		$(this).css('z-index', cRelMenuItems - i);

		// show/hide sub menu on mouse hover
		$(this).hover(function() {
			$(this).addClass('hover');
			$('.sub-menu', this).show();
		}, function() {
			$(this).removeClass('hover');
			$('.sub-menu', this).hide();
		});
	});

	$('form input#q').focus( function(){
		if( $(this).attr('value') == 'Поиск' ){
			$(this).attr('value', '');
		}
	} ).blur( function(){
		if( !$(this).attr('value').length ){
			$(this).attr('value', 'Поиск');
		}
	});
});

// Private functions:
function showTab(s_id) {
	$('#TB_ajaxContent .light-content > .tube').each(function() {
		$(this).hide();
	});

	$('#TB_ajaxContent .l-menu .grapher').removeClass('locked');

	$('#TB_ajaxContent .light-content ' + s_id).show();

	return false;
}

//
function ___switchBank(id) {
	$('#index .good').hide();
	$('#ix_gItem' + id).show();
}
