(function($){$(function(){

	$(".g-js-hiding").each(function(i){

		var $l = $(this);
		var $i = $("#"+$l.attr("for"));

		if ( $i.val() ) $l.hide();

		$i.focus(function(e){
			$l.hide();
		}).blur (function(e){
			if( $i.val()=="" ) $l.show();
		});
	});

	$(".g-js-dropdown").each(function(){
		var $this = $(this);
		var $fill = $this.find(".fill");
		var $ul = $this.find("ul")
		$(this).mouseenter( function(e){ 
			$fill.show(); 
			$ul.show(); 
		}).mouseleave( function(e){ 
			$fill.hide(); 
			$ul.hide(); 
		});
	});
	
	$('.b-send-resume').click(function(){
		var value = $(this).parent().contents().get(0).textContent.replace(/(^\s+)|(\s+$)/g, "");
		$('#_vacancy').val(value);
	});
	$(".g-js-opener").parent().parent().next().hide()
	$(".g-js-opener").click( function(e){
		$(this).parent().parent().next().toggle();
		return false;
	});		
	
	$(".g-js-print").click(function(e){
		var $dt = $(this).parent().parent().prev();
		var $dl = $dt.parent();
		var $c  = $dl.parent();
		var $other = $dt.siblings().add($dl.siblings()).add(".l-header").add(".l-footer").add(".l-sidebar");
		$other.hide();
		$dt.next().show(); 
		if( $.browser.msie ) {
			window.onafterprint = function() {
				$other.show();
			};
		};
		window.print();
		if( !$.browser.msie ) {
			$(document).one("focus", function(){
				$other.show();
			});
		}
		return false;
	});
	
	$(document).keydown(function(e){
		var link;
		if (e.which == 37 && e.ctrlKey) link = $('#prevPageLink').attr('href');
		if (e.which == 39 && e.ctrlKey) link = $('#nextPageLink').attr('href');
		if (link) location.href = link;
	});
	
	
	//register form captcha
	$('#_email').change(function(){
		$('#_nexus6').val($('#_email').val().split('').reverse().join(''));
	});
	

})})(jQuery)
