

// Sets cookie values. Expiration date is optional
//
function setCookie (name, value, days) {
        expire = new Date();
        expire.setTime(expire.getTime()+1000*60*60*24*(days==null?1:days));
        document.cookie = name + "=" + escape (value) +
        "; expires=" + expire.toGMTString();
}

function getCookie(Name) {
    var search = Name + "=";
    if (document.cookie.length > 0) {
        // if there are any cookies
        offset = document.cookie.indexOf(search);
        if (offset != -1) {
            // if cookie exists
            offset += search.length;
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1)
                end = document.cookie.length;
            return unescape(document.cookie.substring(offset, end));
        }
    }
    return null;
}

function deleteCookie (name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}






function Section(name, imagename, description) {
    this.name = name;
    this.imagename = imagename;
    this.description = description;
}

var numSections = 6;
var Sections = new Array(numSections);
var SectHeaderStart = "image/h";
var SectMenuStart = "image/m";
var SectImageExt = ".gif";

Sections[0] = new Section("Time","time",
        "Items of temporal delight.  Wispy yet remonstrative.  " +
        "Without time, no races could be won.  Time is not money, " +
        "but they can be exchanged, provided that there is a " +
        "suitable forum for the transaction.  Should our economy " +
        "revert to a barter system, one might exchange other items " +
        "for time, and we would have phrases like \"Time is cheese\"."
        );
Sections[1] = new Section("Space","space",
        "Three dimensional expanses, wherein objects can exist " +
        "and events can occur.  Space is one example of space. " +
        "And Outer Space is outside of Space, but it still counts " +
        "as space."
        );
Sections[2] = new Section("Matter","matter",
        "Physical objects.  Things to be held, eaten, thrown at " +
        "passers-by, etc.  Matter typically comes in three forms, " +
        "solid, liquid, and gas.  Solid is best for crafting a " +
        "doorstop."
        );
Sections[3] = new Section("Feelings","feelings",
        "All that gooey mush inside you, finally for sale.");
Sections[4] = new Section("Words","words",
        "Words come in two flavors:<br><i>Written words</i> - markings on a surface " +
        "from which the meaning can be visually ascertained.<br>" +
        "<i>Spoken Words</i> - sequences of sounds that contain meaning " +
        "in their pitch, cadence, and volume.</li></ul>");
Sections[5] = new Section("Other","other",
        "Items not fitting in any previous category.  Could include " +
        "plankton, deciduous forests, and acceleration."
        );


var Items = new Array(numItems);
var ImageDir = "image/";
var ImageLargeExt = "-l.jpg";
var ImageMediumExt = "-m.jpg";
var ImageSmallExt = "-s.jpg";
var NoImageName = "noimage";


function Item(name, price, units, section, imagename, blurb, description, descindex, quotes) {
    this.name = name;
    this.price = price;
    this.units = units;
    this.section = section;
    this.imagename = imagename;
    this.blurb = blurb;
    this.description = description;
    this.quotes = quotes;
    }


var numItems = 23;

Items[0] = new Item("Talc",1.95,"ounce",2,"talc",
            "Talc is the material of the future!  It will not explode like " +
            "cellular phones and it will not crash like personal computers! ",
            "<p>Talc is a mineral of the Silicate group, chemical formula " +
            "Mg<sub>3</sub>Si<sub>4</sub>O<sub>10</sub>(OH)<sub>2</sub>.  " +
            "It is the by-product of magnesium-bearing igneous rocks.  Talc " +
            "features a soft, greasy texture, and has a perfect basal cut.  " +
            "Its many uses include pencils, tires, roofing preparation, " +
            "pottery, and chalk.<p>Avoid talc's bastard cousin soapstone, " +
            "which possesses many of the same features of talc, but is rife " +
            "with sin and impurity.  You can't unscramble an egg, so best " +
            "stick with talc, and should you need a corrupted version, add " +
            "the impurities yourself.<p><strong>Warning!</strong> Prolonged " +
            "exposure to talc can present a health risk.  Do not make talc " +
            "clothing. "
            );
Items[1] = new Item("Green",10.95,"acre",5,"green",
            "This color is finally available for sale.  Very popular; " +
            "featured in money and trees.  Non-stick coating.",
            "<p>Green is the result of mixing one part yellow and one " +
            "part blue, and can itself be mixed with other colors to " +
            "make various shades of brown.  Add to milk to make green " +
            "milk.  Mix with skin to be camouflaged in the forest.  " +
            "Append the word 'horn' to make 'greenhorn'.<p>Don't put " +
            "green near fire, for green fire is very hot, much hotter " +
            "than even blue fire.  And do not put green on your face, " +
            "for, if cartoons are correct, that means you are very ill.  " +
            "But do put green on dying plants, or on your lawn during a " +
            "drought.  Do not use any container you have used for green " +
            "for food products later.  Green on food usually means mold, " +
            "except for certain vegetables."
            );
Items[4] = new Item("The Will To Live",29.95,null,3,"will",
            "Newfound respect for all the good things you have that you do " +
            "not appreciate.  Discontent and depression will give way to " +
            "joyfulness and the desire to continue on.",
            "Discover what it is like to look forward to every following day." +
            "<p>For a limited time only, included with your new will to live " +
            "is a heightened sense of self-worth.  Use this to give you the " +
            "confidence you need at that big board meeting tomorrow.  " +
            "Because if you don't do well, Anderson is going to get that " +
            "promotion you have been gunning for for the last five months.  " +
            "And Anderson, with his self-effacing, yes-man attitude, man, " +
            "it would just eat you up inside, if he were your boss."
            );
Items[8] = new Item("Tucson",399.95,null,1,"tucson",
            "This lovely little colony, nestled between Central America and " +
            "Alaska, is the city-owner's dream.  750,000 charming residents, " +
            "a zoo, and radio stations.",
            "Offers a picturesque view of the " +
            "surrounding desolation.  Many areas feature electricity.<p>" +
            "This 'metropolis of the future' features expanses of concrete " +
            "on either side of most of the city's streets, which allow for " +
            "easier pedestrian movement.  A great improvement over last " +
            "year's cobblestones, which led to a third of the population " +
            "needing crutches.  But now the crutches have moved onwards, for " +
            "their job here is done.  The happy citizens now walk without " +
            "fear, and without showshoes, as it rarely snows in this part " +
            "of the world.<p>Because of the size of this item, it may " +
            "require extra shipping time.  No international orders."
            );
Items[2] = new Item("Thirst",113.95,"hour",3,"thirst",
            "That comfortable feeling in your throat can be a thing of the " +
            "past with thirst.  Purchase beverages without fear of losing " +
            "the parched aching sensation.",
            "<p>As the global climate " +
            "moves slowly from 'desert' to 'carwash', it is becoming " +
            "increasingly difficult to enjoy good, ol' fashioned thirst.  " +
            "The kids these days, with their unsodas and those hats with " +
            "the propellors on top and firehoses in their mouths, they will " +
            "never know what it is like to go an hour without a fluoride " +
            "rinse or a soft taco.<p><strong>Surgeon General's Warning:" +
            "</strong> Do not use thirst for more than 48 hours straight.  " +
            "It hurts."
            );
Items[11] = new Item("Spanish",49.95,null,4,"spanish",
            "&iexcl;The language that was built in Spain can now be enjoyed by " +
            "you in the comfort of your own home!  Millions of people " +
            "across the world use Spanish, and now you can own it.",
            "<p>The Spanish language is a collection of words, and a set of " +
            "rules that dictate how one can combine those words to form " +
            "sentences and biographical novels.  In the past, the Spanish " +
            "language has been used to talk about such notable topics as: " +
            "<ul><li>Governmental systems<li>The weather<li>Abraham Lincoln" +
            "<li>Sun-dried tomatoes<li>Symbiosis</ul>" +
            "<p>Pronunciation not included."
            );
Items[10] = new Item("Neptune",98.95,null,2,"neptune",
            "The eighth planet from the Sun in the Solar System, though " +
            "sometimes it is ninth, when its orbit is crossed by Pluto, " +
            "the freak planet.",
            "Neptune has a mass of 10<sup>26</sup> " +
            "kilograms, 75% hydrogen.  Add 3.75x10<sup>25</sup> kilograms " +
            "of oxygen and 2.4x10<sup>24</sup> tablespoons of grape " +
            "Kool-Aid&reg; powder for a nice refreshing intergalactic beverage." +
            "<p>Enjoy lazy afternoons on your new Neptune, as you attempt " +
            "to escape the terrible storms that plague its icy, inhospitable " +
            "surface." +
            "<p>By purchasing Neptune, you automatically become a member of the " +
            "Planet Owners Club of America, an exclusive society dedicated " +
            "to increasing the public's knowledge of the planets.  Planets " +
            "were very popular during the eras of cosmology, and Mork and " +
            "Mindy, but in recent time have fallen by the wayside as people " +
            "focus more on their electronic toothbrushes and internetwork " +
            "of microwave ovens.<p>Quantities are limited."
            );
Items[7] = new Item("Advice",13.99,"word",4,"advice",
            "Solutions to all of life's problems.  Prognostications, " +
            "recommendations, support.  Guaranteed to be correct and " +
            "helpful.",
            "Until now, the winding path of life has been difficult to " +
            "navigate, with its occurrences and situations and rake accidents.  " +
            "But now, be able to plan ahead for all of these obstacles, and " +
            "many more!  Be amazed at how easy it is to interact with other " +
            "humans when you know exactly how everything will turn out.  " +
            "Use this advice not only as another recommendation, but a " +
            "set-in-stone plan of how to progress through life.  So do not " +
            "fear; simply yield control of your life to this guiding hand." +
            "<p>Examples of advice:<ul><li>Are you certain you want that " +
            "promotion, if it will keep you from your family?<li>He doesn't " +
            "deserve you, sister!<li>Tomorrow you will stub your toe, so watch it!" +
            "<li>A stitch in time saves nine.</ul><p>See how easy it is?  You " +
            "too can take advantage of sage-like words such as these!" +
            "<p>Because of the nature of this item, no returns are allowed."
            );
Items[3] = new Item("Rectangular Region",800,"month",1,"ocean",
            "Beautiful ocean view.  This rectangular region, measuring 23 feet " +
            "by 20 feet by 18 feet tall, is located just ninety feet above the " +
            "Pacific ocean, only twenty four hundred miles southwest of Hawaii.",
            "Spacious accomodations are large enough to hold a comfortable " +
            "recliner and a king-sized bed, if only there were some way for " +
            "them to levitate there.<p>Enjoy the relaxing life of the South " +
            "Pacific.  Your palatial rectangular region is a perfect vacation " +
            "destination, where you can fish, sunbathe, and enjoy the ocean " +
            "breeze.<p>And, because your rectangular region is over " +
            "international waters, you are in complete control during the " +
            "extent of your lease.  Declare your rectangular region a no-fly " +
            "zone, and protect it with air-to-air missiles.  Hold political " +
            "prisoners, much to the dismay of Amnesty International, who " +
            "might float around in boats beneath you, begging for the " +
            "release of your captives.  These are just some of the freedoms " +
            "that an international rectangular region offers." +
            "<p>Buy several rectangular regions in a row if you want enough " +
            "space for a stretch limousine or a really long sandwich."
            );
Items[12] = new Item("1632",749.95,null,0,"oldmap",
            "This seventeenth century year occurred right at the twilight of " +
            "the Renaissance, as mankind's intellectual and artistic growth " +
            "began to lose speed.",
            "It features a bustling Euro-centric populus, eager to expand its " +
            "realm of control.  Almost halfway through the Thirty-Years War, " +
            "this year includes such amusing names as 'The Hapsburgs' and " +
            "'L&uuml;tzen' and 'Cromwell'." +
            "<p>But do not let these names restrict you!  " +
            "Owners of years are licensed to change history to their liking.  " +
            "Your year can be the year that the dinosaurs return!  Or how " +
            "amazing would it be if Teflon&reg; were created before mankind even " +
            "had frying pans or ski jackets!  And think how popular you would " +
            "be if yours was the year that man went to the moon, and ate it!  " +
            "The possibilities are endless, when you are in control of a year."
            );
Items[6] = new Item("Shoe",5.39,null,2,"shoe",
            "Shoe can be worn on foot.  Will protect foot from inclement " +
            "weather or difficult terrain.  Constructed of only high-quality " +
            "materials.  Shoe will last for years.",
            "<p>Shoe is approximately U.S. size 10, mens.  Shoe is designed " +
            "for the right foot, but can fit left feet U.S. size 9 and below.  " +
            "Shoe shows some evidence of previous use, including (but not " +
            "limited to) holes and dirt.  Wear does not detract from shoe's " +
            "performance.  Previous owners are unknown." +
            "<p>If shoe is your first shoe, shoe may be bronzed to always " +
            "remind you of shoes, lest you forget again and catch pneumonia.  " +
            "Shoe can be 'paired up' with another shoe, forming a 'pair' of " +
            "shoes, one for each foot.  Masking tape can be used to add " +
            "racing stripes, to increase speed." +
            "<p>Shoe comes pre-tied, for your convenience.  Instructions are " +
            "included."
            );
Items[5] = new Item("'eventful'",149.95,"use",4,null,
            "<font face=\"times roman,arial\"><strong>e&middot;vent&middot;ful" +
            "</strong> (i vent<strong>'</strong> ful), <i>adj.</i> <strong>1." +
            "</strong> full of events or incidents, esp. of a striking " +
            "character: <i>The latter part of the war was an eventful period." +
            "</i></font>",
            "<font face=\"times roman,arial\"><strong>2.</strong> having " +
            "important issues or results; momentous. [" +
            "<font face=\"times roman,arial\" size=-2>EVENT + FUL</font>]  " +
            "-<strong>e&middot;vent'ful&middot;ly,</strong> <i>adv.</i>" +
            "-<strong>e&middot;vent'ful&middot;ness,</strong> <i>n.</i></font>"
            );
Items[9] = new Item("A Few More Minutes",92.95,null,0,"minutes",
            "Several minutes more might give you just enough time to take " +
            "care of some things you didn't get around to.",
            "Maybe you should have moved faster when you had the chance, " +
            "but let's not cry over spilled milk.  " +
            "Instead, why not just buy yourself some more time?  Perhaps now you will have " +
            "enough time to remember which is the correct wire to cut.  Or " +
            "maybe now you can pick up the dry cleaning today instead of on " +
            "Monday.  Or you can get to the sixth level of Ms. Pac-Man before " +
            "your mom makes you come to dinner.<p>A few minutes is plenty of " +
            "time.  You could probably recite half of the Pledge of Allegiance.  " +
            "Or maybe you could make some flash cards.  Or fix that leaky " +
            "faucet that has been driving you crazy for the last few weeks.  " +
            "C'mon, don't waste this time you have!  That's how you got " +
            "into this mess in the first place!"
            );
Items[13] = new Item("Gravity",102.95,"use",5,"gravity",
            "Ever since Newton, people have been avoiding flying apples.  Now, " +
            "you can have more than apples zooming towards you!",
            "Can't reach that salt shaker across the table?  Wish that the guy " +
            "at work would notice you?  Want to get dressed in a jiffy?  Gravity " +
            "is your solution!<p>Our patented method of altering your gravitational " +
            "constant is guaranteed to bring you immediate results.  Gravity is " +
            "essentially a huge web of invisible ropes reaching through the ether " +
            "to attach every object - living and otherwise.  These ropes often " +
            "look like green or red arrows - see diagram.  The 'gravitational " +
            "constant' is how hard we are pulling on the ropes attached to us.  Our " +
            "technique alters that constant, so that it is not really a constant.  " +
            "Therefore, you just turn up the you-baseball constant, and it flies " +
            "right into your glove.  It's as simple as that!" +
            "<p>When using gravity, avoid the heavy objects, as they tend to " +
            "generate more momentum.  Do not operate gravity when under the " +
            "influence."
            );
Items[14] = new Item("The Pepsi&reg; Logo",48.95,null,5,"pepsi",
            "Bring a multinational corporation to its knees as you slowly siphon " +
            "off their revenues by charging them a percentage every time they " +
            "use their logo.",
            "<p>But money is not the only thing you have to gain with your new " +
            "Pepsi&reg; logo.  Also increase your popularity by legally forcing " +
            "PepsiCo&reg;, Inc., to change its logo.  " +
            "<img src=\"image/pepsirex.jpg\" width=45 height=43 border=0 " +
            "align=\"right\"></img>For example, if your name is 'Rex', " +
            "you could have them change their logo to this: " +
            "<p>Any way you Slice&reg; it, owning a popular corporate logo is " +
            "a wise investment.  Don't be the last kid on the block to have one! " +
            "Get your parents' permission and order one today!"
            );
Items[15] = new Item("Buffer Zone",7.95,"foot",1,"buffer",
            "Walk with the greatest of ease through crowded subway stations, " +
            "rock-music concerts, and soccer riots.",
            "This buffer zone will keep people at bay, even in the densest of " +
            "crowds.  Purchase a 1-foot buffer if you just don't want anyone to " +
            "collide with you.  Or get up to five feet of space, if you want " +
            "to have enough room to practice kickboxing.<p>Do not attempt to " +
            "hug people, if you have buffer zone installed.  They will ricochet " +
            "off you and probably hit a wall or something."
            );
Items[16] = new Item("The Sierra Nevadas",138.95,null,2,"sierra",
            "These majestic mountains are located between Sacramento, California, " +
            "and New York, New York.  Enjoy the splendor of this beautiful " +
            "region, which you can own for a low, low price.",
            "And if it is too far from home for you to enjoy it on a regular " +
            "basis, then just move it closer!  It's yours!  The Sierra Nevadas " +
            "have not moved location for over a decade, so who knows what has " +
            "collected under there!  Amidst all the dust and grime, you might " +
            "find anything from dinosaur bones to dinosaur cooking utensils.  " +
            "<p>And if a large expanse of tree- and snow-covered mountains " +
            "isn't your thing, well, go ahead and make some adjustments.  " +
            "Too hard to navigate your SUV through all those trees?  Cut 'em " +
            "down and pave the whole thing.  Kids don't come home because there " +
            "are no streetlights to announce dinnertime?  Install some!  This " +
            "is the great beauty of the natural world, easily molded into a " +
            "more pleasing form."
            );
Items[17] = new Item("Air",2.95,"liter",2,"smog",
            "Can't breathe?  Trapped in a vacuum?  All you need is some air. ",
            "<p>Our air comes in hermetically sealed Ziploc&reg; bags, so it " +
            "will not mix with outside particles.  This makes it ideal for " +
            "shipment to flooded buildings, communications satellites, and " +
            "smoky rock concerts.<p>Air has other uses too!  Pour some cola " +
            "that has gone flat into the bag of air, shake vigorously for " +
            "three minutes, and the carbonation is rejuvenated!  Out of " +
            "breath, but not finished inflating that balloon?  Use air! " +
            "And air can really help you out in a bind, should you be " +
            "stranded with a flat tire."
            );
Items[18] = new Item("Furtive",32.95,null,3,"furtive",
            "Infiltrate enemy encampments.  Escape parties that are boring.  " +
            "Gain access to the central computer.  Accomplish all this and " +
            "more when you are furtive.",
            "<p>This package contains everything a person needs " +
            "to feel and act furtive.  It is guaranteed to yield " +
            "results within a month, such as being ignored by others " +
            "and avoiding the authorities." +
            "<p>The package includes:<ul><li>One (1) Black trenchcoat</li><li>" +
            "One (1) Black hat</li><li>One (1) 'Stealthy Movements' training " +
            "video</li><li>The common cold, so you can speak in a hushed, " +
            "gravelly voice</li></ul>And most importantly,<ul><li>Two (2) " +
            "shifty eyes.</li></ul>"
            );
Items[19] = new Item("Dictatorship",122.95,null,5,"dictator",
            "Be the ruler of the cafeteria!  Command the admiration of your " +
            "classmates!  See posters with your face on them!",
            "<p>Our new Dictator-In-A-Minit&reg; package will make your dream " +
            "come true.  Decide social policy!  Develop economic plans that " +
            "are destined to fail!  Speak to large crowds of people! " +
            "Malformed moustache included." +
            "<p>Be a good dictator.  Your people love you and depend on you.  " +
            "Don't let them down."
            );
Items[20] = new Item("Rough",107.95,"hectare",3,"rough",
            "A little friction would keep you from sliding off that seat, " +
            "young man.  Slouching can lead to lower-back problems.",
            "<p>Friction is the force objects exert when moved against " +
            "eachother.  Rough surfaces have more friction, as there is " +
            "more resistance to movement.  There are no truly frictionless " +
            "surfaces, but we get pretty close with inventions like " +
            "marmalade and skis and Slip'n'Slide.<p>Friction is essential " +
            "in keeping us from falling over.  That, and handrails."
            );
Items[21] = new Item("Passwords",23.95,null,4,"password",
            "Persons and corporations attempt to prevent others from accessing " +
            "their private data.  But don't let this stop you.  All you need " +
            "are passwords.",
            "This item is a grab bag of between twenty and thirty passwords - " +
            "maybe one of them is a winner!  Maybe you can read your employer's " +
            "email or learn government secrets.  Or just use these passwords for " +
            "yourself!  Some examples of past winning passwords are:<ul><li>Shiloh</li>" +
            "</li><li>120375</li><li>I'mRad</li><li>PasSword1</li></ul>"
            );
Items[22] = new Item("Legroom",289.95,null,1,"legroom",
            "Man, it feels good to sit down and stretch these legs out, after " +
            "long day at work.  Thank goodness for all this legroom, or these " +
            "joints and muscles would begin to atrophy.",
            "If only there were this much space everywhere!  Then, no more " +
            "suffering in the world.<p>Legroom is portable, so you can use " +
            "it anywhere.  On a plane.  In a sports car.  On a catamaran." +
            "<p>Legroom can be moved upwards and used as headroom.  Legroom " +
            "should not be used to store carry-on luggage.  Such luggage " +
            "must be stowed in an overhead compartment.  Legroom may be " +
            "broken into pieces, but cannot then be joined together to " +
            "form legroom again.  Two legrooms cannot be grouped for an " +
            "even larger legroom."
            );





var mn1 = 352012956;
var mn2 = 4361;

function EncodeProductNumber(num) {
    return num*mn2+mn1;
}

function DecodeProductNumber(num) {
    newnum = (num-mn1)/mn2;
    return ((Math.floor(newnum)!=newnum) || (newnum>=numItems)) ? -1 : newnum;
}



function GetNextItem(startInd,sectionindex) {
    if (startInd<0)
        Ind = 0;
    else
        Ind = startInd+1;

    if (Ind>=numItems) return -1;

    if (sectionindex==null || sectionindex<0) return Ind;

    while (Ind < numItems) {
        if (Items[Ind].section==sectionindex)
            return Ind;
        Ind++;
    }

    return -1;
}


function getPriceString(price) {
    return Math.floor(price) + "." + Math.round((100*price)%100);
}


var CartSize = parseInt(getCookie("StoreCartSize"));
if (isNaN(CartSize) || CartSize==null)
    CartSize=0;
var CartContents = getCookie("StoreCartContents");
if (CartContents==null) {
    CartContents="";
    CartSize=0;
}

