/*
  CSS Cursor Gadget
  A modular component for visually picking CSS cursors from a web interface.
  author: Thomas Ballard (thomas2003*esqsoft^om antibot: *=@, ^=.c)
  © 2004 E.S.Q Software  More scripts and usage requirements: http://esqsoft.com
*/

//alert('CSS Cursor Gadget successfully included'); //DEBUG

window.CG = function(HTML){
 
  CG.cursors = new Array(
    "pointer",
    "crosshair",
    "default",
    "help",
    "all-scroll",
    "col-resize",
    "hand",
    "move",
    "no-drop",
    "not-allowed",
    "progress",
    "row-resize",
    "text",
    "url('cursors/piano.ani')",
    "url('cursors/pen_m.cur')",
    "vertical-text",
    "wait",
    "auto",
    "N-resize",
    "NE-resize",
    "E-resize",
    "SE-resize",
    "S-resize",
    "SW-resize",
    "W-resize",
    "NW-resize",
    "");
  
  CG.html = ''
  +'<table cellpadding="0" cellspacing="0">'
  +'  <tr>'
  +'    <td class="heading">'
  +'      <h1 id="mheader">CSS Cursor Property Gadget</h1>'
  +'    </td>'
  +'  </tr>'
  +'  <tr valign="top">'
  +'    <td>'
  +'      <table align="center" cellspacing="1" cellpadding="5" class="sptable">'
  
  var done = CG.cursors.length;
  while(done>0){
    CG.html += '<tr>'
    for(var i=0; i<6; i++){
      CG.html += '<td onclick="CG.handleClick(this)" style="cursor:'+CG.cursors[done]+'">'+CG.cursors[done]+'</td>'
      done=done-1
    }
    CG.html += '</tr>'
  }
  
  CG.html += ''
  +'      </table>'
  +'    </td>'
  +'    <td width="120">'
  +'    </td>'
  +'  </tr>'
  +'</table>'
  
  CG.makeIF = function(obj){
    if(obj){
      if(typeof(obj) != 'object'){
        obj = document.getElementById(obj)
        //if(!obj){ alert('error: unable to attach to passed container'); return }
      }
      if(obj && obj.innerHTML !== undefined){ obj.innerHTML = CG.html; return }
    }

    document.write(CG.html)
  }
  
  CG.makePop = function(){
    window.open('','cgPop','')
  }
  
  CG.handleClick = function(obj){
    if(obj && obj.style && obj.style.cursor){
      var val = obj.style.cursor
  
      if(window.clipboardData){                
        var bResult = window.clipboardData.setData('Text',val);
      }
    }
  }  

 window.ivnHClick = function(obj, getCode){
    if(obj && window.clipboardData){
      var str = obj.innerHTML || 0
      if(getCode) str = '<scr'+'ipt src="http://esqsoft.com/tools/expose.js"></scr'+'ipt>\n<scr'+'ipt>expose(location)</scr'+'ipt>'
      if(!str) return
      var bResult = window.clipboardData.setData('Text',str); 
      if(!this.init){ this.init=1; alert('The code has been copied to your clipboard.\nPress CTRL-V to paste the code in your page.\n(This message won\'t display again.)') }
    } else { alert('error: Your browser doesn\'t appear to support this'); }
  
    return false
  }



  /* MAIN */

    if(HTML) CG.makeIF(HTML)
    else CG.makePop()
}
