
/*
 * Creativyst(R) Quote Catcher (v1.0d)
 *
 *  (C) Copyright 2002-2005, 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 = 30;

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;

    return(insideMsg);

    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] = "But the day of the Lord will come as a thief in the night; in the which the heavens shall pass away with a great noise, and the elements shall melt with fervent heat, the earth also and the works that are therein shall be burned up.";
Attrib[0] = "2 Peter 3:10";

Type[1] = "Quote";
Body[1] = "He answered and said, Lo, I see four men loose, walking in the midst of the fire, and they have no hurt; and the form of the fourth is like the Son of God.";
Attrib[1] = "Daniel 3:25";

Type[2] = "Quote";
Body[2] = "Beloved, let us love one another: for love is of God; and every one that loveth is born of God, and knoweth God.";
Attrib[2] = "1 John 4:7";

Type[3] = "Quote";
Body[3] = "Wherefore take unto you the whole armour of God, that you may be able to withstand in the evil day, and having done all to stand.";
Attrib[3] = "Ephesians 6:13";

Type[4] = "Quote";
Body[4] = "In the beginning God created the heavens and the earth. And the earth was without form, and void; and darkness was upon the face of the deep. And the spirit of God moved upon the face of the waters.";
Attrib[4] = "Genesis 1:1-2";

Type[5] = "Quote";
Body[5] = "I Beseech you therefore, brethren, by the mercies of God, that ye present your bodies a living sacrifice, holy, acceptable unto God, which is your reasonable service.";
Attrib[5] = "Romans 12:1";

Type[6] = "Quote";
Body[6] = "Let every thing that hath breath praise the Lord. Praise ye the Lord.";
Attrib[6] = "Psalms 150:6";

Type[7] = "Quote";
Body[7] = "Children, obey your parents in the Lord: for this is right.";
Attrib[7] = "Ephesians 6:1";

Type[8] = "Quote";
Body[8] = "Let not your heart be troubled: ye believe in God, believe also in me.";
Attrib[8] = "John 14:1";

Type[9] = "Quote";
Body[9] = "In the beginning was the Word, and the Word was with God, and the Word was God.";
Attrib[9] = "John 1:1";

Type[10] = "Quote";
Body[10] = "For God so loved the world, that he gave his only begotten Son, that whoesoever believeth in him should not perish, but have everlasting life.";
Attrib[10] = "John 3:16";

Type[11] = "Quote";
Body[11] = "I can do all things through Christ which strengtheneth me.";
Attrib[11] = "Philippians 4:13";

Type[12] = "Quote";
Body[12] = "And now abideth faith, hope, charity, these three, but the greatest of these is charity.";
Attrib[12] = "1 Corinthians 13:13";

Type[13] = "Quote";
Body[13] = "Make a joyful noise unto the Lord, all ye lands. Serve the Lord with gladness: come before his presence with singing.";
Attrib[13] = "Psalms 100:1-2";

Type[14] = "Quote";
Body[14] = "Judge not, that ye be not judged.";
Attrib[14] = "Matthew 7:1";

Type[15] = "Quote";
Body[15] = "This is my commandment, That ye love one another, as I have loved you.";
Attrib[15] = "John 15:12";

Type[16] = "Quote";
Body[16] = "A soft answer turneth away wrath: but grievous words stir up anger.";
Attrib[16] = "Proverbs 15:1";

Type[17] = "Quote";
Body[17] = "And God blessed Noah and his sons, and said unto them, Be fruitful, and multiply, and replenish the earth.";
Attrib[17] = "Genesis 9:1";

Type[18] = "Quote";
Body[18] = "If it be so, our God whom we serve is able to deliver us from the burning fiery furnace, and he will deliver us out of thine hand, O king.";
Attrib[18] = "Daniel 3:17";

Type[19] = "Quote";
Body[19] = "For God is not the author of confusion, but of peace, as in all churches of the saints.";
Attrib[19] = "1 Corinthians 14:33";

Type[20] = "Quote";
Body[20] = "If I have told you earthly things, and ye believe not, how shall ye believe, if I tell you of heavenly things?";
Attrib[20] = "John 3:12";

Type[21] = "Quote";
Body[21] = "For God sent not his Son into the world to condemn the world; but that the world through him might be saved.";
Attrib[21] = "John 3:17";

Type[22] = "Quote";
Body[22] = "Blessed is the man that walketh not in the council of the ungodly, nor standeth in the way of sinners, nor sitteth in the seat of the scornful.";
Attrib[22] = "Psalms 1:1";

Type[23] = "Quote";
Body[23] = "And the Lord God formed man of the dust of the ground, and breathed into his nostrils the breath of life; and man became a living soul.";
Attrib[23] = "Genesis 2:7";

Type[24] = "Quote";
Body[24] = "Therefore shall a man leave his father and his mother, and shall cleave unto his wife: and they shall be one flesh.";
Attrib[24] = "Genesis 2:24";

Type[25] = "Quote";
Body[25] = "Man that is born of a woman is of few days, and full of trouble.";
Attrib[25] = "Job 14:1";

Type[26] = "Quote";
Body[26] = "Praise ye the Lord. Sing unto the Lord a new song, and his praise in the congregation of saints.";
Attrib[26] = "Psalms149:1";

Type[27] = "Quote";
Body[27] = "But he turned, and said unto Peter, Get thee behind me, Satan: thou art an offense unto me: for thou savourest not the things that be of God, but those that be of men.";
Attrib[27] = "Matthew 16:23";

Type[28] = "Quote";
Body[28] = "But Jesus said, Suffer little children, and forbid them not, to come unto me: for such is the kingdom of heaven.";
Attrib[28] = "Matthew 19:14";

Type[29] = "Quote";
Body[29] = "And he arose, and rebuked the wind, and said unto the sea, Peace, be still. And the wind ceased, and there was a great calm.";
Attrib[29] = "Mark 4:39";

} // end with block


