
/*
 * -------
 * :ATTRIBUTION NOTICE BEGINS
 *
 * The following JSMsg functions are:
 * 
 *    (C) Copyright 2002 - 2003, Creativyst, Inc.
 *               ALL RIGHTS RESERVED
 * 
 * For more information go to:
 *           http://www.Creativyst.com
 * or email:
 *           Support@Creativyst.com
 * 
 * Licensed under the Open Software License version 1.1
 *
 * END ATTRIBUTION NOTICE:
 * -------
 * 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 its source.
 *
 *
*/

function cvsnew_JSMsg() {

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





 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)
 {
    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, "Title LinkTitle Desc Description Link LinkTitle DayN Day2N MonthN Month2N Year2N Year4N YearN Year ") ) {
         return(1);

    }
    else if( this.is(msgCmd, "MetaCount") ) {
        return(20);
    }
    else {
        return(0);
    }
 }


     

}

cvsnew = new cvsnew_JSMsg();

/* how slow is the with statement */

with( cvsnew ) {
Title[0] = "IT\'S BRILLIANT! SURE-GRIP GOES POLISHED";
Desc[0] = "Extruded Aluminum • Slip Resistant • Optional Light Kit PN#27-6000";
Link[0] = "http://www.westinautomotive.com/press_releases/2009/06.77.pdf";
DateN[0] = "20090821";

Title[1] = "\'09 Dodge Ram Product Offering";
Desc[1] = "All-Series Westin Products for \'09 Dodge Ram";
Link[1] = "http://www.westinautomotive.com/press_releases/2009/06.75.pdf";
DateN[1] = "20090723";

Title[2] = "Opportunity Knocks - Again!";
Desc[2] = "Westin Gives New Life To Older Model Vehicles 06.76";
Link[2] = "http://www.westinautomotive.com/press_releases/2009/06.76c1.pdf";
DateN[2] = "20090325";

Title[3] = "Westin Announces New Partnership With Wade Automotive";
Desc[3] = "www.wadeauto.com";
Link[3] = "http://westinautomotive.safepages.com/rss/2008/10/0001.htm";
DateN[3] = "20081013";

Title[4] = "Truck-Pal Tailgate Ladder Featured on “TRUCK-U”";
Desc[4] = "TUNE IN to Speed Channel";
Link[4] = "http://www.westinautomotive.com/press_releases/2008/follow-up/04.20c.pdf";
DateN[4] = "20080714";

Title[5] = "45-Series Polished Stainless Sportsman Grille Guard";
Desc[5] = "In Stock & Shipping!!";
Link[5] = "http://westinautomotive.safepages.com/rss/2008/03/0002.htm";
DateN[5] = "20080326";

Title[6] = "Westin\'s All New Truck-Pal Tailgate Ladder";
Desc[6] = "Convenient and Compact Storage";
Link[6] = "http://westinautomotive.safepages.com/rss/2008/03/0001.htm";
DateN[6] = "20080326";

Title[7] = "Westin Project Vehicle - \"24/7\"";
Desc[7] = "2007 Toyota Tundra CrewMax 4X4";
Link[7] = "http://www.westinautomotive.com/press_releases/2007/06.69.pdf";
DateN[7] = "20071211";

Title[8] = "Westin Project Vehicle - \"Tackle Jack\"";
Desc[8] = "2007 Ford F150 Super Crew FX4 4X4";
Link[8] = "http://www.westinautomotive.com/press_releases/2007/06.68.pdf";
DateN[8] = "20071211";

Title[9] = "NEW! Polished Stainless Sportsman Grille Guard";
Desc[9] = "- NOW AVAILABLE! 10/08/07";
Link[9] = "http://westinautomotive.safepages.com/rss/2007/10/0001.htm";
DateN[9] = "20071010";

Title[10] = "Xtreme Push Bars - Polished Stainless Available Now!";
Desc[10] = "http://westinautomotive.safepages.com/rss/2007/05/0001.htm";
Link[10] = "http://www.westinautomotive.com/press_releases/2007/01.45.pdf";
DateN[10] = "20070803";

Title[11] = "2007 Toyota Tundra";
Desc[11] = "Place your order today!";
Link[11] = "DescIsLeadin";
DateN[11] = "20070516";

Title[12] = "Now Available! All E-Series Bull Bar Applications";
Desc[12] = "Place your order today!";
Link[12] = "http://www.westinautomotive.com/press_releases/2007/06.63.pdf";
DateN[12] = "20070516";

Title[13] = "Now Available! All E-Series Step Bar Applications";
Desc[13] = "Ford Motor Company* - 2007 F250HD SuperDuty Crew Cab";
Link[13] = "http://www.westinautomotive.com/press_releases/2007/06.62.pdf";
DateN[13] = "20070516";

Title[14] = "Project Vehicle - WIRED ";
Desc[14] = "Signature & Platinum Series, Oval Tube Step Bars";
Link[14] = "http://westinautomotive.safepages.com/rss/2007/03/0006.htm";
DateN[14] = "20070320";

Title[15] = "07 Jeep Grand Cherokee/Commander - Step-Up Products";
Desc[15] = "Chevy, Dodge, Ford, GMC, Toyota";
Link[15] = "http://westinautomotive.safepages.com/rss/2007/03/0005.htm";
DateN[15] = "20070314";

Title[16] = "Westin E-Series Bull Bar - Now Available!";
Desc[16] = "Step Bars (All)";
Link[16] = "http://westinautomotive.safepages.com/rss/2007/03/0004.htm";
DateN[16] = "20070309";

Title[17] = "2008 Ford HD Superduty Product Update";
Desc[17] = "Step Bars (All)";
Link[17] = "http://westinautomotive.safepages.com/rss/2007/03/0003.htm";
DateN[17] = "20070305";

Title[18] = "2007 Chevy/GMC Silverado Sierra Product Update";
Desc[18] = "Ultimate Bull Bar & Sportsman Grille Guard";
Link[18] = "http://westinautomotive.safepages.com/rss/2007/03/0002.htm";
DateN[18] = "20070305";

Title[19] = "2007 Chevy/GMC Silverado/Sierra Product Update";
Desc[19] = "";
Link[19] = "http://westinautomotive.safepages.com/rss/2007/03/0001.htm";
DateN[19] = "20070305";

} // end with block
