$(document).ready( main );

var main_links = [ 
	{ "display" : "gallery", "id": "gallery" }, 
	{ "display" : "animation", "id": "animation" }, 
	{ "display" : "blog", "id": "blog" }, 
	{ "display" : "contact", "id": "contact" }, 
	{ "display" : "news", "id": "news" }
	];

var gallery_links = [ 
  { "display" : "new work", "id": "current_work" }, 
	{ "display" : "international", "id": "international" }, 
	{ "display" : "fashion", "id": "fashion" }, 
	{ "display" : "animals", "id": "animals" }, 
	{ "display" : "commercial work", "id": "commercial_work" }, 
	{ "display" : "other", "id": "other" } 
	];

var galleries = 
[ 
	{ 
		"name": "current_work",
		"images" :
		[
			{ 
				"img" : "Sound of Music goat puppets.jpg", 
				"mid": "Sound-of-Music-goat-puppets-mid.png", 
				"thumb": "Sound of Music goat puppets-thumb.png", 
				"title": "Sound of Music goat puppets" 
			},	
			{ 
				"img" : "Northwest American Indian Totem.jpg", 
				"mid": "Northwest-American-Indian-Totem-mid.png", 
				"thumb": "Northwest American Indian Totem-thumb.png", 
				"title": "Northwest American Indian Totem commission" 
			},
			{ 
				"img" : "Samurai.jpg", 
				"mid": "Samurai-mid.png", 
				"thumb": "Samurai-thumb.png", 
				"title": "Samurai" 
			},
			{ 
				"img" : "Helmet.jpg", 
				"mid": "Helmet-mid.png", 
				"thumb": "Helmet-thumb.png", 
				"title": "Helmet" 
			},
			{ 
				"img" : "Gi.jpg", 
				"mid": "Gi-mid.png", 
				"thumb": "Gi-thumb.png", 
				"title": "Gi" 
			}, 
			{ 
				"img" : "Mad Eye Moody.jpg", 
				"img2": "MEMside.jpg" , 
				"mid": "Mad-Eye-Moody-mid.png", 
				"thumb": "Mad Eye Moody-thumb.png", 
				"title": "Mad Eye Moody" 
			},
			{ 
				"img" : "Agent Lotus.jpg", 
				"mid": "Agent-Lotus-mid.png", 
				"thumb": "Agent Lotus-thumb.png", 
				"title": "Agent Lotus" 
			},			
			{ 
				"img" : "YukiSnakePit.jpg", 
				"mid": "YukiSnakePit-mid.png", 
				"thumb": "YukiSnakePit-thumb.png", 
				"title": "Yuki Snake Pit" 
			},
			{ 
				"img" : "JasperTheDog.jpg", 
				"mid": "JasperTheDog-mid.png", 
				"thumb": "JasperTheDog-thumb.png", 
				"title": "Jasper the Dog" 
			}
		] 
	},
	{ 
		"name": "international",
		"images" :
		[
			{ 
				"img" : "Kali1.jpg", 
				"mid": "Kali1-mid.png", 
				"thumb": "Kali1-thumb.png", 
				"title": "Kali"  
			},	
			{ 
				"img" : "Arabian-Nights.jpg", 
				"mid": "Arabian-Nights-mid.png", 
				"thumb": "Arabian-Nights-thumb.png", 
				"title": "Arabian Nights"  
			}, 
			{ 
				"img" : "Ninja.jpg", 
				"mid": "Ninja-mid.png", 
				"thumb": "Ninja-thumb.png", 
				"title": "Kunoichi- Female Ninja for Gallery Nucleus \"Ninja Show\" 2007"  
			},	
			{ 
				"img" : "Geshia1.jpg", 
				"mid": "Geshia1-mid.png", 
				"thumb": "Geshia1-thumb.png", 
				"title": "Geisha"  
			},	
			{ 
				"img" : "QE1.jpg", 
				"mid": "QE1-mid.png", 
				"thumb": "QE1-thumb.png", 
				"title": "Queen Elizabeth"  
			},	
			{ 
				"img" : "CarnivalDancer.jpg", 
				"mid": "CarnivalDancer-mid.png", 
				"thumb": "CarnivalDancer-thumb.png", 
				"title": "Pink Brazilian Carnival Girl"  
			},
			{ 
				"img" : "OrangeCarnivalDancer.jpg", 
				"mid": "OrangeCarnivalDancer-mid.png", 
				"thumb": "OrangeCarnivalDancer-thumb.png", 
				"title": "Blue Brazilian Carnival Girl"  
			},	
			{ 
				"img" : "jungle.jpg", 
				"mid": "jungle-mid.png", 
				"thumb": "jungle-thumb.png", 
				"title": "Jungle Head Hunters"  
			},	
			{ 
				"img" : "Scottish-Lass.jpg", 
				"mid": "Scottish-Lass-mid.png", 
				"thumb": "Scottish-Lass-thumb.png", 
				"title": "Scottish Dancer"  
			},	
			{ 
				"img" : "scottish.jpg", 
				"mid": "scottish-mid.png", 
				"thumb": "scottish-thumb.png", 
				"title": "Scottish Dancer 2"  
			},	
			{ 
				"img" : "Craig-Kellman.jpg", 
				"mid": "Craig-Kellman-mid.png", 
				"thumb": "Craig-Kellman-thumb.png", 
				"title": "Scottish C.Kellman -private commission"  
			},
			{ 
				"img" : "Fruit-Boy.jpg", 
				"mid": "Fruit-Boy-mid.png", 
				"thumb": "Fruit-Boy-thumb.png", 
				"title": "Harajuku Boy"  
			},
			{ 
				"img" : "Fruit-Girl.jpg", 
				"mid": "Fruit-Girl-mid.png", 
				"thumb": "Fruit-Girl-thumb.png", 
				"title": "Harajuku Girl"  
			},
			{ 
				"img" : "Sushi.jpg", 
				"mid": "Sushi-mid.png", 
				"thumb": "Sushi-thumb.png", 
				"title": "Sushi"  
			},
			{ 
				"img" : "Junk-Boat.jpg", 
				"mid": "Junk-Boat-mid.png", 
				"thumb": "Junk-Boat-thumb.png", 
				"title": "Hong Kong Junk Ship -2004"  
			},	
			{ 
				"img" : "Ikebana-2.jpg", 
				"mid": "Ikebana-2-mid.png", 
				"thumb": "Ikebana-2-thumb.png", 
				"title": "Ikebana"  
			}
		] 
	},
	{ 
		"name": "fashion",
		"images" :
		[
			{ 
				"img" : "HarijukuBoy.jpg", 
				"img2": "Japanese teen.jpg" ,
				"mid": "HarijukuBoy-mid.png",
				"thumb": "HarijukuBoy-thumb.png", 
				"title": "Harajuku Boy for Gallery Nucleus \"Sweet Streets\" 2010"  
			},	
			{ 
				"img" : "DiorLady1.jpg", 
				"mid": "DiorLady1-mid.png", 
				"thumb": "DiorLady1-thumb.png", 
				"title": "Vintage Dior"  
			},
			{ 
				"img" : "Blue1.jpg", 
				"mid": "Blue1-mid.png", 
				"thumb": "Blue1-thumb.png", 
				"title": "Erte bird lady"  
			}, 
			{ 
				"img" : "blue2.jpg", 
				"mid": "blue2-mid.png", 
				"thumb": "blue2-thumb.png", 
				"title": "Erte peacock lady"  
			},
			{ 
				"img" : "MALongshot.jpg", 
				"mid": "MALongshot-mid.png", 
				"thumb": "MALongshot-thumb.png", 
				"title": "Marie Antoinette -private commission"  
			},
			{ 
				"img" : "Bride.jpg", 
				"mid": "Bride-mid.png", 
				"thumb": "Bride-thumb.png", 
				"title": "Bride"  
			},
			{ 
				"img" : "blueBike.jpg", 
				"mid": "blueBike-mid.png", 
				"thumb": "blueBike-thumb.png", 
				"title": "1950s girl"  
			},
			{ 
				"img" : "Spring-girl.jpg", 
				"mid": "Spring-girl-mid.png", 
				"thumb": "Spring-girl-thumb.png", 
				"title": "Spring girl"  
			},
			{ 
				"img" : "Paris.jpg", 
				"mid": "Paris-mid.png", 
				"thumb": "Paris-thumb.png", 
				"title": "Paris girl"  
			},	
			{ 
				"img" : "ShanghiBaby.jpg", 
				"mid": "ShanghiBaby-mid.png", 
				"thumb": "ShanghiBaby-thumb.png", 
				"title": "Shanghai girl"  
			},	
			{ 
				"img" : "Mod-Brit.jpg", 
				"mid": "Mod-Brit-mid.png", 
				"thumb": "Mod-Brit-thumb.png", 
				"title": "Mod Brit -private commission"  
			}
		] 
	},
	{ 
		"name": "animals",
		"images" :
		[
			{ 
				"img" : "AfricanButterfly.jpg", 
				"mid": "AfricanButterfly-mid.png", 
				"thumb": "AfricanButterfly-thumb.png", 
				"title": "African mask butterfly for Gallery Nucleus \"Bug Show\" 2008"  
			}, 
			{ 
				"img" : "Wasp.jpg", 
				"mid": "Wasp-mid.png", 
				"thumb": "Wasp-thumb.png", 
				"title": "Dead wasp for Gallery Nucleus \"Bug Show\" 2008"  
			},	
			{ 
				"img" : "SpiderLadybug3.jpg", 
				"mid": "SpiderLadybug3-mid.png", 
				"thumb": "SpiderLadybug3-thumb.png", 
				"title": "Red spider for Gallery Nucleus \"Bug Show\" 2008"  
			},	
			{ 
				"img" : "SamuraiBeetle1.jpg", 
				"mid": "SamuraiBeetle1-mid.png", 
				"thumb": "SamuraiBeetle1-thumb.png", 
				"title": "Samurai Beetle for Gallery Nucleus \"Bug Show\" 2008"  
			},	
			{ 
				"img" : "Janie&Humphery.jpg", 
				"mid": "Janie&Humphery-mid.png", 
				"thumb": "Janie&Humphery-thumb.png", 
				"title": "Sleeping dogs"  
			},	
			{ 
				"img" : "DogDay.jpg", 
				"mid": "DogDay-mid.png", 
				"thumb": "DogDay-thumb.png", 
				"title": "Celtic design of sleeping dogs"  
			},
			{ 
				"img" : "queenElizabeth.jpg", 
				"mid": "queenElizabeth-mid.png", 
				"thumb": "queenElizabeth-thumb.png", 
				"title": "Queen Eliza-Bee for Gallery Nucleus \"Bug Show\" 2008"  
			},	
			{ 
				"img" : "CloseupLadybug.jpg", 
				"mid": "CloseupLadybug-mid.png", 
				"thumb": "CloseupLadybug-thumb.png", 
				"title": "African mask lady bug for Gallery Nucleus \"Bug Show\" 2008"  
			},
			{ 
				"img" : "Bugs.jpg", 
				"mid": "Bugs-mid.png", 
				"thumb": "Bugs-thumb.png", 
				"title": "Bugs on a wall"  
			},
			{ 
				"img" : "White-Moth.jpg", 
				"mid": "White-Moth-mid.png", 
				"thumb": "White-Moth-thumb.png", 
				"title": "White moth for Gallery Nucleus \"Bug Show\" 2008"  
			},	
			{ 
				"img" : "White-Fish.jpg", 
				"mid": "White-Fish-mid.png", 
				"thumb": "White-Fish-thumb.png", 
				"title": "Angel fish"  
			},	
			{ 
				"img" : "fish.jpg", 
				"mid": "fish-mid.png", 
				"thumb": "fish-thumb.png", 
				"title": "White fish"  
			},
			{ 
				"img" : "unicorn1.jpg", 
				"mid": "unicorn1-mid.png", 
				"thumb": "unicorn1-thumb.png", 
				"title": "Medieval tapestry for Gallery Nucleus \"Unicorn Show\" 2006"  
			},	
			{ 
				"img" : "lionhead.jpg", 
				"mid": "lionhead-mid.png", 
				"thumb": "lionhead-thumb.png", 
				"title": "Lion"  
			},
			{ 
				"img" : "zebra.jpg", 
				"mid": "zebra-mid.png", 
				"thumb": "zebra-thumb.png", 
				"title": "Zebra"  
			}
		] 
	},
	{ 
		"name": "commercial_work",
		"images" :
		[
			{ 
				"img" : "art-girl-running.jpg", 
				"mid": "art-girl-running-mid.png", 
				"thumb": "art-girl-running-thumb.png", 
				"title": "Art Student/Dick Blick Catalog Cover" 
			}, 
			{ 
				"img" : "CinderellaView2.jpg", 
				"mid": "CinderellaView2-mid.png", 
				"img2": "cindstepsis.jpg", 
				"thumb": "CinderellaView2-thumb.png", 
				"title": "Cinderella Paper Diorama- Tokyo Disneyland" 
			},
			{ 
				"img" : "Alex SideFront.jpg", 
				"mid": "Alex-SideFront-mid.png", 
				"thumb": "Alex SideFront-thumb.png", 
				"title": "Alex puppet- Dreamworks Madagascar 2" 
			},
			{ 
				"img" : "Mort_.jpg", 
				"mid": "Mort_-mid.png", 
				"thumb": "Mort_-thumb.png", 
				"title": "Mort- Dreamworks Madagascar 2" 
			},						
			{ 
				"img" : "Gloria Head Exploration.jpg", 
				"mid": "Gloria-Head-Exploration-mid.png", 
				"thumb": "Gloria-Head-Exploration-thumb.png", 
				"title": "Gloria- Dreamworks Madagascar 2" 
			},
			{ 
				"img" : "FaceVariations.jpg", 
				"mid": "FaceVariations-mid.png", 
				"thumb": "FaceVariations-thumb.png", 
				"title": "Face Variations- Yo Gabba Gabba" 
			},
			{ 
				"img" : "fish.jpg", 
				"mid": "fish-mid.png", 
				"thumb": "fish-thumb.png", 
				"title": "Fish- Yo Gabba Gabba" 
			},
			{ 
				"img" : "bird.jpg", 
				"mid": "bird-mid.png", 
				"thumb": "bird-thumb.png", 
				"title": "Bird- Yo Gabba Gabba" 
			},			
			{ 
				"img" : "princessSheet.jpg", 
				"mid": "princessSheet-mid.png", 
				"thumb": "princessSheet-thumb.png", 
				"title": "Princess- Yo Gabba Gabba" 
			},
			{ 
				"img" : "Princess.jpg", 
				"mid": "Princess-mid.png", 
				"thumb": "Princess-thumb.png", 
				"title": "Princess 2- Yo Gabba Gabba" 
			},
			{ 
				"img" : "Turtle.jpg", 
				"mid": "Turtle-mid.png", 
				"thumb": "Turtle-thumb.png", 
				"title": "Turtle- Yo Gabba Gabba" 
			},
			{ 
				"img" : "WOC Alice.jpg", 
				"mid": "WOC-Alice-mid.png", 
				"thumb": "WOC Alice-thumb.png", 
				"title": "Alice- Disney World of Color" 
			},
			{ 
				"img" : "WOC blowfish.jpg", 
				"mid": "WOC-blowfish-mid.png", 
				"thumb": "WOC blowfish-thumb.png", 
				"title": "Blowfish- Disney World of Color" 
			},
			{ 
				"img" : "WOC cat head.jpg", 
				"mid": "WOC-cat-head-mid.png", 
				"thumb": "WOC cat head-thumb.png", 
				"title": "Cheshire Cat Head- Disney World of Color" 
			},
			{ 
				"img" : "WOC fish1.jpg", 
				"mid": "WOC-fish1-mid.png", 
				"thumb": "WOC fish1-thumb.png", 
				"title": "Fish 1- Disney World of Color" 
			},
			{ 
				"img" : "WOC fish2.jpg", 
				"mid": "WOC-fish2-mid.png", 
				"thumb": "WOC fish2-thumb.png", 
				"title": "Fish 2- Disney World of Color" 
			}
		] 
	}	,
	{ 
		"name": "other",
		"images" :
		[
			{ 
				"img" : "boy-with-braces.jpg", 
				"mid": "boy-with-braces-mid.png", 
				"thumb": "boy-with-braces-thumb.png" , 
				"title": "Braces" 
			},
			{ 
				"img" : "Jambi4.jpg", 
				"mid": "Jambi4-mid.png", 
				"thumb": "Jambi4-thumb.png" , 
				"title": "Jombi from Pee Wees Playhouse" 
			},
			{ 
				"img" : "Friends.jpg", 
				"mid": "Friends-mid.png", 
				"thumb": "Friends-thumb.png" , 
				"title": "Rick and Sam for all seasons -private commission" 
			},
			{ 
				"img" : "RodeoKids.jpg", 
				"mid": "RodeoKids-mid.png", 
				"thumb": "RodeoKids-thumb.png" , 
				"title": "Rodeo Kids -private commission" 
			},
			{ 
				"img" : "monalisa.jpg", 
				"mid": "monalisa-mid.png", 
				"thumb": "monalisa-thumb.png" , 
				"title": "Goofy Mona Lisa" 
			},
			{ 
				"img" : "victorianHouses1.jpg", 
				"mid": "victorianHouses1-mid.png", 
				"thumb": "victorianHouses1-thumb.png" , 
				"title": "Victorian Houses" 
			}
		] 
	}	
]

var animation = [
	{ 
		"title":  "Madagascar 2", 
		"subtitle" : "end credits", 
		"text":"Art Direction and Paper puppets: Megan Brain<br>Produced & animated at Duck Studios<br>for Dreamworks Animation<br>Directed by Jamie Calliri<br>Storyboarded by Jamie Calliri & Alex Juhasz", 
		"img" : "animation-madagascar.png",
		"link" : "video/MAD2.html"
	},
	{ 
		"title":  "Heart", 
		"subtitle" : "United Airlines commercial", 
		"text":"Paper Sculpture & Puppets: Megan Brain<br>Produced by Duck Studios<br>Directed by Jamie Calliri", 
		"img" : "animation-heart.png",
		"link" : "video/united_heart.html"
	},
	{ 
		"title":  "Cool Kitty", 
		"subtitle" : "Class of 3000, Cartoon Network", 
		"text":"Paper Sculpture & Puppets: Megan Brain<br>Produced by Duck Studios<br>Directed by jamie Calliri", 
		"img" : "animation-coolkitty.png",
		"link" : "video/CoolKitty.html"
	},
	{ 
		"title":  "Count the Forest Animals", 
		"subtitle" : "Yo Gabba Gabba, Nickelodeon Jr.", 
		"text":"Art direction and model build by Megan Brain<br>Produced by The Magic Store<br>Animation by Chris Staples<br>Storyboarded by Scott Windes", 
		"img" : "animation-counttheforest.png",
		"link" : "video/ForestPan.html"		
	},
	{ 
		"title":  "The Princess and the Dragon", 
		"subtitle" : "Yo Gabba Gabba, Nickelodeon Jr.", 
		"text":"Art direction and model build by Megan Brain<br>Produced by The Magic Store<br>Animation by Chris Staples", 
		"img" : "animation-yogabbaprincess.png",
		"link" : "video/princess.html"				
	}
]

var news = [
	{ 
		"title":  "July 16th 2011", 
		"text":"Yuki 7 book release art show at Q Pop in Japan Town.<br><a href='http://qpopshop.com/main' target='_blank'>http://qpopshop.com/main</a>", 
		"img" : "ltkFlyer02.jpg"
	},
	{ 
		"title":  "July 9th 2011", 
		"text":"Harry Potter tribute show at Gallery Nucleus.  I made a paper version of the character 'Mad Eye Moody'<br><a href='http://www.gallerynucleus.com/' target='_blank'>http://www.gallerynucleus.com/</a>", 
		"img" : "size300_hp_web1.jpg"
	},
	{ 
		"title":  "May 2011", 
		"text":"Cinderella's Fairy Tale Hall - Tokyo Disneyland: opened in May 2011.<br>Various artists were asked to depict scenes from the film in various mediums: wood, acrylic, porcelain, glass, metal, and paper.", 
		"img" : "Room.jpg"
	},
	{ 
		"title":  "March 2011", 
		"text":"The German publishers Gestalten released Papercraft 2 book<br><a href='https://shop.gestalten.com/index.php/catalog/product/view/id/4008' target='_blank'>Buy Papercraft 2</a>", 
		"img" : "cover.jpg"
	},
	{ 
		"title":  "June 11th 2010", 
		"text": "Opening of <a target='_blank' href='http://disneyland.disney.go.com/disneys-california-adventure/world-of-color/?name=WorldOfColor&CMP=KNC-DLRLocWorldColorFY10&s'>'World Of Color'</a> water spectacular in Disney's California Adventure park.   I created some paper puppets that animate and will be projected on water screens in various sections of the show.  The  puppets I made were animated in aftereffects by my friend <a target='_blank' href='http://www.yellowshed.com/'>Todd Hemker.  Puppets from the 'Little Mermaid' segment of the show are on display in the <a target='_blank' href='http://disneyland.disney.go.com/disneyland/en_US/disneyscaliforniaadventure/index?name=DCAPreview'>'Blue Sky Cellar'</a> (also in the California Adventure park) until January 2011. ", 
		"img" : "news-woc.png"
	},
	{ 
		"title":  "February 2010", 
		"text":"Interviewed for the <a target='_blank' href='http://d23.disney.go.com/'>D23</a> (Disneyland Fan Magazine) Spring issue 2010.  They asked me to explain some of my paper sculpture techniques through a craft project.  I remade the Cheshire cat from the 'World of Color' water spectacular.", 
		"img" : "news-d23.png"
	},
	{ 
		"title":  "October 2009", 
		"text":"Article published about my work in a Moscow magazine called 'Echo of the Planet'.  Very excited about this.", 
		"img" : "news-echo.png"
	},
	{ 
		"title":  "January 2009", 
		"text":"The United 'Heart' commercial I worked on last year just won an Annie Award for 'Best Animated Television Commercial'of 2008!  The ceremony took place on January 30th.  Congratulations, Duck Studios, director Jamie Caliri, and fellow crew. If you haven't seen it yet, it's in the animation section of this site.", 
		"img" : "news-united.png"
	},
	{ 
		"title":  "November 2008", 
		"text": "Dreamworks' 'Madagascar 2' just came out November 11th.  If you go to see it, stick around for the end credits and watch my paper sculpture puppets animate!  It's also on this site in the animation section. I created all of the puppets of the Madagascar main characters and the talented animators at <a target='_blank' href='http://www.duckstudios.com/index.php'>Duck Studios</a> made them move!  The spot was directed by Jamie Caliri and storyboarded by Jamie and Alex Juhasz.  Pablo Grande and Alex hand painted the beautiful African textile backgrounds and Pablo hand made all of the wonderful props. ", 
		"img" : "news-madagascar.png"
	},
	{ 
		"title":  "November 2008", 
		"text": "Also, every year the <a target='_blank' href='http://www.dickblick.com/'>Dick Blick</a> company comes up with a theme for their annual art and supply catalogs.  2008 was 'Comic Books' and, just my luck, the 2009 theme is PAPER! I was asked to submit some concepts for their new cover and one of the three I submitted was picked! It was thrilling and very fun to make.  If you are interested in a catalog you can go to their website and order one to be sent to your home. ", 
		"img" : "news-blick.png"
	},
	{ 
		"title":  "August 2008", 
		"text": "Have you been watching the 2008 Olympics? United Airlines is currently running the commercial I worked on for them - check it out in the animation section of this site.", 
		"img" : "news-united2.png"
	},
	{ 
		"title":  "February 2008", 
		"text":"Feature in Italian magazine <a target='_blank' href='press/rivistedigitali.html'>Riviste Digitali</a>.", 
		"img" : "news-riviste.png"
	},
	{ 
		"title":  "March 2007", 
		"text": "Cartoon Brew feature: my new video for CN's Class of 3000, <a target='_blank' href='press/CartoonBrewCoolKitty.html'>'Cool Kitty'</a>", 
		"img" : "news-coolkitty.png"
	},
	{ 
		"title":  "December 2006", 
		"text": "<a target='_blank' href='http://megan-brain-interview.blogspot.com/'>Blogspot interview!</a> ", 
		"img" : ""
	},
	{ 
		"title":  "November 2006", 
		"text": "Got a nice shout-out from <a target='_blank' href='press/CartoonBrewShoutoutPage.html'>Cartoon Brew</a> today. ", 
		"img" : "news-cb.png"
	}
]

var starter_imgs = [ 
	"AfricanButterfly.jpg", 
	"cindstepsis.jpg", 
	"Sound of Music goat puppets.jpg" 
	];

function main()
{
	// preload_image = new Image(); 
	// preload_image.src="opener-ani.gif"; 
  
  $( "#content" ).html( "<img id='opener_img' src='fangirl.gif'>" );
}

$( "#opener_img" ).live( "click", function( event )
{
  soundHandle = document.getElementById('soundHandle');
  soundHandle.src = 'scissors.mp3';
  soundHandle.play();
	$( "#content" ).html( "<img src='opener-ani.gif'>" );
	var rand_nbr = Math.floor(Math.random()*3)
	$( "#content" ).append( "<img id='fadein_home_img' src='images/" + starter_imgs[ rand_nbr ] + "'>" );	
	$( "#fadein_home_img" ).load( function()
	{
		setTimeout( "DisplayHome()", 4500 );
	} );
} );

$( ".home_links" ).live( "click", function( event )
{
	//if they click the gallery link display the gallery links and move everything else down
	if ( main_links[ $( this ).attr( "index" ) ].id == "gallery" )
	{
		DisplayGalleryLinks();
		for ( var i = parseInt( $( this ).attr( "index" ) ) + 1 ; i < main_links.length; ++i )
		{
			$( "#" + main_links[ i ].id ).animate(
			{
				top: 200 + ( i * 30 )
			}, 1000 );
		}
	}
	//if it's not the gallery, hide the gallery links and move everything back to its proper location
	else
	{
		HideGalleryLinks();	
		for ( var i = 0; i < main_links.length; ++i )
		{
			$( "#" + main_links[ i ].id ).animate(
			{
				top: 100 + ( i * 30 )
			}, 1000 );
		}
	}
	
	//show the right page based on which one they clicked
	DisplayMainLinkPage( $( this ).attr( "index" ) );

	//remove that opener image
	$( "#fadein_home_img" ).remove();
	
	//make sure all the other links are fully highlighted
	for ( var i = 0; i < main_links.length; ++i )
	{
		$( "#" + main_links[ i ].id ).css( "opacity", "1" );
	}	
	
	//now make this particular link fade to show selection
	$( "#" + main_links[ $( this ).attr( "index" ) ].id ).css( "opacity", "0.5" );
	
} );

$( ".thumb_img" ).live( "click", function( event )
{
	ClickThumb( $( this ) );

} );

$( ".gallery_links" ).live( "click", function( event )
{	
	//show the right page based on which one they clicked
	DisplayGalleryPage( $( this ).attr( "index" ) );

	//make sure all the other links are fully highlighted
	for ( var i = 0; i < gallery_links.length; ++i )
	{
		$( "#" + gallery_links[ i ].id ).css( "opacity", "1" );
	}	
	
	//now make this particular link fade to show selection
	$( "#" + gallery_links[ $( this ).attr( "index" ) ].id ).css( "opacity", "0.5" );	
} );

function DisplayGalleryPage( index )
{
	$( "#gallery_thumbs" ).remove();
	$( "#gallery_title" ).remove();
	$( "#gallery_img" ).remove();
	$( "#content" ).append( "<div id='gallery_thumbs'></div>" );
	$( "#content" ).append( "<div id='gallery_title' align='center'></div>" );
	var html = "<table><tr>";

	for ( var i = 0; i < galleries[ index ].images.length; ++i )
	{
		var mid_img = ( galleries[ index ].images[ i ].mid == undefined ? "" : galleries[ index ].name + "/" + escape( galleries[ index ].images[ i ].mid ) )
		html += "<td><img id='thumb-" + i + "' class='thumb_img' mid_img='" + mid_img + "' larger_img='" + galleries[ index ].name + "/" + escape( galleries[ index ].images[ i ].img ) + "' larger_img2='" + galleries[ index ].name + "/" + escape( galleries[ index ].images[ i ].img2 ) + "' src='" + galleries[ index ].name + "/" + escape( galleries[ index ].images[ i ].thumb ) + "' title='" + ( galleries[ index ].images[ i ].title == undefined ? "" : galleries[ index ].images[ i ].title ) + "'></td>"
	}	

	html += "</tr></table>";
	if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i) ) || (navigator.userAgent.match(/iPad/i) )) 
	{
    html += "<span style='color: #99cccc'><font size=1>Please use two fingers to scroll</font></span>";
	}
	$( "#gallery_thumbs" ).append( html );
	ClickThumb( $( "#thumb-0" ) );		
}

function ClickThumb( thumb_dom )
{
	$( "#gallery_img" ).remove();
	var date = new Date();
	var no_cache = date.getTime();
	
	$( "#gallery_title" ).html( thumb_dom.attr( "title" ) );
	
	$( "#content" ).append( "<a href='biggerimages.html?img1=" + escape( thumb_dom.attr( "larger_img" ) ) + "&img2=" + escape( thumb_dom.attr( "larger_img2" ) ) + "' target='_blank'><img id='gallery_img' src='" + ( thumb_dom.attr( "mid_img" ) == "" ? thumb_dom.attr( "larger_img" ) : thumb_dom.attr( "mid_img" ) ) +  "?nocache=" + no_cache +"' img2='" + thumb_dom.attr( "larger_img2" ) + "'></a>" );
	//$( "#content" ).append( "<img id='gallery_img' src='" + thumb_dom.attr( "larger_img" ) + "'>" ); 
	$( "#gallery_img" ).load( function( event )
	{	
		var height = $( this ).height();
		var width = $( this ).width();
		var ratio = width / height;
		$( this ).css( "top", 190 - ( height / 2 ) );	
		$( this ).css( "left", 370 - ( width / 2 ) );
		$( this ).animate( { opacity:1 }, 1000 );
	} );
}

$( ".animation_img" ).live( "click", function( event )
{
	window.open( $( this ).attr( "link" ),"thewin","height=720,width=740,toolbar=no,scrollbars=yes");
} );

function DisplayMainLinkPage( index )
{
	$( "#gallery_thumbs" ).remove();
	$( "#gallery_title" ).remove();
	$( "#gallery_img" ).remove();
	$( "#animation_div" ).remove();
	$( "#news_div" ).remove();
	$( "#contact_img" ).remove();
	$( "#contact_word" ).remove();
	$( "#email" ).remove(); 	
	$( "#news_title" ).remove(); 
	$( "#side_title" ).remove();
	switch ( parseInt( index ) )
	{
		case 0://gallery
			DisplayGalleryPage( 0 );
			break;
		case 1://animation
			$( "#content" ).append( "<div id='animation_div'></div>" );
			var html = "<table id='animation_table'>";
			
			if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i) ) || (navigator.userAgent.match(/iPad/i) )) 
			{
				html += "<tr><td style='padding:5px;color:#99cccc;' colspan=2 align='center'><font size=1>< Please use two fingers to scroll ></font></td></tr>";
			}
			
			for ( var i = 0; i < animation.length; i++ )
			{
				html += "<tr><td class='animation_text' align='right'><span class='animation_title'>\"" + animation[ i ].title + "\"</span><br><span class='animation_subtitle'>" + animation[ i ].subtitle + "</span><br><br>" + animation[ i ].text + "</td><td><img class='animation_img' src='images/" + animation[ i ].img + "' link='" + animation[ i ].link + "'></td></tr>";
			}
			html += "</table>";
			$( "#animation_div" ).html( html );
			break;
		case 2://blog - already linked up in the actual link so nothing to do here
			break;
		case 3://contact
			$( "#content" ).append( "<img src='contact-spider-ani.gif' id='contact_img'>" );
			$( "#content" ).append( "<div id='contact_word'>contact:</div>" );
			$( "#content" ).append( "<div id='email'><a id='email_link' href='mailto:papersculpt@yahoo.com'>papersculpt@yahoo.com</a></div>" );
			break;
		case 4://news
			$( "#content" ).append( "<div id='news_div'></div>" );
			$( "#content" ).append( "<div id='news_title'>news</div>" );
			var html = "<table id='news_table'>";
			if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i) ) || (navigator.userAgent.match(/iPad/i) )) 
			{
				html += "<tr><td style='padding:5px;color:#99cccc;' colspan=2 align='center'><font size=1>< Please use two fingers to scroll ></font></td></tr>";
			}			
			for ( var i = 0; i < news.length; i++ )
			{
				html += "<tr class='news_row'><td class='news_cell'>";
				if ( news[ i ].img != "" )
				{
					html += "<img class='news_img' src='images/" + news[ i ].img + "'>";
				}
				html += "</td><td class='news_text news_cell' align='left'><span class='news_title'>" + news[ i ].title + "</span><br><br>" + news[ i ].text + "</td></tr>";
			}
			html += "</table>";
			$( "#news_div" ).html( html );
			break;			
	}
	$( "#content" ).append( "<img id='side_title' src='images/title-" + main_links[ index ].display + ".png'>" );
	return false;
}

function HideGalleryLinks()
{
	for ( var i = 0; i < gallery_links.length; ++i )
	{
		$( "#" + gallery_links[ i ].id ).remove();
	}
}

function DisplayGalleryLinks()
{
	//add the gallery links invisible and up top
	for ( var i = 0; i < gallery_links.length; ++i )
	{
		$( "#content" ).append( "<a href='#' index='" + i + "' id='" + gallery_links[ i ].id + "' class='gallery_links'>" + gallery_links[ i ].display + "</a>" );
	}
	
	//cycle them in reverse, lower them in and make them visible
	for ( var i = gallery_links.length - 1; i >= 0; --i )
	{
		var top_loc = parseInt( $( "#" + main_links[ 0 ].id ).css( "top" ) ) + 20 + ( i * 18 )
		$( "#" + gallery_links[ i ].id ).animate(
		{
			opacity:1,
			top: top_loc
		}, 1000, function ( event )
		{
			//make the top gallery link fade as it's already selected
			$( "#current_work" ).css( "opacity", 0.5 );
		});
	}	
}

function DisplayHome()
{
	$( "#content" ).append( "<img id='copyright_img' src='images/copyright.png'>" );
	for ( var i = 0; i < main_links.length; ++i )
	{
		if ( i == 2 )
		{
			$( "#content" ).append( "<a href='http://www.meganbrain.blogspot.com/' target='_blank' index='" + i + "' id='" + main_links[ i ].id + "' class='home_links'>" + main_links[ i ].display + "</a>" );
		}
		else
		{
			$( "#content" ).append( "<a href='#' index='" + i + "' id='" + main_links[ i ].id + "' class='home_links'>" + main_links[ i ].display + "</a>" );
		}
	}
	
	for ( var i = main_links.length - 1; i >= 0; --i )
	{
		$( "#" + main_links[ i ].id ).animate(
		{
			opacity:1,
			top: 100 + ( i * 30 )
		}, 2000 );
	}

	$( "#fadein_home_img" ).animate(
	{
		opacity:1,
	}, 2000 );		
}
