function PopupBalloon(popup, rollover){
	popup = $(popup);
	rollover = $(rollover);
	
	if(popup != null && rollover != null)
	{
		var $imageHeight = $(popup).height();
		var $timeOutNum = 5000;
	
		if($.browser.msie){
				setTimeout(function() { popup.css('height','0px'); }, 3000);
	
				rollover.mouseover(
					function(){
						popup.animate({height:$imageHeight/1.06},100)
					    .animate({height:$imageHeight/1.16},150)
					    .animate({height:$imageHeight},150);
						setTimeout(function() { popup.animate({height:'0px'},100); }, 5000);
					}
				);
				
		} else {
			popup.css({height:'0px'});
			rollover.mouseover(function(){
				popup
				.animate({height:$imageHeight/1.06},100)
			    .animate({height:$imageHeight/1.16},150)
			    .animate({height:$imageHeight},150);
			}); 
		
			rollover.mouseout(function(){
				popup.animate({height:'0px'},100);
			});
		}
	}
}

$(document).ready(function(){ 	
	new PopupBalloon('#jellySquirmSpeech', '#jellySquirmRollover');
	new PopupBalloon('#dinoSpeech', '#dinoRollover');
	new PopupBalloon('#oceanMinisSpeech', '#oceanMinisRollover');
	new PopupBalloon('#surfsUpSpeech', '#surfsUpRollover');
	new PopupBalloon('#forbiddenFruitsSpeech', '#forbiddenFruitsRollover');
	new PopupBalloon('#jellySnakesSpeech', '#jellySnakesRollover');
	new PopupBalloon('#wildThingsSpeech', '#wildThingsRollover');
});

$(document).ready(function() {
    $('#preLoader').show();  
                                       
	$('#snakeBGOne').hide(); 
	$('#snakeBGTwo').hide(); 
	$('#snakeBGThree').hide(); 
	$('#snakeBGFour').hide();
	$('#snakeBGFive').hide();
	$('#snakeBGSix').hide();
	$('#snakeBGSeven').hide();
	$('#snakeBGEight').hide();
	
	$('#snakeHolder').hide();
	
	$(window).load(function() {                                           
		setTimeout(function() { $('#snakeBGOne').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGTwo').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGThree').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGFour').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGFive').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGSix').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGSeven').show(); }, 1000); 
		setTimeout(function() { $('#snakeBGEight').show(); }, 1000);
		
		setTimeout(function() { $('#snakeHolder').show(); }, 1000);
		
		setTimeout(function() { $('#preLoader').hide(); }, 1000);
	}); 
});

if ( $.browser.msie = false ) {
fire	
	(function($) {
		  var cache = [];
		  // Arguments are image paths relative to the current page.
		  $.preLoadImages = function() {
		    var args_len = arguments.length;
		    for (var i = args_len; i--;) {
		      var cacheImage = document.createElement('img');
		      cacheImage.src = arguments[i];
		      cache.push(cacheImage);
		    }
		  };
		});
		
		jQuery.preLoadImages("flavourFollowerOver.gif", "/images/squirm/squirmTitle/flavourFollowerOver.gif");
		//menu
		jQuery.preLoadImages("fancy1.gif", "/images/menu/fancy1.gif");
		jQuery.preLoadImages("flavourmonth1.gif", "/images/menu/flavourmonth1.gif");
		jQuery.preLoadImages("natural_archive1.gif", "/images/menu/natural_archive1.gif");
		jQuery.preLoadImages("our_sweets1.gif", "/images/menu/our_sweets1.gif");
		jQuery.preLoadImages("ourstory1.gif", "/images/menu/ourstory1.gif");
		jQuery.preLoadImages("posted.gif", "/images/menu/posted1.gif");
	
}


