﻿

function separator(){
	var menu = document.getElementById('subMenu');
	if(menu){
		var menuT = menu.getElementsByTagName('span');
		menuT[menuT.length - 1].style.display = 'none';
	}
}

function transportationPic(tran){
	
	var arr = tran.split(', ');

	for(var t = 0; t < arr.length; t++){
		switch(arr[t]){
			case 'Авиа':
			  document.write('<img src="/tpls/content/users/img/avai.gif" alt="Авиа" \/>');
			  break;    
			case 'Авто':
			  document.write('<img src="/tpls/content/users/img/avto.gif" alt="Авиа" \/>');
			  break;
			case 'Паром':
			  document.write('<img src="/tpls/content/users/img/ship.gif" alt="Авиа" \/>');
			  break;
		}
	}
}

$(function(){
	separator();
	
	
	//Всплывающее меню
	$('#menu>li').each(function(n){
	   var position =  $(this).position();
	   if(position.left > 390){
	       $(this).addClass('toLeft');
	   } 
	   //else {
	       $(this).addClass('bottomElement');
	   //}
		var children = $(this).find('li');
		if(children.length > 2){
			$(this).addClass('withChildren');
		}
	});
	
	$('#menu ul li').each(function(){
		var children = $(this).find('li');
		if(children.length > 2){
			$(this).addClass('subMeneWithChildren');
		}
	});
	
	
	$('.withChildren, .subMeneWithChildren').hover(function(){
	   $(this).addClass('hover');
	},function(){
	   $(this).removeClass('hover');
	});
	
	
});
