var formFillIn = function(){
	$('form .row.checkbox .value input[type=checkbox]:not(.no-sessioned)').each(function(){
		if(this.value==$('.value-session', $(this.parentNode)).html()){
			this.checked = true;
			$(this).prev().val(this.value);
		} else {
			this.checked = false;
			$(this).prev().val('');
		}
	});
	$('form .row:not(.checkbox):not(.checkboxs):not(.radios) .value input:not(.no-sessioned)').each(function(){if(v=$('.value-session', $(this.parentNode)).html())$(this).val($('.value-session', $(this.parentNode)).html());});
	$('form .row:not(.checkbox):not(.checkboxs):not(.radios) .value textarea:not(.no-sessioned)').each(function(){if(v=$('.value-session', $(this.parentNode)).html())$(this).val($('.value-session', $(this.parentNode)).html());});
} 

$(document).ready(function(){
	$('.no-autocomplete').attr('autocomplete','off');
	$('.captcha-reload').click(function(){
		$(this).prev().attr('src',$(this).next().html());
		p = new Image();
		p.imagePtr = $(this).prev();
	    p.onload=function(){this.imagePtr.attr('src',this.src);};
		p.onerror=function(){this.imagePtr.attr('src',this.imagePtr.next().next().html());alert('There was a problem with refreshing images.');};
		p.src='/ajax.php?acc=captcha&amp;rand='+Math.random();
	});
	$('.captcha-reload').trigger('click');

	formFillIn();
	
	//$('body.system-lucan-spa form .row.error:first').expose({api:true,opacity:.6,color:'#BB9E4F'}).load();
	//$('body.system-west-county form .row.error:first').expose({api:true,opacity:.6,color:'#723881'}).load();

	/*	
	var colorExpose = '#000000';
	if($('body.system-lucan-spa').size()) colorExpose = '#6B4E00';// BB9E4F -> 6B4E00
	else if($('body.system-west-county').size()) colorExpose = '#220031';// 723881 -> 220031
	if($('form .row.error').size()){
		$('form .row.error:first').expose({api:true,opacity:.7,color:colorExpose}).load();
		$('form .row.error').attr('style',$('form .row.error:first').attr('style'));
		$('form .row.captcha').attr('style',$('form .row.error:first').attr('style'));
		$('form .row.submit').attr('style',$('form .row.error:first').attr('style'));
	}*/
});