 $(document).ready(function(){
 
	if($.cookie('BITRIX_CITY')) {
	   $("li").each(function () {
			$(this).removeClass("active");
		});
		var curcity = $.cookie('BITRIX_CITY');
		var cityArr = ['chel','mgn','zlt','ms','ujn','trck','kush','kopeysk'];
		
		if ($.inArray(curcity, cityArr)==-1) //немного безопасности не повредит
			curcity='chel';
		$("#top_menu > ul > li#"+curcity).addClass("active");
	if (curcity=='chel'){
	adress="<li><a href='/company/contacts_"+curcity+".php'>ул. Свободы, 100</a>&nbsp;&nbsp;<span>Тел.: (351) 260-02-33, 260-02-17</span></li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Производственная,8-А</a> &nbsp;&nbsp;<span>Тел.: (351) 7-000-555</span></li>";
	}
	  if (curcity=="mgn"){
	adress="<li><a href='/company/contacts_"+curcity+".php'>455026 г. Магнитогорск</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Мичурина 142</a> &nbsp;&nbsp;<span>Тел.: (3519) 21-55-99, 21-12-12</span></li>";
	}
	  if (curcity=="zlt"){
	adress="<li><a href='/company/contacts_"+curcity+".php'>456208 г. Златоуст</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>проспект Мира 22 А, офис 707</a> &nbsp;&nbsp;<span>Тел.: (3513) 63-55-77, 63-77-55</span></li>";
	}
	  if (curcity=="ms"){
	adress="<li><a href='/company/contacts_"+curcity+".php'>456300 г. Миасс</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Калинина 13, офис 406</a> &nbsp;&nbsp;<span>Тел.: (3513) 55-33-25, 52-02-11</span></li>";
}
	  if (curcity=="ujn"){
	adress="<li><a href='/company/contacts_trck.php'>457100 г. Троицк</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_trck.php'>ул. Советская 109</a> &nbsp;&nbsp;<span>Тел.: (35163) 2-14-70, 2-22-44</span></li>";
}
	  if (curcity=="trck"){
	adress="<li><a href='/company/contacts_"+curcity+".php'>457100 г. Троицк</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Советская 109</a> &nbsp;&nbsp;<span>Тел.: (35163) 2-14-70, 2-22-44</span></li>";
}
	 if (curcity=="kush"){
	adress="<li><a href='/company/contacts_"+curcity+".php'>456870 г. Кыштым</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Калинина 172</a> &nbsp;&nbsp;<span>Тел.: (35151) 45 777, 46 555</span></li>";
}
	 if (curcity=="kopeysk"){
	adress="<li><a href='/company/contacts_"+curcity+".php'>ул. Свободы, 100</a>&nbsp;&nbsp;<span>Тел.: (351) 260-02-33, 260-02-17</span></li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Производственная,8-А</a> &nbsp;&nbsp;<span>Тел.: (351) 7-000-555</span></li>";
	}
  $("#tel > ul").html(adress);
	}
 });
$(function () {

	/*right_link_wight not("#h0").not("#h1").*/
	
	$("#h0 > a").click(function (event) {
    $("#h0").hide();
	$("#h1").show(); 
	    event.stopPropagation();
	});
	
	$(document).click(function(event) {
    if ($(event.target).closest("#h1").length) return;
      	$("#h0").show();
		$("#h1").hide();
    event.stopPropagation();
	});
  

	
	//$(".line").hide();
	$(".block").bind("mouseenter",function(){
	$(this).children("a").children("div").children("img").css("border-bottom","3px solid #ffda75")
	//css("border-bottom","3px solid #ffda75")
	//border-bottom: 3px solid #ffda75;
	});
	$(".block").bind("mouseleave", function(){
	$(this).children("a").children("div").children("img").css("border-bottom","0px solid #ffda75");
	});
	/*
	$("#h1").click(function(event){

	}); 
	event.stopPropagation();
	$(document).click(function () {
	$(".search_input_vash_telefon").blur();
	});
	*/

  $("#top_menu > ul > li").click(function () {
  $("li").each(function () {
	$(this).removeClass("active");
  });
  
  	//	var curdomain ="varyag.loc";
  		var curdomain = document.domain;
		var curcity = "";
  $(this).addClass("active");

	  if ($(this).is("#chel")){	  
	 curcity='chel';
//	adress="<li><a href='/company/contacts_"+curcity+".php'>ул. Свободы, 100</a>&nbsp;&nbsp;<span>Тел.: (351) 260-02-33, 260-02-17</span></li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Производственная,8-А</a> &nbsp;&nbsp;<span>Тел.: (351) 7-000-555</span></li>";
	}
	  if ($(this).is("#mgn")){
	 curcity='mgn';
//	adress="<li><a href='/company/contacts_"+curcity+".php'>455026 г. Магнитогорск</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Мичурина 142</a> &nbsp;&nbsp;<span>Тел.: (3519) 21-55-99, 21-12-12</span></li>";
	}
	  if ($(this).is("#zlt")){
	 curcity='zlt';
//	adress="<li><a href='/company/contacts_"+curcity+".php'>456208 г. Златоуст</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>проспект Мира 22 А, офис 707</a> &nbsp;&nbsp;<span>Тел.: (3513) 63-55-77, 63-77-55</span></li>";
	}
	  if ($(this).is("#ms")){
	 curcity='ms';
	//adress="<li><a href='/company/contacts_"+curcity+".php'>456300 г. Миасс</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Калинина 13, офис 406</a> &nbsp;&nbsp;<span>Тел.: (3513) 55-33-25, 52-02-11</span></li>";
}
	  if ($(this).is("#ujn")){
	 curcity='ujn';
	//adress="<li><a href='/company/contacts_trck.php'>457100 г. Троицк</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_trck.php'>ул. Советская 109</a> &nbsp;&nbsp;<span>Тел.: (35163) 2-14-70, 2-22-44</span></li>";
}
	  if ($(this).is("#trck")){
	 curcity='trck';
//	adress="<li><a href='/company/contacts_"+curcity+".php'>457100 г. Троицк</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Советская 109</a> &nbsp;&nbsp;<span>Тел.: (35163) 2-14-70, 2-22-44</span></li>";
}
	 if ($(this).is("#kush")){
	 curcity='kush';
//	adress="<li><a href='/company/contacts_"+curcity+".php'>456870 г. Кыштым</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Калинина 172</a> &nbsp;&nbsp;<span>Тел.: (35151) 45 777, 46 555</span></li>";
}
	 if ($(this).is("#kopeysk")){
	 curcity='kopeysk';
  //adress="<li><a href='/company/contacts_"+curcity+".php'>ул. Копейск, 100</a> &nbsp;&nbsp;</li>\n<li>&nbsp;&nbsp;&nbsp;&nbsp;<a href='/company/contacts_"+curcity+".php'>ул. Производственная,8-А</a> &nbsp;&nbsp;<span>Тел.: (351) 7-000-555</span></li>";
	}
	 $.cookie('BITRIX_CITY', curcity, { expires: 7, path: '/', domain: curdomain});
	  window.location="http://"+curdomain+"/company/contacts_"+curcity+".php";
 // $("#tel > ul").html(adress);

  return false;
  });
  
});

function makeStripe(tab)
{
    var rows = tab.getElementsByTagName("tr");
 
    if (!rows)
        return;
 
    for(var i=1; i<rows.length; i++)
        rows[i].className = ((i%2)==0 ? "table_gray" : "");
}
 $(document).ready(function(){
makeStripe(document);

});
/*
function makeStripe(tab)
{
    var rows = tab.getElementsByTagName("tr");
 
    if (!rows)
        return;
 
    for(var i=1; i<rows.length; i++)
        rows[i].className = ((i%2)==0 ? "table_gray" : "");
}



*/
