Event.observe(window,'load',function() {
	if($('session_message')) {
		new Effect.Highlight('session_message');
		setTimeout(function(){
			new Effect.Fade('session_message');
		},4000);
		Event.observe('session_message','click',function() {
			new Effect.Fade('session_message');
		});
	}

	$$("a.preview").each(function(a) {
		Event.observe(a,'click',function(event) {
			new Preview({url:a.href});
			event.preventDefault();
		});
	});

	$$("a.contact_history").each(function(a) {
		Event.observe(a,'click',function(event) {
			new ContactHistory({url:a.href});
			event.preventDefault();
		});
	});

	// $$("table.list tr:nth-child(even)").each(function(tr) {
	// 	tr.addClassName("zebra");
	// });
	// 
});

var Preview = Class.create();
Preview.prototype = 
{
  initialize: function(options)
  {
    this.options = {
      url: '#',
	  name: 'preview',
      width: 680,
      height: 500
    };
    Object.extend(this.options, options || {});
    window.open(this.options.url, this.options.name, 'width='+this.options.width+',height='+this.options.height+',menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
  }
};

var ContactHistory = Class.create();
ContactHistory.prototype = 
{
  initialize: function(options)
  {
    this.options = {
      url: '#',
	  name: 'preview',
      width: 450,
      height: 500
    };
    Object.extend(this.options, options || {});
    window.open(this.options.url, this.options.name, 'width='+this.options.width+',height='+this.options.height+',menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
  }
};
