function form_check(formular, error_layer) {  							//checked on submit
var i	
var count=0;
var num_count=0;
var first_four=0;
																
    for (i=0; i<formular.length; i++){									//error check  for NO choice
		if (formular.elements[i].checked == true){
			count=1;
		}
	}
	if (count==0){													//no radiobutton selected
			MM_showHideLayers(error_layer,'','show');
	}
	}
		
	//for (i=0; i>4; i++){												//error check  for sponsorchoice and filled num_fields
	//	if (formular.elements[i].checked == true){
	//		first_four=1;
	//	}
	//}
	//for (i=0; i<formular.length; i++)	{
	//	if(formular.elements[i].name.indexOf('num')> -1){
	//		if (formular.elements[i].value != ""){
	//			num_count=1;
	//		}
	//	}	
	//}
	//if (first_four==1 && num_count==1){							//sponsoship checked + other numfields filled
	//		MM_showHideLayers(error_layer,'','show')
	//}


function checked_but_empty(formular,radio_but,feld,error_layer) { 		//checkin for checked boxes with empty fields 
	obj=eval(radio_but);												//checked on blur
	obj2=eval("document."+formular+"."+feld)
	if(obj){
		if (obj.checked && obj2.value==""){
			obj2.style.background="#FFEFEF"
			MM_showHideLayers(error_layer,'','show')}
			}
}

function req_field_check(formular,error_layer)
	{  					//checked on submit
	var corr = true;
	
	for (i=0; i<formular.length; i++)	
		{
		if(formular.elements[i].name.indexOf('req')> -1)
			{						//all required fields contain the sillable 'req' in their name
			if(formular.elements[i].value == "")
				{						//if any of the form elements cointaining this 'req' in their name stays empty ---
				corr = false;											//the form will not be submitted (as long as corr is not true)
				formular.elements[i].style.background="#FFEFEF";
				MM_showHideLayers(error_layer,'','show');
				}		
			}
		if(formular.elements[i].name.indexOf('re2q')> -1)
			{
					//all required fields contain the sillable 'req' in their name
			if(formular.elements[i].selectedIndex == 0)
				{						//if any of the form elements cointaining this 'req' in their name stays empty ---
				corr = false;											//the form will not be submitted (as long as corr is not true)
				formular.elements[i].style.background="#FFEFEF";
				MM_showHideLayers(error_layer,'','show');
				}		
			}
		
		}
	if (corr==true){
	formular.submit()
		}	
	}

function numeric_check(feld, error_layer)				//error-check for field-content when only numeric entries are valid
{														//checked on blur
	if(feld.value == ""){
		return
	}
	var	test = parseFloat(feld.value)

	if(!isNaN(test))
	{
		feld.value	= test;								//numeric
		feld.style.background="#FFFFFF";
		MM_showHideLayers(error_layer,'','hide');
		return
	}
	
	 feld.style.background="#FFEFEF";						//not numeric
	 MM_showHideLayers(error_layer,'','show');
	 
} 


function reset_bg_color(feld)
{
	feld.style.background="#FFFFFF";
}

function reset_bg_color2(feld)
{
	for(i=0;i<feld.length;i++)
		feld[i].style.background="#F9FAFE";
}



function uncheck_others(formular,radio_set)
{
	
	obj=eval("document."+formular+"."+radio_set);
	if(obj){
		for (i=0; i<obj.length; i++){								//radio button group switch for wrong sponsorship combinations
			if (obj[i].checked){									//switches whole radio_sets								
			obj[i].checked=false;
			}
		}
	}
}

function uncheck_singles(formular, radio_but1, radio_but2)
{
	obj=eval("document."+formular+"."+radio_but1);					//radio button switch for wrong sponsorship combinations
	obj2=eval("document."+formular+"."+radio_but2);					//switches single buttons
	if(obj){
		obj.checked=false;
		}
	if(obj2){
		obj2.checked=false;}
}

function radio_check(formular,feld,radio_but,error_layer){							//checks for radio&field combinations with entered amounts and no clicked radio button
	obj=eval("document."+formular+"."+radio_but);												//checked on blur
	obj2=eval("document."+formular+"."+feld);
	if(obj.checked==false && obj2!==""){
		MM_showHideLayers(error_layer,'','show');
	}
}