var mx = 0; //total number of pictures
var mv = 6; //how many pictures "next" moves
var dir; //picture subdirectory
var pfx; //picture prefix
var sec; //section loader
var title = new Array("");
var real = null;
var hide = null;
var first = null;
var forceFirst = null;

var what = 2;
parseUrl();
var show = getParam('show');
if (show != null) {
   if (show.toLowerCase().indexOf('pursuit') != -1) what = 0;
   if (show.toLowerCase().indexOf('forever') != -1) what = 1;
   if (show.toLowerCase().indexOf('wbc') != -1) what = 2;
   if (show.toLowerCase().indexOf('sussex') != -1) what = 3;
   if (show.toLowerCase().indexOf('video') != -1) what = 4;
} else {
   show = 'wbc';
}
var page = getParam('page');
var firstLoad = (page == null);
if (firstLoad) page = 1;
else page = parseInt(page);
if (page == 0 || isNaN(page)) page = 1;
var cur = (page - 1) * mv + 1; 
var isVideo = (what == 4);

if (what == 0) {
   //Pursuit of Happiness
   mx = 41;
   forceFirst = 10;
   dir = 'pursuit/';
   pfx = 'poh_';
title = new Array(""
,"Westboro Baptist Church member, Grace, stands on flag during Billy Graham crusade protest. Queens, NY. 2005."
,"Westboro Baptist Church members, Grace and her mother, on the 7 train to the next protest. New York, NY. 2005."
,"Leftover cake at autistic artist fundraiser auction. Birmingham, AL. 2008."
,"Boy eating Fritos at autistic artist auction. Birmingham, AL. 2008."
,"The making of Frito Pie at an autistic artist auction. Birmingham, AL. 2008."
,"Brothers ride in mini Cadillac at St. Patrick's Day parade. Belmar, NJ. 2008."
,"Drunken passengers on 10:00 AM train to St. Patrick's Day parade. Asbury Park, NJ. 2008."
,"Seller at her concession stand at St. Patrick's Day parade. Belmar, NJ. 2008."
,"Rollerblading protestor at Drug Peace Rally. New York, NY. 2008."
,"Proud owner at classic Corvette show. Ocean City, NJ. 2005."
,"Mother and daughter at classic Corvette show. Ocean City, NJ. 2005."
,"KKK Cross lighting ceremony. Osceola, IN. 2004."
,"Imperial Wizard Ray Larsen and Ku Klux Klaus salute. Osceola, IN. 2004."
,"Ku Klux Klaus at the Klan compound. Osceola, IN. 2004."
,"Boy shows ribbon his dog won at American Kennel Club show. East Rutherford, NJ. 2004."
,"Woman as the Holy Ghost at a saving the family rally. Washington, DC. 2008."
,"Man shows how to operate his life size Willie Nelson doll at his garage sale. Belmar, NJ. 2008."
,"Girl shows denim skirt for sale at her family's garage sale. Belmar, NJ. 2008."
,"Protestor getting arrested at white power rally counter demonstration. Washington, DC. 2008."
,"Boy holds Mexican flag during Three Kings parade. Brooklyn, NY. 2005."
,"Puerto Rican man walks with camels during Three Kings parade. Brooklyn, NY. 2005."
,"Clown trying to blow bubbles during parade. Point Pleasant, NJ. 2004."
,"Marchers in Clown Parade. Point Pleasant, NJ. 2004."
,"Professional Bull Riders Association fan at Madison Square Garden. New York, NY. 2008."
,"Brothers at Madison Square Garden waiting for PBA invitational to start. New York, NY. 2008."
,"Woman giving her pig Coors Light during Pigfest. Rushland, PA. 2005."
,"Leathernecks salute before a polar bear swim. Point Pleasant, NJ. 2005."
,"Leathernecks in water during a polar bear swim. Point Pleasant, NJ. 2005."
,"Ashley shoots a gun at the range. East Windsor, NJ. 2005."
,"Father shows daughter how to shoot a gun at the range. East Windsor, NJ. 2005."
,"Marilyn Manson fans at the merchandise table, New York, NY. 2008."
,"Band performs to bored kids. Keansburg, NJ. 2004."
,"Men assembling trophies at the boardwalk. Keansburg, NJ. 2004."
,"Team \"Down to Fuck\" shows TV they won at beer pong tournament. Hoboken, NJ. 2008."
,"Woman with her \"Nuke Iraq\" Jeep. Harrisonburg, VA. 2006."
,"Nude poet being photographed and videotaped at reading, New York, NY. 2008."
,"\"Take your pet's photo with Santa Day\" at NYC pet shop. Brooklyn, NY. 2007."
,"Girl with her dog at pet fashion show. Ocean City, NJ. 2005."
,"Crowd watching the taping of Good Morning America. New York, NY. 2009."
,"Men carrying Jesus figure during Easter parade. Brooklyn, NY. 2009."
,"Jay shows off his bike. Brooklyn, NY. 2009."
//add titles for images above
);

hide = new Array(null,
1, 1, 1, 1, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
1, 0, 0, 1, 0, 0, 1, 0, 0, 0,
1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
1, 0
);

} else if (what == 1) {
   //Forever Outsiders
   mx = 23;
   dir = 'forever/';
   pfx = 'fo_';
   title = new Array(mx);

} else if (what == 2) {
   //WBC
   mx = 46;
   dir = 'wbc/';
   pfx = 'wbc_';
title = new Array(""
,"Collection of picket signs, each made specifically for protests at particular events or seasons. Topeka, KS. 2008."
,"Perplexed by his piano lesson, Luke Phelps-Roper, 6, receives much-needed guidance from his mother Shirley, 50. Topeka, KS. 2008."
,"Luke Phelps-Roper, 6, skips to school on a pleasant autumn morning, accompanied by his mother Shirley, 50, his father Brent, 45, and his sister Megan, 22. Topeka, KS. 2008."
,"The refrigerator in the Phelps-Roper kitchen is covered with family photos taken over the years. Topeka, KS. 2008."
,"Organization is essential in managing the activities of the Westboro Baptist Church and of her family, so Shirley Phelps-Roper, 50, has many tools to help her, including this office supply organizer featuring photos of her two youngest sons, Noah, 9, and Luke, 6. Topeka, KS. 2008."
,"Grace Phelps, 12, and her mother Shirley Phelps, 47, on the 7 train heading to the next protest. New York, NY 2005."
,"Brent Roper, 45, goes out to eat at Grover’s Smokehouse with loved ones, including Noah Phelps-Roper, 9, one of his eight sons. Topeka, KS. 2008."
,"Grace Phelps, 12, stands on flag during Billy Graham protest. Flushing Meadows Park in Queens, NY. 2005."
,"Displaying four brightly-colored signs at a protest near the Jewish Historical Society of New York, Margie Phelps, 53, draws more attention to her message by loudly singing parodies of famous Jewish melodies, and by arraying herself with a \"bloody butcher's apron\" (an Israeli flag converted into an apron and spattered with fake blood) and a \"JewsKilledJesus.Com\" T-shirt. New York, NY. 2009."
,"Shirley Phelps-Roper, 50, makes notes in her Bible during the weekly sermon of Westboro Baptist Church pastor Fred Phelps. Topeka, KS. 2008."
,"With a sign reading \"The World is Doomed\", Faith Drain, 4, joins her father Steve, 43, at a picket of The Laramie Project at Kansas State University. Manhattan, KS. 2008."
,"Shirley Phelps-Roper, 50, listens to the weekly sermon of Westboro Baptist Church pastor Fred Phelps. The women of WBC wear head coverings during church services, in accordance with the admonition in 1 Corinthians 11: \"every woman that prayeth or prophesieth with her head uncovered dishonoreth her head\". Topeka, KS. 2008."
,"Near New York City's Temple Emanu-El synagogue, a passer-by sets up a shot of Megan Phelps-Roper, 23, protesting beside other members of Westboro Baptist Church with signs reading \"Mourn For Your Sins\" and \"Jews Stole The Land.\" WBC recently shifted its focus to the Jewish community, stating that Jews broke their covenant with God by disobeying His law and killing Jesus. New York, NY. 2009."
,"Bekah Phelps-Roper, 21, excels at playing the drums on the video game Rock Band. Topeka, KS. 2008."
,"Elisha Phelps, 11, holds an inverted American flag at a local picket, while his sister Danielle, 13, reads and displays a sign reading \"God Hates America\". Topeka, KS. 2008."
,"As Westboro Baptist Church members protest Brooklyn Technical High School for teaching students rebellion against God, students counter-protest across the street. Brooklyn, NY. 2009."
,"Shirley Phelps, 9, enjoys a protest on a sunny day at a busy intersection in Topeka, KS. Topeka, KS. 2008."
,"The steering wheel of Elizabeth Phelps’ car is decorated with stickers by her son, Daniel, 7. Topeka, KS. 2008."
,"As Shirley Phelps-Roper, 51, protests with other members of Westboro Baptist Church at the East Midwood Jewish Center, a New York City police officer addresses a woman yelling at them from her apartment. Brooklyn, NY. 2009."
,"Westboro Baptist Church members protest the homecoming game at the University of Nebraska. Lincoln, NE. 2008."
,"Boaz Drain, 6, listens as his 4-year-old sister Faith whispers to him at a picket. Topeka, KS. 2008."
,"Two men kissing in front of Grace Phelps, 12, as she turns in disgust at a picket held outside of St. Patrick's cathedral. New York, NY. 2005."
,"Jonah Phelps-Roper, 11, listens to music while protesting the homecoming game at the University of Nebraska. Lincoln, NE. 2008."
,"At the homecoming game protest at the University of Nebraska-Lincoln, Sam Phelps-Roper, 29, watches the unruly crowd react to the picket signs. Lincoln, NE. 2008."
,"Shirley Phelps-Roper, 50, addresses the crowds flooding into the homecoming game at the University of Nebraska-Lincoln. Lincoln, NE. 2008."
,"Isaiah Phelps-Roper, 19, wholly ignores the taunts of the counter-protestors at the picket of the homecoming game at the University of Nebraska. Lincoln, NE. 2008."
,"During the picket of the homecoming game at the University of Nebraska-Lincoln, Luke Phelps-Roper, 6, critically examines the hostile, drunken fans passing by. Lincoln, NE. 2008."
,"Margie Phelps, 83, wife of Westboro Baptist Church pastor Fred Phelps, carries her \"God Hates Fag Enablers\" sign to her car at the end of a picket. Topeka, KS. 2008."
,"A counter-protestor at the homecoming game at the University of Nebraska-Lincoln unsuccessfully uses a makeshift megaphone to get the attention of the picketers. Lincoln, NE. 2008."
,"Standing with other members of Westboro Baptist Church, Rebekah Phelps-Roper, 22, protests the Jewish Week newspaper in New York City. The location of the protest coincided with a recruiting station for the U.S. military, another group frequently targeted by WBC for their idolatry. New York, NY. 2009."
,"With his back to Westboro Baptist Church protestors Shirley Phelps-Roper, 51, and her daughter Megan, 23, a New York City police officer monitors counter-protestors from Brooklyn Technical High School across the street. Brooklyn, NY. 2009."
,"Margie Phelps, 83, visits with her great-grandson Elijah, 3, following the weekly sermon at Westboro Baptist Church. Topeka, KS. 2008."
,"Zion Phelps-Roper, 2, looks through a book during the weekly sermon at Westboro Baptist Church. Topeka, KS. 2008."
,"At a monthly birthday party held by the families of Westboro Baptist Church, the children set up a football game. Topeka, KS. 2008."
,"Luke Phelps-Roper, 6, and his brother Jonah, 11, watch television at home while dinner is made. Topeka, KS. 2008."
,"Grace Phelps-Roper, 15, petitions her older sister to style her hair; Megan, 22, happily obliges. Topeka, KS. 2008."
,"Grace Phelps-Roper, 15, sends text messages in her bedroom. Topeka, KS. 2008."
,"Jael Phelps, 23, painted her bedroom walls with murals representing Bible verses. Topeka, KS. 2008."
,"Luke Phelps-Roper, 6, shows off his bedroom. Topeka, KS. 2008."
,"Gabriel Phelps-Roper, 13, shows a model of the Columbia shuttle he made with his father for a science project. Topeka, KS. 2008."
,"Jonah Phelps-Roper, 11, picks up an action figure in his bedroom. Topeka, KS. 2008."
,"Zach Phelps-Roper, 17, works at the computer in his bedroom. Topeka, KS. 2008."
,"Isaiah Phelps-Roper, 19, shows off his bedroom. Topeka, KS. 2008."
,"One of the original signs used in protest by Westboro Baptist Church hangs in an upstairs hallway at the Phelps-Roper house. Topeka, KS. 2008."
,"Rabbi Andy Bachman of Congregation Beth Elohim instructs counter-protestors to mimic his gesture to Westboro Baptist Church protestors across the street. Brooklyn, NY. 2009."
,"The family sits down for a family photo in their game room.  Front row: Jonah Phelps-Roper, 11, Gabriel, 13, Luke, 6, Shirley, 50, Grace, 15, Bekah, 21, and Megan 22.  Back row: Noah, 9, Zach, 17, Brent Roper, 45, and Isaiah, 19. Topeka, KS. 2008."
//add titles for images above
);

title[1] = "</p><p align=left><font size=1 class=bold>I was sitting in the back of Megan's Pontiac driving through downtown Topeka, Kansas. We passed by every suburban fast food chain and mega store you've ever seen. Her cousin Jacob was next to me pounding a store brand version of Mountain Dew explaining how he's tired of paying the big bucks for the name brands, and amusing us with anecdotes about his job at the local Target distribution center.<br><br>Megan's younger sister, Rebekah, was in the front passenger seat asking me if I listen to Akon, Young Jeezy and T.I.<br><br>\"It's such a shame that their music is so good, but they're going to hell because they don't use their talents to serve God\", Megan chimed in.<br><br>Rebekah turned around to show me some funny videos on her cell phone. Past the glow of her Motorola I saw the courthouse on the corner. Their grandmother stood on the sidewalk waiting for us as she clutched her brightly colored sign that read, \"Thank God For IEDs\".</font>"

} else if (what == 3) {
   //Sussex County
   mx = 47;
   dir = 'sussex/';
   pfx = 'sc_';
title = new Array(""
,"Three Horses."
,"Lincoln and Violet on their grandparents' trampoline."
,"Land available."
,"Home team."
,"Two girls in pink / two girls in bikinis."
,"Five kids goofing off with parental figure close behind."
,"Thank You, Walmart."
,"Church."
,"Cute by Amanda."
,"Three teenagers hold hands."
,"Girls get ready before Melanie's wedding."
,"Taking a break at Hampton Diner."
,"Ray's Inn."
,"Religious gift shop."
,"NY Yankee superfan shows ring tattoos outside of ShopRite."
,"Ken and Barbie as Adam and Eve with the dinosaurs."
,"Retired champion."
,"Pat, Janine, Lexi, Pop Pop, Nan, Tara, Lisa, Jean, Jackie at Christmas Eve."
,"NRA representative."
,"Woman leaving Jerry's."
,"Marine Corps 50 / 50."
,"Patriotic wheelchair display on the side of the road."
,"Tractor pull."
,"Walking dogs by miniature house."
,"Welcome home Jamie."
,"Camouflage car."
,"...God"
,"A ride at the fair."
,"Another ride at the fair."
,"Riding For The Son."
,"Live Free Or Die."
,"Cap 'n Crunch."
,"Enormous animal sculptures."
,"Hallway in Nan's house."
,"Angel's grave."
,"Cell phones for soldiers."
,"A moment of silence during a memorial held on the 8th anniversary of the 9/11 attacks."
,"Boy scouts pray."
,"Wild West City cowboy."
,"Barks garage sale."
,"A note to Pop Pop from Nan on top of a bialy from Dianna."
,"The lighting of Tara's 28th birthday cake."
,"Waving Statue of Liberty."
,"Showcased gown at wedding expo."
,"Bart Simpson mural on side of a crumbling outhouse."
,"Crystal Springs resort."
,"Snowman with top hat and Miller Lite can."
//add titles for images above
);


hide = new Array(null,
0, 0, 1, 1, 1, 1, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 0, 0, 0, 0, 0
);

} else if (what == 4) {
   //Videos
   mx = 4;
   dir = 'video/';
   pfx = 'video_';
   title = new Array(mx);

}

first = cur;
if (hide != null) {
    real = new Array(title.length);
    id = 1;
    for (r=1; r<=real.length; r++) {
        if (hide[r] == 0) {
            real[id] = r;
            if (id == cur) first = r;
            id++;
        }
    }
    mx = id-2;
    if (firstLoad && forceFirst != null) first = forceFirst;
}
