/*  Script 'imageScroller.js'
 *  
 *  PURPOSE: Generates an image scroller within specified div element and image directory.
 *  REQUIRES: MooTools, image directory
 */
function header1(timeout) {
	// Create Div Object
	var div = document.createElement('div');
	div.style.position = 'absolute';
	div.style.top = document.getElementById(id).style.top;
	div.style.left = document.getElementById(id).style.left;
	
	var imageNum = '1';
	// Create Image Object
	var img = document.createElement('img');
	img.style.visibility = 'hidden';
	img.setAttribute('src', 'images/headers/header1.jpg');
	img.setAttribute('id', 'temp0');
	img.setAttribute('alt', 'Collect All Payments.');
	div.appendChild(img);
	
	/* New Added Section */
	var buttonDiv = document.createElement('div');
	buttonDiv.style.position = 'relative';
	buttonDiv.style.bottom = '91px';
	buttonDiv.style.left = '877px';
	buttonDiv.style.backgroundColor = 'transparent';
	buttonDiv.style.width = '65px';
	buttonDiv.style.height = '10px';
	
	if( imageNum != '1' ) {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header1(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '2' ) {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header2(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '3' ) {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header3(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '4' ) {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header4(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '5' ) {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header5(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	div.appendChild(buttonDiv);
	var findOutMore = new Element('a', {
		'href': 'collect_payments.php',
		'html': 'Find Out More >>',
		'styles': {
			'position': 'absolute',
			'top': '188px',
			'right': '35px',
			'font-family': 'Arial',
			'font-size': '14px',
			'color': '#FB7430'
		}
	}).inject($(div));
	/* End of New Added Section */
	
	document.getElementById(id).appendChild(div);
			
	new Fx.Morph('temp0', {
		duration: 'long',
		wait: false
	}).start({
		'opacity': [0,1]
	}).chain(function() {
		if(document.getElementById(id).childNodes.length > 1)
				$(id).childNodes[0].destroy();
//				document.getElementById(id).removeChild(document.getElementById(id).childNodes[0]);
	});
	
	clearTimeout(timeout);
}
function header2(timeout) {
	// Create Div Object
	var div = document.createElement('div');
	div.style.position = 'absolute';
	div.style.top = document.getElementById(id).style.top;
	div.style.left = document.getElementById(id).style.left;
	
	var imageNum = '2';
	// Create Image Object
	var img = document.createElement('img');
	img.style.visibility = 'hidden';
	img.setAttribute('src', 'images/headers/header2.jpg');
	img.setAttribute('id', 'temp1');
	img.setAttribute('alt', 'Create Community.');
	div.appendChild(img);
	
	/* New Added Section */
	var buttonDiv = document.createElement('div');
	buttonDiv.style.position = 'relative';
	buttonDiv.style.bottom = '91px';
	buttonDiv.style.left = '877px';
	buttonDiv.style.backgroundColor = 'transparent';
	buttonDiv.style.width = '65px';
	buttonDiv.style.height = '10px';
	
	if( imageNum != '1' ) {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header1(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '2' ) {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header2(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '3' ) {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header3(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '4' ) {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header4(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '5' ) {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header5(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	div.appendChild(buttonDiv);
	var findOutMore = new Element('a', {
		'href': 'community_portal_tools.php',
		'html': 'Find Out More >>',
		'styles': {
			'position': 'absolute',
			'top': '188px',
			'right': '35px',
			'font-family': 'Arial',
			'font-size': '14px',
			'color': '#FB7430'
		}
	}).inject($(div));
	/* End of New Added Section */
	
	document.getElementById(id).appendChild(div);
			
	new Fx.Morph('temp1', {
		duration: 'long',
		wait: false
	}).start({
		'opacity': [0,1]
	}).chain(function() {
		if(document.getElementById(id).childNodes.length > 1)
				$(id).childNodes[0].destroy();
//				document.getElementById(id).removeChild(document.getElementById(id).childNodes[0]);
	});
	
	clearTimeout(timeout);
}

function header3(timeout) {
	// Create Div Object
	var div = document.createElement('div');
	div.style.position = 'absolute';
	div.style.top = document.getElementById(id).style.top;
	div.style.left = document.getElementById(id).style.left;
	
	var imageNum = '3';
	// Create Image Object
	var img = document.createElement('img');
	img.style.visibility = 'hidden';
	img.setAttribute('src', 'images/headers/header3.jpg');
	img.setAttribute('id', 'temp2');
	img.setAttribute('alt', 'Save Money.');
	div.appendChild(img);
	
	/* New Added Section */
	var buttonDiv = document.createElement('div');
	buttonDiv.style.position = 'relative';
	buttonDiv.style.bottom = '91px';
	buttonDiv.style.left = '877px';
	buttonDiv.style.backgroundColor = 'transparent';
	buttonDiv.style.width = '65px';
	buttonDiv.style.height = '10px';
	
	if( imageNum != '1' ) {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header1(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '2' ) {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header2(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '3' ) {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header3(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '4' ) {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header4(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '5' ) {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header5(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	div.appendChild(buttonDiv);
	var findOutMore = new Element('a', {
		'href': 'services.php',
		'html': 'Find Out More >>',
		'styles': {
			'position': 'absolute',
			'top': '188px',
			'right': '35px',
			'font-family': 'Arial',
			'font-size': '14px',
			'color': '#FB7430'
		}
	}).inject($(div));
	/* End of New Added Section */
	
	document.getElementById(id).appendChild(div);
			
	new Fx.Morph('temp2', {
		duration: 'long',
		wait: false
	}).start({
		'opacity': [0,1]
	}).chain(function() {
		if(document.getElementById(id).childNodes.length > 1)
				$(id).childNodes[0].destroy();
//				document.getElementById(id).removeChild(document.getElementById(id).childNodes[0]);
	});
	
	clearTimeout(timeout);
}

function header4(timeout) {
	// Create Div Object
	var div = document.createElement('div');
	div.style.position = 'absolute';
	div.style.top = document.getElementById(id).style.top;
	div.style.left = document.getElementById(id).style.left;
	
	var imageNum = '4';
	// Create Image Object
	var img = document.createElement('img');
	img.style.visibility = 'hidden';
	img.setAttribute('src', 'images/headers/header4.jpg');
	img.setAttribute('id', 'temp3');
	img.setAttribute('alt', 'Easy Integration.');
	div.appendChild(img);
	
	/* New Added Section */
	var buttonDiv = document.createElement('div');
	buttonDiv.style.position = 'relative';
	buttonDiv.style.bottom = '91px';
	buttonDiv.style.left = '877px';
	buttonDiv.style.backgroundColor = 'transparent';
	buttonDiv.style.width = '65px';
	buttonDiv.style.height = '10px';
	
	if( imageNum != '1' ) {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header1(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '2' ) {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header2(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '3' ) {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header3(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '4' ) {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header4(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '5' ) {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header5(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	div.appendChild(buttonDiv);
	var findOutMore = new Element('a', {
		'href': 'integration.php',
		'html': 'Find Out More >>',
		'styles': {
			'position': 'absolute',
			'top': '188px',
			'right': '35px',
			'font-family': 'Arial',
			'font-size': '14px',
			'color': '#FB7430'
		}
	}).inject($(div));
	/* End of New Added Section */
	
	document.getElementById(id).appendChild(div);
			
	new Fx.Morph('temp3', {
		duration: 'long',
		wait: false
	}).start({
		'opacity': [0,1]
	}).chain(function() {
		if(document.getElementById(id).childNodes.length > 1)
				$(id).childNodes[0].destroy();
//				document.getElementById(id).removeChild(document.getElementById(id).childNodes[0]);
	});
	
	clearTimeout(timeout);
}

function header5(timeout) {
	// Create Div Object
	var div = document.createElement('div');
	div.style.position = 'absolute';
	div.style.top = document.getElementById(id).style.top;
	div.style.left = document.getElementById(id).style.left;
	
	var imageNum = '5';
	// Create Image Object
	var img = document.createElement('img');
	img.style.visibility = 'hidden';
	img.setAttribute('src', 'images/headers/header5.jpg');
	img.setAttribute('id', 'temp4');
	img.setAttribute('alt', 'A Custom Fit.');
	div.appendChild(img);
	
	/* New Added Section */
	var buttonDiv = document.createElement('div');
	buttonDiv.style.position = 'relative';
	buttonDiv.style.bottom = '91px';
	buttonDiv.style.left = '877px';
	buttonDiv.style.backgroundColor = 'transparent';
	buttonDiv.style.width = '65px';
	buttonDiv.style.height = '10px';
	
	if( imageNum != '1' ) {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header1(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton1 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '2' ) {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header2(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton2 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '3' ) {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header3(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton3 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '4' ) {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header4(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton4 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	if( imageNum != '5' ) {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			},
			'events': {
				'click': function() {
					header5(timeout);
				}
			}
		}).inject($(buttonDiv));
	} else {
		var imgButton5 = new Element('a', {
			'href': '#',
			'styles': {
				'display': 'block',
				'float': 'left',
				'z-index': '15',
				'width': '9px',
				'height': '10px',
				'padding': '0 4px 0 0'
			}
		}).inject($(buttonDiv));
	}
	
	div.appendChild(buttonDiv);
	var findOutMore = new Element('a', {
		'href': 'customization.php',
		'html': 'Find Out More >>',
		'styles': {
			'position': 'absolute',
			'top': '188px',
			'right': '35px',
			'font-family': 'Arial',
			'font-size': '14px',
			'color': '#FB7430'
		}
	}).inject($(div));
	/* End of New Added Section */
	
	document.getElementById(id).appendChild(div);
			
	new Fx.Morph('temp4', {
		duration: 'long',
		wait: false
	}).start({
		'opacity': [0,1]
	}).chain(function() {
		if(document.getElementById(id).childNodes.length > 1)
				$(id).childNodes[0].destroy();
//				document.getElementById(id).removeChild(document.getElementById(id).childNodes[0]);	
});
	
	clearTimeout(timeout);
}

var statusType = { PAUSED : 0, RUNNING : 1, RETRIEVING : 2 }

function imageScroller(id, directory, time)
{
	imageScroller7(id,directory,time,0,statusType.RUNNING,new Array(),0);
}

function imageScroller7(id, directory, time, index, status, images, timeout)
{
	// Public variables
	this.id = id;
	this.directory = directory;
	this.time = time;
	this.index = index;
	this.status = status;
	this.images = images;
	this.timeout = timeout;
	
	// Initialize
	new Request({
		method: 'get',
		url: 'https://www.innercircuit.com/directory.php',
		onSuccess: function(ret) {
			if(ret == '' || ret.indexOf(',') == -1)
			{
				document.getElementById(id).innerHTML = 'Image Directory Not Found.';
			}
			else
			{
				images = ret.split(',');
				status = statusType.RUNNING;
				// Randomize
				//index = Math.floor((images.length - 1) * Math.random());
				index = 0;
				maintenance();
			}
		},
		onFailure: function() {
			document.getElementById(id).innerHTML = 'Directory.php Not Found.  Please Check Your Internet Connection';
		}
	}).send('directory='+directory);
	
	// Start
	function start()
	{
		status = statusType.RUNNING;
		maintenance();
	}
	
	// Forward
	function forward()
	{
		if(index == images.length - 2)
			index = 0;
		else
			index++;
		maintenance();
	}
	
	// Back
	function back()
	{
		if(index == 0)
			index = images.length - 2;
		else
			index--;
		maintenance();
	}
	
	// Pause
	function pause()
	{
		clearTimeout(timeout);
		status = statusType.PAUSED;
	}
	
	// Refresh and maintain
	function maintenance()
	{
		// Create Div Object
		var div = document.createElement('div');
		div.style.position = 'absolute';
		div.style.top = document.getElementById(id).style.top;
		div.style.left = document.getElementById(id).style.left;
		
		var alternatetext = 'alt text';
		var imageNum = '0';
		var ahref = '';
		switch(images[index])
		{
			case 'images/headers/header1.jpg':
				ahref = 'collect_payments.php';
				alternatetext = 'Collect All Payments.';
				imageNum = '1';
				break;
			case 'images/headers/header2.jpg':
				ahref = 'community_portal_tools.php';
				alternatetext = 'Create Community.';
				imageNum = '2';
				break;
			case 'images/headers/header3.jpg':
				ahref = 'services.php';
				alternatetext = 'Save Money.';
				imageNum = '3';
				break;
			case 'images/headers/header4.jpg':
				ahref = 'integration.php';
				alternatetext = 'Easy Integration.';
				imageNum = '4';
				break;
			case 'images/headers/header5.jpg':
				ahref = 'customization.php';
				alternatetext = 'A Custom Fit.';
				imageNum = '5';
				break;
		}

		// Create Image Object
		var img = document.createElement('img');
		img.style.visibility = 'hidden';
		img.setAttribute('src', images[index]);
		img.setAttribute('id', 'temp'+index);
		img.setAttribute('alt', alternatetext);
		div.appendChild(img);
		
		/* New Added Section */
		var buttonDiv = document.createElement('div');
		buttonDiv.style.position = 'relative';
		buttonDiv.style.bottom = '91px';
		buttonDiv.style.left = '877px';
		buttonDiv.style.backgroundColor = 'transparent';
		buttonDiv.style.width = '65px';
		buttonDiv.style.height = '10px';
		
		if( imageNum != '1' ) {
			var imgButton1 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				},
				'events': {
					'click': function() {
						header1(timeout);
					}
				}
			}).inject($(buttonDiv));
		} else {
			var imgButton1 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				}
			}).inject($(buttonDiv));
		}
		
		if( imageNum != '2' ) {
			var imgButton2 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				},
				'events': {
					'click': function() {
						header2(timeout);
					}
				}
			}).inject($(buttonDiv));
		} else {
			var imgButton2 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				}
			}).inject($(buttonDiv));
		}
		
		if( imageNum != '3' ) {
			var imgButton3 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				},
				'events': {
					'click': function() {
						header3(timeout);
					}
				}
			}).inject($(buttonDiv));
		} else {
			var imgButton3 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				}
			}).inject($(buttonDiv));
		}
		
		if( imageNum != '4' ) {
			var imgButton4 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				},
				'events': {
					'click': function() {
						header4(timeout);
					}
				}
			}).inject($(buttonDiv));
		} else {
			var imgButton4 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				}
			}).inject($(buttonDiv));
		}
		
		if( imageNum != '5' ) {
			var imgButton5 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				},
				'events': {
					'click': function() {
						header5(timeout);
					}
				}
			}).inject($(buttonDiv));
		} else {
			var imgButton5 = new Element('a', {
				'href': '#',
				'styles': {
					'display': 'block',
					'float': 'left',
					'z-index': '15',
					'width': '9px',
					'height': '10px',
					'padding': '0 4px 0 0'
				}
			}).inject($(buttonDiv));
		}
		
		div.appendChild(buttonDiv);
		var findOutMore = new Element('a', {
		'href': ahref,
		'html': 'Find Out More >>',
		'styles': {
			'position': 'absolute',
			'top': '188px',
			'right': '35px',
			'font-family': 'Arial',
			'font-size': '14px',
			'color': '#FB7430'
		}
	}).inject($(div));
		/* End of New Added Section */
		
		document.getElementById(id).appendChild(div);
				
		new Fx.Morph('temp'+index, {
			duration: 'long',
			wait: false
		}).start({
			'opacity': [0,1]
		}).chain(function() {
			if(document.getElementById(id).childNodes.length > 1)
				$(id).childNodes[0].destroy();
//				document.getElementById(id).removeChild(document.getElementById(id).childNodes[0]);
		});
		
		
		if(status == statusType.RUNNING)
		{
			if(index == images.length - 2)
				index = 0;
			else
				index++;
			timeout = setTimeout(maintenance, time);
		}
	}
}