// Section 3

function textLimit(field, maxlen) {
  if (field.value.length > maxlen)
    field.value = field.value.substring(0, maxlen);
}

var preloadFlag = false;
function preloadImages() {
}

// Section 5

function measurewidth() {
}

// Section 6

function navOn(x) {
  o = document.getElementById('nav_'+x);
  o.src = 'nav_rollover_'+x+'.gif';
}

function navOff(x) {
  o = document.getElementById('nav_'+x);
  o.src = 'spacer.gif';
}

function showDropdown(x) {
  var v = 'none';
  if (x) v = 'block';
  document.getElementById('dropdown').style.display = v;
}

// since we don't want to have a form here due to IE formatting oddness,
// we fake an http post (w/GET-style variable)
function doSearch() {
  sv = document.getElementById('sval').value;
  if (sv.length) {
    // we have something in search box!
    // u = '/search.php?search='+escape(sv);
    u = 'http://www.klutz.com/index/page/search?freetext_models_DELIMITER_custom_search_keywords_NEXTFIELD_freetext_models_DELIMITER_name_NEXTFIELD_freetext_models_DELIMITER_description_NEXTFIELD_freetext_models_DELIMITER_part_num='+escape(sv);
    window.location = u; // redirect out to search page
    return false; // never returns, really
  } else {
    // nothing entered, just ignore it
    return true;
  }
}

function grabEnter(e) {
  // make the enter key submit the form
  var key;
  if (window.event) key = window.event.keyCode; // IE
  else key = e.which; // FFox
  if (key == 13) {
    doSearch();
    return false;
  }
}

// Section 7

clipfiles = new Array()
clipfiles[1] = 'trickyvideo';
clipfiles[2] = 'bristlebots';
clipfiles[3] = 'cardtrickery';
clipfiles[4] = 'mystylestudio';
clipfiles[5] = 'teoiexplodingeye';
clipfiles[6] = 'teoichinnikins';
clipfiles[7] = 'teoieggwhap';
clipfiles[8] = 'clonewars';
clipfiles[9] = 'bsk';
clipfiles[10] = 'teoi2bananapeel';
clipfiles[11] = 'rbpfm';
clipfiles[12] = 'glossybands';
clipfiles[13] = 'fashionorigami';
clipfiles[14] = 'animation';
clipfiles[15] = 'inventionsojh';
clipfiles[16] = 'inventionscpph';
clipfiles[17] = 'musicvideo';
clipfiles[18] = 'handbook';
clipfiles[19] = 'monsterdrawing';
clipfiles[20] = 'charmchains';
clipfiles[21] = 'chalktheblock';
clipfiles[22] = 'mixmatchdrawing';
clipfiles[23] = 'fabulousflowers';
clipfiles[24] = 'magicalhorses';
clipfiles[25] = 'stickerdesignstudio';
clipfiles[26] = 'thumbwars';
clipfiles[27] = 'safetypinbracelets';
clipfiles[28] = 'pompom';
clipfiles[29] = 'mummy';
clipfiles[30] = 'dcuniverse';

/*
pids = new Array()
pids[1] = '';
pids[2] = '';
pids[3] = '';
pids[4] = '7500';
pids[5] = '7500';
pids[6] = '7500';
pids[7] = '1360';
pids[8] = '4110';
pids[9] = '3107';
pids[10] = '3505';
pids[11] = '';
*/


ptfiles = new Array()
ptfiles[1] = clipfiles[1];
ptfiles[2] = clipfiles[2];
ptfiles[3] = clipfiles[3];
ptfiles[4] = clipfiles[4];
ptfiles[5] = 'teoi';
ptfiles[6] = ptfiles[5];
ptfiles[7] = ptfiles[5];
ptfiles[8] = clipfiles[5];
ptfiles[9] = clipfiles[6];
ptfiles[10] = 'teoi2';
ptfiles[11] = clipfiles[11];
ptfiles[12] = clipfiles[12];
ptfiles[13] = clipfiles[13];
ptfiles[14] = clipfiles[14];
ptfiles[15] = 'inventionsbook';
ptfiles[16] = ptfiles[15];
ptfiles[17] = clipfiles[17];
ptfiles[18] = clipfiles[18];
ptfiles[19] = clipfiles[19];
ptfiles[20] = clipfiles[20];
ptfiles[21] = clipfiles[21];
ptfiles[22] = clipfiles[22];
ptfiles[23] = clipfiles[23];
ptfiles[24] = clipfiles[24];
ptfiles[25] = clipfiles[25];
ptfiles[26] = clipfiles[26];
ptfiles[27] = clipfiles[27];
ptfiles[28] = clipfiles[28];
ptfiles[29] = clipfiles[29];
ptfiles[30] = clipfiles[30];

miurls = new Array()
miurls[1] = 'http://www.klutz.com/tv';
miurls[2] = 'http://www.klutz.com/Invasion-of-the-Bristlebots';
miurls[3] = 'http://www.klutz.com/magic/book/Card-Trickery';
miurls[4] = 'http://www.klutz.com/drawing/My-Style-Studio-Book';
miurls[5] = 'http://www.klutz.com/book/The-Encyclopedia-of-Immaturity';
miurls[6] = miurls[5];
miurls[7] = miurls[5];
miurls[8] = 'http://www.klutz.com/activity-book/Star-Wars-Clone-Wars';
miurls[9] = 'http://www.klutz.com/activity-book/Boom-Splat-Kablooey';
miurls[10] = 'http://www.klutz.com/book/The-Encyclopedia-of-Immaturity-Volume-2';
miurls[11] = 'http://www.klutz.com/Rubber-Band-Flying-Machine';
miurls[12] = 'http://www.klutz.com/crafts/kids/Glossy-Bands';
miurls[13] = 'http://www.klutz.com/crafts/Fashion-Origami';
miurls[14] = 'http://www.klutz.com/animation';
miurls[15] = 'http://www.klutz.com/The-Klutz-Book-of-Inventions';
miurls[16] = miurls[15];
miurls[17] = 'http://www.klutz.com/book/Make-Your-Own-Music-Video';
miurls[18] = 'http://www.klutz.com/science/The-Hand-Book';
miurls[19] = 'http://www.klutz.com/art/Dr-Frankensketch-Monster-Drawing-Machine';
miurls[20] = 'http://www.klutz.com/book/Charm-Chains';
miurls[21] = 'http://www.klutz.com/Chalk-the-Block';
miurls[22] = 'http://www.klutz.com/Mix-Match-Drawing';
miurls[23] = 'http://www.klutz.com/crafts/Fabulous-Flowers';
miurls[24] = 'http://www.klutz.com/Marvelous-Book-of-Magical-Horses';
miurls[25] = 'http://www.klutz.com/Sticker-Design-Studio';
miurls[26] = 'http://www.klutz.com/games/Thumb-Wars';
miurls[27] = 'http://www.klutz.com/crafts/Safety-Pin-Bracelets';
miurls[28] = 'http://www.klutz.com/crafts/Pom-Pom-Monster-Salon';
miurls[29] = 'http://www.klutz.com/Make-a-Mummy';
miurls[30] = 'http://www.klutz.com/Draw-the-DC-Universe';

caps = new Array()
caps[1] = '<b><a href=\"' + miurls[1] + '\">Tricky Video</a></b> ($19.95) Tricky Video is a clever collection of easy-to-achieve video tricks, gags, and gimmicks you can do with your home video camera. Turns out you don\'t need to go high tech to be a master moviemaker. This book comes with a Hollywood-style slate to mark the start of every scene.';
caps[2] = '<b><a href=\"' + miurls[2] + '\">Invasion of the Bristlebots</a></b> ($19.95) Invasion of the Bristlebots comes with two mini-robots &mdash; basically motorized toothbrush heads. These guys zoom around like caffeinated cockroaches, spinning, skittering, and bouncing off walls. Resistance is futile. The book bristles with ideas for robot games and activities.';
caps[3] = '<b><a href=\"' + miurls[3] + '\">Card Trickery</a></b> ($14.95) From throwing cards to fancy shuffles, from mind-blowing magic to sneaky ways that cheaters cheat &mdash; everything you need to rule any deck of cards is here, including the deck of cards. These 54 cards are bridge-sized, which means they are narrower than a standard deck and easier for novice hands to manipulate.';
caps[4] = '<b><a href=\"' + miurls[4] + '\">My Style Studio</a></b> ($21.95) With no drawing skills, young designers can still create fashions and figures that always come out perfectly proportioned. The secret? Tracing. Super-clear line art on mix-and-match vinyl clings makes it easy to assemble a bazillion different outfits. Use the provided paper and pencil to trace your fashion, adding your own stylish touches freehand.';
caps[5] = '<b><a href=\"' + miurls[5] + '\">The Encyclopedia of Immaturity</a></b> ($19.95) The ultimate how-not-to-grow-up guide. The Encyclopedia of Immaturity contains more than 300 entries: How to Skip a Stone, How to Do a Wheelie, How to Hang a Spoon from Your Nose... all painstakingly illuminated with full-color photographs, illustrations, diagrams, and the occasional footnote.';
caps[6] = caps[5];
caps[7] = caps[5];
caps[8] = '<b><a href=\"' + miurls[8] + '\">Draw Star Wars&#174;: The Clone Wars&#8482;</a></b> ($16.95) Draw Star Wars&#174;: The Clone Wars&#8482; is packed with tips and techniques, practice space to draw right in the book, and translucent overlays to make you a master of drawing. Start with stick figures, move onto basic shapes, and finish up with the details. Learn to draw 20 different Clone Wars characters.';
caps[9] = '<b><a href=\"' + miurls[9] + '\">Boom! Splat! Kablooey!</a></b> ($19.95) Boom! Splat! Kablooey! comes with all the special equipment you need to make ordinary ingredients from your kitchen go boom in impressive - yet non-destructive - style. A Geyser Tube&trade; and a depth charge make table salt and a bottle of soda into a backyard geyser.';
caps[10] = '<b><a href=\"' + miurls[10] + '\">The Encyclopedia of Immaturity Volume 2</a></b> ($19.95) The Encyclopedia of Immaturity has been such a hit that we\'re following up with a second book. The Encyclopedia of Immaturity Volume 2 includes thought-provoking topics such as how to slide down a banister, what we talk about when we talk about wedgies, how to send a toiletgram, and more. It\'s all new and all hopelessly goofy.';
caps[11] = '<b><a href=\"' + miurls[11] + '\">Rubber Band Powered Flying Machines</a></b> ($19.95) Everything you need to fly like a pro, indoors or out. Our three only-from-Klutz, rubber band powered airplanes have been carefully engineered for coolness, from the extra-large Firebird (an impressive 19-inch wingspan), to the acrobatic Lightning Looper (it really loops), to the Shooting Star (which makes such tight turns you can fly it in the living room).';
caps[12] = '<b><a href=\"' + miurls[12] + '\">Glossy Bands</a></b> ($19.95) Glossy Bands start as a special, non-toxic, acrylic gel. To make one, simply squeeze out dots of color following one of the patterns in the book. Then use the swirling stick to mix the color into fancy designs. Once it\'s dry, peel your bracelet up, wrap it around your wrist, and admire. Then, just stretch the bracelet to take it off. Beautiful, durable, completely wearable pieces of art.';
caps[13] = '<b><a href=\"' + miurls[13] + '\">Fashion Origami</a></b> ($19.95) Turn single sheets of paper into sassy fashions that are anything but flat. Super-clear, step-by-step instructions show how to fold ten unique pieces, from party dresses to pajamas. The results are cute, cool, and uniquely dimensional. Custom-designed origami paper in an array of bold and bright patterns gives each project an up-to-date look.';
caps[14] = '<b><a href=\"' + miurls[14] + '\">The Klutz Book of Animation</a></b> ($19.95) The Klutz Book of Animation is a complete how-to treatment of stop-motion magic, from practical instruction to ready-to-shoot scripts. The software you\'ll need is available as a free download, ready to use on any computer (PC or Mac). All you need to provide is a video camera, a computer, and a way to connect the two.';
caps[15] = '<b><a href=\"' + miurls[15] + '\">The Klutz Book of Inventions</a></b> ($19.99) A 200-page catalog of never-before-seen contraptions that are equal parts brilliant, useful, and ridiculous. None of them exist as actual products, but in a better world, a funnier world, they would all be household essentials.';
caps[16] = caps[15];
caps[17] = '<b><a href=\"' + miurls[17] + '\">Make Your Own Music Video</a></b> ($16.99) Whether you lip-sync or play your own tunes, you can create an awesome video starring your awesome self. Learn how to develop storyboards. Add drama with special angles and clever camera tricks.';
caps[18] = '<b><a href=\"' + miurls[18] + '\">The Hand Book</a></b> ($19.99) The Hand Book comes with a life-sized skeleton hand, an irresistible invitation to finding our what goes on under your skin. Assembling the 22 snap-together bones is rewarding in itself. And when you\'re done, you\'ve got a scientifically accurate, movable model on a sturdy display stand.';
caps[19] = '<b><a href=\"' + miurls[19] + '\">Doctor Frankensketch\'s Monster Drawing Machine</a></b> ($16.99) Dr. Frankensketch did the dirty work by collecting the creature parts - All you need to do is lay those parts into the patented Monster Drawing machine, trace your monster, and laugh maniacally as lighting flashes in the sky!';
caps[20] = '<b><a href=\"' + miurls[20] + '\">Charm Chains</a></b> ($19.99) With Charm Chains, create charms out of delicate wire, sparkly beads, and pretty plastic cutouts. Learn to make a butterfly, a leaf, a flower… even a tiny peace symbol. Then use the included crochet hook to fashion a fine wire chain. Attach the charms to the chain, and a little magic takes place.';
caps[21] = '<b><a href=\"' + miurls[21] + '\">Chalk The Block</a></b> ($12.99) Chalk the Block comes with 4 big pieces of chalk and a ton of bold ideas for adding temporary humor to the sidewalks, curbs, walls, rocks, and bricks of your neighborhood — colorful antics, caricatures, and tomfoolery, with a few extreme hopscotch grids thrown in.';
caps[22] = '<b><a href=\"' + miurls[22] + '\">Mix and Match Drawing</a></b> ($19.99) Easy-to-follow step-by-step instructions for drawing a bunch of cool characters, objects, and backgrounds. Mix and match them for a conventional scene, or create something no one has ever seen before. Lions in the living room, sharks in outer space, a high-heeled octopus in the countryside.';
caps[23] = '<b><a href=\"' + miurls[23] + '\">Fabulous Flowers</a></b> ($19.99) Let your creativity bloom with this book of can\'t-go-wrong instructions for life-sized, dimensional, paper blossoms inspired by our favorite flowers: roses, daisies, daffodils, hibiscus, zinnias, cosmos, poppies, and larkspur.';
caps[24] = '<b><a href=\"' + miurls[24] + '\">The Marvelous Book of Magical Horses</a></b> ($19.99) Who knew paper dolls could be so enchanting? The Marvelous Book of Magical Horses comes with six gorgeous paper ponies and three paper-doll fairies. Plus, of course, everything you need to dress them up and play.';
caps[25] = '<b><a href=\"' + miurls[25] + '\">Sticker Design Studio</a></b> ($16.99) To make your mark truly personal, stick with Sticker Design Studio. This book is packed with more than 400 stickers to mix, match, color, and layer to create your own unique designs. With pages of tips, inspiration, and guided creativity, even if you can\'t draw a heart, you can still ink one in your own unique style.';
caps[26] = '<b><a href=\"' + miurls[26] + '\">Thumb Wars</a></b> ($12.99) To bring thumb wrestling to the next level, we invented the Sleeve of Doom, a sleek, shiny, and sensational instrument of combat. Two contenders slide their hands in and clasp them together, poking their thumbs through the holes for an even playing field. The book covers everything from classic challenges, strategies, and training exercises to fake outs, battle cries, and never-before-played games.';
caps[27] = '<b><a href=\"' + miurls[27] + '\">Safety Pin Bracelets</a></b> ($19.99) Safety Pin Bracelets helps anyone craft an entire collection of brilliantly sparkling jewelry out of garden-variety safety pins. The book includes 12 dazzling bracelet designs. Whichever design you choose, you pick the colors and patterns so each bracelet is uniquely you.';
caps[28] = '<b><a href=\"' + miurls[28] + '\">Pom-Pom Monster Salon</a></b> ($16.99) Create homemade pom-poms that have real personality. And with our amazing pom-pom maker, it\'s easier then ever. Just wrap, snap, and snip!';
caps[29] = '<b><a href=\"' + miurls[29] + '\">Make a Mummy, Shrink a Head</a></b> And Other Useful Skills ($19.99) Learn how to unleash an ancient tomb curse to protect your beadroom from intruders. Shrink a head (or an apple). Make a hot dog mummy that will last for thousands of years. Translate hieroglyphic messages, and more!';
caps[30] = '<b><a href=\"' + miurls[30] + '\">Draw the DC Universe</a></b> ($19.99) This book is a complete how-to-draw package, jammed with expert tips and techiniques, tons of practice space, and, of course, a universe of DC charecters.';

atcurls = new Array()
atcurls[1] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=122&quantity=1&';
atcurls[2] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=11&quantity=1&';
atcurls[3] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=15&quantity=1&';
atcurls[4] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=86&quantity=1&';
atcurls[5] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=34&&quantity=1&';
atcurls[6] = atcurls[5];
atcurls[7] = atcurls[5];
atcurls[8] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=175&quantity=1';
atcurls[9] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=169&quantity=1&';
atcurls[10] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=170&quantity=1&';
atcurls[11] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=351&quantity=1&';
atcurls[12] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=343&quantity=1&';
atcurls[13] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=340&quantity=1&';
atcurls[14] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=348&quantity=1&';
atcurls[15] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=358&quantity=1&';
atcurls[16] = atcurls[15];
atcurls[17] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=356&quantity=1&';
atcurls[18] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=362&quantity=1&';
atcurls[19] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=360&quantity=1&';
atcurls[20] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=361&quantity=1&';
atcurls[21] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=394&quantity=1&';
atcurls[22] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=396&quantity=1&';
atcurls[23] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=395&quantity=1&';
atcurls[24] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=385&quantity=1&';
atcurls[25] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=393&quantity=1&';
atcurls[26] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=382&quantity=1&';
atcurls[27] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=381&quantity=1&';
atcurls[28] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=412&quantity=1&';
atcurls[29] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=414&quantity=1&';
atcurls[30] = 'http://www.klutz.com/index/page/shopping_cart?actions[ShoppingCartModule]=add_to_cart&product_id=426&quantity=1&';

tafurls = new Array()
tafurls[1] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=tv';
tafurls[2] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Invasion-of-the-Bristlebots';
tafurls[3] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=magic/book/Card-Trickery';
tafurls[4] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=drawing/My-Style-Studio-Book';
tafurls[5] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=book/The-Encyclopedia-of-Immaturity';
tafurls[6] = tafurls[5];
tafurls[7] = tafurls[5];
tafurls[8] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=activity-book/Star-Wars-Clone-Wars';
tafurls[9] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=activity-book/Boom-Splat-Kablooey';
tafurls[10] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=book/The-Encyclopedia-of-Immaturity-Volume-2';
tafurls[11] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Rubber-Band-Flying-Machine';
tafurls[12] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=crafts/kids/Glossy-Bands';
tafurls[13] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=crafts/Fashion-Origami';
tafurls[14] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=animation';
tafurls[15] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=The-Klutz-Book-of-Inventions';
tafurls[16] = tafurls[15];
tafurls[17] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=book/Make-Your-Own-Music-Video';
tafurls[18] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=science/The-Hand-Book';
tafurls[19] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=art/Dr-Frankensketch-Monster-Drawing-Machine';
tafurls[20] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=book/Charm-Chains';
tafurls[21] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Chalk-the-Block';
tafurls[22] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Mix-Match-Drawing';
tafurls[23] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=crafts/Fabulous-Flowers';
tafurls[24] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Marvelous-Book-of-Magical-Horses';
tafurls[25] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Sticker-Design-Studio';
tafurls[26] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=games/Thumb-Wars';
tafurls[27] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=crafts/Safety-Pin-Bracelets';
tafurls[28] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=crafts/Pom-Pom-Monster-Salon';
tafurls[29] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Make-a-Mummy';
tafurls[30] = 'http://www.klutz.com/index.php?page=static&subpage=friend_email_page&friend_link=Draw-the-DC-Universe';

function f_scrollTop() {
  return f_filterResults (
    window.pageYOffset ? window.pageYOffset : 0,
    document.documentElement ? document.documentElement.scrollTop : 0,
    document.body ? document.body.scrollTop : 0
  );
}

function f_filterResults(n_win, n_docel, n_body) {
  var n_result = n_win ? n_win : 0;
  if (n_docel && (!n_result || (n_result > n_docel)))
    n_result = n_docel;
  return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function sp(cap, clipfile, ptfile, miurl, atcurl, tafurl) {
  // video height
  h = 380; t = 120;
  // if(pid == 7500 || pid == 1360 || pid == 4110) { h = 340; t = 155; }
  if (clipfile == 'eggwhap' || clipfile == 'chinnikins' || clipfile == 'explodingeye' || clipfile == 'mystylestudio' || clipfile == 'cardtrickery') {
    h = 340; t = 155;
  }
  document.getElementById('video_player').style.top = t+'px';
  document.getElementById('video_player').style.height = h+'px';
  document.getElementById('bgl').style.display = 'block';
  for (k = 0; k < clipfiles.length; k++) {
    if(clipfiles[k] == clipfile) {
      // l = 'javascript: popup("/tv/tv_tell.php?vid='+k+'&video=1", 600, 460);';
      // document.getElementById('tellafriendlink').href = l;
      document.getElementById('tellafriendlink').href = tafurl;
      window.location.hash = k;
      break;
    }
  }
  ts = parseInt(new Date().getTime().toString().substring(0, 10)); // timestamp
  // document.getElementById('addtocart').href = '/user/cart.php?itemNo='+pid+'&action=add&tsn='+ts;
  document.getElementById('addtocart').href = atcurl;
  // document.getElementById('moreinfo').href = '/catalog/product/'+pid;
  document.getElementById('moreinfo').href = miurl;
  // document.getElementById('pu_thumb').src = pid+'-1s-low.jpg';
  document.getElementById('pu_thumb').src = 'product_thumb_'+ptfile+'.jpg';
  document.getElementById('pu_proddescr').innerHTML = cap;
  document.getElementById('video_player').innerHTML = '';
  // todo - set more info and add to cart buttons with pid (and timestamp)
  // document.getElementById('pu').style.top = 20 + f_scrollTop();
  document.getElementById('pu').style.top = (20 + f_scrollTop()) + ('px');
  document.getElementById('pu').style.display = 'block';
  // use flashembed to place flowplayer into HTML element
  api = flashembed("video_player",
    // first argument supplies standard Flash parameters. See full list:
    // http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_12701
    {
      src:'FlowPlayerLight.swf',
      width: 550, 
      height: h
    },
    // second argument is Flowplayer specific configuration. See full list:
    // http://flowplayer.org/player/configuration.html
    { config: {
      initialScale: 'scale',
      autoRewind: true,
      loop: false,
      autoPlay: true,
      videoFile: 'video_clip_'+clipfile+'.flv',
      showMuteVolumeButton: false,
      showMenu: false,
      showStopButton: false,
      showFullScreenButton: false,
      showVolumeSlider: false
    }}
  );
}

function hp() {
  document.getElementById('pu').style.display = 'none';
  document.getElementById('bgl').style.display = 'none';
  document.getElementById('video_player').innerHTML = ''; // kill video for IE6
  document.getElementById('pu_thumb').src = 'spacer.gif'; // clear icon
  // window.location.hash = '';
}

function popup(filename,width,height) {
  thedefinitionWindow = open(filename, "deWin"+width+height, get_win_props(width,height));
  thedefinitionWindow.focus();
}

function get_win_props(thewidth,theheight) {
  theprops = '';
  if(screen.width) {
    theprops = 'left=' + (screen.width - thewidth) / 2;
    theprops = theprops + ', top=' + (screen.height - theheight) / 2;
    theprops = theprops + ', ';
  }
  theprops = theprops + 'width='+thewidth+',height='+theheight+',resizable=yes,status=0';
  return theprops;
}


