var no_eval = false; ///svarbu!!!
var first_time = true;

function close_all_hslides() {
	hs.close(document.getElementById('highslide-html-7'));
	}

function a1(divas) {
	var dfrom = 'baidare1'; var dto = 'highslide-html-7'; hs.align = 'center'; hs.targetY = 'targ 5px'; hs.targetX = 'targ -3px';
	hs.htmlExpand(document.getElementById(dfrom), { contentId: dto, outlineType: 'rounded-white', outlineWhileAnimating: true} )
	}
	
var show_id = 0;
var show_id2 = 0;
var show_id4 = 0;

function showBox( boxId, level ) {
	var boxai = ['subsub_11', 'subsub_12','subsub_13', 'subsub_14'];
	if ($('#MenuLeft').length > 0) {
		var rels = ['vienas', 'du', 'trys', 'keturi'];
		for (var i=0; i < boxai.length; i++) {
			if (boxai[i] == boxId) {
				no_eval = true;
				first_time = false;
				$('a[rel="'+rels[i]+'"]', '#MenuLeft').click();
			}
		}
	} else {
		var myBox = document.getElementById( boxId );
		if (boxId != 'subx_2' && boxId != 'sub_2') {
			for (var i=0; i < boxai.length; i++) {
				if (boxai[i] != boxId) {
					document.getElementById( boxai[i] ).style.display = 'none';
				}
			}
		}
		if ( myBox.style.display == 'none'){
			myBox.style.display = 'block';
		} 
		else {
			myBox.style.display = 'none';
		}
	}
}

function showBox2( boxId ) // naudojamas marsrutu aprasymams
{
    var myBox = document.getElementById( boxId );

    if ( myBox.style.display == 'none' )
    {
        myBox.style.display = 'block';
    } 
    else 
    {
        myBox.style.display = 'none';
    }
}

function bu (bu){
	document.getElementById('bu2').className = "level_1_li_none";
	document.getElementById('bu3').className = "level_1_li_none";
	document.getElementById('bu10').className = "level_1_li_none";
	document.getElementById('bu'+bu).className = "level_1_li";
	
	/* -- Change link color -- */
	
	document.getElementById('abu2').style.color = "white";
	document.getElementById('abu3').style.color = "white";
	document.getElementById('abu10').style.color = "white";
	document.getElementById('abu'+bu).style.color = "#023267";
	
	}

function changeHover(id) {
	if (document.getElementById(id).className == 'level_1_li_none_hover') {
		document.getElementById(id).className = "level_1_li_none";
		}
	else {
		if (document.getElementById(id).className == 'level_1_li_none') document.getElementById(id).className = "level_1_li_none_hover";
		}
	}


$(document).ready(function() {
	$('#MenuLeft').find('a').click(function(e) {
		if ($(this).attr('href') == '#') {
			e.preventDefault();
			if ($(this).next('ul').length > 0 && $(this).next('ul').css('display') == 'block') {
				$(this).removeClass('active');
				$(this).next('ul').hide();
			} else {
				if ($(this).next('ul.Sub1').length > 0) {
					$(this).parents('ul:first').find('ul:not(.Sub2)').hide();
				} else {
					$(this).parents('ul:first').find('ul').hide();
				}
				$(this).parents('ul:first').find('a').removeClass('active');
				$(this).addClass('active');
				
				$(this).next('ul').show();
				
				if ($(this).next('ul').find('a[rel="du"]').length > 0 && first_time === true) {
					first_time = false;
					$(this).next('ul').find('a[rel="du"]').click();
				}
				
				if ($(this).attr('rel') != '' && typeof $(this).attr('rel') === 'string' && $(this).parents('ul:first').is('.Sub1') && $('#movie').length > 0) {
					if (no_eval === false) {
						eval($(this).attr('rel')+'();');
					} else {
						no_eval = false;
					}
				}
			}
		}
	}).mouseover(function() {
		if ($(this).attr('rel') != '' && typeof $(this).attr('rel') === 'string' && $(this).parents('ul:first').is('.Sub2') && $('#movie').length > 0) {
			eval($(this).attr('rel')+'();');
		}
	}).mouseout(function() {
		if ($(this).attr('rel') != '' && typeof $(this).attr('rel') === 'string' && $(this).parents('ul:first').is('.Sub2') && $('#movie').length > 0) {
			eval($(this).attr('rel')+'_out();');
		}
	});
});
