ingateFormCheck = function(){
	$("input.clearme").focus(function(){
		if ( $(this).attr("title") == $(this).attr("value") ){
			$(this).attr({"value": ""});
		}
	});
	$("input.clearme").blur(function(){
		if ( $(this).attr("value") == "" ){
			var defText = $(this).attr("title");
			$(this).attr({"value": defText});
		}
	});
	
	$("textarea.clearme").focus(function(){
		if ( $(this).attr("title") == $(this).html() ){
			$(this).html("");
		}
	});
	$("textarea.clearme").blur(function(){
		if ( $(this).html() == "" ){
			var defText = $(this).attr("title");
			$(this).html(defText);
		}
	});
}

startBanner = function(){
	$('.tours').animate({opacity: 0}, 1500, function(){
		$('.virt').animate({opacity:1}, 1500, function(){
			$('.virt').animate({opacity:0}, 1500, function(){
				$('.tours').animate({opacity:1}, 1500, function(){
					
				});
			});
		});
	});
}

$(document).ready(function(){
	$("#block0234394").hide();
	$("#contacts-block0234394 span").toggle(
							function () {
								$("#block0234394").show("fast");
								$("#contacts-block0234394").toggleClass("active");
								$("#contacts-block0234394").toggleClass("simpl");
							},
							function () {
								$("#block0234394").hide("fast");
								$("#contacts-block0234394").toggleClass("active");
								$("#contacts-block0234394").toggleClass("simpl");
							}
						);
	ingateFormCheck();
	$("a[rel=lightbox]").fancybox({ 'zoomSpeedIn': 0, 'zoomSpeedOut': 0, 'overlayShow': true });
	startBanner();
	window.setInterval(startBanner, 6000);	
});

// Добавить в Избранное
function add_favorite(a) {
  title=document.title;
   url=document.location;
   try {
     // Internet Explorer
     window.external.AddFavorite(url, title);
   }
   catch (e) {
     try {
       // Mozilla
       window.sidebar.addPanel(title, url, "");
     }
     catch (e) {
       // Opera
       if (typeof(opera)=="object") {
         a.rel="sidebar";
         a.title=title;
         a.url=url;
         return true;
       }
       else {
         // Unknown
         alert('Нажмите Ctrl-D чтобы добавить страницу в закладки');
       }
     }
   }
   return false;
}

