if ('createTouch' in document){
 
	var myLinks = document.getElementsByTagName('a');
	
	for(var i = 0; i < myLinks.length; i++){
	 myLinks[i].addEventListener('touchstart', function(){this.className = "touch";}, false);
	 myLinks[i].addEventListener('touchend', function(){this.className = "";}, false);
	 myLinks[i].addEventListener('touchcancel', function(){this.className = "";}, false);
	}

}


var bubbies = (function(){

if (!$('.kid').length){return false;}

/*
var top = $('.kid').offset().top - 200;
var left = -16;
*/

if ($('.bubble').length){$('.bubble').remove();}
		
	var quote = '';

	if ($('.kid').attr('src').match(/percy/ig) && window.location.href.match(/books/ig)){
		
		quote = 'Look!<br>Stories about <br>me and all of<br>my friends!';
		
	}
	

	if (window.location.href.match(/books\/es/ig)){
		

		quote = '¡Mira!<br>Historias sobre<br>mí y mis amigos!';
		//quote = '¡Mira!<br>Historias sobre<br>mí y todos mis amigos!';
	}
	

	if ($('.kid').attr('src').match(/carlos/ig) && window.location.href.match(/resources/ig)){
		quote = 'Look!<br>All my friends from<br>Ready Set Pre-K<br>are on “A Closer<br>Look” posters!';
	}












	if ($('.kid').attr('src').match(/ajay/ig) && window.location.href.match(/videos/ig)){
		

		quote = 'Ready! Set! Action!<br>It’s Stuart-TV!';
		
	}

	if ($('.kid').attr('src').match(/ajay/ig) && window.location.href.match(/press/ig)){
		

		quote = 'Press pictures of<br>Stuart, me and all<br>my friends from<br>Ready Set Pre-K…<br>and Pickle, too!';
		
	}
	


	if ($('.kid').attr('src').match(/emma/ig) && window.location.href.match(/about/ig)){
		

		quote = 'Stuart writes<br>storybooks.<br>I <em>love</em> storybooks!';
		
	}



	if ($('.kid').attr('src').match(/freda/ig) && window.location.href.match(/experts/ig)){
		

		quote = 'Our experts know<br>about young children.<br>They were all once<br>children, too!';
		
	}


	if ($('.kid').attr('src').match(/cathy/ig) && window.location.href.match(/learn/ig)){
	

		quote = 'There\'s so much<br>to do in our town!<br>Follow us on<br><a href="http://facebook.com/pages/Stuart-J-Murphy/117428138325651">Facebook</a> & <a href="http://twitter.com/vizlearning">Twitter</a><br>for updates!';

	}
	
	




	if ($('.kid').attr('src').match(/cathy/ig) && window.location.href.match(/booklists/ig)){
		quote = 'I can print out<br>lists of I See I Learn<br>books!';
	}

	
	
	
	
	if ($('.kid').attr('src').match(/camille/ig) && window.location.href.match(/overview/ig)){
	

		quote = 'I can\'t read<br>words, yet, but I can<br>"read" pictures!<br>I see...I learn!';



	}	
	
	 
	if ($('.kid').attr('src').match(/freda/ig) && window.location.href.match(/contact/ig)){
	

		quote = 'Do you have<br>a question?<br>A story? An idea<br>for an activity?<br>Send us a note!';
		
	}		
	

/*


fred  Picnics are my favorite—even when Pickle comes, too!
ajay  I practiced and now I can throw a ball! It feels so good!
emma  When Freda and Percy give me a hug, it’s the best friendwich ever!
Percy  When I am a monster, my friends won’t play with me!
Camille What a fun day we had at Friendly Waves Beach!
Percy It’s no fun to be grouchy and cranky!


* Each individual book gets its own character talking about the book!!!

Freda Plans a Picnic / Cognitive Skills / Sequencing

Freda’s mom says she can invite her friends to picnic. There is so much to do, from packing the picnic basket to cleaning up. All the steps add up to a fun-filled time!

The ability to to recall events in proper order—what happens first, what comes next, and what occurs last—is important for story comprehension, mathematics, following directions, planning, and other life skills. 

Now it’s time to help your child plan a picnic!

Freda blurb: “Picnics are my favorite—even when Pickle comes, too!”


Good Job, Ajay! / Emotional Skills / Building Confidence

Ajay want to throw a ball straight and far. He tries, but he just can’t do it. Then his friends remind Ajay how he learned to do other things. See what happens when they cheer him on. 

Having confidence is critical as young children try new things, face new challenges, and attemnpt to reach higher goals. 

Help your child take on something new!

Ajay blurb: “I practiced and now I can throw a ball! It feels so good!”


Emma’s Friendwich / Social Skills / Making Friends

Emma is new in town. More than anything, she wants to make new friends. See what happens when she smiles, asks to play, offers to help, and shares her toys. Making friends is fun!

The ability to make new friends is important as young children meet one another and work and play together.

Encourage your child to make a new friend!

Emma blurb: “When Freda and Percy give me a hug, it’s the best friendwich ever!”

or “My friends are the best. We play, laugh, draw and go to Ready Set Pre-K and Stay-and-Play Park!


Percy Plays It Safe
  
Percy love to go to the playground. He plays on the swings, the slide, and the monkey bars—and in the big sandbox. But what happens when Percy doesn’t play it safe? 

Knowing how to follow playground rules, use common sense, and respect others are important skills to keep children from hurting themselves or others. 

Safe play is fun play!

Percy blurb: “When I am a monster, my friends won’t play with me!” 


Camille’s Team / Social Skills / Cooperation

Camille loves to build sand forts at the beach. But it’s hard to build a big fort alone. See what happens when Camille and her friends make a plan, work together, and share the fun. 

Learning how to work together to achieve a goal helps children develop mutual respect. Children see that they can get more done—and have more fun doing it!

Sahre the work. Share the fun!

Camille’s blurb: “What a fun day we had at Friendly Waves Beach!” (NOTE: should Camille be in her bathing suit?) 


Percy Gets Upset / Emotional Skills / Dealing with Frustration 

Percy sometimes gets upset. He crosses his arms, stamps his feet, and scowls. But when he learns how to calm down, he has fun again!

Developing strategies for managing anger, such as taking a deep breath and counting to ten, helps children calm down and feel better. 

When you’re not upset, you have more fun!

Percy blurb: “It’s no fun to be grouchy and cranky!” 


•••••••••••••••••••••••



COPY FOR OTHER PAGES: 

Overview / Camille: I can't read words, yet, but I can "read" pictures! I see..I learn! 

Experts / Freda: Our experts know all about young children. They were all once children, too!

Books / Percy: Look! Stories about me and all my friends!

Bullet Bio / Emma: Stuart writes storybooks. I love storybooks!

Posters / Carlos: Look! All my friends from Ready Set Pre-K are on “A Closer Look” posters!

Videos: Ajay: Ready! Set! Action! It’s Stuart-TV! 

Bibliographies / Miss Cathy (THIS WILL GO LIVE LATER) 

See-and-Learn City map (Interim)/ /Miss Cathy: We are still under construction. Follow us on Twitter (link) and Facebook (link) for updates. Thank you! 

Family Album / Ajay:   Press pictures of Stuart, me and all my friends from Ready Set Pre-K...and Pickle, too!  











*/

	if (!quote){return false;}
	
	$('#wrapper > article').append('<div class="bubble"><p>'+quote+'</p></div>');
	
	//$('#wrapper > article').append('<div class="bubble" style="top:'+top+'px; left:'+left+'px;"><p>'+quote+'</p></div>');
	
	
	setTimeout(function(){
		$('.bubble').addClass('grow');
	},1);	
		
		
});
	



setTimeout(function(){
	bubbies();
},200);







$(window).load(function(){
	
	$('body').addClass('loaded');
	
	if ('createTouch' in document){
		document.body.addEventListener('touchmove', function(e) {
			e.preventDefault();
		});
	}
	
	var api = $('#content').data('jsp');

	if (api){ 

		if (!$('aside:visible','ul.items').length){
			api.reinitialise();
		}
	
	}
	
});







var throttleTimeout;

$(window).bind('resize',
function(){
	
	clearTimeout(throttleTimeout);
	
	throttleTimeout = setTimeout(
		function(){
		
			var api = $('#content').data('jsp');
			
			if (api){
				
				api.reinitialise();
				
				if ($('aside:visible','ul.items').length){
					$('.jspVerticalBar').hide();
				}
				
			}
			
		},
		100
	);

});







$(document).ready(function(){
	
	$('a','ul.browsertype').click(function(e){
		
		$(this).addClass('selected').parent('li').siblings('li').find('a.selected').removeClass('selected');
		
		var type = $(this).data('type');
		
		$('li:not(".'+type+'")','.bookslist').hide();
		$('li.'+type,'.bookslist').show();
		
		e.preventDefault();
		
	});
	
});






$(window).load(function(){

	$('aside#pickle').bind('click',function(e){
		
		if (e.target.nodeName === 'A'){
			return true;
		}
			
		
		if (e.target.nodeName === 'BUTTON'){
			$('#buybooks').removeClass('grow');
			e.preventDefault();
			e.stopPropagation();
			
			setTimeout(function(){
				$('#buybooks').hide();
			},500);
			
			return false;
		}
	
		$('#buybooks').show();
		setTimeout(function(){
			$('#buybooks').addClass('grow');
		},1);	
		
		e.preventDefault();
		
	});	

});




(function(){
	var items;
	
	if (window.location.href.match(/books/ig)){
		items = 'Books';
	}

	if (window.location.href.match(/resources/ig)){
		items = 'Posters';
	}	
	if (window.location.href.match(/videos/ig)){
		items = 'Videos';
	}		
	if (window.location.href.match(/press/ig)){
		items = 'Pics';
	}			
	
	if (!items){return false;}
	
	if (window.location.href.match(/books\/es/ig)){
		
		items = 'Libros';
		
		$('section').append('<div id="itemnav" class="inactive"><button id="viewall">Todos '+items+'</button><button id="backwards">Backwards</button><button id="forwards">Forwards</button></div>');
	
	} else {
	
		$('section').append('<div id="itemnav" class="inactive"><button id="viewall">All '+items+'</button><button id="backwards">Backwards</button><button id="forwards">Forwards</button></div>');
		
	}
	


	$('#viewall').click(function(){
		
		$('.jspVerticalBar').show();
		
		window.location.hash = '';
		
		$('aside','ul.items').hide();
		
		$('#itemnav').addClass('inactive');
		
		$('#content').css({overflow:'auto'});
		
		


		/*
			if ($('.kid').attr('src').match(/percy/ig) && window.location.href.match(/books/ig)){
				
				quote = 'Look!<br>Stories about <br>me and all of<br>my friends!';
				
			}
			
		
			if (window.location.href.match(/books\/es/ig)){
				
		
				quote = '¡Mira!<br>Historias sobre<br>mí y mis amigos!';
				//quote = '¡Mira!<br>Historias sobre<br>mí y todos mis amigos!';
			}
		*/




		if (window.location.href.match(/books\/es/ig)){
			$('.kid').attr('src','/iseeilearn/assets/img/kids/6/carlos2.png');
		} else {
			$('.kid').attr('src','/iseeilearn/assets/img/kids/3/percy.png');
		}
		
		bubbies();
		
		
		
		
		
	});

	$('.fucky').click(function(){
		$('#itemnav').removeClass('inactive');
	});


	$('#backwards').live('click',function(){
		
		
		if (!$('aside:visible','ul.items').length){
			return false;
		}
		
		var $previous = $('aside:visible','ul.items').parents('li:first').prevAll('li:first').find('aside');
	
		//make sure it exists
		if (!$('aside:visible','ul.items').parents('li:first').prevAll('li').length || !$('aside:visible','ul.items').parents('li:first').prevAll('li').data('type')){
			return false;
		}
		
		
		var $fucky = $('aside:visible','ul.items').parents('li:first').prevAll('li:first').find('.fucky');

		$('aside:visible','ul.items').hide();
		
		$fucky.trigger('click');
		
		//$previous.show();
		
	});
	
	$('#forwards').live('click',function(){
		

		if (!$('aside:visible','ul.items').length){
			return false;
		}
		

		var $next = $('aside:visible','ul.items').parents('li:first').nextAll('li:first').find('aside');
		
		//make sure it exists
		if (!$('aside:visible','ul.items').parents('li:first').nextAll('li').length || !$('aside:visible','ul.items').parents('li:first').nextAll('li').data('type')){
			return false;
		}
		
		
		

		var $fucky = $('aside:visible','ul.items').parents('li:first').nextAll('li:first').find('.fucky');
		
		$('aside:visible','ul.items').hide();
		
		$fucky.trigger('click');
		
		//$next.show();
		
	});
	
})();



$(window).load(function(e){
	if (window.location.hash){
		$('.fucky[data-story="'+window.location.hash.replace('#','')+'"]').trigger('click');
	}
});


function clickbuy(e){
	$('#pickle').trigger('click');
	e.preventDefault();
}

$(document).ready(function(){



	$('#buyit').click(function(e){
		
		$('#pickle').trigger('click');
		
		e.preventDefault();
		
	});




	$('body').click(function(e){
		
/*
		if (!$(e.target).hasClass('sharing')){alert('true');}
		
		if (!$(e.target).hasClass('shareoptions')){alert('true');}
		
		if (!$(e.target).parents('.shareoptions').length){alert('true');}
		
*/
		
		
		if (!$(e.target).hasClass('sharing') && !$(e.target).hasClass('shareoptions') && !$(e.target).parents('.shareoptions').length){

		//	if ($('.shareoptions:visible').length){
				$('.shareoptions').hide('fast');
		
		}
		
	});

});


$(document).ready(function(){
	
	$('.sharing').click(function(e){
		
		$(this).siblings('.shareoptions').toggle('fast');
		return false;
		//e.preventDefault();
		
	});
	
});


function hideme(){
	$('#ie').remove();
}

