document.observe("dom:loaded", function()
{
	imageSwitcher();
	formElement_init();
});

function imageSwitcher() {
	var switchElements = $$('#imgSwap img');
	imageSwap();
	window.setInterval("imageSwap()",(switchElements.length * 4.5 * 1000));
}

function imageSwap() {
	if($('imgSwap')) {
		var switchElements = $$('#imgSwap img');
		for(var i = 0; i < switchElements.length; i++) {
			if(i == 0) {
				Effect.Appear.delay((i*4.5), switchElements[i]);
				Effect.Fade.delay((i*4.5), switchElements[switchElements.length - 1]);
			}
			Effect.Appear.delay((i*4.5), switchElements[i]);
			Effect.Fade.delay((i*4.5), switchElements[i].previous());
		}
	}
}

function limit_input(element,limit) {
	element.setAttribute('maxlength', limit);
}

function formElement_init() {
	if($$('.wpsc_checkout_forms')[0]) {
		limit_input($('wpsc_checkout_form_19'),'15');
		limit_input($('wpsc_checkout_form_20'),'15');
		limit_input($('wpsc_checkout_form_21'),'15');
	}
}