$(document).ready(function() {

//$("#container2").css("display","block");

//куки начало
function SetCookie(name, value, expires, path, domain, secure)
{
  var expString = ((expires == null)? "" : ("; expires=" + 
                    expires.toGMTString()));
  var pathString = ((path == null) ? "" : ("; path=" + path));
  var domainString = ((domain == null)? "" : ("; domain=" + domain));
  var secureString = ((secure == true) ? "; secure" : "");
  document.cookie = name + "=" + escape(value)+ expString + pathString + 
                    domainString+ secureString;
}


function GetCookie(name)
{
  var result = null;
  var myCookie = " " + document.cookie + ";";
  var searchName = " " + name + "=";
  var startOfCookie = myCookie.indexOf(searchName);
  var endOfCookie;
  if (startOfCookie != -1)
  {
    startOfCookie += searchName.length;
    // Пропуск последнего имени cookie
    endOfCookie = myCookie.indexOf(";", startOfCookie);
    result = unescape(myCookie.substring(startOfCookie,endOfCookie));
  }
  return result;
}
/*куки конец*/

/*
var width = $(window).width();
if(width>0)
{
var exp_live = 3600*24*365*1000;
var expDate = new Date();
expDate.setTime (expDate.getTime() + exp_live);  
SetCookie("wa", width, expDate, null, null, false);
}
*/

/*для выделения подчеркивания ссылок бардовым старт*/
	$(".bard").parent("a").css("color","#973326");
/*для выделения подчеркивания ссылок бардовым конец*/

/*определяем разрешение экрана*/

var height=0; 
var width=0; 
colorDepth = screen.colorDepth; 
if (self.screen) 
{  
  width = screen.width  
  height = screen.height 
} 
else if (self.java) 
{  
  var jToolKit = java.awt.Toolkit.getDefaultToolkit();  
  var scrsize = jToolKit.getScreenSize();  
  width = scrsize.width; 
  height = scrsize.height;  
}  

if (width > 0 && height > 0)  
{
var ss;
//ss = GetCookie("wa");
//alert (ss);
	if(GetCookie("wa")!=width)
	{
/*запоминаем разрешение экрана в куку*/

var exp_live = 3600*24*365*1000;
var expDate = new Date();
expDate.setTime (expDate.getTime() + exp_live);  
SetCookie("wa", width, expDate, null, null, false);
//alert (width);
         }
}  


/*ограничение ширины страницы*/
/*
if($("#stop").width()>1280)
{
$("#stop").width(1280);
}

if($("#stop2").width()>1280)
{
$("#stop2").width(1280);
}
*/


/*высота внутреннего блока*/
var h_const = 266;
var h_div = $("#d_main").height();
if(h_div<($(window).height()-h_const))$("#d_main").height($(window).height()-h_const);

/*на главной зарубежной странице*/
$("#pageContent_zarubej").height($("#zarubej_cent").height()-$("#zarubej_oferta").height());

/*высота внутреннего блока агентской*/
var ha_const = 187;
var ha_div = $("#d_main_agency").height();
if(ha_div<($(window).height()-ha_const))$("#d_main_agency").height($(window).height()-ha_const);

$(window).resize(function(){
if(h_div< ($(window).height()-h_const))$("#d_main").height($(window).height()-h_const);

if(ha_div< ($(window).height()-ha_const))$("#d_main_agency").height($(window).height()-ha_const);


if($("#stop").width()>1280)
{
$("#stop").width(1280);
}
else
{
if($(window).width()<1280)$("#stop").width($(window).width());
}


if($("#stop2").width()>1280)
{
$("#stop2").width(1280);
}
else
{
if($(window).width()<1280)$("#stop2").width($(window).width());
}



});
/*ограничение ширины страницы end*/

$(".dbr").next("br").replaceWith("");
$(".bod3dbr").next("br").replaceWith("");
$(".bod5dbr").next("br").replaceWith("");

/*
function smena(){
$("#crs_partner_catalog #tab-catalog").height("200px").css("border","0");
}

setTimeout('smena()','10000');
*/

/*информер погоды старт*/
/*
var informer = $("#informer_footer").html();
$("#informer_pogoda").html(informer);
*/
/*информер погоды финиш*/

/*подсветка точек на главной странице*/
$(".s_pod").hover(function() {
	$(this).prev("span").css("color","#c33");
}, function() {
	$(this).prev("span").css("color","#474747");
});

/*подсветка точек на главной странице*/
$(".s_pod_ots").hover(function() {
	$(this).parent("div").prev("span").css("color","#c33");
}, function() {
	$(this).parent("div").prev("span").css("color","#474747");
});


//перемещение точки!! начало
//убираем все точки
$(".s_pod_an").each(function(i) {
$(this).prev("span").css("color","#fee9b2");
});


//назначаем цвет первой строке
$(".s_pod_an").eq(0).prev("span").css("color","#c33");
//назначаем класс первой стоке
$(".s_pod_an").eq(0).addClass("s_pod_an2");

$(".s_pod_an").hover(function() {
		//обесвечиваем все точки
		$(".s_pod_an").prev("span").css("color","#fee9b2");
		//выбранную точку подсвечиваем
		$(this).prev("span").css("color","#c33");
		//удаляем класс
		$(".s_pod_an").removeClass("s_pod_an2").addClass("s_pod_an");;

}, function() {
		//обесвечиваем все точки
		$(".s_pod_an").each(function(i) {
		$(this).prev("span").css("color","#fee9b2");
		});
		//назначаем класс первой стоке
		$(".s_pod_an").eq(0).addClass("s_pod_an2");
		//назначаем цвет первой строке
		$(".s_pod_an").eq(0).prev("span").css("color","#c33");
});
//перемещение точки!! конец

/*подсветка с фоном*/
$(".s_pod_li").hover(function() {
	$(this).parent("div").prev("span").css("color","#c33");
	$(this).parent("div").parent("li").css("background","#fee9b2");

}, function() {
	$(this).parent("div").prev("span").css("color","#474747");
	$(this).parent("div").parent("li").css("background","#ffffff");
});

$(".s_pod_li_ros").hover(function() {
	$(this).parent("div").prev("div").css("color","#c33");
	$(this).parent("div").parent("li").css("background","#fee9b2");

}, function() {
	$(this).parent("div").prev("div").css("color","#474747");
	$(this).parent("div").parent("li").css("background","#ffffff");
});


$(".s_pod_li2").hover(function() {
	$(this).parent("div").prev("span").css("color","#c33");
	$(this).parent("div").parent().parent("li").css("background","#fee9b2");

}, function() {
	$(this).parent("div").prev("span").css("color","#474747");
	$(this).parent("div").parent().parent("li").css("background","#fcf8eb");
});


$(".s_pod_li3").hover(function() {
	$(this).prev("span").css("color","#c33");
	$(this).parent().parent("li").css("background","#fee9b2");

}, function() {
	$(this).prev("span").css("color","#474747");
	$(this).parent().parent("li").css("background","#fcf8eb");
});

$(".s_pod_li4").hover(function() {
	$(this).prev("span").css("color","#c33");
	$(this).parent().parent("li").css("background","#fee9b2");

}, function() {
	$(this).prev("span").css("color","#fcf8eb");
	$(this).parent().parent("li").css("background","#fcf8eb");
});

$(".s_pod_li5").hover(function() {
	$(this).prev("span").css("color","#c33");
	$(this).parent().parent("li").css("background","#fee9b2");

}, function() {
	$(this).prev("span").css("color","#474747");
	$(this).parent().parent("li").css("background","#fcf8eb");
});

//левое меню на главной зарубежной
$(".s_pod_zarubej").hover(function() {
	$(this).prev("span").css("color","#c33");
	$(this).parent().parent("li").css("background","#fee9b2");

}, function() {
	$(this).prev("span").css("color","#474747");
	$(this).parent().parent("li").css("background","#fcf8eb");
});



//welkom на главной
$("#welkom").hover(function() {
	$(this).attr("src","/var/images/180x33_velcom_over.gif");
}, function() {
	$(this).attr("src","/var/images/180x33_velcom.gif");
});

//кнопка online-бронирования у объектов и туров
$(".online_bron").hover(function() {
	$(this).attr("src","/var/images/107х40_over.png");
}, function() {
	$(this).attr("src","/var/images/107х40.png");
});

//кнопка online-бронирования у объектов и туров
$(".online_bron2").hover(function() {
	$(this).attr("src","/var/images/43x28_over.png");
}, function() {
	$(this).attr("src","/var/images/43x28.png");
});

//поиск туров в левом столбце
$("#poisk_turov").hover(function() {
	$(this).attr("src","/var/images/246x51_4.gif");
}, function() {
	$(this).attr("src","/var/images/246x51_3.gif");
});

//поиск туров в левом столбце зарубеж
$("#poisk_turov_z").hover(function() {
	$(this).attr("src","/var/images/246x51z_over.gif");
}, function() {
	$(this).attr("src","/var/images/246x51z.gif");
});

//поиск активных туров в левом столбце
$("#poisk_aktiv_turov").hover(function() {
	$(this).attr("src","/var/images/232x40_over.gif");
}, function() {
	$(this).attr("src","/var/images/232x40.gif");
});


//вход для агентств
$("#vhod_agentstv").hover(function() {
	$(this).attr("src","/var/images/126x21_vhod_over.png");
}, function() {
	$(this).attr("src","/var/images/126x21_vhod.png");
});

//вход для агентств на главной
$("#submit").hover(function() {
	$(this).css("background","url(/var/images/139x16_over.gif)");
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("background","url(/var/images/139x16.gif)");
	$(this).css("cursor","default");
});

//кнопка субмит на подписке для рассылки
$(".kn_podpisk_na_rassilku").hover(function() {
	$(this).css("background","url(/var/images/139x16_ras.png)");
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("background","url(/var/images/139x16_ras_over.png)");
	$(this).css("cursor","default");
});

//на главную для агентской в header
$(".s8").hover(function() {
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("cursor","default");
});

//кнопка сотрудничество на главной
$("#sotr_form").hover(function() {
	$('#kart_sotr').attr("src","/var/images/180x16_over.gif");
}, function() {
	$('#kart_sotr').attr("src","/var/images/180x16.gif");
});

//кнопка все туры на агентской
$("#kn_vse_turi").hover(function() {
	$(this).attr("src","/var/images/82x50_vse_turi_over.png");
}, function() {
	$(this).attr("src","/var/images/82x50_vse_turi.png");
});

//кнопка туры по россии на агентской
$("#kn_turi_po_russia").hover(function() {
	$(this).attr("src","/var/images/82x50_turi_po_rossii_over.png");
}, function() {
	$(this).attr("src","/var/images/82x50_turi_po_rossii.png");
});

/*сортировка таблицы старт*/
$("#myTable").tablesorter({widthFixed: true, widgets: ['zebra']});
/*сортировка таблицы конец*/

/*анимация старт*/
$(".pic_uvel").hover(function() {

if((!$.browser.msie)||(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] > 7)))
	{
$(this).parent().parent(".rotacia_").css("z-index",2);
$(this).animate({"width": "175px", "height": "120px","margin-left": "-17px","margin-top": "-10px"},300);
	}
}, function() {
if((!$.browser.msie)||(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] > 7)))
	{
$(this).parent().parent(".rotacia_").css("z-index",1);
$(this).animate({"width": "126px","height": "97px","margin-left": "0px","margin-top": "0px"},300);
	}
});


$(".pic_uvel_2").hover(function() {
$(this).parent(".pic_naruj").css("z-index",2);
$(this).animate({"width": "175px", "height": "120px","margin-left": "-17px","margin-top": "-24px"},300);
}, function() {
$(this).parent(".pic_naruj").css("z-index",1);
$(this).animate({"width": "140px","height": "96px","margin-left": "0px","margin-top": "0px"},300);
});

$(".pic_uvel_3").hover(function() {
if((!$.browser.msie)||(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] > 7)))
	{
$(this).parent(".pic_naruj").css("z-index",2);
$(this).animate({"width": "245px", "height": "185px","margin-left": "-10px","margin-top": "-8px"},300);
	}
}, function() {
if((!$.browser.msie)||(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] > 7)))
	{
$(this).parent(".pic_naruj").css("z-index",1);
$(this).animate({"width": "225px","height": "169px","margin-left": "0px","margin-top": "0px"},300);
	}
});  
/*анимация финиш*/

/*карта popup старт*/
$("#trigger_karta").hover(function() {

	if(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] < 10))
	{
	$("div.tooltip_karta_popup").animate({height:"show"}, 300);
	}
	else
	{
        $("div.tooltip_karta_popup").animate({opacity:"show"}, 600);
	}
}, function() {

	if(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] < 10))
	{
	$("div.tooltip_karta_popup").css({"display":"none"});
	}
	else
	{
        $("div.tooltip_karta_popup").animate({opacity:"hide"}, 600);
	}
});

$("#menu_karta_popup .karta_vn").hover(function() {
	$(this).children(".karta_vn2").animate({height:"show"}, 300);
}, function() {
        $(this).children(".karta_vn2").animate({height:"hide"}, 600);
});
/*карта popup финиш*/
/*мал. картинки на стр. списках старт*/
$("div.pic_object_vn").hover(function() {
	$(this).children("div.kart_over").animate({height:"show"}, 300);
	$(this).css("cursor","pointer");
}, function() {
        $(this).children("div.kart_over").animate({height:"hide"}, 600);
	$(this).css("cursor","default");
});
//на страницах списков объектов в регионах, районах
$("div.pic_object_vn2").hover(function() {
	$(this).children("div.kart_over2").animate({height:"show"}, 300);
	$(this).css("cursor","pointer");
}, function() {
        $(this).children("div.kart_over2").animate({height:"hide"}, 600);
	$(this).css("cursor","default");
});


/*мал. картинки на главной зарубежной стр.*/
$("div.pic_zarubej_vn").hover(function() {
	$(this).children("div.pic_zarubej_over").animate({height:"show"}, 300);
	$(this).css("cursor","pointer");
}, function() {
        $(this).children("div.pic_zarubej_over").animate({height:"hide"}, 600);
	$(this).css("cursor","default");
});


/*мал. картинки на стране.*/
$("div.pic_zarubej_vn_strana").hover(function() {
	$(this).children("div.pic_zarubej_over_strana").animate({height:"show"}, 300);
	$(this).css("cursor","pointer");
}, function() {
        $(this).children("div.pic_zarubej_over_strana").animate({height:"hide"}, 600);
	$(this).css("cursor","default");
});


//смена курсора в эксплорере 7
$("div.kart_over").hover(function() {
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("cursor","default");
});
/*мал. карт. на стр. списках финиш*/
/*мал. карт. на ротации старт*/
$("div.rotacia").hover(function() {
	$(this).children().children("div.kart_over2").animate({height:"show"}, 300);
}, function() {
        $(this).children().children("div.kart_over2").animate({height:"hide"}, 600);
});
/*мал. карт. на ротации справа*/
$("div.rotacia_r1").hover(function() {
	$(this).children().children("div.kart_over2").animate({height:"show"}, 300);
}, function() {
        $(this).children().children("div.kart_over2").animate({height:"hide"}, 600);
});
/*мал. карт. на ротации финиш*/
   //facebox start
      $('a[rel*=facebox]').facebox({
        loading_image : '/facebox/loading.gif',
        close_image   : '/facebox/images/closelabel.gif'
      }); 
   //facebox finish

//fancybox start
			$("a[rel=fancybox]").fancybox({
				'showNavArrows' : true,
				'overlayShow'	: true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'titlePosition'		: 'inside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.6,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over5">Фото ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
			     }
			});

			$("a[rel=fancybox2]").fancybox({
				'showNavArrows' : true,
				'overlayShow'	: true,
				'titleShow'     : true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'titlePosition'		: 'inside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.6,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over5">Фото ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';

			     }
			});

			$("a[rel=fancybox3]").fancybox({
				'showNavArrows' : true,
				'overlayShow'	: true,
				'titleShow'     : true,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				'titlePosition'		: 'inside',
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.6,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over5">Фото ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';

			     }
			});
//fancybox finish


$("#slider").easySlider({
	controlsBefore:	'<p id="controls">',
	controlsAfter:	'</p>',
	auto: true 
	//continuous: true
});

//левое меню старт
$("ul.ulmenu li").hover(function() {
	if(($.browser.msie)&&(navigator.appVersion.match(/MSIE\u0020([.\d]+);/)[1] < 8))
	{
	$("ul.ulmenu li").eq($("ul.ulmenu li").index(this)).css({"list-style-image": "url(/var/images/3.gif?j=1)"});
	}
	else
	{
		if($.browser.opera)
	        {
		$("ul.ulmenu li").eq($("ul.ulmenu li").index(this)).css({"list-style-image": "url(/var/images/3.gif?j=1)"});
		}
		else
		{
		$("ul.ulmenu li").eq($("ul.ulmenu li").index(this)).css({"list-style-image": "url(/var/images/1.gif?j=1)"});
		}
	}
}, function() {
$("ul.ulmenu li").eq($("ul.ulmenu li").index(this)).css({"list-style-image": "none","list-style-type": "none"}); 
}); 
//левое меню конец

//по странице региона старт
var arr = new Array();

$(".region3").each(function(i) {
arr[i] =  $(this).height();
$(this).height(1);

});

        $(".region3").eq(0).height(arr[0]);
        $(".region1").eq(0).css({
        "background-image": "url(/var/images/minus_14x15.png)"
	});

  $(".region4").click(function() {
	if($(".region3").eq($(".region4").index(this)).height()==1)
	{
        $(".region3").eq($(".region4").index(this)).height(arr[$(".region4").index(this)]);
        $(".region1").eq($(".region4").index(this)).css({
        "background-image": "url(/var/images/minus_14x15.png)"	
      });

	}
	else
	{
        $(".region3").eq($(".region4").index(this)).height(1);
        $(".region1").eq($(".region4").index(this)).css({
        "background-image": "url(/var/images/plus_14x15.png)"
      });

	}

});

 $(".region4").hover(function() {
$(this).css("cursor","pointer");
}, function() {
$(this).css("cursor","default");
});

//по странице региона конец
//страница объекта старт

if($("#ops_st2").height()>$("#ops_st1").height())
{
$("#ops_st1").height($("#ops_st2").height());
}
else
{
$("#ops_st2").height($("#ops_st1").height());
}


var arr_objects = new Array();

$(".objects3").each(function(i) {
arr_objects[i] =  $(this).height();

});

$(".objects3").height(1);

/*корректируем высоту страницы list старт*/
$(".objects3").queue(function () {
	var h_const = 266;
	var h_div = $("#d_main").height();
	if(h_div<($(window).height()-h_const))$("#d_main").height($(window).height()-h_const);
   });                          
/*корректируем высоту страницы list конец*/

  $(".objects4").click(function() {
	if($(".objects3").eq($(".objects4").index(this)).height()==1)
	{
        $(".objects3").eq($(".objects4").index(this)).height(arr_objects[$(".objects4").index(this)]);
        $(".objects1").eq($(".objects4").index(this)).css({
        "background-image": "url(/var/images/minus_14x15.png)"	
      });

	}
	else
	{
        $(".objects3").eq($(".objects4").index(this)).height(1);
        $(".objects1").eq($(".objects4").index(this)).css({
        "background-image": "url(/var/images/plus_14x15.png)"
      });

	}

});

 $(".objects4").hover(function() {
$(this).css("cursor","pointer");
}, function() {
$(this).css("cursor","default");
});

//страница объекта конец
//top-menu start
/*Республика Алтай*/
$("#top_menu_1").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});
/*
$("#top_menu_1").click(function() {
location.replace('/objects/altai.htm')
});
*/
/*Алтайский край*/
$("#top_menu_2").hover(function() {
$("#top_menu_vn_7").css("color","#ca5c2c");
$("#top_menu_vn_12").css("color","#ca5c2c");
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$("#top_menu_vn_7").css("color","#474747");
$("#top_menu_vn_12").css("color","#474747");
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Кемеровская обл*/
$("#top_menu_3").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$("#top_menu_vn_8").css("color","#ca5c2c");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$("#top_menu_vn_8").css("color","#474747");
$(this).css("cursor","default");
});

/*Красноярский край*/
$("#top_menu_4").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Новосибирская область*/
$("#top_menu_5").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Иркутская область*/
$("#top_menu_6").hover(function() {
$("#top_menu_vn_14").css("color","#ca5c2c");
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$("#top_menu_vn_14").css("color","#474747");
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Белокуриха*/
$("#top_menu_vn_7").hover(function() {
$(this).css("color","#ca5c2c");
$(this).css("cursor","pointer");
}, function() {
$(this).css("color","#474747");
$(this).css("cursor","default");
});


/*Горная Шория*/
$("#top_menu_vn_8").hover(function() {
$(this).css("color","#ca5c2c");
$(this).css("cursor","pointer");
}, function() {
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Тюменская область*/
$("#top_menu_9").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Республика Хакасия*/
$("#top_menu_10").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Республика Тыва*/
$("#top_menu_11").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Озеро Ая*/
$("#top_menu_vn_12").hover(function() {
$(this).css("color","#ca5c2c");
$(this).css("cursor","pointer");
}, function() {
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Республика Бурятия*/
$("#top_menu_13").hover(function() {
$("#top_menu_vn_14").css("color","#ca5c2c");
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$("#top_menu_vn_14").css("color","#474747");
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Байкал*/
$("#top_menu_vn_14").hover(function() {
$(this).css("color","#ca5c2c");
$(this).css("cursor","pointer");
}, function() {
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Ханты-Мансийский АО*/
$("#top_menu_15").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Омская обл*/
$("#top_menu_16").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});

/*Томская обл*/
$("#top_menu_17").hover(function() {
$(this).css("background-color","#e75127");
$(this).css("color","#ffffff");
$(this).css("cursor","pointer");
}, function() {
$(this).css("background-color","");
$(this).css("color","#474747");
$(this).css("cursor","default");
});
//top-menu finish

// show a simple loading indicator start
	var windowHeight = $("body").height();
	var top_zagr=-(windowHeight - 66)/2+100;
	
		var loader = jQuery('<div id="loader"><div style="position:absolute;top:'+top_zagr+'px;left:50%;width:66px;height:66px;margin-left:-33px;margin-top:-33px;border:0px dotted red;"><img src="/images/aloader.gif" alt="loading..." /></div></div>')
			.css({position: "relative", top: "0px", left: "0px"})
			.appendTo("#main_content")
			.hide();
		jQuery().ajaxStart(function() {					
			loader.show();
		}).ajaxStop(function() {
			loader.hide();
		}).ajaxError(function(a, b, e) {
			throw e;
		});
		// show a simple loading indicator end
		
		
//start	datepicker
/*
   $("input.p1").datepicker({	
	});
  
    $("input.p2").datepicker({
	});
*/	
/*	$("#dt_rojd").datepicker({
	changeMonth: "true",
	changeYear: "true",
	yearRange: "1910:2020"
	});
*/	
//end datepicker


//маска ввода для телефона Mobile
/*
 $("#Phone").mask("(999) 999-9999");
 $("#Mobile").mask("(999) 999-9999");
*/ 
  //$("#dt_rojd").mask("99.99.9999");


//////подписка на рассылку для турагентств старт////////////
  
  	$.validator.addMethod("validCifra", function(value) {
	if(/^([0-9]){1,}$/i.test($.trim(value)))return true;
	return false;
  });
	
	$.validator.addMethod("validTel_s_kodom", function(value) {
	var new_length1 = $('#kod_goroda').val().replace(/\s+/g,'').length;//длина без пробелов
	var new_length2 = value.replace(/\s+/g,'').length;	
	if((new_length1+new_length2)==10)return true;
	return false;
  });

	$.validator.addMethod("validRus", function(value) {
	if(/^([А-ЯЁа-яё0-9]|[-]|[ ]|[\.]|[,]|[\/]){1,}$/i.test($.trim(value)))return true;
	return false;
  });
	
	$.validator.addMethod("validLat", function(value) {
	if(/^([\w]|[-]|[ ]|[\.]|[,]|[\/]){1,}$/i.test($.trim(value)))return true;
	return false;
  });
	
	$.validator.addMethod("validRus_no_required", function(value) {
	if($.trim(value)=="")return false;//если пусто, то выходим и не проверяем													   
	if(/^([А-ЯЁа-яё0-9]|[-]|[ ]|[\.]|[,]|[\/]){1,}$/i.test($.trim(value)))return true;
	return false;
  });

	$.validator.addMethod("validData", function(value) {
	if((/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/i.test(value))==false)return false;	
	return true;
  });	

	$.validator.addMethod("validTel", function(value) {
	if((/^\([0-9]{3}\) [0-9]{3}-[0-9]{4}$/i.test(value))==false)return false;	
	return true;
  });

  $.validator.addMethod("validPunkt_vileta", function(value) {
	var mas = $('input[name=punkt_vileta[]]:input');
	if(pusto(mas))return false;//если пусто, то выход false
	return true;

  });

  $.validator.addMethod("validPunkt_prileta", function(value) {
	var mas = $('input[name=punkt_prileta[]]:input');
	if(pusto(mas))return false;
	return true;
  });
  
  $.validator.addMethod("validData_tuda", function(value) {
	var mas = $('input[name=data_tuda[]]:input');
	if(pusto_data(mas))return false;
	return true;
  });
  
    $.validator.addMethod("validData_obratno", function(value) {
	var mas = $('input[name=data_obratno[]]:input');
	if(pusto_data_obratno(mas))return false;
	return true;
  });
	
	$.validator.addMethod("validFamilia_rus_bron", function(value) {
	var mas = $('input[name=familia[]]:input');
	if(pusto_rus(mas))return false;
	return true;
  });
	
	$.validator.addMethod("validGrajdanstvo_rus_bron", function(value) {
	var mas = $('input[name=grajdanstvo[]]:input');
	if(pusto_rus(mas))return false;
	return true;
  });
	
	$.validator.addMethod("validName_rus_bron", function(value) {
	var mas = $('input[name=name[]]:input');
	if(pusto_rus(mas))return false;
	return true;
  });
	
	$.validator.addMethod("validData_rojdenia", function(value) {
	var mas = $('input[name=data_rojdenia[]]:input');
	if(pusto_data_rojdenia(mas))return false;
	return true;
  });
	
	$.validator.addMethod("validKont_lico", function(value) {
	if(/^([А-ЯЁа-яё]|[-]|[ ]|[\.]){1,}$/i.test($.trim(value)))return true;
	return false;
  });
	
	$.validator.addMethod("validVac", function(value) {
	var msg ="";
	$("#form_podpiska_na_rassilku input[id='vac[]']:checked").each(function(){
	msg +=this.value;});
	if(msg =="")return false;
	return true;
  });
	


function pusto(mas_vn)
{
	   for (var i=0; i<mas_vn.length; ++i)
       {
		if($.trim(mas_vn.eq(i).val())=="")return true;   
	   }
	return false;	
}

function pusto_data(mas_vn)
{
	   for (var k=0; k<mas_vn.length; ++k)
       {
		 var vnzn=$.trim(mas_vn.eq(k).val());
		if(vnzn=="")
		{
			return true;
		}
		else
		{
			if((/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/i.test(vnzn))==false)return true;								
		}
	   }
	return false;	
}

function pusto_data_obratno(mas_vn)
{
	   for (var k=0; k<mas_vn.length; ++k)
       {
		//делаем проверку на не пусто и на правильность даты, если в скрытом поле записано 1
		if($("input[name='skritoe[]']:input").eq(k).val()==1)
		{
		 	var vnzn=$.trim(mas_vn.eq(k).val());
			if(vnzn=="")
			{
			return true;
			}
			else
			{
			if((/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/i.test(vnzn))==false)return true;								
			}		
		}
		
	   }
	   
	   	return false;	
}

function pusto_rus(mas_vn)
{
	   for (var k=0; k<mas_vn.length; ++k)
       {
		  if ($("input[name='radio1']:checked").val() == 'bron')
		  {	
		 	var vnzn=$.trim(mas_vn.eq(k).val());
			if(vnzn=="")
			{
			return true;
			}
			else
			{//только русские буквы
			if((/^([А-ЯЁа-яё]|[-]|[ ]|[\.]){1,}$/i.test(vnzn))==false)return true;								
			}		
		}
		
	   }
	   
	   	return false;	
}

function pusto_data_rojdenia(mas_vn)
{
	   for (var k=0; k<mas_vn.length; ++k)
       {
		  if ($("input[name='radio1']:checked").val() == 'bron')
		  {	
		 	var vnzn=$.trim(mas_vn.eq(k).val());
			if(vnzn=="")
			{
			return true;
			}
			else
			{//проверка даты на xx.xx.xxxx
			if((/^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/i.test(vnzn))==false)return true;								
			}		
		}
		
	   }
	   
	   	return false;	
}



  $("#form_podpiska_na_rassilku").validate({
							  
	focusInvalid: false,
    focusCleanup: true,	

    rules: {
	   Fio2_: {
		   required: true,
           validRus:true     
      },
	  dt_rojd: {
		   required: true,
           validData:true     
      },
	  Birth: {
		   required:true,
           validRus:true     
      },
	  Marr: {
		   required:true,
           validRus:true     
      },
	  Child: {
		   required:true,
           validRus_no_required:true     
      },
	  Add: {
		   required:true,
           validRus:true     
      },
	  Edu1: {
		   required:true,
           validRus:false     
      },
	  Exp: {
		   required:true,
           validRus:false     
      },
	  Lang: {
		   required:true,
           validRus:true     
      },
	  PC: {
		   required:true   
      },
	  Skills: {
		   required:true   
      },
	  Pers0: {
		   required:true   
      },
	  Pers: {
		   required:true   
      },
	  Money: {
		   required:true   
      },
	  "vac[]": {
           validVac:true     
      },
      "punkt_vileta[]": {
           validPunkt_vileta:true     
      },
	  "punkt_prileta[]": {
           validPunkt_prileta:true     
      },
	  "data_tuda[]": {
           validData_tuda:true     
      },
	  "data_obratno[]": {
           validData_obratno:true     
      },
	  "familia[]": {
           validFamilia_rus_bron:true     
      },
	  "grajdanstvo[]": {
           validGrajdanstvo_rus_bron:true     
      },
	  "name[]": {
           validName_rus_bron:true     
      },
	  "data_rojdenia[]": {
           validData_rojdenia:true     
      },
	  kont_lico: {
           validKont_lico:true     
      },
	  kod_goroda: {
		   required:true,
		   validCifra:true,
           rangelength:[3,5]
	  },
	  tel1: {
		   required:true,
		   validCifra:true,	   
           validTel_s_kodom:true
	  },
	  
	  fax: {
		   required:true,
		   validCifra:true,	   
           validTel_s_kodom:true
	  },
      email: {
        required: true,
        email: true
      },
	  gorod: {
		   required: true,
           validRus:true,
		   minlength: 2,
		   maxlength: 200
      },
	  index_pocht: {
		   required: true,
		   validCifra:true,			   
		   minlength: 6,
		   maxlength: 6		   
      },
	  adress_pocht: {
		   required: true,
           validRus:true,
		   minlength: 10,
		   maxlength: 200
      },
	  inn: {
		   required: true,
		   validCifra:true,	
		   minlength: 10,
		   maxlength: 10		   
      },
      name: {
        required: true,
        minlength: 3,
		maxlength: 200
      },	  
      mes: {
        required: true,
        minlength: 50
      },	  
	  code: {
        required: true,
		validLat:true,
		minlength: 6,
		maxlength: 6
      }
    },
    messages: {
		Fio2_: {
		required: "Укажите контактное лицо!",
        validRus: "Используйте только русские буквы!"
      },
	  	dt_rojd: {
		required: "Укажите дату!",
        validData: "Используйте правильный формат: XX.XX.XXXX!"
      },
	  	Birth: {
		required: "Укажите место рождения!",
        validRus: "Используйте только русские буквы!"
      },
	  	Marr: {
		required: "Укажите семейное положение!",
        validRus: "Используйте только русские буквы!"
      },
	  	Child: {
		required: "Если нет детей, напишите НЕТ!",
        validRus_no_required: "Используйте только русские буквы!"
      },
	  	Add: {
		required: "Укажите ваш домашний адрес!",
        validRus: "Используйте только русские буквы!"
      },
	  	Edu1: {
		required: "Укажите ваше основное образование!",
        validRus: "Используйте только русские буквы!"
      },
	  	Exp: {
		required: "Укажите ваше опыт работы!",
        validRus: "Используйте только русские буквы!"
      },
	  	Lang: {
		required: "Укажите знание иностранных языков!",
        validRus: "Используйте только русские буквы!"
      },
	  	PC: {
		required: "Укажите знание компьютера!"
      },
	  	Skills: {
		required: "Укажите другие навыки и умения!"
      },
	  	Pers0: {
		required: "Укажите ваши интересы и увлечения!"
      },
	  	Pers: {
		required: "Укажите ваши личные качества!"
      },
	  	Money: {
		required: "Укажите желаемую заработную плату!"
      },
	  "vac[]": {
        validVac: "Вы не указали направления"
      },
	    "punkt_vileta[]": {
        validPunkt_vileta: "Заполните везде &laquo;Пункт вылета&raquo;"
      }, 
	    "punkt_prileta[]": {
        validPunkt_prileta: "Заполните везде &laquo;Пункт прилёта&raquo;"
      },
	  	"data_tuda[]": {
        validData_tuda: "Заполните везде &laquo;Дата туда&raquo;"
      },
	  	"data_obratno[]": {
        validData_obratno: "Заполните везде &laquo;Дата обратно&raquo;"
      },
	  	"familia[]": {
        validFamilia_rus_bron: "Заполните везде &laquo;Фамилия&raquo;"
      },
	  	"grajdanstvo[]": {
        validGrajdanstvo_rus_bron: "Заполните везде &laquo;Гражданство&raquo;"
      },
	  	"name[]": {
        validName_rus_bron: "Заполните везде &laquo;Имя&raquo;"
      },
	  	"data_rojdenia[]": {
        validData_rojdenia: "Заполните везде &laquo;Дата рождения&raquo;"
      },
       kont_lico: {
        validKont_lico: "Укажите контактное лицо!"
      },
       kod_goroda: {
        required: "Укажите код города!",
		validCifra: "Должны быть только цифры!",
		rangelength: "От 3 до 5 символов"
		//validTel: "Неправильно указан телефон!"
      },	  
       tel1: {
        required: "Укажите телефон без кода города!",
		validCifra: "Должны быть только цифры!",
		validTel_s_kodom: "Длина номера вместе с кодом города должна = 10 симв.!"
      },
	  fax: {
        required: "Укажите телефон без кода города!",
		validCifra: "Должны быть только цифры!",
		validTel_s_kodom: "Длина номера вместе с кодом города должна = 10 симв.!"
      },
      name: {
        required: "Введите название компании",
        minlength: "Не менее 3 символов!",
		maxlength: "Не более 200 символов!"
      },	  
      email: {
        required: "Введите ваш e-mail",
        email: "Е-mail указан некорректно!"
      },
	  gorod: {
		required: "Укажите название города!",
        validRus: "Используйте только русские буквы!",
		minlength: "Не менее 2 символов!",
		maxlength: "Не более 200 символов!"
      },
	  index_pocht: {
		required: "Укажите ваш почтовый индекс!",
		validCifra: "Должны быть только цифры!",
		minlength: "Длина должна быть 6 символов!",
		maxlength: "Длина должна быть 6 символов!"
      },	  
	  adress_pocht: {
		required: "Укажите почтовый адрес!",
        validRus: "Используйте только русские буквы!",
		minlength: "Не менее 10 символов!",
		maxlength: "Не более 200 символов!"
      },
	  inn: {
		required: "Укажите ИНН!",
		validCifra: "Должны быть только цифры!",
		minlength: "Длина должна быть 10 символов!",
		maxlength: "Длина должна быть 10 символов!"
      },
      mes: {
        required: "Введите ваше сообщение",
        minlength: "Не меннее 50 символов"
      },	  
	  code: {
        required: "Введите код с картинки!",
		validLat: "Переключите раскладку на латинницу!",
		minlength: "Должно быть введено 6 символов!",
		maxlength: "Должно быть введено 6 символов!"
      }
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
      label.html("&nbsp;").addClass("checked");
    }	
  });

//////подписка на рассылку для турагентств финиш/////////

/*form задать вопрос начало*/
  $("#form_zadat_vopros").validate({
							  
	focusInvalid: false,
    focusCleanup: true,	

    rules: {
      name: {
        required: true,
        minlength: 3,
	maxlength: 100
      },
      email: {
        email: true
      },	  
      mes: {
        required: true
      },	  
	code: {
        required: true,
		validLat:true,
		minlength: 6,
		maxlength: 6
      }
    },
    messages: {
      name: {
        required: "Введите имя",
        minlength: "Не менее 3 символов!",
		maxlength: "Не более 100 символов!"
      },	  
      email: {
        email: "Е-mail указан некорректно!"
      },
      mes: {
        required: "Введите ваше сообщение"
      },	  
	code: {
        required: "Введите код с картинки!",
		validLat: "Переключите раскладку на латинницу!",
		minlength: "Должно быть введено 6 символов!",
		maxlength: "Должно быть введено 6 символов!"
      }
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result_form_zadat_vopros",
        timeout: 3000,
    	beforeSend: function(){
    	$("#result_form_zadat_vopros").html("<img src=/images/loading.gif width=20 height=20 style=vertical-align:middle>");
    	}
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
      label.html("&nbsp;").addClass("checked");
    }	
  });
/*form задать вопрос конец*/



  $("#contact_form").validate({
							  
	focusInvalid: false,
    focusCleanup: true,	

    rules: {
	   Fio: {
		   required: true,
           validRus:true     
      },
	  dt_rojd: {
		   required: true,
           validData:true     
      },
	  Birth: {
		   required:true,
           validRus:true     
      },
	  Marr: {
		   required:true,
           validRus:true     
      },
	  Child: {
		   required:true,
           validRus_no_required:true     
      },
	  Add: {
		   required:true,
           validRus:true     
      },
	  Edu1: {
		   required:true,
           validRus:false     
      },
	  Exp: {
		   required:true,
           validRus:false     
      },
	  Lang: {
		   required:true,
           validRus:true     
      },
	  PC: {
		   required:true   
      },
	  Skills: {
		   required:true   
      },
	  Pers0: {
		   required:true   
      },
	  Pers: {
		   required:true   
      },
	  Money: {
		   required:true   
      },
	  "vac[]": {
           validVac:true     
      },
      "punkt_vileta[]": {
           validPunkt_vileta:true     
      },
	  "punkt_prileta[]": {
           validPunkt_prileta:true     
      },
	  "data_tuda[]": {
           validData_tuda:true     
      },
	  "data_obratno[]": {
           validData_obratno:true     
      },
	  "familia[]": {
           validFamilia_rus_bron:true     
      },
	  "grajdanstvo[]": {
           validGrajdanstvo_rus_bron:true     
      },
	  "name[]": {
           validName_rus_bron:true     
      },
	  "data_rojdenia[]": {
           validData_rojdenia:true     
      },
	  kont_lico: {
           validKont_lico:true     
      },
	  Mobile: {
		   required:true,
           validTel:true
	  },
      email: {
        required: true,
        email: true
      },
      name: {
        required: true,
        minlength: 3
      },	  
      mes: {
        required: true,
        minlength: 50
      },	  
	  code: {
        required: true,
		minlength: 6,
		maxlength: 6
      }
    },
    messages: {
		Fio: {
		required: "Укажите контактное лицо!",
        validRus: "Используйте только русские буквы!"
      },
	  	dt_rojd: {
		required: "Укажите дату!",
        validData: "Используйте правильный формат: XX.XX.XXXX!"
      },
	  	Birth: {
		required: "Укажите место рождения!",
        validRus: "Используйте только русские буквы!"
      },
	  	Marr: {
		required: "Укажите семейное положение!",
        validRus: "Используйте только русские буквы!"
      },
	  	Child: {
		required: "Если нет детей, напишите НЕТ!",
        validRus_no_required: "Используйте только русские буквы!"
      },
	  	Add: {
		required: "Укажите ваш домашний адрес!",
        validRus: "Используйте только русские буквы!"
      },
	  	Edu1: {
		required: "Укажите ваше основное образование!",
        validRus: "Используйте только русские буквы!"
      },
	  	Exp: {
		required: "Укажите ваше опыт работы!",
        validRus: "Используйте только русские буквы!"
      },
	  	Lang: {
		required: "Укажите знание иностранных языков!",
        validRus: "Используйте только русские буквы!"
      },
	  	PC: {
		required: "Укажите знание компьютера!"
      },
	  	Skills: {
		required: "Укажите другие навыки и умения!"
      },
	  	Pers0: {
		required: "Укажите ваши интересы и увлечения!"
      },
	  	Pers: {
		required: "Укажите ваши личные качества!"
      },
	  	Money: {
		required: "Укажите желаемую заработную плату!"
      },
	  "vac[]": {
        validVac: "Выберите интереусующую вас вакансию"
      },
	    "punkt_vileta[]": {
        validPunkt_vileta: "Заполните везде &laquo;Пункт вылета&raquo;"
      }, 
	    "punkt_prileta[]": {
        validPunkt_prileta: "Заполните везде &laquo;Пункт прилёта&raquo;"
      },
	  	"data_tuda[]": {
        validData_tuda: "Заполните везде &laquo;Дата туда&raquo;"
      },
	  	"data_obratno[]": {
        validData_obratno: "Заполните везде &laquo;Дата обратно&raquo;"
      },
	  	"familia[]": {
        validFamilia_rus_bron: "Заполните везде &laquo;Фамилия&raquo;"
      },
	  	"grajdanstvo[]": {
        validGrajdanstvo_rus_bron: "Заполните везде &laquo;Гражданство&raquo;"
      },
	  	"name[]": {
        validName_rus_bron: "Заполните везде &laquo;Имя&raquo;"
      },
	  	"data_rojdenia[]": {
        validData_rojdenia: "Заполните везде &laquo;Дата рождения&raquo;"
      },
       kont_lico: {
        validKont_lico: "Укажите контактное лицо!"
      },
       Mobile: {
        required: "Укажите телефон без восьмерки!",
		validTel: "Неправильно указан телефон!"
      },
      name: {
        required: "Укажите контактное лицо",
        minlength: "Должно быть не менее 3 символов"
      },	  
      email: {
        required: "Укажите ваш e-mail",
        email: "e-mail неправильный!"
      },
      mes: {
        required: "Введите ваше сообщение",
        minlength: "Должно быть не менее 50 символов"
      },	  
	  code: {
        required: "Введите код!",
		minlength: "Должно быть 6 символов",
		maxlength: "Должно быть 6 символов"
      }
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
      label.html("&nbsp;").addClass("checked");
    }	
  });

//отзывы старт
  $("#contact_form_otzivi").validate({
							  
	focusInvalid: false,
    focusCleanup: true,	

    rules: {
      email: {
        required: false,
	maxlength: 255,
        email: true
      },
      name: {
        required: true,
        maxlength: 255
      },	  
      mes: {
        required: true,
        maxlength: 2000
      },	  
	  code: {
        required: true,
		minlength: 6,
		maxlength: 6
      }
    },
    messages: {
      name: {
        required: "Укажите имя",
        maxlength: "Должно быть не более 255 символов"
      },	  
      email: {
        //required: "Укажите ваш e-mail",
        maxlength: "Должно быть не более 255 символов",
        email: "e-mail неправильный!"
      },
      mes: {
        required: "Введите ваше сообщение",
        maxlength: "Не более 2000 символов"
      },	  
	  code: {
        required: "Введите код!",
		minlength: "Должно быть 6 символов",
		maxlength: "Должно быть 6 символов"
      }
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
      label.html("&nbsp;").addClass("checked");
    }	
  });
//отзывы финиш

//поиск на главной старт
  $.validator.addMethod("valid_qr", function(value) {
	var str_qr=$("#qr").val();
        if($.trim(str_qr)!="")
	{
		if(str_qr=="Введите поисковый запрос")return false;
        	return true;
	}
	else
	{
        return false;
	}
  });



  $("#form_subm_main").validate({
							  
	focusInvalid: false,
    focusCleanup: true,	

    rules: {
      qr: {
           valid_qr:true     
      }
    },
    messages: {
    qr: {
        valid_qr: "Введите слово или фразу для поиска"
      }	  
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
	//класс, который добавляется в метке, в случае успеха
      //label.html("&nbsp;").addClass("checked");
    }	
  });


$("#qr").click(function() {
if($("#qr").val()=="Введите поисковый запрос")
	{
	$("#qr").val("");
	}
});
//поиск на главной финиш
//валидация формы end

//поиск на странице словарика старт

   $.validator.addMethod("valid_qr_sl", function(value) {
	var str_qr_sl=$("#qr_sl").val();
        if($.trim(str_qr_sl)!="")
	{
		if(str_qr_sl=="Введите первые буквы искомого слова")return false;
        	return true;
	}
	else
	{
        return false;
	}
  });



  $("#form_subm_slovarik").validate({
							  
	focusInvalid: false,
    focusCleanup: true,	

    rules: {
      qr_sl: {
           valid_qr_sl:true     
      }
    },
    messages: {
    qr_sl: {
        valid_qr_sl: "Введите первые буквы искомого слова"
      }	  
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
	//класс, который добавляется в метке, в случае успеха
      //label.html("&nbsp;").addClass("checked");
    }	
  });


$("#qr_sl").click(function() {
if($("#qr_sl").val()=="Введите первые буквы искомого слова")
	{
	$("#qr_sl").val("");
	}
});


//поиск на странице словарика финиш
//валидация формы end
/*
//на странице словарика старт

	$("#qr_sl").autocomplete("autocompl.php", {
width: 260,
delay:400,
matchSubset:1,
autoFill:true,
matchContains:1,
cacheLength:10,
selectFirst:true
	});
//на странице словарика финиш
*/

//form agency главной старт

  $("#form_agency_main").validate({
							  
    focusInvalid: false,
    focusCleanup: true,	

    rules: {
      login: {
        required: true
      },	  
      passw: {
        required: true
      }
    },
    messages: {
      login: {
        required: "Введите логин"
      },
      passw: {
        required: "Введите пароль"
      }	  	  
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
	//класс, который добавляется в метке, в случае успеха
      label.html("&nbsp;").addClass("checked");
    }	
  });


//form agency главной финиш
//валидация формы end





//tooltip start

$('a.s8,a.s77,a.s78,a.s3,a.s10,img.vsp1,a.s18b').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	showBody: " &&& ",
	extraClass: "pretty",
	fixPNG: true,
	left: -30, //Позиция основного окна подсказки относительно указателя мыши
	top: 10 
});

$('a.s76,div.objects4').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	showBody: " &&& ",
	extraClass: "pretty2",
	fixPNG: true,
	left: -30,
	top: 10 
});

$('a.spop1').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	showBody: " &&& ",
	extraClass: "pretty3",
	fixPNG: true,
	left: -30,
	top: 10 
});

$('a.spop2').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	showBody: " &&& ",
	extraClass: "pretty4",
	fixPNG: true,
	left: -30,
	top: 10 
});

//tooltip finish

});//end $(document).ready 

//добавить в закладки cтарт
function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 10 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
// if (window.navigator.userAgent.indexOf ("MSIE") >= 0) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
 return false;
} 
//добавить в закладки финиш
function sotrudnichestvo(){
jQuery.facebox("<div style='width:270px;padding:20px 20px 10px 20px;text-align:justify'>Чтобы получить полный доступ к разделу для агентств, обратитесь за логином и паролем к Пожидаевой Ольге по тел. <b>212-58-76</b> или по e-mail: <a href='mailto:agent@acris.ru'>agent@acris.ru</a></div>");
//$('#facebox').css('left', $(window).width() / 2 - ($('#facebox table').width() / 2)+30);
//$('#facebox').css('top', '500');

}
//для универсальной формы старт
function form_avtor(){
jQuery.facebox("<form action='/obr.htm' method='POST' name='form_agency_main' id='form_agency_main'><div style='padding: 5px 0 0 0px;float:left;font-size:11px;width:40px'>Логин:</div><div style='padding: 4px 0 0 5px;'><label for='login'><span class='main_form3'></span></label><input name='login' id='login' maxlength=120 style='width:127px'></div><div style='clear:both'></div><div style='padding: 9px 0 0 0px;float:left;font-size:11px;width:40px'>Пароль:</div><div style='padding: 8px 0 0 5px'><label for='passw'><span class='main_form3'></span></label><input type='password' name='passw' id='passw' maxlength=120 style='width:127px'></div><div style='clear:both'></div><div style='position:relative;height:9px;widht:20px'><div id=result style='font-size:10px;height:9px;color:#a11d1f;position:absolute;top:-3px;left:-7px;width:250px'></div></div><div style='padding: 0 0 5px 40px'><input type='submit' id='submit' value='' style='background: url(/var/images/139x16.gif);width:139px;height:16px;border:0'/></div><div style='clear:both'></div></form>");

$('#facebox').css('left', $(window).width()- ($(window).width() / 2 - ($('#stop').width() / 2))-450);
$("#stop").width()
//$("#stop").width();
$('#facebox').css('top', '100px');
$(document).ready(function() {
/////////////
  $("#form_agency_main").validate({
							  
    focusInvalid: false,
    focusCleanup: true,	

    rules: {
      login: {
        required: true
      },	  
      passw: {
        required: true
      }
    },
    messages: {
      login: {
        required: "Введите логин"
      },
      passw: {
        required: "Введите пароль"
      }	  	  
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
	//класс, который добавляется в метке, в случае успеха
      label.html("&nbsp;").addClass("checked");
    }	
  });
/////////////

$("#submit").hover(function() {
	$(this).css("background","url(/var/images/139x16_over.gif)");
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("background","url(/var/images/139x16.gif)");
	$(this).css("cursor","default");
});


});

}
//для универсальной формы финиш

function popup1(){
var left_zagr=(screen.width - 573)/2-10;
var top_zagr=(screen.height - 647)/2-30;
window.open('http://bus54.ru/inc/contact_hotels_avto.php?rand=1','name_win2','menubar=0,toolbar=0,location=0,status=0,scrollbars=0,resizable=0,width=573,height=647,left='+left_zagr+',top='+top_zagr);
}

function virtual(tt){
var tt;
jQuery.facebox({ ajax: tt });
}

/*всплывающее сообщить об ошибке старт*/

$(document).ready(function() {

    $(document).bind("keydown", function(event) {
        if (event.ctrlKey) {
            var link = null;
            var href = null;
            switch (event.keyCode ? event.keyCode : event.which ? event.which : null) {
                case 0xD:
		    $("#remarkText").val(jQuery.trim(getSelText()));
		    $("#remarkComment").val("");
                    $("#url_remark").val(window.location.href);

			if(jQuery.trim(getSelText())!="")
			{
			var left_zagr=(screen.width - 465)/2;
			var top_zagr=(screen.height - 430)/2-100;
			$("#remark_vn").css("left",left_zagr);
			$("#remark_vn").css("top",top_zagr);

			$("#remark_vn").show();
                        showOverlay();
			}
                    break;
            }
        }
	
    });
//////////////////

//добавляем затемнённый слой
function showOverlay() {
if ($('remark_vn_overlay').length == 0) 
$("body").append('<div id="remark_vn_overlay" class="remark_vn_hide"></div>')
return false
}

//закрываем окно по кнопке
$(".close").click(function() {
hideOverlay()
});

$(".close2").click(function() {
hideOverlay2()
});

//закрываем окно по затемнённому слою
$("#remark_vn_overlay").live("click",function() {
hideOverlay()
});

//закрываем окно по клавише "ESC"
$(document).bind('keydown', function(e) {
//$(document).bind('keydown.remark_vn', function(e) {
if (e.keyCode == 27) hideOverlay()
return true
})

//функция, выполняющая закрытие окна
  function hideOverlay() {
    $('#remark_vn_overlay').fadeOut(200, function(){
      $("#remark_vn_overlay").remove()
	$("#remark_vn").hide()
	$("#remark_result").empty()
    })
    
    return false
  }


  function hideOverlay2() {
    $('#remark_vn_overlay').fadeOut(200, function(){
      $("#remark_vn_overlay").remove()
	$("#remark_vn").hide(100,
	function(){
		var left_zagr=(screen.width - 262)/2;
		var top_zagr=(screen.height - 262)/2-100;
		$("#mishka").css("left",left_zagr);
		$("#mishka").css("top",top_zagr);
		//Мишка появляется
                setTimeout(function() { $("#mishka").css("display","block");$("#img_mishka").attr("src","/var/images/196x196_1.png"); }, 100);
                setTimeout(function() { $("#mishka").css("display","block");$("#img_mishka").attr("src","/var/images/196x196_2.png"); }, 2000);
                setTimeout(function() { $("#mishka").css("display","block");$("#img_mishka").attr("src","/var/images/196x196_3.png"); }, 2250);
                setTimeout(function() { $("#mishka").css("display","block");$("#img_mishka").attr("src","/var/images/196x196_4.png"); }, 2500);
		//Мишка исчезает
                setTimeout(function() { $("#mishka").css("display","none"); }, 4000);
	}

		);
	$("#remark_result").empty()
    })
    
    return false
  }

//////////////////

//кнопка субмит
$(".kn_remark").hover(function() {
	$(this).css("background","url(/var/images/139x16_ras.png)");
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("background","url(/var/images/139x16_ras_over.png)");
	$(this).css("cursor","default");
});




//form form_remark старт

  $("#form_remark").validate({
							  
    focusInvalid: false,
    focusCleanup: true,	

    rules: {
      remarkText: {
        required: true,
        maxlength: 1000
      },	  
      remarkComment: {
        //required: true,
        maxlength: 1000
      },
      remarkName: {
        //required: true,
        maxlength: 100
      },
      remarkEmail: {
        //required: true,
        maxlength: 100,
	email: true
      }
    },
    messages: {
      remarkText: {
        required: "Нет выделенного текста",
        maxlength: "Должно быть не более 1000 символов"
      },
      remarkComment: {
        //required: "Введите комментарий:",
        maxlength: "Должно быть не более 1000 символов"
      },
      remarkName: {
        //required: "Введите ваше имя:",
        maxlength: "Должно быть не более 100 символов"
      },
      remarkEmail: {
        //required: "Введите e-mail:",
        maxlength: "Должно быть не более 100 символов",
	email: "E-mail введён неверно"
      }	  	  	  	  	  	  	  	  
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#remark_result",
        timeout: 3000,
    beforeSend: function(){
    $("#remark_result").html("<img src=/images/loading.gif width=20 height=20 style=vertical-align:middle>");
    }
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
	//класс, который добавляется в метке, в случае успеха
      //label.html("&nbsp;").addClass("checked");
    }	
  });


//form_remark финиш



}); //конец read...





function getSelText() {
    var txt = '';
    if (window.getSelection) {
        txt = window.getSelection();
    }
    else if (document.getSelection) {
        txt = document.getSelection();
    }
    else if (document.selection) {
        txt = document.selection.createRange().text;
    }
    return txt;
}



//вход агентов в помощь старт
function form_avtor_help(){
jQuery.facebox("<form action='/obr_help_agent.htm' method='POST' name='form_agency_help' id='form_agency_help'><div style='padding: 5px 0 0 0px;float:left;font-size:11px;width:40px'>Логин:</div><div style='padding: 4px 0 0 5px;'><label for='login'><span class='main_form3'></span></label><input name='login' id='login' maxlength=120 style='width:127px'></div><div style='clear:both'></div><div style='padding: 9px 0 0 0px;float:left;font-size:11px;width:40px'>Пароль:</div><div style='padding: 8px 0 0 5px'><label for='passw'><span class='main_form3'></span></label><input type='password' name='passw' id='passw' maxlength=120 style='width:127px'></div><div style='clear:both'></div><div style='position:relative;height:9px;widht:20px'><div id=result_form_agency_help style='font-size:10px;height:9px;color:#a11d1f;position:absolute;top:-3px;left:-7px;width:250px'></div></div><div style='padding: 0 0 5px 40px'><input type='submit' id='submit_form_agency_help' value='' style='background: url(/var/images/139x16.gif);width:139px;height:16px;border:0'/></div><div style='clear:both'></div></form>");

//$('#facebox').css('left', $(window).width()- ($(window).width() / 2 - ($('#stop').width() / 2))-450);
//$("#stop").width()
//$('#facebox').css('top', '100px');

//$('#facebox').css('display', 'fixed');
$('#facebox').css('top', $(window).height() / 2-50);
$('#facebox').css('display', 'fixed');


$(document).ready(function() {
/////////////
  $("#form_agency_help").validate({
							  
    focusInvalid: false,
    focusCleanup: true,	

    rules: {
      login: {
        required: true
      },	  
      passw: {
        required: true
      }
    },
    messages: {
      login: {
        required: "Введите логин"
      },
      passw: {
        required: "Введите пароль"
      }	  	  
    },
    submitHandler: function(form) {
      // вызываем метод ajaxSubmit
      // плагина jquery.form.js
      $(form).ajaxSubmit({
        target: "#result_form_agency_help",
        timeout: 3000
      });
    },
    errorPlacement: function(error, element) {
      error.appendTo(
        element.parent()
        .find("label[for='" + element.attr("name") + "']")
        .find("span")
      );
    },
	 success: function(label) {
	//класс, который добавляется в метке, в случае успеха
      label.html("&nbsp;").addClass("checked");
    }	
  });
/////////////

$("#submit_form_agency_help").hover(function() {
	$(this).css("background","url(/var/images/139x16_over.gif)");
	$(this).css("cursor","pointer");
}, function() {
	$(this).css("background","url(/var/images/139x16.gif)");
	$(this).css("cursor","default");
});


});

}
//вход агентов в помощь финиш

