
/*
 * -------
 * :ATTRIBUTION NOTICE BEGINS
 *
 * The following JSMsg functions are:
 * 
 *    (C) Copyright 2002 - 2005, 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 demo_JSMsg() {

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

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



 this.ShortListSize = 20;
 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.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 Cat Category SubjectDayN Day2N MonthN Month2N Year2N Year4N YearN Year Time Hour2N Minute2N ") ) {
         return(1);

    }
    else if( this.is(msgCmd, "MetaCount") ) {
        return(20);
    }
    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);
    }
 }

     

}

demo = new demo_JSMsg();

/* how slow is the with statement */

with( demo ) {
/* Meta values
*/
MetaKeys[0] = "MetaCopyright";
MetaVals[0] = "2009 CBS Interactive Inc. All rights reserved";
MetaKeys[1] = "MetaTitle";
MetaVals[1] = "CNET News.com";
MetaKeys[2] = "MetaLink";
MetaVals[2] = "http://news.cnet.com/";
MetaKeys[3] = "MetaLinkTitle";
MetaVals[3] = "<A HREF=\"http://news.cnet.com/\" CLASS=\"JSMsg\">CNET News.com</A>";
MetaKeys[4] = "MetaUpdateDate";
MetaVals[4] = "JulyJuJu000000";
MetaKeys[5] = "MetaDesc";
MetaVals[5] = "Tech news and business reports by CNET News. Focused oninformation technology, core topics include computers, hardware, software,networking, and Internet media..";


/* content vaues:
*/
Title[0] = "How to use App Tabs in Firefox (video)";
Desc[0] = "Mozilla has given tabs some long-overdue love in the second Firefox 4 beta with App Tabs, a feature that annihilates your scramble to search for that one elusive open tab. Watch what it does in this How To video.";
Link[0] = "http://download.cnet.com/8301-2007_4-20012241-12.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[0] = "";
DateN[0] = "20100730115129";

Title[1] = "\'Smart window\' maker Soladigm to build factory";
Desc[1] = "Soladigm, which adds thin films to glass to block light and heat, plans a manufacturing plant in Mississippi to make its green building gear.";
Link[1] = "http://news.cnet.com/8301-11128_3-20012233-54.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[1] = "";
DateN[1] = "20100730110611";

Title[2] = "Did we pronounce privacy dead this week?";
Desc[2] = "Academics Jeff Jarvis and Danah Boyd, on stage at Supernova, can\'t pinpoint a solution to online privacy controversies, but agree misguided attempts to define privacy are part of the problem.";
Link[2] = "http://news.cnet.com/8301-13577_3-20012234-36.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[2] = "";
DateN[2] = "20100730110127";

Title[3] = "Apple tries to patent travel, hotel, shopping apps";
Desc[3] = "The company applied for a patent on mobile applications for booking flights and hotels, as well as mobile shopping services.";
Link[3] = "http://news.cnet.com/8301-31021_3-20012208-260.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[3] = "";
DateN[3] = "20100730104324";

Title[4] = "Report: Google, CIA fund predictive analytics firm";
Desc[4] = "Google Ventures and CIA\'s investment arm fund Recorded Future, a start-up that monitors Web and connects dots between people, places, events, Wired says.";
Link[4] = "http://news.cnet.com/8301-27080_3-20012213-245.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[4] = "";
DateN[4] = "20100730102631";

Title[5] = "Week in review: Jailbreaking goes legit";
Desc[5] = "Copyright office says bypass is legal, while Wikileaks publishes classified documents on the war in Afghanistan. Also: New Apple desktops.";
Link[5] = "http://news.cnet.com/8301-1001_3-20012168-92.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[5] = "";
DateN[5] = "20100730100039";

Title[6] = "Sony, McAfee, sued over software activation patent";
Desc[6] = "Uniloc USA is also suing Activision, Quark, others as follow-up to a similar suit filed against Microsoft over software activation tech.";
Link[6] = "http://news.cnet.com/8301-13578_3-20012200-38.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[6] = "";
DateN[6] = "20100730092942";

Title[7] = "360 Panorama does instant, awesome panoramas";
Desc[7] = "Want to grab a quick panoramic picture with your iPhone? The makers of the popular RedLaser app have a new photo tool out that can create one using your iPhone\'s video camera.";
Link[7] = "http://news.cnet.com/8301-27076_3-20012163-248.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[7] = "";
DateN[7] = "20100730090000";

Title[8] = "T-Mobile cares";
Desc[8] = "Google releases location-aware mobile advertising, Research In Motion could launch its iPhone killer by next week, and T-Mobile ranks first in wireless customer service.";
Link[8] = "http://news.cnet.com/1606-2_3-50090986.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[8] = "";
DateN[8] = "20100730082959";

Title[9] = "Big data in context";
Desc[9] = "A whole realm of new vendors aim to make it easier to process vast amounts of information. It\'s a field that\'s as interesting as it is complicated.";
Link[9] = "http://news.cnet.com/8301-13846_3-20012164-62.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[9] = "";
DateN[9] = "20100730081701";

Title[10] = "Samsung profit, sales up on TV and chip demand";
Desc[10] = "Second-quarter earnings shoot up 83 percent to record levels while sales rise 21 percent as the company sees surging demand for computer chips and TVs.";
Link[10] = "http://news.cnet.com/8301-1001_3-20012186-92.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[10] = "";
DateN[10] = "20100730080532";

Title[11] = "Home efficiency pros cross fingers Home Star will pass";
Desc[11] = "The Home Star program has a shot at passage in an oil spill-focused energy bill, paving the way for services and goods to improve home energy and water efficiency.";
Link[11] = "http://news.cnet.com/8301-11128_3-20012189-54.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[11] = "";
DateN[11] = "20100730080410";

Title[12] = "Justice Department sues Oracle, alleging fraud";
Desc[12] = "Lawsuit claims government agencies, under a contract that involved \"hundreds of millions of dollars in sales,\" got deals \"far inferior\" to those Oracle gave its commercial clients.";
Link[12] = "http://news.cnet.com/8301-1001_3-20012193-92.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[12] = "";
DateN[12] = "20100730080026";

Title[13] = "Picture of the Day 7/30: What is this?";
Desc[13] = "If you know what this is and where it\'s located, you could win a prize in the CNET Road Trip Picture of the Day challenge.";
Link[13] = "http://news.cnet.com/8301-13772_3-20012159-52.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[13] = "";
DateN[13] = "20100730080000";

Title[14] = "Mobile phone shipments ring in at 308 million";
Desc[14] = "Nokia and Samsung continue to dominate as global handset shipments rise 13 percent in the second quarter, though smartphone wars mean operating profits are volatile.";
Link[14] = "http://news.cnet.com/8301-1035_3-20012173-94.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[14] = "";
DateN[14] = "20100730064716";

Title[15] = "Facebook\'s IPO stalling: Are we even still surprised?";
Desc[15] = "A report from Bloomberg brings the shocking news that Facebook will not go public next year. Is the social network\'s repeated shying from an IPO more of a statement than anything else?";
Link[15] = "http://news.cnet.com/8301-13577_3-20012176-36.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[15] = "";
DateN[15] = "20100730062346";

Title[16] = "Friday Poll: Is the mouse, indeed, dead?";
Desc[16] = "Some say Apple\'s new Magic Trackpad heralds a mouse-free future. Are mice a dying breed or will they take their place alongside multitouch and gesture?";
Link[16] = "http://news.cnet.com/8301-17938_105-20012142-1.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[16] = "";
DateN[16] = "20100730060000";

Title[17] = "The 2011 Harleys roll off the line (photos)";
Desc[17] = "Road Trip 2010: What could be more appropriate for a road trip than seeing the world\'s most iconic motorcycles get made?";
Link[17] = "http://news.cnet.com/2300-11386_3-10004326.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[17] = "";
DateN[17] = "20100730045357";

Title[18] = "Ask Maggie: On cutting data costs and making video calls";
Desc[18] = "Ask Maggie is a weekly technology advice column tackling readers\' questions about mobile and broadband products, services, and issues.";
Link[18] = "http://news.cnet.com/8301-30686_3-20012162-266.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[18] = "";
DateN[18] = "20100730040000";

Title[19] = "Harley-Davidson\'s latest and greatest bikes";
Desc[19] = "Road Trip 2010: CNET reporter Daniel Terdiman appreciates adventure, and as part of his, he went to see Harley-Davidson put together the machines that will take countless people on endless journeys.";
Link[19] = "http://news.cnet.com/8301-13772_3-20012153-52.html?part=rss&amp;subj=news&amp;tag=2547-1_3-0-20";
Cat[19] = "";
DateN[19] = "20100730040000";

} // end with block
