function checkInputs(doc, errmsg, errcolor, validcolor, errbg, validbg)
{
	var inputs = $$('.required');

	//defaults
	var focused = false;

	if(errmsg == undefined) errmsg = '&nbsp;'; // set emtpy error message
	if(errcolor == undefined) errcolor = '&nbsp;'; // set error color
	if(errbg == undefined) errbg = '#fff2e5'; // set error background
	if(validcolor == undefined) validcolor = '#b4babc'; // set valid color
	if(validbg == undefined) validbg = '#F5F5F5'; // set valid background color

	var iserror = 0;
	var gerror = 0;

	for (var index = 0; index < inputs.length; ++index) {

		var item = inputs[index];
		var inputValue = item.value;
		var titleValue = item.getAttribute('title');
		iserror = 0;

		// reset colors
		item.setStyle({ backgroundColor: validbg, borderColor: validcolor });
		
		if(titleValue == 'email') {
			if (inputValue == '' || inputValue.length < 6 || (inputValue.indexOf("@") < 1)  || (inputValue.indexOf(".") < 1) ) {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'zip') {
			if (inputValue == '' || inputValue.length < 4 || inputValue.length > 4 ) {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'lastname') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'name') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'firstname') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'rec_1_name') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'rec_1_firstname') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'rec_1_email') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'comments') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'salutation') {
			if (inputValue == '-1') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'verification_code') {
			if (inputValue == '') {
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'agb') {
			
			if($('agbtitle')) { $('agbtitle').setStyle({ color:'#333333' }); }			
			if (item.checked == false) {
				$('agbtitle').setStyle({ color:errcolor });
				iserror = 1; 
				gerror += 1; 
			}
		}
		else if(titleValue == 'terms_conditions') {
			if(!item.checked) {
				iserror = 1;
				gerror += 1;
			}
		}
		
		if(iserror==1){
			item.setStyle({ backgroundColor:errbg, borderColor: errcolor });
			Effect.Pulsate(item,{duration:1, pulses: 2});
			
			if(!focused) item.focus();
			focused = true;
		}
	}

	if(gerror>0){
		if($('errormsg')) {
			$('errormsg').innerHTML = errmsg;
		}
	}
	//alert(gerror);
	if (gerror == 0)
		$(doc).submit();	
}