/*
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Copyright © 2000-2009 by Gary Johnson


COPYRIGHT

The information contained on this site is protected by Canadian, United States of America and international copyright laws.

All website materials, including, without limitation, design, text, graphics, photos, files, the Fast Track! logo, and
the selection and arrangement thereof are © 2000-2009 Gary Johnson ALL RIGHTS RESERVED.

Permission is granted to electronically copy and print to hard copy portions of this website for the sole purpose of
using materials it contains for informational and non-commercial personal use only.

Any other use of materials in this website, including any commercial use, reproduction for purposes other than those noted above,
modification, distribution or republication, without the prior written consent of Gary Johnson is strictly prohibited.


The Full Copyright statement is

http://cookdotcom.com/XXSoftwareTools/Copyright.html

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/

//  Globals
var toggleId;
var px  = 'px';
//  var EOL = "\n";
var EOL = '<br>';
var debugOnce=false;
var vtoggleTop=200;

function gjonerror(ex, msg)
{
  try
  {
    if(isGecko())
    {
      //println("gjonerror " + msg + " " + ex.name + " " + ex.message + "\n");
      var wintxt = "\n" + " -- - " +  "\n" + "\n" + " " + " - - -  "  + msg + " - - -  " + "\n" + " " + " - - -  "  + ex.name + " - - -  " + " " +  ex.message + " - - - " + "\n" + "\n" + " - - -  " + ex.fileName  + " - - -  " + " line: " + ex.lineNumber + " - - -  " + "\n" + "\n" + " - - -   " + " UA " + navigator.userAgent + " - - -  " + "\n" + "\n" + "\n" + " - - -  ";
      alert(wintxt);
    }
    else
    {
      var wintxt = "\n" + " - - -  " +  "\n" + "\n" + " " + " - - -  "  + msg + " - - -  " + "\n" + " " + " - - -  "  + ex.name + " - - -  " + " " +  ex.message + " - - -  " + "\n" + "\n" + " - - -  " + " UA " + navigator.userAgent + " - - -  " + "\n" + "\n" + " - - -  ";
      alert(wintxt);
    }
  }
  catch(error)
  {
    alert("Error in Error" + msg + "1: " + ex.name + "1: " + ex.message  + "2: " + error.name +  "2: " + error.name);
  }

  return false;
}

function mkunique()
{
  return (new Date()).getTime();
}

function noOP()
{
  return;
}


function setToggleTop(eventin)
{
  if(isGecko())
  {
    vtoggleTop = getEventY(eventin) + 10;
  }
  else
  {
    //cannot get zindex to go in front of java object
    vtoggleTop = getEventY(eventin) +30;
  }
}

function getToggleBottom()
{
  return 1;
}

function getElement(idin)
{
  // SEP 2006, removed try catch because of Timer.html and FF throwing error
  if(document.all)
  {
    return document.all[idin];
  }
  else
  {
    return document.getElementById(idin);
  }
}

function setVisible(idin)
{
  try
  {
    document.getElementById(idin).style.visibility = 'visible';
  }
  catch (error)
  {
    gjonerror( error, " setVisible ");
  }
}

function setHidden(idin)
{
  try
  {
    document.getElementById(idin).style.visibility = 'hidden';
  }
  catch (error)
  {
    gjonerror( error, " setHidden ");
  }
}

function setGone(idin)
{
  try
  {
    document.getElementById(idin).style.visibility = 'hidden';
  }
  catch (error)
  {
    gjonerror( error, " setGone ");
  }
}

/* diplay none is better */
function isVisible(idin)
{
  var myE= document.getElementById(idin);
  if(myE.style.visibility=='hidden')
  {
    return false;
  }
  else
  {
    return true;
  }
}

function toggleVisibility(idin)
{
  try
  {
    if(isVisible(idin))
    {
      setHidden(idin);
    }
    else
    {
      setVisible(idin);
    }
  }
  catch (error)
  {
    gjonerror( error, " toggleVisibility ");
  }
}

function toggleDivVisibility(idin, width, height)
{
  try
  {
    if(isVisible(idin))
    {
      setHeight(idin,10);
      setWidth(idin,10);
      setHidden(idin);
    }
    else
    {
      if(width)
      {
        setWidth(idin,width);
        //should throw error here if width is bad
      }
      if(height)
      {
        setHeight(idin,height);
      }
      setVisible(idin);
    }
  }
  catch (error)
  {
    gjonerror( error, " toggleDivVisibility ");
  }
}

function toggleDivVisibilityZ(idin, width, height, myZ)
{
  try
  {
    if(isVisible(idin))
    {
      setHeight(idin,10);
      setWidth(idin,10);
      setZ(idin, --myZ);
      setHidden(idin);
    }
    else
    {
      if(width)
      {
        setWidth(idin,width);
        //should throw error here if width is bad
      }
      if(height)
      {
        setHeight(idin,height);
      }
      setZ(idin,++myZ);
      setVisible(idin);
    }
  }
  catch (error)
  {
    gjonerror( error, " toggleDivVisibility ");
  }
  return myZ;
}

// <input class="closeit" type="button" id="sSSssazy" value="-" onClick="toggleDisplayButton('CMEB1','sSSssazy' );">
// <p id ="CMEB1" class="note">

function toggleDisplayButton(idin,buttonid)
{
  try
  {
    var aDiv = document.getElementById(idin);

    if(aDiv.style.display == 'none')
    {
      aDiv.style.display = 'block';
      document.getElementById(buttonid).value="-";
    }
    else
    {
      aDiv.style.display = 'none';
      document.getElementById(buttonid).value="+";
    }
  }
  catch (error)
  {
    gjonerror( error, "toggleDisplayButton");
  }
}


//get the integer of the top
function getTop(idin)
{
  var top=-1;

  var myE= document.getElementById(idin);

  try
  {
    if(isGecko())
    {
      top = parseInt(myE.style.top);  //missing radix
    }
    else if(isIE())
    {
      if(myE.style)
      {
        top = myE.style.posTop;
      }
    }
    else
    {
      alert('unknown browser in getTop');
    }
  }
  catch (error)
  {
    gjonerror( error, "getTop ");
  }
  return top;
}

function mygetTop(idin)
{
  var mtop;

  try
  {
    mtop = getTop(idin);
    if((!mtop) || (mtop == -1))
    {
      mtop = parseInt(getCompStyle(idin, 'top'));
      if(isNaN(mtop))
      {
        mtop = -1;
      }
    }
  }
  catch (error)
  {
    gjonerror( error, "mygetTop ");
  }
  return mtop;
}


//get the integer of the left
//I probably need to make all of these act like this one

function getLeft(idin)
{
  var left=-1;

  var myE= document.getElementById(idin);

  try
  {
    if(isGecko())
    {
      if(myE.style.left)
      {
        left = parseInt(myE.style.left);
      }
    }
    else if(isIE())
    {
      if(myE.style.pixelLeft)
      {
        left = myE.style.pixelLeft;
      }
    }
    else
    {
      alert('unknown browser in getLeft');
    }
  }
  catch (error)
  {
    gjonerror( error, "getLeft");
  }
  return left;
}
//      if(!mleft == NaN) if (typeof yourvar == "undefined"
function mygetLeft(idin)
{
  var mleft;

  try
  {
    mleft = getLeft(idin);
    if((!mleft) || (mleft == -1))
    {
      mleft = parseInt(getCompStyle(idin, 'left'));
      if(isNaN(mleft))
      {
        mleft = -1;
      }
    }
  }
  catch (error)
  {
    gjonerror( error, "mygetLeft");
  }
  return mleft;
}


function getWidth(idin)
{
  var myE= document.getElementById(idin);

  var width =-1;
  try
  {
    if(isGecko())
    {
      width = parseInt(myE.style.width);
    }
    else if(isIE())
    {
      if(myE.style)
      {
        width = myE.style.pixelWidth;
      }
    }
    else
    {
      alert('unknown browser in getWidth');
    }
  }
  //    isGecko() ? (width = parseInt(myE.style.width )) : ( width = myE.style.pixelWidth);
  catch (error)
  {
    gjonerror( error, "getWidth ");
  }
  return width;
}

function mygetWidth(idin)
{
  var mwidth;

  try
  {
    mwidth = getWidth(idin);
    if((!mwidth) || (mwidth == -1))
    {
      mwidth = parseInt(getCompStyle(idin, 'width'));
      if(isNaN(mwidth))
      {
        mwidth = -1;
      }
    }
  }
  catch (error)
  {
    gjonerror( error, "mygetWidth ");
  }
  return mwidth;
}

function getHeight(idin)
{
  var myE= document.getElementById(idin);
  var height=-1;

  try
  {
    if(isGecko())
    {
      height = parseInt(myE.style.height);
    }
    else if(isIE())
    {
      if(myE.style)
      {
        height = myE.style.posHeight;
      }
    }
    else
    {
      alert('unknown browser in getHeight');
    }
  }
  //    isGecko() ? (height = parseInt(myE.style.height)) : (height = myE.style.posHeight);
  catch (error)
  {
    gjonerror( error, "getHeight ");
  }
  return height;
}

function mygetHeight(idin)
{
  var mheight;

  try
  {
    mheight = getHeight(idin);
    if((!mheight) || (mheight == -1))
    {
      mheight = parseInt(getCompStyle(idin, 'height'));
      if(isNaN(mheight))
      {
        mheight = -1;
      }
    }
  }
  catch (error)
  {
    gjonerror( error, "mygetHeight");
  }
  return mheight;
}

function setWidth(idin, newWidth)
{
  var myE= document.getElementById(idin);

  try
  {
    isGecko() ? (myE.style.width = newWidth + px) : ( myE.style.pixelWidth = newWidth);
  }
  catch (error)
  {
    gjonerror( error, "setWidth ");
  }
}

function setHeight(idin, newHeight)
{
  var myE= document.getElementById(idin);
  var ret = -1;
  try
  {
    if(isGecko())
    {
      myE.style.height = newHeight + px;
      ret = myE.style.height;
    }
    else if(isIE())
    {
      myE.style.posHeight = newHeight;
      ret = myE.style.posHeight;
    }
  }
  catch (error)
  {
    gjonerror( error, "setHeight "  + idin);
  }
  return ret;
}

// x oordinates CSS style is always T R B L - need to have T and L to set Postion
// Mickey has left as read only

function setTop(idin,y)
{
  var myE= document.getElementById(idin);

  try
  {
    isGecko() ? myE.style.top = y + px : myE.style.pixelTop = y;
  }
  catch (error)
  {
    gjonerror( error, "setTop for " + idin);
  }
}


function setLeft(idin, x)
{
  var myE= document.getElementById(idin);
  try
  {
    isGecko() ? myE.style.left = x + px : myE.style.pixelLeft = x;
  }
  catch (error)
  {
    gjonerror( error, " setLeft for " + idin );
  }
}

function setClip(idin, t,r,b,l)
{

  if(checkDebug())
  {
    var myE= document.getElementById(idin);
    if(myE.style.clip === undefined  || myE.style.clip === "" || myE.style.clip == "0")
    {
      alert('setClip clip not set in css');
      return;
    }
    if(myE.style.position != 'absolute')
    {
      alert('setClip position not absolute');
      return;
    }
  }
  else
  {
    var myE= document.getElementById(idin);
  }

  try
  {
    //    var myRect = 'rect(' + t + px + ' ' + r + px + ' ' + b + px + ' ' + l + px + ')';
    //    myE.style.clip = 'rect(' + t + px + ',' + r + px + ',' + b + px + ',' + l + px + ')';

    var myclip = 'rect(' + t + ',' + r + ',' + b + ',' + l + ')';
    //    alert(" " + myclip);
    myE.style.clip = myclip;
    //    alert("clip is : " + myE.style.clip);
  }
  catch (error)
  {
    gjonerror( error, "setClip");
  }
}

function setClass(idin, cname)
{
  var myE= document.getElementById(idin);
  myE.className=cname;
}

function setZ(idin,z)
{
  var myE= document.getElementById(idin);

  try
  {
    myE.style.zIndex = z;
  }
  catch (error)
  {
    gjonerror( error, "setZ ");
  }
}
/* duh maybe a better name would be setLeftTop becasue thats the real order of the args */
function setTopLeft(idin, x, y)
{
  setTop(idin,y);
  setLeft(idin,x)
}


function setBackGroundColor(idin, mycolor)
{
  var myE= document.getElementById(idin);

  try
  {
    myE.style.backgroundColor = mycolor;
  }
  catch (error)
  {
    gjonerror( error, "setBackGroundColor ");
  }
}

function getInterCap(cstyle)
{
  //  margin-left to MarginLeft
   //    this does NOT fix : top or  posTop
  //  :left or  pixelLeft
  //  :width or  pixelWidth
  //  :height or posHeight

  try
  {
    var converted = new String(cstyle);
    var re = "-";
    var where = converted.indexOf(re);

    if(where > 0)
    {
      var part1 = converted.substr(0, where);
      var capit = converted.substr(where + 1, 1);
      capit = capit.toUpperCase();
      var part2 = converted.substr(where +2, converted.length);
      return part1 + capit + part2;
    }
    else
    {
      delete converted;
      return cstyle;
    }
  }
  catch (error)
  {
    gjonerror( error, "getInterCap");
  }
  return false;
}


function changeInnerHTML(idin, myHTML)
{
  try
  {
    var myE= document.getElementById(idin);
    myE.innerHTML = myHTML;
  }
  catch (error)
  {
    gjonerror( error, "changeInnerHTML" + idin + " " + myHTML);
  }
}

function returnInnerHTML(idin)
{
  try
  {
    var myE= document.getElementById(idin);
  }
  catch (error)
  {
    gjonerror( error, "returnInnerHTML id" + idin);
  }

  return myE.innerHTML;
}

function changeBorder(idin, which)
{
   if(which)
  {
    document.getElementById(idin).style.borderStyle  = 'dotted';
    document.getElementById(idin).style.borderSize = '2px';
    document.getElementById(idin).style.borderColor  = 'black';
  }
  else
  {
    document.getElementById(idin).style.borderStyle  = 'solid';
    document.getElementById(idin).style.borderSize = '2px';
    document.getElementById(idin).style.borderColor  = 'black';
  }
}

function myHighlight(idto, idfrom, mygoto)
{
  if(isIE())
  {
    var temp = document.getElementById(idto);
    if(temp.style.borderStyle ==  'dotted')
    {
      myHighlightundo(idto);
      myHighlightundo(idfrom);
    }
    else
    {
      myHighlightdo(idto);
      myHighlightdo(idfrom);

      if(mygoto)
      {
        window.location = mygoto;
      }
    }
  }
  else
  if(isGecko())
  {
    //kludge see note in getCompStyle
    var testit = getCompStyle(idto,'border-left-style');

    if( (testit == 'dotted') || (document.getElementById(idto).style.borderStyle ==  'dotted') )
    {
      myHighlightundo(idto);
      myHighlightundo(idfrom);
    }
    else
    {
      myHighlightdo(idto);
      myHighlightdo(idfrom);

      if(mygoto)
      {
        window.location = mygoto;
      }
    }
  }
}

function myHighlightdo(idin)
{
  document.getElementById(idin).style.borderStyle  = 'dotted';
  document.getElementById(idin).style.borderWidth  = '2px';
  document.getElementById(idin).style.borderColor  = 'black';
}

function myHighlightundo(idin)
{
  document.getElementById(idin).style.borderStyle  = 'none';
  document.getElementById(idin).style.borderWidth  = '0';
}

function hideStatus()
{
  try
  {
    if(window.statusbar.visible=='visible')
    {
      window.statusbar.visible=!window.statusbar.visible;
    }
  }
  catch (error)
  {
    gjonerror( error, "hide Status error ");
  }
}


function getCW()
{
  var clientWidth = -1;

  if(isIE())
  {
    if( document.body )
    {
      //IE 4, 5 & 6 (in non-standards compliant mode)
      clientWidth       = document.body.clientWidth; //document.body.clientWidth;
    }
    else if( document.documentElement )
    {
      //IE 6 (in standards compliant mode)
      clientWidth       = document.documentElement.clientWidth; // 0 in some case document.body.clientWidth;
    }
    //try body.offsetWidth or body.clientWidth + body.clientLeft + widht of scrollbars
  }
  else if(isGecko())
  {
    //        clientWidth       = window.screen.width;   document width client width - scroll bars - margins ?
    clientWidth       = document.width;
  }


  return clientWidth;
}

function getCH()
{
  var clientHeight = -1;

  if(isIE())
  {
    if( document.documentElement && ( document.documentElement.clientHeight ))
    {
      //IE 6 (in standards compliant mode)
      clientHeight        = document.documentElement.clientHeight;
    }
    else if( document.body )
    {
      //IE 4, 5 & 6 (in non-standards compliant mode)
      clientHeight        = document.body.clientHeight;
    }
  }
  else if(isGecko())
  {
    clientHeight      = window.innerHeight;
  }

  return clientHeight;
}

//if pageX/Y is supplied, pageX/Y is relative to the whole page (Netscape compatible) - also used by Opera 7+
//if clientX/Y is supplied, clientX/Y should be relative to displayed portion of page (Internet Explorer compatible)
// http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=17

function getEventX(event)
{
  var eventX;

  if(isIE())
  {
    if( typeof( event.clientX ) == 'number' )
    {
      eventX = event.clientX;

      // add it if its not 0
      if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
      {
        //IE 4, 5 & 6 (in non-standards compliant mode)
        eventX += document.body.scrollLeft;
      }
      else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
      {
        //IE 6 (in standards compliant mode)
        eventX += document.documentElement.scrollLeft;
      }
    }
    else
    {
      alert('we are hosed in getEventX Not number');
    }
  }
  else if(isGecko())
  {
    eventX            = event.pageX;
  }
  return eventX;
}

function getEventY(event)
{
  var eventY;
  if(isIE())
  {
    if( typeof( event.clientY ) == 'number' )
    {
      eventY = event.clientY;

      // add it if its not 0
      if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
      {
        eventY += document.body.scrollTop;
      }
      else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
      {
        eventY += document.documentElement.scrollTop;
      }
    }
    else
    {
      alert('we are hosed in getEventY not number');
    }
  }
  else if(isGecko())
  {
    eventY            = event.pageY;
  }
  else
  {
    alert('unsupported browser');
  }
  return eventY;
}

function showMousePosition()
{
  if (document.addEventListener)
  {
    // DOM Level 2 Event Model
    // Register capturing event handlers
    document.addEventListener("mousemove", showMousePostionE, true);
  }
  else if (document.attachEvent)
  {
    // IE 5+ Event Model
    // In the IE Event model, we can't capture events, so these handlers
    // are triggered when only if the event bubbles up to them.
    // This assumes that there aren't any intervening elements that
    // handle the events and stop them from bubbling.
    document.attachEvent("onmousemove", showMousePostionE);
  }
  else
  {
    alert('we are hosed in showMousePosition');
  }
}

function showMousePostionE(event)
{
  if(isGecko())
  {
    var w = window;

    window.status = "eventX,Y: " + event.pageX + "," + event.pageY +
    " w.page X,YOffset: " + window.pageXOffset + "," + window.pageYOffset +
    " w.inner W,H: " + window.innerWidth +  "," + window.innerHeight +
    " w.scroll X,Y: " + window.scrollX +  "," + window.scrollY;
  }
  else if(isIE())
  {

    var w = window;

    if(document.compatMode == 'CSS1Compat')
    //    if(document.documentElement)
    {
      var d = document.documentElement;
    }
    else if(document.body)
    {
      var d = document.body;
    }
    else
    {
      alert('we are hosed in showMousePostionE');
    }

    window.status = "w.event.clientX,Y: " + w.event.clientX + "," + w.event.clientY +
    " w.eventx,y: " + w.event.x + "," + w.event.y +
    " d.scrollL,T: " + d.scrollLeft + "," + d.scrollTop;
  }
  else
  {
    alert('we are hosed in showMousePostionE');
  }
}

function getCenterY()
{
  var center = -1;

  if(isGecko())
  {
    center = window.pageYOffset + (getCH() / 2);
  }
  else if(isIE())
  {
    if(document.compatMode == 'CSS1Compat')
    {
      center = document.documentElement.scrollTop + (getCH() / 2);
    }
    else
    {
      center = document.body.scrollTop + (getCH() / 2);
    }
  }
  else
  {
    alert('we are hosed in getCenterY');
  }
  return center;
}

function getYoffset()
{
  var yOff = -1;

  if(isGecko())
  {
    yOff = window.pageYOffset;
  }
  else if(isIE())
  {
    if(document.compatMode == 'CSS1Compat')
    {
      yOff = document.documentElement.scrollTop;
    }
    else
    {
      yOff = document.body.scrollTop;
    }
  }
  else
  {
    alert('we are hosed in getYOffset');
  }
  return yOff;
}


function getCenterX()
{
  var center = -1;

  if(isGecko())
  {
    center = window.pageXOffset + (getCW() / 2);
  }
  else if(isIE())
  {
    if(document.compatMode == 'CSS1Compat')
    {
      center = document.documentElement.scrollLeft + (getCH() / 2);
    }
    else
    {
      center = document.body.scrollLeft + (getCH() / 2);
    }
  }
  else
  {
    alert('we are hosed in getCenterX');
  }
  return center;
}

function getXoffset()
{
  var xOff = -1;

  if(isGecko())
  {
    xOff = window.pageXOffset;
  }
  else if(isIE())
  {
    if(document.compatMode == 'CSS1Compat')
    {
      xOff = document.documentElement.scrollLeft;
    }
    else
    {
      xOff = document.body.scrollLeft;
    }
  }
  else
  {
    alert('we are hosed in getXoffset');
  }
  return xOff;
}

function setDisplayV(idin)
{
  try
  {
    document.getElementById(idin).style.display = 'block';
  }
  catch (error)
  {
    gjonerror( error, "setDisplayV");
  }
}

function setDisplayH(idin)
{
  try
  {
    document.getElementById(idin).style.display = 'none';
  }
  catch (error)
  {
    gjonerror( error, "setDisplayH");
  }
}

//no good unless I put it in an eval
//put the following type thing inline,  instead
//myE.style.position = 'absolute';
function setStyle(idin, attrName, newData)
{
  var myE= document.getElementById(idin);

  try
  {
    myE.style.attrName = newData;
  }
  catch (error)
  {
    gjonerror( error, "setStyle ");
  }
}

function assert(fact, msgin)
{
  if(!fact)
  {
    var msg = "Assert Failure " + msgin;
    if(arguments.callee.caller !== null)
    {
      msg = msg + " in function " + arguments.callee.caller.toString().match(/function\s+(\w+)/)[1];
    }
    alert(msg);
  }
}
/* MSIE 7.0; Windows NT 6.0 */
function isIE()
{
  return (navigator.userAgent.toLowerCase().indexOf("msie") > -1)?true:false;
}

function isGecko()
{
  return ((navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
}

function isOpera()
{
  return (navigator.userAgent.toLowerCase().indexOf("opera") > -1)?true:false;
}

function whichBrowser()
{
  try
  {
    if (document.all)
    {
      alert("Internet Explorer Detected");
    }
    else if (document.layers)
    {
      alert("Netscape Navigator Detected");
    }
  }
  catch (error)
  {
    gjonerror( error, "whichBrowser ");
  }
}

//dup in xulutils used for install
function gjwhichOS()
{
  var splatform;
  if (typeof(window.navigator.platform) != 'undefined')
  {
    splatform = window.navigator.platform.toLowerCase();
    if (splatform.indexOf('win') != -1)
    {
      return 'w';
    }
    else if (splatform.indexOf('mac') != -1)
    {
      return 'm';
    }
    else if (splatform.indexOf('unix') != -1 || splatform.indexOf('linux') != -1)
    {
      return 'x';
    }
  }
  return 0;
}

function LTrim(str)
{
  for (var k=0; k<str.length && str.charAt(k)<=" " ; k++){} ;

  return str.substring(k,str.length);
}

function RTrim(str)
{
  for (var j=str.length-1; j>=0 && str.charAt(j)<=" " ; j--) {} ;

  return str.substring(0,j+1);
}

function Trim(str)
{
  return LTrim(RTrim(str));
}

function stristr( str1, str2)
{

  var pos = 0;

  str1 += '';
  pos = str1.toLowerCase().indexOf( (str2+'').toLowerCase() );
  if( pos == -1 )
  {
    return 0;
  }
  else
  {
    return 1;
  }
}