var dialog = new function(){
  var videoIds = 0;

  this.generic = function( title, id ){
    var dlg = $.DialogEx({
      content: {
        id:     '#dialog-'+id,
        title:  title,
        URL:    '/include/dialogs/'+id+'.html'
      }
    });
    dlg.dialog('open');
  };
  
  this.coupon = function( code ){
    var dlg = $.DialogEx({
      content: {
        id:     '#dialog-' + code,
        title:  '<span style="color: #f00;">' + code + '</span> &ndash; Coupon Code Disclaimer',
        URL:    '/include/dialogs/' + code + '.html'
      }
    });
    dlg.dialog('open');
  };
  
  this.video = function( title, width, height, video ){
    var id, dlg;
    
    id = '#dialog-video-' + (videoIds++);
    dlg = $.DialogEx({
      content: {
        id:     id,
        title:  title,
        value:  "<embed src='/include/swf/player.swf' width='"+width+"' height='"+height+"' bgcolor='#ffffff' allowscriptaccess='always' allowfullscreen='true' flashvars='file="+video+"' />"
      },
      dialog: {
        width: width
      }
    });
  
    dlg.dialog('open');
  };

  this.GC_Terms = function(){ this.generic('Gift Card Terms &amp; Conditions', 'GC-Terms'); }
  this.AMEX     = function(){ this.generic('AMEX Subscriptions Info',          'AMEX');     }
  this.STORY    = function(){ this.generic('Story of Harry &amp; David Disclaimer','STORY');    }
  this.STJUDE   = function(){ this.generic('St. Jude Disclaimer',              'STJUDE');   }
  this.TPO      = function(){ this.generic('Discount Disclaimer',              'TPO'     ); }
  this.AMEXTERMS1  = function(){ this.generic('Save 15%',                'AMEXTERMS1'); }
  this.AMEXTERMS2  = function(){ this.generic('Earn Double Membership Rewards Points','AMEXTERMS2'); }

  this.FLAG     = function(){ this.coupon('FLAG');     }
  this.H66      = function(){ this.coupon('H66');      }
  this.SHIP     = function(){ this.coupon('SHIP');     }
  this.LABOR    = function(){ this.coupon('LABOR');    }
  this.SAVE     = function(){ this.coupon('SAVE');     }
  this.BIRTHDAY = function(){ this.coupon('BIRTHDAY'); }
  this.DISCOVER = function(){ this.coupon('DISCOVER'); }
  this.PEARDEAL = function(){ this.coupon('PEARDEAL'); }
  this.GIVE     = function(){ this.coupon('GIVE');     }
  this.JOLLY    = function(){ this.coupon('JOLLY');    }


  this.RIOJA = function(){
    var dlg = $.DialogEx({
      content: {
        id:     '#dialog-RIOJA',
        title:  'Rioja Video',
        URL:    '/include/dialogs/RIOJA.html'
      },
	  dialog: {
		width: 550
	  }
    });
    
	dlg.dialog('open');
	
	dlg.bind('dialogclose', function(event, ui) {
		dlg.dialog( 'destroy' );
		$('#dialog-RIOJA').remove();
	});
  };
  
  this.FOREIGN = function(){
    var dlg = $.DialogEx({
      content: {	  
        id:     '#dialog-FOREIGN',
        title:  'FOREIGN COUNTRIES WE SHIP TO',
        URL:    '/include/dialogs/FOREIGN.html'
      },
	  dialog: {
		width: 368,
		height:450
	  }
    });
	dlg.dialog('open');
  };
  
  this.FOMCLIST = function(){
    var dlg = $.DialogEx({
      content: {	  
        id:     '#dialog-FOMCLIST',
        title:  'Fruit of the Month Club&reg; Collection',
        URL:    '/include/dialogs/FOMCLIST.html'
      },
	  dialog: {
		width: 700,
		height:450
	  }
    });
	dlg.dialog('open');
  };
}

