function preload(section) { if (document.images) {
	imgs[section] = new Array();
	for (i=0; i < 8; i++) {
		imgs[section][i] = new Image();
		imgs[section][i].src = "img/" + section + i + ".gif";
	}
	counter[section] = 1;
}}

preload('home');
preload('shipping');
preload('insurance');
preload('services');
preload('about');
preload('people');
preload('network');
preload('instruct');
preload('contact');

peelingup['home'] = 1;
peelingup['shipping'] = 1;
peelingup['insurance'] = 1;
peelingup['services'] = 1;
peelingup['about'] = 1;
peelingup['people'] = 1;
peelingup['network'] = 1;
peelingup['instruct'] = 1;
peelingup['contact'] = 1;

if (currentsection) {
	peelingup[currentsection] = 0;
	peelingdown[currentsection] = 1;
}

function startpeelup(section) { if (document.images) {
	if (section != currentsection) {
		startpeeldown(lastover);
		lastover = section;
		peelingup[section] = 1;
		peelingdown[section] = 0;
		peelup(section);
}}}

function startpeeldown(section) { if (document.images) {
	if (section != currentsection) {
		peelingdown[section] = 1;
		peelingup[section] = 0;
		peeldown(section);
}}}

function peelup(section) { if (section != currentsection) {
	if (! peelingdown[section]) {
		if (counter[section] < 8) {
			document.images[section].src = imgs[section][counter[section]].src;
			if (counter[section] < 7) {
				counter[section] = counter[section] + 1;
				setTimeout("peelup('" + section + "')",delay);
}}}}}

function peeldown(section) { if (section != currentsection) {
		if (! peelingup[section]) {
		if (counter[section] > -1) {
			document.images[section].src = imgs[section][counter[section]].src;
			if (counter[section] > 0) {
				counter[section] = counter[section] - 1;
				setTimeout("peeldown('" + section + "')",delay);
}}}}}

function setsection(section) { if (document.images) {
	if (section != currentsection) {
		document.images[section].src = imgs[section][7].src;
		initializing = false
		currentsection = section;
		
		startpeeldown('home');
		startpeeldown('shipping');
		startpeeldown('insurance');
		startpeeldown('services');
		startpeeldown('about');
		startpeeldown('people');
		startpeeldown('network');
		startpeeldown('instruct');
		startpeeldown('contact');
		
}}}

function changesection(section) {
	if (document.images) {
		startpeelup(section);
		// We ought to do a bit of waiting here
		setsection(section);
	}
}

