
/*
 * -------
 * :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.Author = Array([this.ShortListSize]);
this.Link = Array([this.ShortListSize]);
this.DateN = Array([this.ShortListSize]);

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



 this.ShortListSize = 13;
 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 Author Link LinkTitle DayN Day2N MonthN Month2N Year2N Year4N YearN Year Time Hour2N Minute2N ") ) {
         return(1);

    }
    else if( this.is(msgCmd, "MetaCount") ) {
        return(13);
    }
    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] = "&#169; 1986-2007 The Scientist";
MetaKeys[1] = "MetaTitle";
MetaVals[1] = "News from The Scientist";
MetaKeys[2] = "MetaLink";
MetaVals[2] = "http://www.the-scientist.com";
MetaKeys[3] = "MetaLinkTitle";
MetaVals[3] = "<A HREF=\"http://www.the-scientist.com\" CLASS=\"JSMsg\">News from The Scientist</A>";
MetaKeys[4] = "MetaDesc";
MetaVals[4] = "The latest biological and medical news from The Scientist";


/* content vaues:
*/
Title[0] = "Ocean life support dwindling";
Desc[0] = "Phytoplankton have been declining by 1 percent each year for 100 years, spelling trouble for Earth\'s oceans";
Author[0] = "Jef Akst";
Link[0] = "\n									http://www.the-scientist.com/blog/display/57576/\n								";
DateN[0] = "20100728200000";

Title[1] = "Tasty transgenics";
Desc[1] = "Check out ongoing projects that are tinkering with edible animals";
Author[1] = "Jennifer Welsh";
Link[1] = "\n									http://www.the-scientist.com/blog/display/57577/\n								";
DateN[1] = "20100728200000";

Title[2] = "Eyelashes up close";
Desc[2] = "Cilia are a must-have appendage, and they do much more than swat bodily currents -- indeed, new research is suggesting they play an important role in development and disease";
Author[2] = "Peter Satir";
Link[2] = "\n									http://www.the-scientist.com/article/display/57525/\n								";
DateN[2] = "20100728200000";

Title[3] = "$1B boost for NIH?";
Desc[3] = "The increase, which now has support from the U.S. House and Senate, would up the agency\'s funding by 3.2 percent";
Author[3] = "Bob Grant";
Link[3] = "http://blog.the-scientist.com/2010/07/28/senate-oks-1-billion-boost-for-nih/";
DateN[3] = "20100728200000";

Title[4] = "Q&A: Do we need a stem cell bank?";
Desc[4] = "Evan Snyder doesn\'t think so";
Author[4] = "Jennifer Welsh";
Link[4] = "\n									http://www.the-scientist.com/blog/display/57573/\n								";
DateN[4] = "20100727200000";

Title[5] = "Top 7 neuroscience papers";
Desc[5] = "Check out the highest ranked articles from a 30-day period on Faculty of 1000 Neuroscience";
Author[5] = "Megan Scudellari";
Link[5] = "\n									http://www.the-scientist.com/blog/display/57574/\n								";
DateN[5] = "20100727200000";

Title[6] = "Brain, interrupted";
Desc[6] = "It affects thousands per day, yet has no treatment, and receives only a small fraction of the funding allocated to much less common diseases. Now, researchers studying traumatic brain injury are making a last-ditch effort to transform the field";
Author[6] = "Megan Scudellari";
Link[6] = "\n									http://www.the-scientist.com/article/display/57527/\n								";
DateN[6] = "20100727200000";

Title[7] = "News in a nutshell";
Desc[7] = "A bleak AIDS meeting; America COMPETES, again; monster marmots";
Author[7] = "Bob Grant";
Link[7] = "http://blog.the-scientist.com/2010/07/26/news-in-a-nutshell-8/";
DateN[7] = "20100726200000";

Title[8] = "Perry\'s Arcana, 1810-1811";
Desc[8] = "Check out one of the first serial magazines of natural history, along with a video slideshow";
Author[8] = "Jef Akst";
Link[8] = "\n									http://www.the-scientist.com/article/display/57538/\n								";
DateN[8] = "20100726200000";

Title[9] = "Best Places to Work Academia 2010";
Desc[9] = "From the farmlands of France to the rust-colored post-industrial cities of Michigan, this year\'s top institutions are finding good science in some rather unusual places";
Author[9] = "Lauran Urban";
Link[9] = "\n									http://www.the-scientist.com/article/display/57513/\n								";
DateN[9] = "20100726200000";

Title[10] = "Totipotent art";
Desc[10] = "A stem cell biologist finds the time for a successful career as a fine art photographer";
Author[10] = "Jef Akst";
Link[10] = "\n									http://www.the-scientist.com/blog/display/57572/\n								";
DateN[10] = "20100723200000";

Title[11] = "Video: When peat goes POP";
Desc[11] = "Lowly Sphagnum employs sophisticated tactics to get its spores out and about";
Author[11] = "Bob Grant";
Link[11] = "\n									http://www.the-scientist.com/news/display/57571/\n								";
DateN[11] = "20100723200000";

Title[12] = "Alphabet soup";
Desc[12] = "Before polymerases and ribosomes existed, how were nucleic acid and proteins made?";
Author[12] = "Richard P. Grant ";
Link[12] = "\n									http://www.the-scientist.com/article/display/57520/\n								";
DateN[12] = "20100723200000";

} // end with block
