$(function(){
	$('#login-btn').click(function(event) {
	    event.preventDefault();
		$('#login-block').show();//css({'opacity': 0}).animate({opacity:1},600)
	});
	$('#login-block-close-btn').click(function(event) {
	    event.preventDefault();
		$('#login-block').hide();
	});
    $('#login-btn2').click(function(event) {
	    event.preventDefault();
		$('#login-block').show().css({'opacity': 0}).animate({opacity:1},600);
	});
    $("#select-user-agreement-btn").click(function(){
         $(".search-sel").bind('click',close_popup);
         $('#user_agreement_block').show();
        });
    $(".s2").hover(function(){
        $(".search-sel").unbind('click',close_popup)},
        function(){$(".search-sel").bind('click',close_popup)
        }
        );
    $(".send_title_close").click(function(){
        $('#user_agreement_block').hide();
    });
    $("#user_agreement_button_close").click(function(){
        $('#user_agreement_block').hide();
    });

});
var close_popup = function() {
    $('#user_agreement_block').hide();
    $(".search-sel").unbind('click',close_popup);};
//$(document).ready(function() {
//    // bind form using ajaxForm
//    $('#login-block-form').ajaxForm({
//        // dataType identifies the expected content type of the server response
//        dataType:  'json',
//
//        // success identifies the function to invoke when the server response
//        // has been received
//        success:   processJsonLogin
//    });
//});
function processJsonLogin(data) {
    // 'data' is the json object returned from the server
    if(data.loggedin == 1) {
        alert("Logged in");
    } else {
        alert("Login failed");
    }
}
