F1 = 'MailForm';

Field = new Image();
Field.src = '../img/common/field2.gif';

if (TheChapter == 6)
    {
FieldTotal = 4;
FieldName = new Array();
FieldName[0] = 'TheName';
FieldName[1] = 'TheMail';
FieldName[2] = 'ThePeriodFrom';
FieldName[3] = 'ThePeriodTo';
MessageType = MessageType1;
    }

if (TheChapter == 7)
    {
FieldTotal = 2;
FieldName = new Array();
FieldName[0] = 'TheName';
FieldName[1] = 'TheMail';
MessageType = MessageType2;
    }

// check fields for valid entry
function CheckFields(TheField)
    {
for (i=0; i < FieldTotal; i++)
    {
    if( (d.getElementById([FieldName[i]]).value == '') || (d.getElementById([FieldName[i]]).value.length < 5))
        {
    alert(ScriptTxt[1] + FieldType[i] + ScriptTxt[2] + MessageType + ScriptTxt[3]);
    ErrorField('Error',d.getElementById([FieldName[i]]));
    return false;
        }
    }
return CheckMail();
    }


// check mailfields-syntax
function CheckMail()
    {
Field = d.getElementById('TheMail');

ValidChr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@.-_;';

for (x=0; x<Field.value.length; x++) 
    {
TempValue = '' + Field.value.substring(x, x+1);
if (ValidChr.indexOf(TempValue) == '-1')
    {
alert(ScriptTxt[4]);
ErrorField('Error',Field);
return false;
    }
    }

    if ((Field.value.indexOf('@') == -1) || (Field.value.indexOf('.') == -1))
        {
    alert(ScriptTxt[5]);
    ErrorField('Error',Field);
    return false;
        }
d.getElementById('TheRedirect').value = "../htm/page.php?chapter="+TheChapter+"&page=1&language="+TheLanguage+"&xtra=" + d.getElementById('TheMail').value;
d.getElementById('TheSubject').value = d.getElementById('TheSubject').value.toLowerCase();
d[F1].submit();
//alert('allright...');
    }


// interactive butts
function ChangeButtonStyle(WhichMove,WhichButton)
    {
if(WhichMove == '1')
    {
WhichButton.style.color      = '#000000';
WhichButton.style.background = '#E8D2D1';
    }
else
    {
WhichButton.style.color      = '#FFFFFF';
WhichButton.style.background = '#B52D20';
    }
    }


// set attention to wrong fields
function ErrorField(ActionType,Field)
    {
if(ActionType == 'Error')
    {
Field.style.background = "#FFAAAA url('../img/common/field2.gif')";
Field.focus();
    }
else
    {
Field.style.background = "#D6DAE5 url('../img/common/field1.gif')";
    }
    }
    
// select radio with textlink
function SelectRadio(WhichRadio)
	{
RadioFrequenty = new Array()
RadioFrequenty[1] = 'Radio1';
RadioFrequenty[2] = 'Radio2';

d.getElementById(RadioFrequenty[WhichRadio]).checked = true;
	}
    
// more information about the houses
function XplainAcc()
    {
ConfirmURL = confirm(ScriptTxt[6]);
    if (ConfirmURL)
       {
location.href = 'page.php?chapter=2&page=0&language='+TheLanguage+'&xtra=0';
       }
    }

