$(function() {
 $('input[name=ajax]').val(1);
});

$(document).ready(function() { 
    // bind form using ajaxForm 
    $('#formLogin').ajaxForm({ 
        // dataType identifies the expected content type of the server response 
	target : '#box_login',
 	dataType : 'json',
        // success identifies the function to invoke when the server response 
        // has been received 
        success:   function(code,data2,data) { 
            /*alert(code.text);*/
		if (code.code == 10) {
			$('#box_login').html(code.text);
		} else {
			alert(code.text);
		  }
	}
    }); 
});

function processJson(data) { 
    // 'data' is the json object returned from the server 
    alert(data.text); 
}

function userLogout() {
	$('#box_login').load('/bin/users/logout.php',{ajax:1});
}

$(function() {
        href = $('a[name=passwordLost]').attr('href');
        $('a[name=passwordLost]').attr('href',href+'?ajax=1&KeepThis=true&TB_iframe=true&height=300&width=600');
});

$(function() {
        href = $('a[name=salvaRicerche]').attr('href');
        $('a[name=salvaRicerche]').attr('href',href+'&ajax=1&KeepThis=true&TB_iframe=true&height=300&width=600');
});