<script language="JavaScript" type="text/javascript">
<!--
function chkFormular() {
	if(document.post.usedfor.value == "") {
		alert("You have to enter a Usage!");
		document.post.usedfor.focus();
   		return false;
	}
	
	if(document.post.day.value == "") {
		alert("You have to enter date!");
		document.post.day.focus();
   		return false;
	}
	
	if(document.post.month.value == "") {
		alert("You have to enter date!");
		document.post.month.focus();
   		return false;
	}
	
	if(document.post.year.value == "") {
		alert("You have to enter date!");
		document.post.year.focus();
   		return false;
	}
	
	if(document.post.euro.value == "" || document.post.euro.value == "0.00") {
		alert("You have to enter the total costs!");
		document.post.euro.focus();
   		return false;
	}
	
	if(document.post.usereuro.value == "" || document.post.usereuro.value == "0.00") {
		alert("You have to enter the costs for each member!");
		document.post.usereuro.focus();
   		return false;
	}
	
}

function berechnen() {
	var anz = document.post.anz.value;
	var total = document.post.euro.value;
	
	var user = total/anz;
	var rounduser = Math.round(user);
	
	document.post.usereuro.value = rounduser;
	document.post.calculation.value = rounduser + " EUR  (" + total + "/" + anz + "=" + user + ")";
	
	document.post.usereuro.focus();
	return;
}
-->
</script>

<form name="post" method="post" action="cash_box.php" onSubmit="return chkFormular()">
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="$border">
    <tr> 
      
    <td class="title" align="center" bgcolor="$bghead">new usage</td>
    </tr>
    <tr> 
      <td bgcolor="$pagebg"></td>
    </tr>
    <tr> 
      
    <td bgcolor="$bg1"><table align="center" cellpadding="2" cellspacing="0" class="formtable">
          <tr>
            <td align="right">Squad:</td>
            <td><select name="squad">$squads</select></td>
          </tr>
          <tr>
            <td align="right">Usage:</td>
            <td><input name="usedfor" type="text" id="usedfor" value="$usedfor" size="55"></td>
          </tr>
          <tr> 
            <td align="right" valign="top">Info:</td>
            <td><textarea name="info" cols="50" rows="7">$info</textarea></td>
          </tr>
          <tr>
            <td align="right" valign="top">Bank account:</td>
            <td><textarea name="konto" cols="50" rows="4">$konto</textarea></td>
          </tr>
          <tr>
            <td align="right">pay until:</td>
            <td><input type="text" name="day" size="2">
              . 
              <input type="text" name="month" size="2">
              . 
              <input type="text" name="year" size="4">
              dd.mm.yyyy</td>
          </tr>
          <tr> 
            <td align="right">Total Costs:</td>
            <td><input type="text" dir="rtl" name="euro" size="8" value="$euro"> 
              &#8364;</td>
          </tr>
          <tr> 
            <td align="right">Costs/Member:</td>
            <td><input type="hidden" name="anz" value="$anz"> <input type="text" dir="rtl" name="usereuro" size="8" value="$usereuro"> 
				
              &#8364; <input type="button" name="calculate" value="calc" onClick="berechnen()">
              <input name="calculation" type="text" class="input" size="50" value=""></td>
          </tr>
          <tr> 
            <td>&nbsp;</td>
            <td><input type="submit" name="save" value="submit"></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
