/* moocredits v. 0.6beta
by info(at)creativeprogramming.org
GNU license
*/



var moodialog = new Class({
    
    version: '0.4',
     
     initialize: function(options) {
          this.options = $extend({
               // default transition
               title: "moodialog",
               initialWidth: 420,
               initialHeight: 290
          }, options || {});
          
          this.pageDimensions = getPageDimensions();
          this.viewportSize = getViewportSize();
          this.scrollingPosition = getScrollingPosition();
          
          if (this.viewportSize[1] > this.pageDimensions[1]) {
               this.pageDimensions[1] = this.viewportSize[1];
          }
          
          this.overlay = new Element('div', {'id': 'cOverlay'});
          this.overlay.setStyles({
               position: "absolute",
               left: "0",
               top: "0",
               width: this.pageDimensions[0] + "px",
               height: this.pageDimensions[1] + "px"
          });
          
          try {
               this.overlay.injectInside(document.body);
               this.center = new Element('div', {'id': 'lbCenter', 'class': 'customDialog'});
               
               this.center.setStyles({
                    left: this.scrollingPosition[0] + parseInt((this.viewportSize[0] / 2) - 230) - parseInt(this.center.offsetWidth / 2) + "px",
                    top: this.scrollingPosition[1] + parseInt((this.viewportSize[1] / 2) - 200) - parseInt(this.center.offsetWidth / 2) + "px",
                    width: this.options.initialWidth,
                    height: this.options.initialHeight,
                    padding: '4px 4px 4px 4px',
                    border: '1px dashed #FFD700',
                    visibility: 'visible',
                    zIndex: '150'
               });
               
               this.lastModified = document.lastModified;
                             
               //new Asset.css('css/moodialog.css', {id: 'creditsStyle', title: 'creditsStyle'});
               this.creditsContents =  " <div id='contents' style='clear: both'>\
               <h2>CREDITS on TriGEO.it</h2>\
               <h3>Multimedia Concept by </h3>\
               <div class='image_float'></div> \
               <p><a>BebopStudios.eu</a></p>\
               <div class='spacer'></div>\
               <h3>Logic & Programming by</h3>\
               <div class='image_float'></div> \
               <p><a>CreativeProgramming.org</a></p>\
               <div class='spacer'></div>\
               <div>\
               <p style='padding-top: 22px; width: 70%; font-family:verdana; color: silver; font-size: 9px; float: right'>\
               Sito ottimizzato per Firefox, Opera e IE 7.0</p>\
               </div>\
               <h1 style='padding: 6px 0px 0px 0px; font-size: 9px; text-align: right; float: right; width: 70%; color: #528AC6;'>v. " + this.version + "<br/></h2>\
               <h1 style='padding: 2px 0px 2px 0px; font-size: 9px; text-align: right; float: right; width: 70%; color: #528AC6;'>Last update: 06/12/2010</h2>\
               </div>";               
               this.contentDiv = new Element('div', {'id': 'contentDiv', 'class': 'customDialog'}).injectInside(this.center);
               this.contentDiv.setHTML(this.creditsContents);
               new Element('a', {'id': 'closeLink', 'href': '#'}).injectInside(this.contentDiv).onclick = this.overlay.onclick = this.close.bind(this);
               this.center.injectInside(document.body);
          } catch(error) {
          //console.log('Controlla nel try perchè si sono verificati alcuni errori');
     }
},


close: function(){
     this.center.remove();
     this.overlay.remove();
     return false;
}
}); // End of class



