var main_host;
var img_array = new Array();
var swap_img = "";
var debug = true;

$().ready(function() {


  main_host = $('base').attr('href');

  log('Campi restricted: '+$('.restricted').size());
  $('.restricted').bind('keypress', function(e) {
    return restricted(e, $(this).attr('rel'));
  });
	if($('.popup').length > 0) {
		buttons  = {};
		buttons[getLang('base', 'CLOSE')] = function() {
																									 $('.popup').dialog('destroy');
																							 };
		$('.popup').dialog({
			title: getLang('base', 'COMUNICAZIONE_IMPORTANTE'),
			modal : true,
			overlay: {
				backgroundColor: '#000',
				opacity: 0.5
			},
			buttons: buttons,
			close: function(event, ui) { $('.popup').dialog('destroy'); },
			position: new Array('center', 20, 'center', 0) ,
			heigth: '450px',
			width: '600px'
		});
	}

  /**
   * Gestione degli helptip.
   */
  $('.helptip').hover(function() { showhelptip(this);}, function () {hidehelptip()});
  $('.helptip').bind('click', function() { return false; });

  $('.newwindow').each(function() {
    $(this).attr({'title' : $(this).attr('title')+' '+getLang('base', 'NEW_WINDOW')});
  });

  $('.newwindow').bind('click', function() {
    href = $(this).attr('href');
    height = $(window).height()-30;
    width = $(window).width()-30;
    window.open(href, '', 'width='+width+',height='+height);
    return false;
  });

  $('#audiorecaptcha').bind('click', function() {
    recaptchaAudio();
    return false;
  });

  $('#textrecaptcha').bind('click', function() {
    recaptchaText();
    return false;
  });

});

$(window).load(function() {
  $('.rollover').hover(function() { rolloverimg(this) },function() { rolloutimg(this) });
});







