// end x, end y
var people=[
	[60,13],
	[95,30],
	[106,70],
	[82,103],
	[39,103],
	[13,70],
	[25,30]
];

animateIn=false;
if(animateIn){
	// start x, start y, end x, end y
	seatedPeople=new Array();
	for(p in people){

		// get the last person's cords, or starting cords
		if(! (lastPerson=people[p-1]) ){
			lastPerson=people[(people.length-1)].slice(0);
		}

		if(true){
			lastPerson[0]=lastPerson[0]-(people[p][0]-lastPerson[0]);
			lastPerson[1]=lastPerson[1]-(people[p][1]-lastPerson[1]);
		}

		// set up their cords swith start and end
		thisPerson=new Array();
		thisPerson.push(lastPerson[0],lastPerson[1],people[p][0],people[p][1]);
		seatedPeople.push(thisPerson);
	}
	people=seatedPeople;
}

jQuery(document).ready(function(){

	jQuery('#logo img').attr({
		src:'/wp-content/themes/mrcf/images/logo.base.png'
	});

	jQuery('#logo img').load(function(){
		showPeople(people,0);
	});

	// add people container
	jQuery(document.createElement("div"))
		.attr({
			style: 'position:absolute; z-index:5; margin-left:4px; margin-top:2px;',
			id: 'people_carrier'
		})
		.appendTo(jQuery('#logo'))
	;

	// add clip img
	jQuery(document.createElement("img"))
		.attr({
			style: 'position:absolute; z-index:10; margin:11px;',
			src: '/wp-content/themes/mrcf/images/logo.clip.png'
		})
		.appendTo(jQuery('#logo'))
	;

});

function showPeople(myPeople,delay){

	// get my person
	if(!people.length) return;
	person=myPeople.shift();

	jQuery(document.createElement("img"))
		.attr({
			style: 'position:absolute; opacity:0; z-index:10;',
			src: '/wp-content/themes/mrcf/images/person.png'
		})
		.css('left',person[0]).css('top',person[1])
		.prependTo(jQuery('#people_carrier'))
		.load(function(){
			jQuery(this)
				.delay(150+delay)
				.animate({
					opacity:1,
					left:[person[2],'swing'],
					top:[person[3],'swing']
				},1500);
			showPeople(people,delay+250);
		})
	;
}

