function setDark() {
	//body.style.backgroundColor = '#1f0000';
	var fx = new Fx.Morph($('body'), {duration:2000, wait:false});
	fx.start({'background-color': '#1f0000'});
}

function setLight() {
	$('body').style.backgroundColor = '#fff';
}

function setResized() {
	var fx = new Fx.Morph($('logo'), {duration:1000, wait:false});
	fx.start({'height': 400});
}

bgPos = 0;
function moveBackground() {
	bgPos++;
	$('body').setStyle('background-position-x',bgPos+'px');
	setTimeout('moveBackground()',200);
}

function checkEmailField() {
	var emailInput = $('builderEmail');
	var submitButton = $('builderBegin');
	//var formElem = document.forms['quoteFormWidgetForm'];
	var vis = 'hidden';
	if (emailInput && submitButton) { //&&formElem
		if (emailInput.value.match(/^[^\s]+@[^\s]+[.][^\s]+$/)) {
			vis = 'visible';
			//formElem.onSubmit = null;
		} else {
			/*
			formElem.onSubmit = function() {
				alert('Please enter in your e-mail address!');
				return false;
			};
			*/
		}
		submitButton.style.visibility = vis;
	} else {
		//alert('problem');
	}
}

tmFlashIsOff = !(swfobject.hasFlashPlayerVersion("9"));

window.addEvent('load',function() {				
	var flashvars = {
		name1: "hello",
		name2: "world",
		name3: "foobar"
	};
	var params = {
		menu: "false",
		bgcolor: "#ffffff"
	};
	var attributes = {
		id: "logo",
		name: "logo"
	};
	//alert(SWFObject.embedSWF);
	if ( !tmFlashIsOff ) {
		if ( Math.random() > -1 ) {
			try {
				$('body').setStyle('background-image','none');
				$('c-notice').appendText('Video copyright 2004 Thinkingman.com');
			} catch( e ) {}
			swfobject.embedSWF("/db/handlers/Home/media/logo.swf", "logo", "850", "200", "9.0.0","/db/3rd-party/js/swfobject-1.5/expressInstall.swf", flashvars, params, attributes);
		} else {
			moveBackground();
		}
	}
	var emailInput = $('builderEmail');
	var submitButton = $('builderBegin');

	if (emailInput && submitButton) {
		//alert(emailInput);
		emailInput.addEvent('keyup',checkEmailField);
		checkEmailField();
	} else {
		//alert(emailInput+','+submitButton+'problem!');
	}
});
