function header() {
	var h = '-' + $('.header .blockTop').height() + 'px';
	$('.expoFlash').css('top', h);
	$('.expoFlash').css('marginBottom', h);
	$('.expoFlash').show(1);
}


function openMenu(el) {
	$('.menu UL UL').hide();
	
	if(el.css('display')!='block') {
		el.animate({height: 'show'}, 300);
	}
	else{
		 el.animate({height: 'hide'}, 300);
	}
}

function closeArh() {
	if($('.link .arhiveYear').css('display') != 'block') {
		$('.link .arhive a')[0].className = 'allColor2';
		$('.link .arhiveYear').show(500);
	}
	else{
		$('.link .arhive a')[0].className = '';
		$('.link .arhiveYear').hide(500);
	}
	return false;
}

function popapOpen(el) {
	$('.content form').hide();
	$('.' + el).fadeIn(600);
	$('.shadow').css('display', 'block').fadeTo("fast", 0.4);
	}

function popapClose() {
	$('.content form').show();
	$('.popap').fadeOut(600);
	$('.shadow').fadeTo("fast", 0).css('display', 'none');
	}
//===================================================================================================


$(document).ready(function() {
	                  $('.popap .blockClose').click(popapClose);
	                  $('.sideSearch .inputText').click(function() { this.value = (this.value != 'Я ищу...') ? this.value : ''; });
	                  $('.sideSearch .inputText').blur(function() { this.value = (this.value == '') ? 'Я ищу...' : this.value;});
	                  $('.menu UL UL[rel=close]').css('display', 'none');
	                  $('.allSendForm A.allColor1').css('display', 'inline');
	                  $('.arhiveYear .close').click(closeArh);
	                  $('.link .arhive a:eq(0)').click(closeArh);
	                  $('.menu:not([rel=archive]) div:eq(0) a').click(function() {openMenu($('.menu UL UL:eq(0)'));return false;});
	                  $('.menu:not([rel=archive]) div:eq(1) a').click(function() {openMenu($('.menu UL UL:eq(1)'));return false;});
	                  $('.menu:not([rel=archive]) div:eq(2) a').click(function() {openMenu($('.menu UL UL:eq(2)'));return false;});
	                  $('.menu:not([rel=archive]) div:eq(3) a').click(function() {openMenu($('.menu UL UL:eq(3)'));return false;});

	                  header();
                      
	                  $('a.printPage').attr('target','_blank');
                      
                      outLinks();
                  });

// change your domain name:
//var yourURL = "construction-exhibitions.ru";
function outLinks() {
  var outLink;
  if (document.getElementsByTagName('a')) {
    for (var i = 0; (outLink = document.getElementsByTagName('a')[i]); i++) {
      if (outLink.href.indexOf(yourURL) == -1) {
        outLink.setAttribute('target', '_blank');
      }
    }
  }
}
