
var ToggleSelect = function( id_select, options) {
   this.id_select = id_select;
   this._options = options;
   $( this.id_select).bind( 'change', this, this.actua);
   this.actua( {data: this});
}

 ToggleSelect.prototype = {

   actua: function (e) {
       var seleccionada = $(e.data.id_select).val();
       for (var a = 0 ; a < e.data._options.length ; a++)
       {
         style = e.data._options[a][0] == seleccionada ? 'block' : 'none';
         class_name = e.data._options[a][0] == seleccionada ? 'required' : '';
         if ($(e.data._options[a][1])) {
           $(e.data._options[a][1]).css( 'display', style); 
           if( $(e.data._options[a][1] + '_select'))
             $(e.data._options[a][1] + '_select').attr( 'class', class_name);
           var quants = $('.' + e.data._options[a][1] + '_quantity');
           if( quants.length > 0 ) {
             var quantities = $('._quantity');
             for (var i=0; i < quantities.length; i++) {
               $(quantities[i]).removeClass( 'required digits');
             };
           }
           for (var i=0; i < quants.length; i++) {
             $(quants[i]).addClass( 'required digits');
           };
         }
        }
     }
 };
 
 function ToggleCheckBox( ids) {
    this.input = ids[0];
   	this.div = ids[1];
	  $(this.input).bind( 'click', jQuery.proxy( this, 'actua'))
	  this.actua();
 }
 
 ToggleCheckBox.prototype = {

   actua:      	function (e) {
 								if ($(this.input).attr( 'checked') == true)
                 	$(this.div).hide();
               	else
                 	$(this.div).show();
             }
 };
 
  
  function openWindow(url,name,width,height) {
    window.open(url,name,"menubar=1,resizable=1,scrollbars=yes,width=" + width + ",height=" + height);
  }
