
var writeDrag1 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv1",  // id of positioned div to be dragged
  handleId: "",         // optional, place null or "" if no handle
  writeId:  "",    // optional, will write to dragId if null or empty string
  // end of settings area - no need to edit below this line
  
  draggable: false,   // set true once dragObj.init called
  hideFlag: true,     // used in checkHide (document click)
  
  init: function() {   // initialize for dragging
    if (this.handleId) dragObj.init(this.handleId, this.dragId);
    else dragObj.init(this.dragId);
    this.draggable = true;
    // add handlers for hiding layer (esc key and doc click)
    
    dw_event.add( document, "keydown", writeDrag1.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function() {
    this.hideFlag = false;  // click on link to show layer is also document click, which would hide it
    var wobj = this.writeId? document.getElementById( this.writeId ): document.getElementById( this.dragId );
    var dobj = document.getElementById( this.dragId );
    if ( !this.draggable ) this.init();
    this.hide();
 
    offx=0;
    offy=0;
    this.positionIt( dobj, offx, offy);
  }, 
  
  positionIt: function(o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    
    x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    //y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY-100;    
    y=200;

    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag1.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag1.hide();
  }, 

 

  hide: function() { document.getElementById(writeDrag1.dragId).style.visibility = "hidden"; }
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}




var writeDrag2 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv2",  // id of positioned div to be dragged
  handleId: "",         // optional, place null or "" if no handle
  writeId:  "",    // optional, will write to dragId if null or empty string
  // end of settings area - no need to edit below this line
  
  draggable: false,   // set true once dragObj.init called
  hideFlag: true,     // used in checkHide (document click)
  
  init: function() {   // initialize for dragging
    if (this.handleId) dragObj.init(this.handleId, this.dragId);
    else dragObj.init(this.dragId);
    this.draggable = true;
    // add handlers for hiding layer (esc key and doc click)
    
    dw_event.add( document, "keydown", writeDrag2.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function() {
    this.hideFlag = false;  // click on link to show layer is also document click, which would hide it
    var wobj = this.writeId? document.getElementById( this.writeId ): document.getElementById( this.dragId );
    var dobj = document.getElementById( this.dragId );
    if ( !this.draggable ) this.init();
    this.hide();
 
    offx=0;
    offy=0;
    this.positionIt( dobj, offx, offy);
  }, 
  
  positionIt: function(o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    
    x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    //y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY-100;    
    y=200;
 
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag2.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag2.hide();
  }, 

 

  hide: function() { document.getElementById(writeDrag2.dragId).style.visibility = "hidden"; }
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}


var writeDrag3 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv3",  // id of positioned div to be dragged
  handleId: "",         // optional, place null or "" if no handle
  writeId:  "",    // optional, will write to dragId if null or empty string
  // end of settings area - no need to edit below this line
  
  draggable: false,   // set true once dragObj.init called
  hideFlag: true,     // used in checkHide (document click)
  
  init: function() {   // initialize for dragging
    if (this.handleId) dragObj.init(this.handleId, this.dragId);
    else dragObj.init(this.dragId);
    this.draggable = true;
    // add handlers for hiding layer (esc key and doc click)
    
    dw_event.add( document, "keydown", writeDrag3.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function() {
    this.hideFlag = false;  // click on link to show layer is also document click, which would hide it
    var wobj = this.writeId? document.getElementById( this.writeId ): document.getElementById( this.dragId );
    var dobj = document.getElementById( this.dragId );
    if ( !this.draggable ) this.init();
    this.hide();
 
    offx=0;
    offy=0;
    this.positionIt( dobj, offx, offy);
  }, 
  
  positionIt: function(o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    
    x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    //y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY-100;    
    y=200;
 
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag3.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag3.hide();
  }, 

 

  hide: function() { document.getElementById(writeDrag3.dragId).style.visibility = "hidden"; }
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}


var writeDrag4 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv4",  // id of positioned div to be dragged
  handleId: "",         // optional, place null or "" if no handle
  writeId:  "",    // optional, will write to dragId if null or empty string
  // end of settings area - no need to edit below this line
  
  draggable: false,   // set true once dragObj.init called
  hideFlag: true,     // used in checkHide (document click)
  
  init: function() {   // initialize for dragging
    if (this.handleId) dragObj.init(this.handleId, this.dragId);
    else dragObj.init(this.dragId);
    this.draggable = true;
    // add handlers for hiding layer (esc key and doc click)
    
    dw_event.add( document, "keydown", writeDrag4.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function() {
    this.hideFlag = false;  // click on link to show layer is also document click, which would hide it
    var wobj = this.writeId? document.getElementById( this.writeId ): document.getElementById( this.dragId );
    var dobj = document.getElementById( this.dragId );
    if ( !this.draggable ) this.init();
    this.hide();
 
    offx=0;
    offy=0;
    this.positionIt( dobj, offx, offy);
  }, 
  
  positionIt: function(o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    
    x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    //y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY-100;    
    y=200;
 
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag4.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag4.hide();
  }, 

 

  hide: function() { document.getElementById(writeDrag4.dragId).style.visibility = "hidden"; }
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}


var writeDrag5 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv5",  // id of positioned div to be dragged
  handleId: "",         // optional, place null or "" if no handle
  writeId:  "",    // optional, will write to dragId if null or empty string
  // end of settings area - no need to edit below this line
  
  draggable: false,   // set true once dragObj.init called
  hideFlag: true,     // used in checkHide (document click)
  
  init: function() {   // initialize for dragging
    if (this.handleId) dragObj.init(this.handleId, this.dragId);
    else dragObj.init(this.dragId);
    this.draggable = true;
    // add handlers for hiding layer (esc key and doc click)
    
    dw_event.add( document, "keydown", writeDrag5.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function() {
    this.hideFlag = false;  // click on link to show layer is also document click, which would hide it
    var wobj = this.writeId? document.getElementById( this.writeId ): document.getElementById( this.dragId );
    var dobj = document.getElementById( this.dragId );
    if ( !this.draggable ) this.init();
    this.hide();
 
    offx=0;
    offy=0;
    this.positionIt( dobj, offx, offy);
  }, 
  
  positionIt: function(o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    
    x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    //y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY-100;    
    y=200;
 
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag5.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag5.hide();
  }, 

 

  hide: function() { document.getElementById(writeDrag5.dragId).style.visibility = "hidden"; }
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}
var writeDrag6 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv6",  // id of positioned div to be dragged
  handleId: "",         // optional, place null or "" if no handle
  writeId:  "",    // optional, will write to dragId if null or empty string
  // end of settings area - no need to edit below this line
  
  draggable: false,   // set true once dragObj.init called
  hideFlag: true,     // used in checkHide (document click)
  
  init: function() {   // initialize for dragging
    if (this.handleId) dragObj.init(this.handleId, this.dragId);
    else dragObj.init(this.dragId);
    this.draggable = true;
    // add handlers for hiding layer (esc key and doc click)
    
    dw_event.add( document, "keydown", writeDrag6.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function() {
    this.hideFlag = false;  // click on link to show layer is also document click, which would hide it
    var wobj = this.writeId? document.getElementById( this.writeId ): document.getElementById( this.dragId );
    var dobj = document.getElementById( this.dragId );
    if ( !this.draggable ) this.init();
    this.hide();
 
    offx=0;
    offy=0;
    this.positionIt( dobj, offx, offy);
  }, 
  
  positionIt: function(o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    
//    x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
//    y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY-100;    
//    y=200;
 
//    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag6.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag6.hide();document.getElementById('overlay').style.display='none';
  }, 

 

  hide: function() { document.getElementById(writeDrag6.dragId).style.visibility = "hidden"; }
}

// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  while ( oNode.parentNode ) {
    oNode = oNode.parentNode;
    if ( oNode == oCont ) return true;
  }
  return false;
}
