function detectFlash( iRequired, iMax )
{
    var iRequiredVersion = iRequired;
    var iMaxVersion = iMax;
    var iAvailableVersion = 0;

    if( typeof(navigator.plugins["Shockwave Flash"]) == "object" )
    {
        var strDescription = navigator.plugins["Shockwave Flash"].description;
        iAvailableVersion = strDescription.substr( 16, ( strDescription.indexOf(".", 16) - 16) );
    } else if( typeof(ActiveXObject) == "function" ) {
        for(var i = 2; i < (iMaxVersion + 1); i ++)
        {
            try 
            {
                if( typeof( new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i ) ) == "object" )
                {
                    iAvailableVersion = i;
                }
           } catch( error ) {
			   
           }
        }
    }

    return iAvailableVersion;
}


function validateDealerForm()
{
	objDealerForm = document.getElementById("DealerForm");
	if(  objDealerForm == null )
	{
		return;
	}
	
	resetDealersFormCtrls();
		
	if( checkFormField("company_name") == false )
	{
		alert("Please enter a 'Company'!");
		return;
	}
	
	if( checkFormField("prename") == false )
	{
		alert("Please enter a 'Surname'!");		
		return;
	}	
	
	if( checkFormField("name") == false )
	{
		alert("Please enter a 'Name'!");				
		return;
	}
	
	if( checkFormField("email") == false )
	{
		alert("Please enter a 'eMail'!");				
		return;
	} else {
		objEmail = document.getElementById("email");
		if( objEmail == null )
		{
			return;
		}
		
		iAPos = objEmail.value.indexOf("@");
		iDotPos = objEmail.value.lastIndexOf(".");
		if( iAPos < 1 || iDotPos - iAPos < 2 || objEmail.value.length - iDotPos < 3 ) 
		{
			objEmail.className = "text_input_field_sel";
			objEmail.focus();
			alert("Please enter a 'eMail' with the right format!");
			return;
		}		
	}
	
	if( checkFormField("phone") == false )
	{
		alert("Please enter a 'Phone'-No.!");
		return;
	}
	
	if( checkFormField("street") == false )
	{
		alert("Please enter a 'Street'!");		
		return;
	}	
	
	if( checkFormField("zip") == false )
	{
		alert("Please enter a 'ZIP-Code'!");				
		return;
	}		
	
	if( checkFormField("city") == false )
	{
		alert("Please enter a 'City'!");						
		return;
	}
	
	if( checkFormField("country") == false )
	{
		alert("Please enter a 'Country'!");						
		return;
	}	
	
	objSubmited = document.getElementById("Submited");
	if( objSubmited != null )
	{
		objSubmited.value = "1";
	}
	
	objDealerForm.submit();
}

function resetDealersFormCtrls()
{	
	document.getElementById("company_name").className = "text_input_field";
	document.getElementById("prename").className = "text_input_field";
	document.getElementById("name").className = "text_input_field";
	document.getElementById("email").className = "text_input_field";
	document.getElementById("phone").className = "text_input_field";
	document.getElementById("street").className = "text_input_field";
	document.getElementById("zip").className = "text_input_field";	
	document.getElementById("city").className = "text_input_field";	
	document.getElementById("country").className = "text_input_field";
}

function resetFeedbackFormCtrls()
{
	document.getElementById("THEMA_1").className = "radio_input_field";
	document.getElementById("THEMA_2").className = "radio_input_field";
	document.getElementById("THEMA_3").className = "radio_input_field";
	document.getElementById("THEMA_4").className = "radio_input_field";
	document.getElementById("THEMA_5").className = "radio_input_field";
	
	document.getElementById("NAME").className = "text_input_field";
	document.getElementById("VORNAME").className = "text_input_field";
	document.getElementById("ADRESSE").className = "text_input_field";
	document.getElementById("PLZ_ORT").className = "text_input_field";
	document.getElementById("LAND").className = "text_input_field";
	document.getElementById("TELEFON").className = "text_input_field";
	document.getElementById("EMAIL").className = "text_input_field";
	document.getElementById("BETREFF").className = "text_input_field";
	document.getElementById("NACHRICHT").className = "text_input_field";
}

function resetDevelopmentFormCtrls()
{
	document.getElementById("ANREDE_1").className = "radio_input_field";
	document.getElementById("ANREDE_2").className = "radio_input_field";	
	
	document.getElementById("FIRMA").className = "text_input_field";
	document.getElementById("NAME").className = "text_input_field";
	document.getElementById("VORNAME").className = "text_input_field";
	document.getElementById("ADRESSE").className = "text_input_field";
	document.getElementById("PLZ_ORT").className = "text_input_field";
	document.getElementById("LAND").className = "text_input_field";
	document.getElementById("TELEFON").className = "text_input_field";
	document.getElementById("EMAIL").className = "text_input_field";
	document.getElementById("FAHRZEUGMARKE").className = "text_input_field";
	document.getElementById("FAHRZEUGTYP").className = "text_input_field";
	document.getElementById("BAUJAHR").className = "text_input_field";
	document.getElementById("NACHRICHT").className = "text_input_field";		
	
	document.getElementById("FEDERNSATZ").className = "radio_input_field";
	document.getElementById("SPORTFAHRWERK").className = "radio_input_field";
	document.getElementById("GEWINDEFAHRWERK").className = "radio_input_field";
}

function validateDevelopmentForm()
{
	objDevelopmentForm = document.getElementById("DevelopmentForm");
	if( objDevelopmentForm == null )
	{
		return;
	}
	
	resetDevelopmentFormCtrls();	
	
	objANREDE1 = document.getElementById("ANREDE_1");
	objANREDE2 = document.getElementById("ANREDE_2");	
	if( objANREDE1.checked == false &&
	    objANREDE2.checked == false )
	{
		objANREDE1.className = "radio_input_field_sel";
		objANREDE2.className = "radio_input_field_sel";							
		alert("Bitte waehlen Sie eine 'Anrede' aus!");
		return;		
	}
	
	if( checkFormField("NAME") == false )
	{
		alert("Bitte geben Sie einen 'Name' ein!");
		return;
	}		
	
	if( checkFormField("VORNAME") == false )
	{
		alert("Bitte geben Sie einen 'Vornamen' ein!");
		return;
	}	
	
	if( checkFormField("ADRESSE") == false )
	{
		alert("Bitte geben Sie eine 'Strasse' ein!");
		return;
	}	
	
	if( checkFormField("PLZ_ORT") == false )
	{
		alert("Bitte geben Sie eine 'PLZ' und einen 'Ort' ein!");
		return;
	}	
	
	if( checkFormField("LAND") == false )
	{
		alert("Bitte geben Sie ein 'Land' ein!");
		return;
	}	
	
	if( checkFormField("TELEFON") == false )
	{
		alert("Bitte geben Sie eine 'Telefonnummer' ein!");
		return;
	}	
	
	if( checkFormField("EMAIL") == false )
	{
		alert("Bitte geben Sie eine 'eMail' ein!");
		return;
	} else {
		objEmail = document.getElementById("EMAIL");
		if( objEmail == null )
		{
			return;
		}
		
		iAPos = objEmail.value.indexOf("@");
		iDotPos = objEmail.value.lastIndexOf(".");
		if( iAPos < 1 || iDotPos - iAPos < 2 || objEmail.value.length - iDotPos < 3 ) 
		{
			objEmail.className = "text_input_field_sel";
			objEmail.focus();
			alert("Bitte richtiges eMail Format eingeben!");
			return;
		}		
	}	
	
	if( checkFormField("NACHRICHT") == false )
	{
		alert("Bitte geben Sie eine 'Nachricht' ein!");
		return;
	}
	
	if( checkFormField("FAHRZEUGMARKE") == false )
	{
		alert("Bitte geben Sie eine 'Fahrzeugmarke' ein!");
		return;
	}	
	
	if( checkFormField("FAHRZEUGTYP") == false )
	{
		alert("Bitte geben Sie einen 'Fahrzeugtyp' ein!");
		return;
	}	
	
	if( checkFormField("BAUJAHR") == false )
	{
		alert("Bitte geben Sie ein 'Baujahr' ein!");
		return;
	}		
								   
	objFEDERNSATZ = document.getElementById("FEDERNSATZ");
	objSPORTFAHRWERK = document.getElementById("SPORTFAHRWERK");	
	objGEWINDEFAHRWERK = document.getElementById("GEWINDEFAHRWERK");		
	if( objFEDERNSATZ.checked == false &&
	    objSPORTFAHRWERK.checked == false &&
		objGEWINDEFAHRWERK.checked == false )
	{
		objFEDERNSATZ.className = "radio_input_field_sel";
		objSPORTFAHRWERK.className = "radio_input_field_sel";
		objGEWINDEFAHRWERK.className = "radio_input_field_sel";
		alert("Bitte waehlen Sie mindestens ein 'Produktgruppe' aus!");
		return;
	}
	objSubmited = document.getElementById("Submited");
	if( objSubmited != null )
	{
		objSubmited.value = "1";
	}

	objDevelopmentForm.submit();
}

function validateFeedbackForm()
{
	objFeedbackForm = document.getElementById("FeedbackForm");
	if(  objFeedbackForm == null )
	{
		return;
	}
	
	resetFeedbackFormCtrls();
				
	objTHEMA1 = document.getElementById("THEMA_1");
	objTHEMA2 = document.getElementById("THEMA_2");
	objTHEMA3 = document.getElementById("THEMA_3");
	objTHEMA4 = document.getElementById("THEMA_4");
	objTHEMA5 = document.getElementById("THEMA_5");
	
	if( objTHEMA1.checked == false &&  
	    objTHEMA2.checked == false &&  
		objTHEMA3.checked == false &&  
		objTHEMA4.checked == false &&  
		objTHEMA5.checked == false )
	{
		objTHEMA1.className = "radio_input_field_sel";
		objTHEMA2.className = "radio_input_field_sel";
		objTHEMA3.className = "radio_input_field_sel";
		objTHEMA4.className = "radio_input_field_sel";
		objTHEMA5.className = "radio_input_field_sel";
		alert("Please select a 'category'!");
		return;
	}
	
	
	if( checkFormField("NAME") == false )
	{
		alert("Please enter a 'Name'!");		
		return;
	}	
	
	if( checkFormField("VORNAME") == false )
	{
		alert("Please enter a 'Surname'!");				
		return;
	}		
	
	if( checkFormField("ADRESSE") == false )
	{
		alert("Please enter a 'Street'!");						
		return;
	}			

	if( checkFormField("PLZ_ORT") == false )
	{
		alert("Please enter a 'Zip' and 'City'!");
		return;
	}			
	
	if( checkFormField("LAND") == false )
	{
		alert("Please enter a 'Country'!");
		return;
	}				
	
	if( checkFormField("TELEFON") == false )
	{
		alert("Please enter a 'Phone'-No.!");		
		return;
	}					

	if( checkFormField("EMAIL") == false )
	{
		alert("Please enter a 'eMail'!");				
		return;
	} else {
		objEmail = document.getElementById("EMAIL");
		if( objEmail == null )
		{
			return;
		}
		
		iAPos = objEmail.value.indexOf("@");
		iDotPos = objEmail.value.lastIndexOf(".");
		if( iAPos < 1 || iDotPos - iAPos < 2 || objEmail.value.length - iDotPos < 3 ) 
		{
			objEmail.style.backgroundColor = "#FF0000";
			objEmail.focus();	
			alert("Please enter a 'eMail' with the right format!");
			return;
		}		
	}	

	if( checkFormField("BETREFF") == false )
	{
		alert("Please enter a 'Subject'!");								
		return;
	}	
	
	if( checkFormField("NACHRICHT") == false )
	{
		alert("Please enter a 'Message'!");										
		return;
	}		

	objSubmited = document.getElementById("Submited");
	if( objSubmited != null )
	{
		objSubmited.value = "1";
	}
	
	objFeedbackForm.submit();
}

function checkFormField( strElementId )
{
	objFormElement = document.getElementById( strElementId );
	if( objFormElement == null )
	{
		return false;
	}
		
	if( objFormElement.value == "" )
	{
		objFormElement.className = "text_input_field_sel";		
		objFormElement.focus();
		return false;
	} else {
		return true;
	}
}

/*
	RRO Tombola
*/

function resetDealersFormCtrls()
{	
	document.getElementById("NAME").className = "text_input_field";
	document.getElementById("NACHNAME").className = "text_input_field";
	document.getElementById("ADRESSE").className = "text_input_field";
	document.getElementById("PLZ_ORT").className = "text_input_field";
	document.getElementById("LAND").className = "text_input_field";
	document.getElementById("EMAIL").className = "text_input_field";	
}

function validateRROForm()
{
	objRROForm = document.getElementById("RROForm");
	if(  objRROForm == null )
	{
		return;
	}
	
	resetDealersFormCtrls();
		
	if( checkFormField("NAME") == false )
	{
		alert("Please enter a 'Name'!");
		return;
	}
	
	if( checkFormField("NACHNAME") == false )
	{
		alert("Please enter a 'Surname'!");		
		return;
	}	
	
	if( checkFormField("ADRESSE") == false )
	{
		alert("Please enter a 'Street'!");				
		return;
	}
	
	if( checkFormField("PLZ_ORT") == false )
	{
		alert("Please enter a 'ZIP/City'!");				
		return;
	}	
	
	if( checkFormField("LAND") == false )
	{
		alert("Please enter a 'Country'!");				
		return;
	}	
		
	if( checkFormField("EMAIL") == false )
	{
		alert("Please enter a 'eMail'!");				
		return;
	} else {
		objEmail = document.getElementById("EMAIL");
		if( objEmail == null )
		{
			return;
		}
		
		iAPos = objEmail.value.indexOf("@");
		iDotPos = objEmail.value.lastIndexOf(".");
		if( iAPos < 1 || iDotPos - iAPos < 2 || objEmail.value.length - iDotPos < 3 ) 
		{
			objEmail.className = "text_input_field_sel";
			objEmail.focus();
			alert("Please enter a 'eMail' with the right format!");
			return;
		}		
	}	
	
	objCheck = document.getElementById("check")
	if( objCheck == null )
	{
		return;
	} else {
		if( objCheck.checked != true )
		{
			alert("Please accept the terms!");
			return;
		}
	}
	
	
	objSubmited = document.getElementById("Submited");
	if( objSubmited != null )
	{
		objSubmited.value = "1";
	}
	
	objRROForm.submit();
}

