
/*
 * -------
 * :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 = 10;
 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(10);
    }
    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] = "CNN.com";
MetaKeys[2] = "MetaLink";
MetaVals[2] = "http://www.cnn.com/?eref=rss_topstories";
MetaKeys[3] = "MetaLinkTitle";
MetaVals[3] = "<A HREF=\"http://www.cnn.com/?eref=rss_topstories\" CLASS=\"JSMsg\">CNN.com</A>";
MetaKeys[4] = "MetaUpdateDate";
MetaVals[4] = "20100904220504";
MetaKeys[5] = "MetaDesc";
MetaVals[5] = "CNN.com delivers up-to-the-minute news and information on the latest top stories, weather, entertainment, politics and more.";


/* content vaues:
*/
Title[0] = "Rights group: Iran orders 99 lashes for condemned woman";
Desc[0] = "An Iranian woman already condemned to death for adultry may be facing another sentence of 99 lashes because it appears she was photographed without a head scarf. Foes of her execution say it is a case of mistaken identity.";
Link[0] = "http://www.cnn.com/2010/WORLD/meast/09/04/iran.stoning/index.html?eref=rss_topstories";
DateN[0] = "20100904204330";

Title[1] = "Terror network broken up, Bahrain says";
Desc[1] = "Bahrain says it plans to charge 23 people for plotting to overthrow the government and for belonging to what officials described as a sophisticated terrorist network, the Bahrain News Agency (BNA) reported on Saturday.";
Link[1] = "http://www.cnn.com/2010/WORLD/meast/09/04/bahrain.arrests/index.html?eref=rss_topstories";
DateN[1] = "20100904205653";

Title[2] = "Craigslist censors its adult section";
Desc[2] = "Online classified service Craigslist\'s decision to censor its adult services section could be a model for other websites, a leader in the fight against prostitution ads said Saturday.";
Link[2] = "http://www.cnn.com/2010/CRIME/09/04/craigslist.censored/index.html?eref=rss_topstories";
DateN[2] = "20100904181807";

Title[3] = "Earl lashes Canada after skirting U.S.";
Desc[3] = "Tropical Storm Earl raked Canada\'s Nova Scotia on Saturday, and its winds grew stronger on Prince Edward Island, the National Hurricane Center said.";
Link[3] = "http://www.cnn.com/2010/US/09/04/tropical.weather/index.html?eref=rss_topstories";
DateN[3] = "20100904184912";

Title[4] = "U.S. drone kills 4 militants, source says";
Desc[4] = "An apparent U.S. drone strike killed four suspected militants in Pakistan near the Afghanistan border, two Pakistani intelligence officials told CNN on Saturday.";
Link[4] = "http://www.cnn.com/2010/WORLD/asiapcf/09/04/pakistan.drone.strike/index.html?eref=rss_topstories";
DateN[4] = "20100904160529";

Title[5] = "Mistrial in alleged \'sham marriage\' case";
Desc[5] = "The sham marriage trial of actress Fernanda Romero, which the judge has likened to a soap opera, appeared threatened with a mistrial Friday after a dramatic turn a day earlier.";
Link[5] = "http://www.cnn.com/2010/CRIME/09/03/california.actress.sham.marriage.trial/index.html?eref=rss_topstories";
DateN[5] = "20100903223745";

Title[6] = "Opinion: Reporting Ariz. to U.N. correct";
Desc[6] = "Since World War II, Democratic and Republican administrations alike have consistently held the United States out as a worldwide model for the protection and promotion of human rights standards.";
Link[6] = "http://www.cnn.com/2010/OPINION/09/04/bhatnagar.arizona.un/index.html?eref=rss_topstories";
DateN[6] = "20100904163402";

Title[7] = "Quake-hit N. Zealand city under curfew";
Desc[7] = "Officials declared a state of emergency Saturday after a powerful predawn earthquake struck near Christchurch, New Zealand, sending people into the streets as windows exploded, water mains broke and buildings crumbled.";
Link[7] = "http://www.cnn.com/2010/WORLD/asiapcf/09/04/new.zealand.quake.aftermath/index.html?eref=rss_topstories";
DateN[7] = "20100904094202";

Title[8] = "U.N. official pleads for aid for Pakistan";
Desc[8] = "A United Nations representative on Saturday pleaded for more international aid to help the millions of Pakistanis displaced from flooding that has ravaged the country for more than a month.";
Link[8] = "http://www.cnn.com/2010/WORLD/asiapcf/09/04/pakistan.floods/index.html?eref=rss_topstories";
DateN[8] = "20100904062330";

Title[9] = "\'Mummified\' babies found in basement";
Desc[9] = "Detectives are investigating the discovery of two \"mummified\" babies found wrapped in 1930s newspaper in the basement of a Los Angeles apartment building.";
Link[9] = "http://www.cnn.com/2010/US/09/04/california.mummified.babies/index.html?eref=rss_topstories";
DateN[9] = "20100904072351";

} // end with block
