
 
 $.fn.creerBox = function(options) {
   

 //   function draggable(){
 //     alert( obj )  
 //   }
   //  function closableBox(){
   //   alert( obj )  
  //}
 var closableBox = {
    
    init:function(){
       // alert( obj ) 
    }
    
 }
            var defaults = {
            idParent : 'body',
            idBox : 'idBox',
            zIndex : '10000',
            display : 'block',
            position : 'absolute',
            type : 'div',
            top : 0,
            left : 0,
            width : 0,
            height : 0,
            background : '#fff',
            alpha : 100,
            closable : false,
            valign : false,
            createCache : false,
            cursor : false,
            color:'#000'
            };
            
                var arrayPageSize = getPageSize() ;
                var arrayPageScroll = getPageScroll();
              
                
                options = $.extend(defaults, options);
                
                var o =options;
                var obj = $(this);
      
                var fenetre= document.getElementById(o.idParent);
               
                var nouveauDiv = document.createElement(o.type);
                nouveauDiv.id=o.idBox;
                nouveauDiv.style.display=o.display;
                nouveauDiv.style.zIndex=o.zIndex;
                nouveauDiv.style.position=o.position;
                nouveauDiv.style.top=  o.top+'px';
                nouveauDiv.style.left= o.left +'px';
                nouveauDiv.style.width= o.width +'px';
                nouveauDiv.style.height= o.height +'px';
                nouveauDiv.style.background=o.background;
              if ( o.alpha != 100 ) {  nouveauDiv.style.filter = "alpha(opacity= "+o.alpha+")" };
                nouveauDiv.style.MozOpacity = o.alpha/100 ;
                nouveauDiv.style.color= o.color ; 
                if ( o.cursor !=false ){
                    
                     nouveauDiv.style.cursor= o.cursor;
                    
                }
                fenetre.appendChild(nouveauDiv);
           
           $("#"+o.idBox).click(function() { })

           if ( o.valign == 'center' ) {
     o_height =  o.height ;
            o_top = arrayPageScroll[1]+( arrayPageSize[3]-o_height) /2 ; 
           $("#"+o.idBox).css( 'top' , o_top )  ;
         }
           if ( o.valign == 'top' ) {
            $("#"+o.idBox).css( 'top' ,0)  ; 
            }
           
           if ( o.align == 'center' ) {
                     o_width =  o.width ;
            o_left = ( arrayPageSize[0]-o_width ) /2 ; 
           $("#"+o.idBox).css( 'left' , o_left )  ;
           }           

           if ( o.align == 'right' ) {
            
            o_width =  o.width ;
            
            var reg=new RegExp("px",'g');
            value = $("#"+o.idParent).css( 'width');
            width=Number ( value.replace(reg,"") ) ;
            
            o_left = ( width - o.width )  ; 
            $("#"+o.idBox).css( 'left' ,o_left  )  ;
           
            }


           if ( o.closable == true ) {
            $().creerBox({idParent :o.idBox, idBox : 'CloseBox',zIndex : o.zIndex+1,width : 100,height : 32,cursor : 'pointer' , background:"transparent url('/img/icons/iconFermer_nv.jpg') right top no-repeat" , valign:'top', align : 'right'});
           
            $("#CloseBox").click(function() {
                if ( $("#CacheBox") ){
                   $("#CacheBox").remove();
                }
                var fenBox=$("#CloseBox").parent(); 
                if (fenBox){
                   fenBox.remove();    
                }
            
            })
 //           closableBox.init();
           }
           
           if ( o.createCache == true ){
            
            $().creerBox({idBox : 'CacheBox',zIndex : o.zIndex-10,width : arrayPageSize[0],height : arrayPageSize[1],background:'#000', alpha : 80  });

               
           }
    
 }
 
 /*
    $.fn.closableBox() = function(options) {
       
    
  }
  
  
  
 
 
 (function($){  
     $.fn.extend({   
         //plugin name - animatemenu  
        creerBox: function(options) {  

            var defaults = {
            idParent : 'body',
            idBox : 'idBox',
            zIndex : '10000',
            display : 'block',
            position : 'absolute',
            top : 0,
            left : 0,
            width : 0,
            height : 0,
            background : '#fff',
            alpha : 100,
            closable : false
            }; 
               
        options = $.extend(defaults, options);  
        var o =options;
        var obj = $(this);
      
                var fenetre= document.getElementById(o.idParent);
               
                var nouveauDiv = document.createElement(o.type);
                nouveauDiv.id=o.idBox;
                nouveauDiv.style.display=o.display;
                nouveauDiv.style.zIndex=o.zIndex;
                nouveauDiv.style.position=o.position;
                nouveauDiv.style.top= o.top+'px';
                nouveauDiv.style.left= o.left +'px';
                nouveauDiv.style.width= o.width +'px'
                nouveauDiv.style.height= o.height +'px';
                nouveauDiv.style.background=o.background;
                nouveauDiv.style.filter = "alpha(opacity= "+o.alpha+")";
                nouveauDiv.style.MozOpacity = o.alpha/100 ;
                fenetre.appendChild(nouveauDiv);
                  // alert( nouveauDiv.style.top )
                                return this.each(function() {  
                   var o =options;  
                   var obj = $(this);
                    });  
 /*         
             return this.each(function() {  
                   var o =options;  
                   var obj = $(this);                  
                   var items = $("li", obj);  
                     
                   $("li:even", obj).css('background-color', o.evenColor);                 
                   $("li:odd", obj).css('background-color', o.oddColor);                     
                     
                   items.mouseover(function() {  
                       $(this).animate({paddingLeft: o.animatePadding}, 300);  
                       
                   }).mouseout(function() {  
                       $(this).animate({paddingLeft: o.defaultPadding}, 300);  
                       
                   });  
             });

         }  
     });  
 })(jQuery);   */
