
//for link opened in new tab
/*function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName('a');
for (var i=0; i < anchors.length; i++) {
	if (anchors[i].getAttribute('href') &&

	anchors[i].getAttribute('rel') == 'external') {
		anchors[i].target = '_blank';
	}
}

}*/


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)//.animate({height: 'hide'}, 500);	
	}
	else{
		$('.link .arhive a')[0].className='';
		$('.link .arhiveYear').hide(500)//.animate({height: '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');
	}
//===================================================================================================


$(function(){
	$('.popap .blockClose').click(popapClose);
	$('.sideSearch .inputText').click(function(){this.value!='searching for...'?this.value=this.value:this.value='';});
	$('.sideSearch .inputText').blur(function(){this.value==''?this.value='searching for...':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;});
	$('.menu:not([rel=archive]) div:eq(4) a').click(function(){openMenu($('.menu UL UL:eq(4)'));return false;});
	$('.menu:not([rel=archive]) div:eq(5) a').click(function(){openMenu($('.menu UL UL:eq(5)'));return false;});
	//$('.header .logo a').click(function(){popapOpen('popap');return false});
})


window.onload = function(){
	header();
}

$(document).ready(function(){
	$('a.printPage').attr('target','_blank');
});

// 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');
      }
    }
  }
}
$(document).ready(function(){outLinks();});