﻿// Fichier JScript
var EIC = {

	start: function(){
        
       /* Pour corriger le bug d'IE6 */ 
       $('containerEspaceClient').setStyle( 'margin-top', $('containerEspaceClient').getStyle('margin-top').toInt() + 'px');
	      
	      var menuitems = $$('a.menuitem');
        menuitems.each(function(item){
            var overfxs = new Fx.Morph(item, {'duration': 200, 'wait': false});
            item.setStyle( 'color', '#666');
            item.addEvent( 'mouseover', function(e){
                overfxs.start({'padding-top': 27,
                                 'color': '#000'
                              });
            });
            item.addEvent( 'mouseout', function(e){
                overfxs.start({'padding-top': 17,
                                 'color': '#666'
                              });
            });
        });
        
        
        var myTips = new Tips($$('.toolTipElement'), {
          showDelay: 300,
          hideDelay: 100
        });
        
        var adminCookie = new Hash.Cookie('admin.eic');
        
        if($$('div.admin')) {
           $$('div.admin').setStyle( 'opacity', '0.65');
           if (adminCookie.get('coords')) {
					   var savePos = adminCookie.get('coords');
					   $$('div.admin').setStyle( 'left', savePos.x);
					   $$('div.admin').setStyle( 'top', savePos.y);
				   } 
           $$('div.admin').makeDraggable({ handle: $("h2"),
              onDrag: function() {
					      var pos = {"x": this.element.getStyle('left').toInt(), "y": this.element.getStyle('top').toInt() };
					      adminCookie.set('coords', pos);
				      } 
				   });          
        }

       /*alert('body:' + document.body.clientHeight + ' / document:' + document.documentElement.clientHeight + ' / diff:' + (document.documentElement.clientHeight - document.body.clientHeight));*/
       var diff = document.documentElement.clientHeight - document.body.clientHeight;
       if( diff>0) {
         diff = diff + $('footer').getStyle('padding-top').toInt(); 
         $('footer').setStyle('padding-top', diff + 'px');
       }
	}
};

function popupwindow(page,largeur,hauteur,options)
{
  var top=(screen.height-hauteur)/2;
  var left=(screen.width-largeur)/2;
  window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}

window.addEvent('load', EIC.start);
