function mergeMail(name, prov, top, subject){
	document.location.href="mailto:" + name +"@"+ prov +"."+ top +"?subject=" + subject;
}

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 = '#FF0000'; // set error color
	if(errbg == undefined) errbg = '#EFEFEF'; // set error background
	if(validcolor == undefined) validcolor = '#b4babc'; // set valid color
	if(validbg == undefined) validbg = '#ffffff'; // 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;


		// extra code for sepcial fields
		if(titleValue == 'agb') {
		 //alert(item.checked);
		}
		// 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 == 'agb') {

			if($('agbtitle')) { $('agbtitle').setStyle({ color:'#333333' }); }
			if (item.checked == false) {

				$('agb_error').setStyle({ color:errcolor });
				iserror = 1;
				gerror += 1;
			}
		}
		else if(titleValue == 'terms_conditions') {
			if(!item.checked) {
				iserror = 1;
				gerror += 1;
			}
		}else if(titleValue == 'search'){
			if(document.getElementById('branche').value <= 0 && inputValue.length < 4){

					iserror = 1;
					gerror += 1;
			}

		}
		else if(titleValue != '' && inputValue == '') {
			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;
		}
	}

	if (gerror == 0)
		$(doc).submit();
}