Event.observe(window, 'load', function () {
	

	Nifty('div#container', 'bottom');
	Nifty('div#header', 'bottom transparent');
	Nifty('div#navigation', 'transparent');
	Nifty('div#search-box');
	Nifty('div#flash-main', 'transparent');
	Nifty('div.article');
	Nifty('div.paging');
	Nifty('div#registration');
	Nifty('div#side-navigation');
	Nifty('div#google-ads');
	Nifty('div#flashMessage');
	Nifty('div.actions');
	Nifty('div#footer');
	
	$$('.side_section a img').each(function (item, index) {
		item.setStyle(
			{
				opacity: 0.5
			}
		);
		item.onmouseover = function () {
			this.setStyle(
				{
					opacity: 1
				}
			);
		};
		item.onmouseout = function () {
			this.setStyle(
				{
					opacity: 0.5
				}
			);
		};
	});
});

function setErrorStyle (obj) {
	obj.setStyle({
		border         : '1px solid #ff0000',
		backgroundColor: '#ffdada' 
	});
	$('loading_show').hide();
	$('sbmt').disabled = false;
	return true;
}

function validation () {
	
	$('loading_show').show(); 
	$('sbmt').disabled = true;
	
	if ($F('first_name').length < 2) { 
		setErrorStyle($('first_name'));
		return false;
	} if ($F('last_name').length < 2) {
		setErrorStyle($('last_name'));
		return false;
	} if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($F('email')))) {
		setErrorStyle($('email'));
		return false;
	} if ($F('address').length < 2) {
		setErrorStyle($('address'));
		return false;
	} if ($F('city').length < 2) {
		setErrorStyle($('city'));
		return false;
	} if ($F('state').length != 2) {
		setErrorStyle($('state'));
		return false;
	} if ($F('zip').length != 5) {
		setErrorStyle($('zip'));
		return false;
	}
	return true;
};

function createFields () {
	$('form_holder_here').appendChild(
		Builder.node('input',
			{
				id       : 'Name',
				className: 'Name',
				name     : 'Name',
				value    : $F('first_name') + ' ' + $F('last_name'),
				style    : 'display:none'
			}
		)
	);
	$('form_holder_here').appendChild(
		Builder.node('input',
			{
				id       : 'Homephone',
				className: 'Homephone',
				name     : 'Homephone',
				value    : '(' + $F('area') + ')' + $F('pre') + '-' + $F('post'),
				style    : 'display:none'
			}
		)
	);
}
function updateFields () {
	$('Name').value = $F('first_name') + ' ' + $F('last_name');
	$('Homephone').value = '(' + $F('area') + ')' + $F('pre') + '-' + $F('post');
}
