  $(function() {
    
    $('.tipsyTool').tipsy({gravity: 's'});
   
  });

var hiddenShare = false;  

$(document).ready(function(){
	$('#facebook').bind('mouseover',function(){
		$(this).attr('src',img+'facebook_on.png');
	});
	$('#facebook').bind('mouseout',function(){
		$(this).attr('src',img+'facebook.png');
	});
	$('#twitter').bind('mouseover',function(){
		$(this).attr('src',img+'twitter_on.png');
	});
	$('#twitter').bind('mouseout',function(){
		$(this).attr('src',img+'twitter.png');
	});
	$('#in').bind('mouseover',function(){
		$(this).attr('src',img+'in_on.png');
	});
	$('#in').bind('mouseout',function(){
		$(this).attr('src',img+'in.png');
	});
	$('#youtube').bind('mouseover',function(){
		$(this).attr('src',img+'youtube_on.png');
	});
	$('#youtube').bind('mouseout',function(){
		$(this).attr('src',img+'youtube.png');
	});
	shareHiddens();
	$(window).bind('resize', function() {
		shareHiddens();
	});
	$('#src_submit').click(function(){
	    if ( $('#src_input').val() != '' && $('src_input').val() != 'Keresés' ) {
		window.location.href = doc_root + 'kereses/'+$('#src_input').val();
	    }
	});
});

function shareHiddens(){
	var width = $(document).width();
	if ( width < 1129 ){
		$('#social').css('display','none');
		hiddenShare = true;
		showShare();
	}
	else {
		$('#social').css('display','block');
		hiddenShare = false;
	}
}

function showShare(){
	$(document).mousemove(function(e){
		if ( hiddenShare  ) {
			if ( ( e.pageX > 0 && e.pageX < 78 ) && ( e.pageY > 200 && e.pageY < 568 ) ){
				$('#social').show('slow');
			}
			else {
				$('#social').hide('slow');
			}
		}
	});
}
