// ********* ********* ********* ********* *********
//  Sticky Notes
//  Scriptcalendar.com software
//  (c)2000 Dan Shipe 
//  www.scriptcalendar.com
//  salesadmin@scriptcalendar.com
// ********* ********* ********* ********* *********

var e9d3g = true;
var e9d3h;
function fpuObject() {
  this.name = "_default";
  this.height = 200;
  this.width = 200;
  this.top = (document.body.clientHeight - this.height)/2;
  this.left = (document.body.clientWidth - this.width)/2;
  this.backColor = "#ff9999";
  this.foreColor = "#000000";
  this.shadowColor = "#666666";
  this.imageUrl = "stickynote/tape.gif";
  this.font = "14pt comic sans ms";
  this.html = "sticky note popup software from MarketingTools.com";
  this.closeButton = true;
  this.inDrag = false;
  this.elStartLeft = 0;
  this.elStartTop = 0;
  this.cursorStartX = 0;
  this.cursorStartY = 0;
};

fpuObject.prototype.create = function() {

  var e9d3k = e9d3e(document.body, "div", "");
  this.e9d3i = e9d3k;
  e9d3f(e9d3k, "name", this.name);
  e9d3f(e9d3k, "id", this.name);
  e9d3k.style.position = "absolute";
  e9d3k.style.top = this.top;
  e9d3k.style.left = this.left;
  e9d3k.style.width = this.width;
  e9d3k.innerHTML = "&nbsp;";
  e9d3k.e9d3j = this;

  var objBackground = e9d3e(e9d3k, "div", "");
  e9d3f(objBackground, "id", this.name + "_background");
  e9d3f(objBackground, "name", this.name + "_background");
  objBackground.onmousedown=e9d3b;
  objBackground.style.zIndex = "10";
  objBackground.style.backgroundColor = this.backColor;
  objBackground.style.border = "solid 1px #00AEEF";
  objBackground.e9d3j = this;

  var objClose = e9d3e(e9d3k, "div", "");
  e9d3f(objClose, "id", this.name + "_close");
  e9d3f(objClose, "name", this.name + "_close");
  objBackground.style.zIndex = "20";
  objClose.style.position = "absolute";
  objClose.style.top = "0";
  objClose.style.left = "0";
  objClose.style.width = "100%";
  objClose.style.height = "35";
  objClose.style.backgroundImage = "url('" + this.imageUrl + "')";
  objClose.style.backgroundRepeat = "no-repeat";
  objClose.style.backgroundPosition = "center top";
  objClose.style.font = "12pt verdana";
  objClose.style.textAlign = "right";
  if (this.closeButton==true) objClose.innerHTML = "<br/>&#x00d7;&nbsp;";
  if (this.closeButton==true) objClose.onclick=e9d3a;
  objClose.e9d3j = this;
  var objContent = e9d3e(objBackground, "div", "");
  e9d3f(objContent, "id", this.name + "_content");
  e9d3f(objContent, "name", this.name + "_content");
  objContent.style.font = this.font;
  objContent.style.color = this.foreColor;
  objContent.style.margin = "15 10 10 10";
  objContent.style.textAlign = "left";
  objContent.innerHTML = this.html;
  objContent.e9d3j = this;
  return e9d3k;
};

function e9d3a() {
  this.e9d3j.destroy();
};

fpuObject.prototype.destroy = function() {
  document.body.removeChild(this.e9d3i);
};

function e9d3b(event) {
  this.e9d3j.dragStart(event);
};

fpuObject.prototype.dragStart = function(event) {
  var e9d3k = this.e9d3i;
  var e9d3l = this;
  var x, y;
  var i;
  if (e9d3g) window.status = e9d3l.name;
  if (e9d3h) e9d3h.e9d3i.style.zIndex=9;
  e9d3h = e9d3l;
  e9d3h.e9d3i.style.zIndex=10;
  if (window.event) {
    x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
  } else {
    x = event.clientX + window.scrollX;y = event.clientY + window.scrollY;
  };

  e9d3l.cursorStartX = x;
  e9d3l.cursorStartY = y;
  e9d3l.e9d3iStartX = parseInt(e9d3l.e9d3i.style.left, 10);
  e9d3l.e9d3iStartY = parseInt(e9d3l.e9d3i.style.top, 10);
  if (isNaN(e9d3l.e9d3iStartX)) e9d3l.e9d3iStartX = 0;
  if (isNaN(e9d3l.e9d3iStartY)) e9d3l.e9d3iStartY = 0;
  if (window.event) {
    document.attachEvent("onmousemove", e9d3c);
    document.attachEvent("onmouseup", e9d3d);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  } else {
    document.addEventListener("mousemove", e9d3c, true);
    document.addEventListener("mouseup", e9d3d, true);
    event.preventDefault();
  };
};

function e9d3c(event) {
  e9d3h.dragGo(event);
};

fpuObject.prototype.dragGo = function(event) {
  var e9d3k = this.e9d3i;
  var e9d3l = this;
  var x, y;
  if (window.event) {
    x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
  } else {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  };
  e9d3k.style.left = (this.e9d3iStartX + x - this.cursorStartX) + "px";
  e9d3k.style.top = (this.e9d3iStartY + y - this.cursorStartY) + "px";
  if (window.event) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  } else {
    event.preventDefault();
  };
  e9d3l.inDrag = true;
};

function e9d3d(event) {
  e9d3h.dragStop(event);
};

fpuObject.prototype.dragStop = function(event){
  var e9d3k = this.e9d3i;
  var e9d3l = this;
  if (e9d3g) window.status = "";
  if (window.event) {
    document.detachEvent("onmousemove", e9d3c);
    document.detachEvent("onmouseup", e9d3d);
  } else {
    document.removeEventListener("mousemove", e9d3c, true);
    document.removeEventListener("mouseup", e9d3d, true);
  };
  e9d3l.inDrag = false;
};

function e9d3e(objParent, strName, strValue) {
  var e9d3m = objParent.ownerDocument;
  if (!e9d3m) e9d3m = objParent;
  var e9d3n = e9d3m.createElement(strName);
  if (strValue) {
    var e9d3nText = e9d3m.createTextNode(strValue);
    e9d3n.appendChild(e9d3nText);
  };
  objParent.appendChild(e9d3n);
  return e9d3n;
};

function e9d3f(objParent, strName, strValue) {
  var e9d3m = objParent.ownerDocument;
  if (!e9d3m) e9d3m = objParent;
  var e9d3n = e9d3m.createAttribute(strName);
  if (strValue) e9d3n.nodeValue = strValue;
  objParent.attributes.setNamedItem(e9d3n);
};

