/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  Copyright 2003 by Sharon Paine 
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

/*
    dw_writedrag.js - version date Nov 2003
    requires dw_event.js, dw_drag.js, and dw_viewport.js
*/

var writeDrag = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv",  // 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, "click",   writeDrag.checkHide, false );
    dw_event.add( document, "keydown", writeDrag.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag.hide();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag.hide") != -1 ) writeDrag.hide();
      else return;
    }
    if (writeDrag.hideFlag) writeDrag.hide();
  },

  hide: function() { document.getElementById(writeDrag.dragId).style.visibility = "hidden"; }
}

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: true,   // 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, "click",   writeDrag1.checkHide, false );
    dw_event.add( document, "keydown", writeDrag1.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
	document.getElementById(this.dragId).style.display = "block";
    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();
	alert("in");
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
	alert("in");
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv1") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag1.hide") != -1 ) writeDrag1.hide(); 
	 
      else return;
    }
  
  },

  hide: function() 
  {  
	document.getElementById(writeDrag1.dragId).style.visibility = "hidden"; 
	document.getElementById(writeDrag1.dragId).style.display = "none";
  }
  
}

// code for hear songs

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: true,   // 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, "click",   writeDrag2.checkHide, false );
    dw_event.add( document, "keydown", writeDrag2.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    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();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv2") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag2.hide") != -1 ) writeDrag2.hide();
      else return;
    }
    //if (writeDrag2.hideFlag) writeDrag2.hide();
  },

  hide: function() { document.getElementById(writeDrag2.dragId).style.visibility = "hidden"; }
}

// end of code for hear songs


// code for top 100
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: true,   // 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, "click",   writeDrag3.checkHide, false );
    dw_event.add( document, "keydown", writeDrag3.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt3, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt3;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    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();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv3") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag3.hide") != -1 ) writeDrag3.hide();
      else return;
    }
   // if (writeDrag1.hideFlag) writeDrag1.hide();
  },

  hide: function() { document.getElementById(writeDrag3.dragId).style.visibility = "hidden"; }
}
// end of code for top 100


// code for top 10
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, "click",   writeDrag4.checkHide, false );
    dw_event.add( document, "keydown", writeDrag4.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt4, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt4;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    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();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv4") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag4.hide") != -1 ) writeDrag4.hide();
      else return;
    }
   // if (writeDrag1.hideFlag) writeDrag1.hide();
  },

  hide: function() { document.getElementById(writeDrag4.dragId).style.visibility = "hidden"; }
}
// end of code for top 10



// code for request
var writeDrag7 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv7",  // 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: true,   // 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, "click",   writeDrag7.checkHide, false );
    dw_event.add( document, "keydown", writeDrag7.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt7, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt7;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag7.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag7.hide();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv7") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag7.hide") != -1 ) writeDrag7.hide();
      else return;
    }
   // if (writeDrag1.hideFlag) writeDrag1.hide();
  },

  hide: function() { document.getElementById(writeDrag7.dragId).style.visibility = "hidden"; }
}
// end of code for request


// code for dial up
var writeDrag14 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv14",  // 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: true,   // 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, "click",   writeDrag14.checkHide, false );
    dw_event.add( document, "keydown", writeDrag14.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt14, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt14;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag14.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag14.hide();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv14") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag14.hide") != -1 ) writeDrag14.hide();
      else return;
    }
   // if (writeDrag1.hideFlag) writeDrag1.hide();
  },

  hide: function() { document.getElementById(writeDrag14.dragId).style.visibility = "hidden"; }
}
// end of code for dial up


// code for broadband
var writeDrag15 = {
  // offX and offY can be numbers or "c"
  offX: 20,
  offY: 20,
  dragId:   "dragDiv15",  // 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: true,   // 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, "click",   writeDrag15.checkHide, false );
    dw_event.add( document, "keydown", writeDrag15.checkKey,  true );
  },
  
  // called onclick of links (from wrapContent)
  set: function(e, cntnt15, wd, offx, offy) {
    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();
    wobj.innerHTML = cntnt15;
    
    if (wd) {
      // wd might be width of image, so add border and padding
      // rely on styles set inline (or lengthy code needed)
      var bw = dobj.style.borderWidth? parseInt(dobj.style.borderWidth): 0;
      var pw = wobj.style.padding? parseInt(wobj.style.padding): 0;
      wd += 2 * bw + 2 * pw;
      dobj.style.width = wd + "px"; 
    }
    this.positionIt(e, dobj, offx, offy);
  }, 
  
  positionIt: function(e, o, offx, offy) {
    var x=0, y=0; viewport.getAll();
    // check positioning choices
    if ( this.offX == "c" ) {
      x = Math.round( (viewport.width - o.offsetWidth)/2 ) + viewport.scrollX;
    } else {  // use mouse location onclick to position
      x = e.pageX? e.pageX: e.clientX + viewport.scrollX;
      offx = offx || this.offX;  // check for passed offsets
      if ( x + o.offsetWidth + offx > viewport.width + viewport.scrollX ) 
        x = viewport.width + viewport.scrollX - o.offsetWidth;
      else x = x + offx;
    }
    
    if ( this.offY == "c" ) {
      y = Math.round( (viewport.height - o.offsetHeight)/2 ) + viewport.scrollY;    
    } else {
      y = e.pageY? e.pageY: e.clientY + viewport.scrollY; 
      offy = offy || this.offY; 
      if ( y + o.offsetHeight + offy > viewport.height + viewport.scrollY )
        y = viewport.height + viewport.scrollY - o.offsetHeight;
      else y = y + offy;
    }
    o.style.left = x + "px"; o.style.top = y + "px";
    document.getElementById(this.dragId).style.visibility = "visible";
    setTimeout("writeDrag15.hideFlag = true",200);  // delayed until after checkHide 
  },
  
  checkKey: function(e) { // check for esc key
    e = e? e: window.event;  if ( e.keyCode == 27 ) writeDrag15.hide();
  }, 

  // doc click hides
  checkHide: function(e) { 
    dw_event.DOMit(e);
    // hide the layer if you click anywhere in the document 
    // except a link that displays the layer (hideFlag), or on the layer itself, 
    // unless that click on the layer is on the layer's close box    
    if (e.tgt.nodeType && e.tgt.nodeType == 3) e.tgt = e.tgt.parentNode;  // text node?
    if ( contained( e.tgt, document.getElementById("dragDiv15") ) ) {
      if ( e.tgt.tagName && e.tgt.tagName == "IMG" ) e.tgt = e.tgt.parentNode; 
      if ( e.tgt.tagName == "A" && e.tgt.href.indexOf("writeDrag15.hide") != -1 ) writeDrag15.hide();
      else return;
    }
   // if (writeDrag1.hideFlag) writeDrag1.hide();
  },

  hide: function() { document.getElementById(writeDrag15.dragId).style.visibility = "hidden"; }
}
// end of code for broadband


// returns true of oNode is contained by oCont (container)
function contained(oNode, oCont) {
  if (!oNode) return; 
  while ( oNode = oNode.parentNode ) if ( oNode == oCont ) return true;
  return false;
}