/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



//$(window).bind('beforeunload', function() {
//  $.ajax({
//    url: '/frontend_dev.php/user-disconnect',
//    async: false
//  });
//});


$(document).ready (function() {
    jQuery.fn.exists = function(){return jQuery(this).length>0;}


    jQuery.fn.dynamicInput = function(vars) {
      if (vars.defaultString == null) {
        alert('errore nell\'uso di dynamicInput, va specificata la variabile defaultString!');
      }
      $input = jQuery(this);
      if ($input.val() == "") {
        $input.val(vars.defaultString);
      }

      $input.focus(function() {
        if ($(this).val() == vars.defaultString) {
          $(this).val('');
        }
      });
      $input.blur(function() {
        if ($(this).val() == '') {
          $(this).val(vars.defaultString);
        }
      });
    }
})



jQuery.fn.caption = function(vars) {

}


// TENDINA LOGIN
$(document).ready( function() {
  sostituisciPulsanteTendina();
});

function sostituisciPulsanteTendina()
{
  $('#tendina-login input#button-login').remove();
  $bottoneLogin = $('<a>');
  $bottoneLogin.addClass('button');
  $bottoneLogin.html('log in');
  $bottoneLogin.attr('href', '#');
  $bottoneLogin.click( function() {
    $('#tendina-login form').submit();
  });
  $('#tendina-login form').append($bottoneLogin);
}
