
function menuLight(obj)
{
	var btn = $(obj);
	btn.find("div.menu_default_btn").css('display', 'none');
	btn.find("div.menu_light_btn").css('display', 'block');
}

function menuDark(obj)
{
	var btn = $(obj);
	btn.find("div.menu_light_btn").css('display', 'none');	
	btn.find("div.menu_default_btn").css('display', 'block');

}


function hideText(text, field, show)
{
	if (field.value == '' && show==1)
	{
		field.value = text;
	}
	if (field.value == text && show==0)
	{
		field.value = '';
	}
}




function showTab(num, total)
{
var linkID='tab_link_id_';
var tabID='tab_id_';

	for (var i=1; i<=total; i++)
	{
		document.getElementById(linkID+i).className = 'tab_item';
		document.getElementById(tabID+i).className = 'tab_cont_block';
	}
	document.getElementById(linkID+num).className = 'tab_item_active';
	document.getElementById(tabID+num).className = 'tab_cont_block_ac';
	
}

function showTab2(num, total)
{
var linkID='tab_link_id_';
var tabID='tab_id_';

	for (var i=1; i<=total; i++)
	{
		document.getElementById(linkID+i).className = 'tab_item';
		document.getElementById(tabID+i).className = 'tab_cont_block';
	}
	document.getElementById(linkID+num).className = 'tab_item_active';
	document.getElementById("tab_id_1").className = 'tab_cont_block_ac';
	
//new
	var tds = document.getElementById(linkID+num).getElementsByTagName("a");
    time = tds[0].firstChild.nodeValue;
	//alert(time);
    document.getElementById('form_hiddenbox').value=time;
	//alert(document.getElementById('form_hiddenbox').value);
//new
}




var closeSubmenuTimer;
var submenuObj;
var hideOn = false;

function hideDropDown()
{
	hideOn = true;
	closeSubmenuTimer = setTimeout('hideDropDownAction()', 6000);
	document.getElementById("hider").innerHTML = "hide start";
}

function hideDropDownAction()
{
	if (hideOn==false)
	{
		clearTimeout(closeSubmenuTimer);
		return;
	}
	var parent = submenuObj.parentNode;
	var root = $(parent);
	clearTimeout(closeSubmenuTimer);
	root.find("div").css('display', 'none');
}

function openDropDown(obj)
{
	submenuObj = obj;
	var parent = obj.parentNode;
	var root = $(parent);
	root.find("div").css('display', 'block');
	obj.onmouseover = function() { clearTimeout(closeSubmenuTimer); hideOn = false; }
	parent.onmouseover = function() { clearTimeout(closeSubmenuTimer); hideOn = false;}
	root.find("div").mouseover(function() { clearTimeout(closeSubmenuTimer); hideOn = false; });
	root.find("div").find("a").mouseover(function() { clearTimeout(closeSubmenuTimer); hideOn = false; });

	obj.onmouseout = function() { hideDropDown(); }
	parent.onmouseout = function() { hideDropDown(); }
	root.find("div").mouseout(function() { hideDropDown(); });
	root.find("div").find("a").mouseout(function() { hideDropDown(); });

	
}
////////////////////////////////
function clearForms()
 {
   var i;
   for (i = 0; (i < document.forms.length); i++) {
     document.forms[i].reset();
   }
 }
//////////////////////////////////////


$(document).ready(function() {
 $('.accordeon').click(function() {
  $(this).children(".accordeon_content").toggleClass("invis");
  $(this).children("span").toggleClass("acc_item");
  
});

$('.vacancy_item').click(function() {
  $(this).children(".vacancy_item_bottom").toggleClass("invis");
});

$('#calc_select_out1').text($('select#calc_prod option:selected').text());
$('#calc_prod').change(function() {
 var selected_option=$('select#calc_prod option:selected').val();
  $('#calc_select_out1').text($('select#calc_prod option:selected').text());
});
$('#calc_select_out2').text($('select#number option:selected').text());
$('#number').change(function() {
 var selected_option=$('select#number option:selected').val();
  $('#calc_select_out2').text($('select#number option:selected').text());
});

$('#calc_select_out3').text($('select#lenght option:selected').text());
$('#lenght').change(function() {
 var selected_option=$('select#lenght option:selected').val();
  $('#calc_select_out3').text($('select#lenght option:selected').text());
});

$('#calc_select_out4').text($('select#number2 option:selected').text());
$('#number2').change(function() {
 var selected_option=$('select#number2 option:selected').val();
  $('#calc_select_out4').text($('select#number2 option:selected').text());
});

$('#calc_select_out5').text($('select#number3 option:selected').text());
$('#number3').change(function() {
 var selected_option=$('select#number3 option:selected').val();
  $('#calc_select_out5').text($('select#number3 option:selected').text());
});
//----------------------------------------------------------------------------//

$('#res_fields').click(function() {

 $(':input','form[name=calc]')
 .not(':button, :submit, :reset, :hidden')
 .val('')
 .removeAttr('checked')
 .removeAttr('selected');
 $('#calc_select_out1').text("");
 $('#calc_select_out2').text("");
 $('#calc_select_out3').text("");
 $('#calc_select_out4').text("");
 
});


$("#calc_prod").change(function() {
	if ($(this).val()) {
		window.location = '?calc_type='+$(this).val();
	}
});

var selected_option=$('select.date_input_s option:selected').val();
  $('.date_out').text(selected_option);
var selected_option=$('select.month_input_s option:selected').val();
  $('.month_out').text(selected_option);
var selected_option=$('select.year_input_s option:selected').val();
  $('.year_out').text(selected_option);
 var selected_option=$('select.vacansy_sel_s option:selected').val();
  $('.vac_out').text(selected_option);
  
$('.date_input_s').change(function() {
 var selected_option=$('select.date_input_s option:selected').val();
  $('.date_out').text(selected_option);
});
$('.month_input_s').change(function() {
 var selected_option=$('select.month_input_s option:selected').val();
  $('.month_out').text(selected_option);
});
$('.year_input_s').change(function() {
 var selected_option=$('select.year_input_s option:selected').val();
  $('.year_out').text(selected_option);
});
$('.vacansy_sel_s').change(function() {
 var selected_option=$('select.vacansy_sel_s option:selected').val();
  $('.vac_out').text(selected_option);
});



$('.a3').click(function() {
  $(this).children(".a_answer").toggleClass("invis");
   
   $(this).children(".a_question").toggleClass("a_bg_ac");
   $(this).children(".a_question").toggleClass("a_bg");
});

  
/*$('#nc_captcha_code').focus(function() {
  $('#nc_captcha_code').val('');
});
$('#nc_captcha_code').blur(function() {
 $('#nc_captcha_code').val('Ââåäèòå êîä');
});*/

//function prepareEventHandlers(){
var capthaField = document.getElementById("nc_captcha_code");
if(capthaField!=null){
capthaField.onfocus = function () {
	if(capthaField.value == "Ââåäèòå êîä"){
		capthaField.value="";
	}
}
capthaField.onblur = function () {
	if(capthaField.value == ""){
		capthaField.value="Ââåäèòå êîä";
	}
}

var capthaField = document.getElementById("nc_captcha_code");
}
//}

//window.onload = function() {
//prepareEventHandlers();
//}





$('.news_item').mouseover(function() {
  //alert("kkkk");
  $(this).addClass("shadow_blck_dark");
});
$('.news_item').mouseout(function() {
  //alert("kkkk");
  $(this).removeClass("shadow_blck_dark");
});


jQuery("#map-container AREA").mouseover(function(){

				var regionList = '.'+$(this).attr('id')+'-list';

                //jQuery(regionList).css('display', 'block');
				jQuery(regionList).fadeIn('slow');



			}).mouseout(function(){


				var regionList = '.'+$(this).attr('id')+'-list';

                //jQuery(regionList).css('display', 'none');
				jQuery(regionList).fadeOut('slow');

			});

 });
 
 
 function popup(Path, Width, Height, Title)
{
   WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
   w = window.open("", "window", WinFeatures);
   w.document.open();
   w.document.write('<html>');
   w.document.write('<head><title>'+Title+'</title></head>');
   w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='"+Title+"'></body>");
   w.document.write('</html>');
   w.document.close();
}


function sh(elem, id)
{
//alert(elem.parentNode.className);
	if (document.getElementById) {
		if (id == 'place2') {
			//this.className='add2';*/
			var pl3 = document.getElementById('place3');
			//alert("test");
			if (pl3.style.display == 'block'){
			pl3.style.display = 'none';
            
			}
		}

		var obj = document.getElementById(id);
		obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
		
		elem.parentNode.className = (elem.parentNode.className == 'add')?'del':'add';
	 }
}
