(function ($) {
  Drupal.behaviors.manipulateFormElements = {
    attach: function(context, settings) {
    // give the login form some love
    $('#user-login-form .login-submit-link').click(function(){
    	$('#user-login-form').submit();
    	return false;
    });
    }
  };
  Drupal.behaviors.correctActiveTrails = {
    attach: function(context, settings) {
      // fix menus that don't respect active trail because drupal links are stoopid
    $('#region-menu ul li.active').parents('li').addClass('active-trail');
    }
  };
})(jQuery);
;
// $Id: ruxisa.js $
/*
** we're using the jQuery based javascript, but our design pattern will be
** the Yui object paradigm which is much better at stability and 
** expandability.
*/
var Ticode = (("undefined" == typeof Ticode) || (!Ticode)) ? {} : Ticode;

(
function ($)
{

Ticode.ZoomUp = function ()
{
  /*  
  ******************************************************************
  ** private variables available only to methods of the module.
  */

  /*  
  ** private shorthand variables to comon jQuery parts/utilities
  */

  /*  
  ** private shorthand variable for built jQuery objects. set in init()
  */

  /*  
  ** constants used in this module.
  */
  var imgpopup	= { autoOpen: false
		  , show:     'blind'
		  , width:    845
		  , modal:    true
		  , hide:     'explode'
		  , closeText:''
		  , top:      10
		  , left:     400
		  }
    ;

  /*  
  ** module state:
  */
  var built = { }
    ;

  /*  
  ** these are Dom refrences that won't change, they are set by direct
  ** calls when needed, and then used freely after that.
  */

  /*  
  ** ******************************************************************
  ** private methods available only to other methods of the module.
  */
  var that =
    /*
    ** publicly accessible variables where we store AJAX results by
    ** evaluating valid js pointing to these arrays.
    */
    { translations: [] // Ticode.ZoomUp.translations[]

      /*
      ** public method Ticode.ZoomUp.popZU() -- Method setus up jquery 
      **                                          dialog imageing.
      */
    , popZU: function ()
      {
	var a	  = $(this)
	  , link  = null
	  ;
	link  = $(a).attr('href');

	if (!built[link])
	{
	  var box = $('<div />')
	    , ac  = $('<a />')
	    , img = $('<img />')
	    ;
	  $(img)  .attr('src', link);
	  $(ac)	  .append(img);
	  $(box)  .append(ac);
	  $(box)  .dialog(imgpopup);

	  var popup = function ()
	      {
		$(box).dialog('open');

		return false;
	      }
	    , closer = function ()
	      {
		$(box).dialog('close');

		return false;
	      }
	    ;
	  $(this) .click(popup);
	  $(ac)	  .click(closer);

	  built[link] = 1;
	}
      }
    };
      /*
      ** for finding .attr('style', 'background:#ee9933');
      */
        //attr('style', 'background:#ee9933');

  return that;

}(); // the parens here cause the anonymous func to execute and return

Drupal.behaviors.zoomup =
{
  attach: function(context, settings)
  {
    // first we init the hs and then create other attached behaviors
    //
    $('a.zoomup', context)	.once('zoomup-prep', Ticode.ZoomUp.popZU);
  }
};

}
)(jQuery);
;
// $Id: pirate.js $
/*
** we're using the jQuery based javascript, but our design pattern will be
** the Yui object paradigm which is much better at stability and 
** expandability.
*/
var Ticode = (("undefined" == typeof Ticode) || (!Ticode)) ? {} : Ticode;

(
function ($)
{

Ticode.Pirate = function ()
{
  /*  
  ******************************************************************
  ** private variables available only to methods of the module.
  */

  /*  
  ** private shorthand variables to comon jQuery parts/utilities
  */

  /*  
  ** private shorthand variable for built jQuery objects. set in init()
  */

  /*  
  ** constants used in this module.
  */

  /*  
  ** module state:
  */
  var del_id  = null
    , send_id = null
    ;

  /*  
  ** these are Dom refrences that won't change, they are set by direct
  ** calls when needed, and then used freely after that.
  */
  var send_button = null
    , confirm_box = null
    ;

  /*  
  ** ******************************************************************
  ** private methods available only to other methods of the module.
  */
  /*
  ** private method deleteP() - Click handler for the delete button; 
  **				verifies request to delete a reservation,
  **  and redirects to the deletion if confirmed.
  */
  var deleteP = function ()
    {
      if (!confirm('Did you really want to delete this reservation?'))
      {
	return false;
      }
      window.location = 
	'/control/admin/reservation-manage?action=delete&index=' + del_id;

      return true;
    };
    
  /*
  ** private method statusP() - Change handler for the status selectbox; 
  **				tests if the new status is 'Confirm', if so
  **  enables the 'Send Ticket' button, otherwise disables it.
  */
  var statusP = function ()
    {
      var state = $(this).val()
	;
      
      /*
      ** disable the send button, unless we're in state '1'
      */
      $(send_button)  .attr('disabled', ((1 == state) ? '' : 'disabled'));

      /*
      ** hide the confirm box unless we're in state '2'
      */
      $(confirm_box)  .toggle((2 == state));
    };

  /*
  ** private method ticketP() -	Click handler for 'Send Ticket' button; 
  **				verifies request to send the ticket, and
  **	redirects to the send if confirmed.
  */
  var ticketP = function ()
    {
      if (!confirm('Do you really want to send the ticket?'))
      {
	return false;
      }
      $('#set_action')	.val('send');
      $('#saveForm')	.click();

      return true;
    };

  var reservPayAction = function ()
    {
      if ($("#agree:checked").val())
      {
	var daform = $("#frmSolicitudPago");
	daform.attr('action', $("#URLVPOS").val());
	daform.submit();
      }
      else
      {
	alert("You must agree the terms and conditions checkbox");
	return false;
      }
    };

  var handleULforVPOS = function (index) 
    {
      var keep_lis  = $(this).children('li')
	, hide_lis  = null
	, count	    = 0
	;
      hide_lis = $(keep_lis).filter(':contains(vpos_plugin)');
      keep_lis = $(keep_lis).not(   ':contains(vpos_plugin)');

      $(hide_lis).hide();

      $(keep_lis).each(function () { count++; });

      if (!count)
      {
	$(this).hide();
	$(this).closest('div.messages').hide();
      }
    };

  var that =
    /*
    ** publicly accessible variables where we store AJAX results by
    ** evaluating valid js pointing to these arrays.
    */
    { translations: [] // Ticode.Pirate.translations[]

      /*
      ** public method Ticode.Pirate.delConfirm() - Method attaches a click
      **					    handler for the delete
      **    reservation button.
      */
    , delConfirm: function ()
      {
	del_id	= $('#pk_aut_reservacion').val();

	$(this).click(deleteP);
      }

      /*
      ** public method Ticode.Pirate.statusChange() - Method binds a change
      **					      handler to reservation
      **    status, by making status changes enable or disable the 
      **    'Send Ticket' button and also display or hide the Confirm
      **    mail checkbox.  Additionally, after this change behavior is 
      **    bound to the select box, we invoke the change to get the initial
      **    page state correct.
      */
    , statusChange: function ()
      {
	send_button = $('#sendMail');
	confirm_box = $('#ConfirmMailBox');

	$(this).change(statusP);
	$(this).change();
      }

      /*
      ** public method Ticode.Pirate.sendConfirm() -- Method attaches a 
      **					      click handler for the
      **  'Send Ticket' button.
      */
    , sendConfirm: function ()
      {
	send_id	= $('#pk_aut_reservacion').val();

	$(this).click(ticketP);
      }

      /*
      ** public method Ticode.Pirate.reservPayPrepare() - Prepares the 
      **						  submit action 
      **    for the reservation confirmation form (previous step for 
      **    actual payment).
      */
    , reservPayPrepare: function ()
      {
	$(this).unbind().bind('click', function () {
	    reservPayAction();
	  });
      }

      /*
      ** public method Ticode.Pirate.reservHideVPOS() - Removes any silly
      **						VPOS warnings since
      **    aval is too lazy to write good code. :P***
      */
    , reservHideVPOS: function ()
      {
	$(this).show();
	$(this).children('ul').each(handleULforVPOS);
      }
    };

      /*
      ** for finding .attr('style', 'background:#ee9933');
      */
        //attr('style', 'background:#ee9933');

  return that;

}(); // the parens here cause the anonymous func to execute and return

Drupal.behaviors.customOmegaSubthemeJS =
{
  attach: function(context, settings)
  {
    // first we init the hs and then create other attached behaviors
    //
    $('input#button_del',
      context)	      .once('legacy-prep', Ticode.Pirate.delConfirm);
    $('select#int_estado',
      context)	      .once('legacy-prep', Ticode.Pirate.statusChange);
    $('input#sendMail',
      context)	      .once('legacy-prep', Ticode.Pirate.sendConfirm);
    $('input#reserv-confirm-submit',
      context)	      .once('legacy-prep', Ticode.Pirate.reservPayPrepare);

    $('body.node-type-legacy div.messages',
      context)	      .once('legacy-prep', Ticode.Pirate.reservHideVPOS); 
  }
};


}
)(jQuery);
;

