﻿
var CustomForm = Class.create();
CustomForm.prototype =
{
   initialize:function(config)
   {
              
   },  
   loadMembers:function(config)
   {
 
      Object.extend(this,config);      
      this.exitBtn.onclick = this.cancel.bindAsEventListener(this);
      this.cancelBtn.onclick = this.cancel.bindAsEventListener(this);
      if(this.saveBtn)
      this.saveBtn.onclick  = this.save.bindAsEventListener(this);  
       Event.observe( window,"load", this.createOverlay.bindAsEventListener(this));     
   },
    createOverlay:function()
    {

     this.overlay =$("overlay");
     if(!this.overlay ) 
     {
        this.overlay =createDiv("overlay",document.body,"overlay"); 
        appendElementToAnother(this.el,document.body);
     }
        $(this.overlay).hide();
    },    
  
    cancel:function()
    {      
      this.close();
      if(this.onCancel) this.onCancel();
   },
           
   close:function()
   {
     this.el.hide();
    showSelectBoxes(document.body);   
    this.overlay.hide();    

   }, 
   open:function()
   {  
   
     this.el.show();
    this.showOverlay();

   },  
   
    showOverlay:function()
  {
 	 //  debugger;
 	 this.createOverlay();
 	    hideSelectBoxes(document.body);
		var arrayPageSize = getPageSize();				
		 setHeight(this.overlay, arrayPageSize[1]);		 
		 setWidth(this.overlay,document.body.clientWidth);
         this.overlay.show();
         
		//new Effect.Appear(this.overlay, { duration: 0.2, from: 0.0, to: 0.8 });		
 
 },

     
   save:function()
   {    
     if(this.onSave) this.onSave();
   }
   
 }