﻿/*
	FranchiseMain.js
*/

// sequencer for scriptaculous' imageswapping
function hedSwap() {
	if (!document.getElementById('Franchise_splash_float')) { return; }
//	z = testForIE6(); if (z==1) { return; }
	dt = 9; // The delay timer. whole seconds value.
	wt = 9; // Delay timer for the first fade - gives images some time to load before the flipping starts.
	ft = 0.5; // The fader timer (Time it takes an object to fade to the next one). Whole seconds value.
	eId = 'hsf_'; // the base name for the element IDs being sequenced.
	hedqueue = new Array();
	for (a=0;a<1000;a++) {
		b = a + 1;
		if (document.getElementById(eId+b)) {
			hedqueue[a] = eId + b;
			if (a!=0) { // this assumes the first element in the sequence is always numbered '1'
				new Effect.Opacity(hedqueue[a],{duration:0,from:0.0,to:0.0,queue:'end',afterFinish:hedHider})
				document.getElementById(hedqueue[a]).style.zIndex = 1;
			} else {
				document.getElementById(hedqueue[a]).style.zIndex = 2;
			}
		}
		if (a>hedqueue.length) { break; }
	}
	d = 0;
	for (a=0;a<70;a++) {
		for (e=0;e<hedqueue.length;e++) {
			if (d==e) {
				// do nothing to the first image in the first loop.
			} else {
				newimg = hedqueue[e];
				oldimg = hedqueue[d];
				if (e!=0) {
					new Effect.Opacity(oldimg,{duration:0.5,from:1.0,to:0.0,delay:dt,queue:'end'});
					new Effect.Opacity(newimg,{duration:0.5,from:0.0,to:1.0,queue:'end'});
				} else {
					new Effect.Opacity(oldimg,{duration:0.5,from:1.0,to:0.0,delay:dt,queue:'end'});
					new Effect.Opacity(newimg,{duration:0.5,from:0.0,to:1.0,queue:'end'});
				}
			}
			d = e; // cache the previous value of 'e' for the coming loop cycle
		}
	}
	return;
}
function hedHider(obj) {
	$(obj.element.id).removeClassName('Franchise_box_hid');
	return;
}
// Tests for MSIE 6. Returns 1 if true.
function testForIE6() {
	z = 0;
	/*@cc_on
		if (@_jscript_version <= 5.6) { z = 1; }
	@*/
	return z;
}
function launchAll() {
	//initRollovers();
	//formFill();
	hedSwap();
}
window.onload = launchAll;

/* EOF */
