jQuery( document ).ready( function () {

  // assign language
  oCONSTANT.LANGUAGE = oCONSTANT.LANGUAGE[oGlobal.langCode.toUpperCase()];

  // assign name (to avoid: id="txtFoo" name="txtFoo")
  jQuery( 'form :input[id]' ).each( function () {
    if (jQuery( this ).attr( 'name' ) == '' || jQuery( this ).attr( 'name' ) == null) {
      jQuery( this ).attr( 'name', jQuery( this ).attr( 'id' ) );
    }
  } );

  // initialize events
  jQuery( 'input' ).keyup( function (e) { if ((e.keyCode ? e.keyCode : e.which) == 13) { jQuery( 'form' ).submit(); } } ); // 13 - enter/return
  jQuery( 'div.submit input:button' ).click( function () { jQuery( 'form' ).submit(); } );

  // set focus
  jQuery( 'form :input:first[value=""]' ).focus();

  // set google analytics tracking value
  pageTracker._setVar( 'Tenant' );

} );

function logout( sURL ) {
  if (confirm( oCONSTANT.LANGUAGE.MESSAGE.CONFIRM.LOGOUT )) { window.location = jQuery( 'base' ).attr( 'href' ).replace( /\/application\/.+/, '' ) + sURL + '/logout'; }
}


