

var birdSong = new Array(
	{text:"30% less fat than regular crisps"								,size:'18px' ,top:'13px'}
	,{text:"Tiny moments of extraordinary pleasure"							,size:'16px' ,top:'15px'}
	,{text:"Bursting with Wholegrain for extra crunch"						,size:'17px' ,top:'10px'}
	,{text:"Natural flavours that charm your taste buds"					,size:'17px' ,top:'3px'}
	,{text:"A taste of sun-grown, wholegrain bliss"							,size:'18px' ,top:'3px'}
	,{text:"Packed with 1/3 suggested daily wholegrain*"					,size:'16px' ,top:'14px'}
	,{text:"No artificial colours, flavours or preservatives"				,size:'15px' ,top:'10px'}
	,{text:"Brimming with great natural flavours"							,size:'18px' ,top:'13px'}
);

var lastBirdSong = false;//birdSong[0];

function getRandomBirdSong()
{
	if( lastBirdSong == false ){
		lastBirdSong = birdSong[0];
		return birdSong[0];
	}
	var r = Math.floor(Math.random()*birdSong.length);
	var newBirdSong = birdSong[r];
	if(newBirdSong.text==lastBirdSong.text) newBirdSong = getRandomBirdSong();
	lastBirdSong = newBirdSong;
	return newBirdSong;
}

function showBirdSong(newBirdSong,add)
{
	// add this one to the array?
	add = typeof(add)=='undefined' ? false : add;
	
	if(typeof(newBirdSong)!='undefined' && add){
		//birdSong[birdSong.length] = newBirdSong;
		birdSong.push(newBirdSong);
	}
	
	var p = $('#bird p');
	p.stop(true);
	if($.browser.msie){
		p.css('display','none');
	}else{
		p.animate({'opacity':'0'},{duration:0});
	}
	p.html(newBirdSong.text);
	p.css('top',newBirdSong.top);
	p.css('font-size',newBirdSong.size);
	if($.browser.msie){
		p.css('display','block');
	}else{
		p.animate({'opacity':'1'},{duration:500});
	}
	Cufon.replace('#bird p', { fontFamily: 'Amity Jack', hover: true}); 	
}

$(document).ready(function(){
	
	Cufon.replace('#bird p', { fontFamily: 'Amity Jack', hover: true});

	$('#bird').click(function(e){
		$(this).removeClass('nobubble');
		e.preventDefault();
		var newBirdSong = getRandomBirdSong();
		showBirdSong(newBirdSong);
	});
	
	
	$('#header ul li.top').mouseover(function(){
		$(this).find('ul.drop').css('display','block');
	});
	$('#header ul li.top').mouseout(function(){
		$(this).find('ul.drop').css('display','none');
	});
	
});
	

