var str_menu_colour_focus = '#000000';
var str_menu_colour_blur = '#B4B4B4';

var str_sale_colour_focus = "#FF0000";
var str_sale_colour_blur = "#FF7373";

var arr_menus = Array('man', 'woman', 'boy', 'girl', 'life', 'sale_m', 'sale_w', 'blog');

function show_menu(string, int_num_items) {
   for (var int_i = 0; int_i < arr_menus.length; int_i++) {
      var str_menu = arr_menus[int_i];
      if (str_menu == string) {
         if (str_menu.search('sale') > -1) {
            $('#ml1_' + str_menu + '_title').css('color', str_sale_colour_focus);
         } else {
            $('#ml1_' + str_menu + '_title').css('color', str_menu_colour_focus);
         }
      } else {
         if (str_menu.search('sale') > -1) {
            $('#ml1_' + str_menu + '_title').css('color', str_sale_colour_blur);
         } else {
            $('#ml1_' + str_menu + '_title').css('color', str_menu_colour_blur);
         }
         $('#ml1_' + str_menu).hide();
         $('#ml2_' + str_menu).hide();
      }
   }

   var obj_requested_menu = $('#ml1_' + string);
   if (string == 'blog') {
      $('#ml2_blog').show();
   } else {
      if (obj_requested_menu.css('display') != 'block') {
         slide_open(document.getElementById('ml1_' + string), int_num_items);
         $('#ml2_' + string).css('display', 'block');
      } else {
         slide_shut(document.getElementById('ml1_' + string));
         $('#ml2_' + string).hide();
      }
   }
}

function slide_open(obj_menu, int_num_items) {
	int_tgt_height = 20 + (16 * int_num_items);
	obj_menu.style.display='block';
	set_height(obj_menu, 0);
//alert(obj_menu.id)
	inc_height(obj_menu, 1);
}

function slide_shut(obj_menu) {
	obj_menu.style.display='none';
	set_height(obj_menu, 0);
}

function inc_height(obj_menu, int_height) {
	set_height(obj_menu, int_height);
	if(int_height < int_tgt_height) {
		int_height += 12;
		setTimeout(function () {inc_height(obj_menu, int_height);}, 20);
	}
}

function get_height(obj_menu) {
	return obj_menu.style.height;
}

function set_height(obj_menu, int_height) {
	obj_menu.style.height = int_height;
}

function goto_man(int_items) {
	show_menu('man', int_items);
	$('#master_collage').html($('#content_MAN').html());
}

function goto_woman(int_items) {
	show_menu('woman', int_items);
	$('#master_collage').html($('#content_WOMAN').html());
}

function goto_boy(int_items) {
	show_menu('boy', int_items);
}

function goto_girl(int_items) {
	show_menu('girl', int_items);
}

function goto_life(int_items) {
	show_menu('life', int_items);
	$('#master_collage').html($('#content_LIFE').html());
}

/*function update_about_vancancies_position() {
   // Set padding for ABOUT US -> VACANCIES
   int_workarea_height = $('#workarea').height();
   int_ml1_height = $('#ml1').height();

   // Default Margin
   int_margin = 20;
   if (int_workarea_height > int_ml1_height) {
      int_margin = (int_workarea_height - 270);
   }
   $('#ml1_about_vacancies').css('margin-top', int_margin);
}*/