jQuery(function(){
	
	function showEFormCall(){
		jQuery('div.popup_block_call').prepend('<a href="#" class="close"><img style="margin-top: -6px; margin-right: -8px;" src="/img/cross.png" /></a>').fadeIn();
		
		var popMargTop = (jQuery(".popup_block_call").outerHeight()) / 2;
		var popMargLeft = (jQuery(".popup_block_call").outerWidth()) / 2;
		
		jQuery(".popup_block_call").css({
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		jQuery('body').append('<div class="popup_bg"></div>');
		jQuery('.popup_bg').css({'filter' : 'alpha(opacity=50)'}).fadeIn();
	
		jQuery('a.close, .popup_bg').live('click', function() {
			jQuery('.popup_bg , .popup_block_call').fadeOut(function() {
				jQuery('.popup_bg, a.close').remove();
			});
			return false;
		});
	}

	if(window.location.hash == "#erOkCall") {
		showEFormCall();
	}
	
	jQuery("a[href=#callyou]").click(function(){
		showEFormCall();	
		return false;
	});
	
	$('#erNameCall, #erPhoneCall').keyup(function(){
		if ( $('#erNameCall').val().length > 2 && $('#erPhoneCall').val().length > 6){
			$('#erSendCall').attr('disabled',false);
		}
		else{
			$('#erSendCall').attr('disabled',true);
		}
	}); 

});
