
/*
 * -------
 * :ATTRIBUTION NOTICE BEGINS
 *
 * The following JSMsg functions are:
 * 
 *    (C) Copyright 2002 - 2004, Creativyst, Inc.
 *               ALL RIGHTS RESERVED
 * 
 * For more information go to:
 *   http://www.Creativyst.com/Doc/Std/JSMsg/JSMsg.htm
 * or email:
 *            Support@Creativyst.com
 * 
 * Licensed under the Open Software License version 1.1
 *
 * END ATTRIBUTION NOTICE:
 * -------
 *
 * The following version token is 
 * required by aggregators
 * -------
 * JSMsgVersion:1.0a
 * -------
 *
 * Made by: JSMFeed.pl v1.0e
*/
/* JSCpragma:StartCompress
*/
/* These functions are free software; you can redistribute 
 * them and/or modify them under the terms of the Open 
 * Software License (OSL) version 1.1 as published by
 * the Open Source Initiative;
 * 
 * This program is distributed in the hope that it will 
 * be useful, but WITHOUT ANY WARRANTY; without even the 
 * implied warranty of MERCHANTABILITY or FITNESS FOR A 
 * PARTICULAR PURPOSE. See the Open Software License
 * version 1.1 for more details.
 * 
 * For the complete details of the Open Software License
 * please visit the Open Source Initiative website.
 *
 * 
 * These functions are part of a shared convention.
 * called JSMsg.  Please see the JSMsg document
 * for more details.
 *
 * www.creativyst.com/Doc/Std/JSMsg/JSMsg.htm
 *
 * -------------------------------------------
 * Parts of this code were automatically
 * generated and may contain copyrighted
 * content from other sources as well.
 * Such content may not be used without
 * first obtaining explicit permissions
 * from their sources.
 *
 *
*/

function nn_JSMsg() {

this.Title = Array([this.ShortListSize]);
this.Desc = Array([this.ShortListSize]);
this.Link = Array([this.ShortListSize]);
this.DateN = Array([this.ShortListSize]);

this.MetaKeys = Array([6]);
this.MetaVals = Array([6]);



 this.ShortListSize = 8;
 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.GetMsgN = function()
 {
	return(this.ShortListSize);
 }

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


 this.GetN = function(msgPart, msgNumber)
 {
    return( 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,"Year2N") ) {
            return(this.DateN[msgNumber].substr(2,2));
          }
          return(this.DateN[msgNumber].substr(0,4));
        }
    }

    if(  this.ok(msgPart,"Time") ) {
      myTmp = this.DateN[msgNumber];
      return(myTmp.substr(8,6));
    }
    if(  this.ok(msgPart,"Hour2N") ) {
      myTmp = this.DateN[msgNumber];
      return(myTmp.substr(8,2));
    }
    if(  this.ok(msgPart,"Minute2N") ) {
      myTmp = this.DateN[msgNumber];
      return(myTmp.substr(10,2));
    }

    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)
 {
    var i,l;

    if( this.is(msgCmd, "Title LinkTitle Desc Description Link LinkTitle DayN Day2N MonthN Month2N Year2N Year4N YearN Year Time Hour2N Minute2N ") ) {
         return(1);

    }
    else if( this.is(msgCmd, "MetaCount") ) {
        return(8);
    }
    else {
        if(this.MetaKeys) {
            l = this.MetaKeys.length;
            for(i = 0;i < l;i++) {
                if(this.MetaKeys[i] == msgCmd) {
                    return(this.MetaVals[i]);
                }
            }
        }
        return(0);
    }
 }

     

}

nn = new nn_JSMsg();

/* how slow is the with statement */

with( nn ) {
/* Meta values
*/
MetaKeys[0] = "MetaCopyright";
MetaVals[0] = "© 2010 Cable News Network LP, LLLP.";
MetaKeys[1] = "MetaTitle";
MetaVals[1] = "Financial news of the day - CNNMoney.com";
MetaKeys[2] = "MetaLink";
MetaVals[2] = "http://money.cnn.com/rssclick/mostpopular/?section=money_mostpopular";
MetaKeys[3] = "MetaLinkTitle";
MetaVals[3] = "<A HREF=\"http://money.cnn.com/rssclick/mostpopular/?section=money_mostpopular\" CLASS=\"JSMsg\">Financial news of the day - CNNMoney.com</A>";
MetaKeys[4] = "MetaUpdateDate";
MetaVals[4] = "20100904221303";
MetaKeys[5] = "MetaDesc";
MetaVals[5] = "From CNN and Money magazine, CNNMoney.com combines business news and in-depth market analysis with practical advice and answers to personal finance questions.";


/* content vaues:
*/
Title[0] = "I have $10,000 and four months. Where do I invest?";
Desc[0] = "Question: I have a budget of $10,000 for a stock simulation I\'m doing for a business and personal-finance class. What stocks should I invest in to make the most money in four months? -- Matt";
Link[0] = "http://money.cnn.com/rssclick/2010/09/03/pf/expert/right_way_to_invest.moneymag/index.htm?section=money_mostpopular";
DateN[0] = "20100903060137";

Title[1] = "What went wrong at Burger King";
Desc[1] = "It\'s not yet clear what Burger King\'s new owner, the Brazilian-backed private equity firm 3G Capital, has in mind for the troubled No. 2 fast-food chain. But a total strategic revamp is in order.";
Link[1] = "http://money.cnn.com/rssclick/2010/09/03/news/companies/burger_king_buyout.fortune/index.htm?section=money_mostpopular";
DateN[1] = "20100903121702";

Title[2] = "Why all smartphones are $199";
Desc[2] = "A hot new smartphone can be Incredible, Vibrant, Epic or just \"eh,\" but no matter how it stacks up, it\'s a safe bet that it will start selling at $199.";
Link[2] = "http://money.cnn.com/rssclick/2010/09/01/technology/smartphone_price/index.htm?section=money_mostpopular";
DateN[2] = "20100901034149";

Title[3] = "The fading iPod Classic";
Desc[3] = "The iPod helped Apple rise from the dead in the last decade. But the iPod Classic, the device that jump-started that resurrection, didn\'t get so much as a mention from Steve Jobs at Apple\'s iPod event on Wednesday.";
Link[3] = "http://money.cnn.com/rssclick/2010/09/02/technology/ipod_classic/index.htm?section=money_mostpopular";
DateN[3] = "20100902144132";

Title[4] = "Housing\'s new nightmare";
Desc[4] = "In another ominous sign for the economy, the number of people falling behind on their mortgages for the first time is on the rise.";
Link[4] = "http://money.cnn.com/rssclick/2010/08/27/news/economy/housing_economy_delinquencies/index.htm?section=money_mostpopular";
DateN[4] = "20100827144319";

Title[5] = "Overworked? Take back your lunch hour";
Desc[5] = "Dear Annie: Your article about why everyone should take a vacation (\"5 ways to take a guilt-free vacation,\" June 2) got a lot of attention in my office, and we all agree that we are exhausted and need some downtime. But how are we supposed to take our vacations when we can\'t even get away from our desks long enough to go out for lunch? I work for a big company where so many people have been laid off in the past two years that, even with business relatively slow, we are all putting in 10- and 12-hour days (for weeks on end) just to get the work out the door.";
Link[5] = "http://money.cnn.com/rssclick/2010/08/31/news/economy/lunch_hour.fortune/index.htm?section=money_mostpopular";
DateN[5] = "20100902093456";

Title[6] = "Should US government debt be rated junk?";
Desc[6] = "A few weeks ago, Hedgeye, the investment research firm where I\'m a managing director, hosted a conference call for our subscribers that posed the question, \"Should U.S. Government Debt Be Rated Junk Status?\" Given that debt issued by the U.S. government continues to trade at almost all-time lows in yield, this is a contrarian call to say the least.";
Link[6] = "http://money.cnn.com/rssclick/2010/09/02/news/economy/US_Treasury_debt_junk_status.fortune/index.htm?section=money_mostpopular";
DateN[6] = "20100903090147";

Title[7] = "Home prices gain 3.6% in past year";
Desc[7] = "Despite a recent spate of bad news coming out of the housing industry, home prices show signs of stabilizing.";
Link[7] = "http://money.cnn.com/rssclick/2010/08/31/real_estate/June_Case_Shiller/index.htm?section=money_mostpopular";
DateN[7] = "20100831095327";

} // end with block
