
/*
 * Creativyst(R) Quote Catcher (v1.0d)
 *
 *  (C) Copyright 2002-2004, Creativyst, Inc.
 *           ALL RIGHTS RESERVED
 *
 * You may not copy, distribute, or produce
 * derivative works of the following code
 * without the expressed, written permission
 * of Creativyst, Inc.
 *
 * Parts of this code were automatically
 * generated and may contain copyrighted
 * content from other sources as well.
 * Such content may not be used without
 * permission from its respective sources.
 *
 *
 *
*/

function cqc_JSMsg() {
  this.ListPosition = 0;

this.Type = Array([this.ShortListSize]);
this.Desc = Array([this.ShortListSize]);
this.Body = Array([this.ShortListSize]);
this.Attrib = Array([this.ShortListSize]);


 this.ShortListSize = 30;
 this.BeenLoaded = 0;
 this.dispNumb;

 this.Msg = function(msgPart, msgOffset)
 {
    document.write( this.Get(msgPart, msgOffset) );
 }

 this.MsgDay = function(msgPart)
 {
    document.write( this.GetDay(msgPart) );
 }

 this.MsgN = function(msgPart, msgNumber)
 {
    document.write( this.GetN(msgPart, msgNumber) );
 }


 this.Get = function(msgPart, msgOffset)
 {
    if(!msgOffset) {
        msgOffset = 0;
    }
    if(!this.BeenLoaded) {
        this.BeenLoaded = 1;
        dispNumb = 
           this.getRandInt(this.ShortListSize);
    }
    return( this.GetN(msgPart, (dispNumb + msgOffset)) );
 }

 this.GetDay = function(msgPart)
 {
    var d = new Date();
    var x = d.getDate();
    return( this.GetN(msgPart, x) );
 }



 this.GetN = function(msgPart, msgNumber)
 {
    return( this.ChkShowroom( this.GetNCore(msgPart, msgNumber) ) );
 }

 this.GetNCore = function(msgPart, msgNumber)
 {
    var myTmp;

    if(!msgPart) {
        msgPart = "Body";
    }
    if(!msgNumber) {
        msgNumber = 0;
    }

    if(msgNumber >= this.ShortListSize) {
        msgNumber = msgNumber % this.ShortListSize;
    }

    if(  this.ok(msgPart,"Type") ) {
        return(this.Type[msgNumber]);
    }
    if(  this.ok(msgPart,"Title") ) {
        return(this.Title[msgNumber]);
    }
    if(  this.ok(msgPart, "Desc Description Content") ) {
        return(this.Desc[msgNumber]);
    }
    if(  this.ok(msgPart,"Body") ) {
        return(this.Body[msgNumber]);
    }
    if(  this.ok(msgPart, "Attrib Attribute Source") ) {
        return(this.Attrib[msgNumber]);
    }
    if(  this.ok(msgPart, "Author") ) {
        if(!this.Author[msgNumber]) {
            return(this.Attrib[msgNumber]);
        }
        return(this.Author[msgNumber]);
    }

    if(  this.ok(msgPart,"DayN Day2N Day") ) {
        myTmp = this.DateN[msgNumber];
        if(myTmp.length) { 
          myTmp = myTmp.substr(6,2);
          if(  this.ok(msgPart,"Day2N") ) {
            return(myTmp);
          }
          if(myTmp.charAt(0) == "0") {
            return(myTmp.substr(1,1))
          }
          return(myTmp);
        }
    }
    if(  this.ok(msgPart, "MonthN Month2N") ) {
        myTmp = this.DateN[msgNumber];
        if(myTmp.length) {
          myTmp = myTmp.substr(4,2)
          if(  this.ok(msgPart,"Month2N") ) {
            return(myTmp);
          }
          if(myTmp.charAt(0) == "0") {
            return(myTmp.substr(1,1))
          }
          return(myTmp);
        }
    }
    if(  this.ok(msgPart, "Year2N Year4N YearN Year") ) {
        if(this.DateN[msgNumber].length) {
          if(  this.ok(msgPart,"Year4N") ) {
            return(this.DateN[msgNumber].substr(0,4));
          }
          return(this.DateN[msgNumber].substr(0,4));
        }
    }

    if(  this.ok(msgPart,"Link") ) {
        return(this.Link[msgNumber]);
    }
    if( this.ok(msgPart,"LinkTitle") ) {
        if(this.MetaMsg(msgPart,"Link") && this.MetaMsg(msgPart,"Title") ) {
          if( !this.Link[msgNumber] ) {
              return(this.Title[msgNumber]);
          }

          if( !this.Title[msgNumber] ) {
            this.Title[msgNumber] =  this.Link[msgNumber];              
          }
          myTmp = '<A TARGET="_blank" \n'; 
          myTmp = myTmp + 'HREF="' + this.Link[msgNumber] + '">\n';
          myTmp = myTmp + this.Title[msgNumber] + '</A>\n';

          return(myTmp);

        }
        if( this.MetaMsg(msgPart,"Title") ) {
          return(this.Title[msgNumber]);
        }
        if( this.MetaMsg(msgPart,"Link") ) {
          if( this.Link[msgNumber] ) {
            myTmp = "<A TARGET=\"_blank\" \n"; 
            myTmp = myTmp + "HREF=\"" + this.Link[msgNumber] + "\">\n";
            myTmp = myTmp + this.Link[msgNumber] + "</A>\n";
            return(myTmp);
          }
        }
        return("");
    }
    if( this.ok(msgPart,"Cat Category Subject") ) {
        return(this.Cat[msgNumber]);
    }
    if( this.ok(msgPart,"Thumb") ) {
        return(this.Thumb[msgNumber]);
    }
    if( this.ok(msgPart,"Alt") ) {
        return(this.Alt[msgNumber]);
    }

    return("");
 }




 this.getRandInt = function(RandSz)
 {
    var t, t2, t3;

    t = 0;
    while(t < .000001) {
        t = Math.random();
        t = Math.abs(t);
    }
    t2 = t * 1000000;
    t2 = Math.round(t2);
    t3 = t2 % RandSz;
    return(t3);
 }



 this.ok = function(a, b)
 {
    var t, t2;

    if(!this.is(a,b)) {
        return(0);
    }
    return(this.MetaMsg(a));
 }

 this.is = function(a, b)
 {
    var t, t2;

    t = a + " ";
    t2 = b + " ";
    t2 = t2.toUpperCase();
    t = t.toUpperCase();

    if(t2.indexOf(t) == -1) {
        return(0);
    }
    return(1);
 }


 this.MetaMsg = function(msgCmd)
 {
    if( this.is(msgCmd, "Type Desc Description Body Attrib Source ") ) {
         return(1);

    }
    else if( this.is(msgCmd, "MetaCount") ) {
        return(30);
    }
    else {
        return(0);
    }
 }


 this.ChkShowroom = function(insideMsg)
 {
    var rv;

    

    if( (self.location.href.search(/http\:\/\/www\.creativyst/i) == -1)     &&      // us
        (self.location.href.search(/http\:\/\/216\.*/i) == -1)                      // Google cache
                                                                       ) {
        rv = "<A TARGET=\"_blank\" HREF=\"http://www.creativyst.com/Prod/14/\">";
        rv += insideMsg;
        rv += "</A>";
        return(rv);
    }
    return(insideMsg);

 }


}

cqc = new cqc_JSMsg();

/* how slow is the with statement */

with( cqc ) {
Type[0] = "Quote";
Body[0] = "A first rate soup is more creative than a second-rate painting.";
Attrib[0] = "Abraham Maslow";

Type[1] = "Quote";
Body[1] = "The one who can not forgive destroys the bridge over which he himself must cross";
Attrib[1] = "Unknown";

Type[2] = "Quote";
Body[2] = "People's hobbies are more their measure than are their jobs";
Attrib[2] = "Robert Byrne";

Type[3] = "Quote";
Body[3] = "Our Creator did not promise a world without evil, only that we would not face it alone";
Attrib[3] = "911 survivor";

Type[4] = "Quote";
Body[4] = "If you have integrity, nothing else matters. If you don't have integrity, nothing else matters.";
Attrib[4] = "Al Simpson, former U.S. Senator";

Type[5] = "Quote";
Body[5] = "Lying makes a problem part of the future, truth makes a problem part of the past";
Attrib[5] = "Rick Pitino";

Type[6] = "Quote";
Body[6] = "All truths are easy to understand once they are discovered, the point is to discover them";
Attrib[6] = "Galileo Galilei";

Type[7] = "Quote";
Body[7] = "Science has achieved some wonderful things of course, but I'd far rather be happy than right any day";
Attrib[7] = "HGTTG";

Type[8] = "Quote";
Body[8] = "He who asks is a fool for five minutes, but he who does not ask remains a fool forever";
Attrib[8] = "Old Chinese saying";

Type[9] = "Quote";
Body[9] = "If the learner has not learned, the teacher has not taught";
Attrib[9] = "Ernest Smith";

Type[10] = "Quote";
Body[10] = "Never fry bacon in the nude";
Attrib[10] = "L.B.";

Type[11] = "Quote";
Body[11] = "The first step on the road to truth is to call things by their proper names";
Attrib[11] = "Ancient Chinese saying";

Type[12] = "Quote";
Body[12] = "In each of us there is a little of all of us";
Attrib[12] = "Lichtenberg";

Type[13] = "Quote";
Body[13] = "In theory there is no difference between theory and practice; In practice there is";
Attrib[13] = "Chuck Reid";

Type[14] = "Quote";
Body[14] = "Diligence is the mother of good fortune";
Attrib[14] = "Cervantes";

Type[15] = "Quote";
Body[15] = "Where there is no fear, there can be no courage";
Attrib[15] = "Unknown";

Type[16] = "Quote";
Body[16] = "Courage is resistance to fear, mastery of fear - not absence of fear";
Attrib[16] = "Mark Twain";

Type[17] = "Quote";
Body[17] = "Given a choice between two theories, take the one which is funnier";
Attrib[17] = "Blore's Razor";

Type[18] = "Quote";
Body[18] = "The greatest risk is not taking one";
Attrib[18] = "Unknown";

Type[19] = "Quote";
Body[19] = "Oh life is a glorious cycle of song, a medley of extemporanea; And love is a thing that can never go wrong; And I am Marie of Roumania";
Attrib[19] = "Dorothy Parker";

Type[20] = "Quote";
Body[20] = "Have nothing in your houses that you do not know to be useful or believe to be beautiful";
Attrib[20] = "William Moreson";

Type[21] = "Quote";
Body[21] = "We attract hearts by the qualities we display; we retain them by the qualities we posses";
Attrib[21] = "Jean Baptiste Antoine Suard";

Type[22] = "Quote";
Body[22] = "The Internet will transform advertising because of its trackability, not its beauty";
Attrib[22] = "Eric Schmidt, Google CEO";

Type[23] = "Quote";
Body[23] = "Hollywood leaders like Jack Valenti would have organized the monks to burn down Gutenberg's printing press, if they were alive during that period of rapid change and innovation.";
Attrib[23] = "Harris N. Miller (president ITAA)";

Type[24] = "Quote";
Body[24] = "Knowledge without wisdom is like a swimming pool full of water without the swimming pool.";
Attrib[24] = "D. J. Repici";

Type[25] = "Quote";
Body[25] = "99.7 percent of all statistics are made up on the spot";
Attrib[25] = "Bruce Karsh";

Type[26] = "Quote";
Body[26] = "For a successful technology, reality must take precedence over public relations, for Nature cannot be fooled.";
Attrib[26] = "Dick Feynman";

Type[27] = "Quote";
Body[27] = "Marriage is fine, but when you mix your Lego collections, you're really serious";
Attrib[27] = "Stefan Gustavson";

Type[28] = "Quote";
Body[28] = "I turned over the keyboard and beat on it until some peanut shells fell out, and lo, all was well";
Attrib[28] = "Jerry Pournelle";

Type[29] = "Quote";
Body[29] = "Opportunity is missed by most people because it is dressed in overalls and looks like work";
Attrib[29] = "Thomas Edison";

} // end with block


