
		   <%
if session("allow")= false then
Response.Redirect "bc_login.asp?file_name=add_result.asp"
end if
%>
<!--#INCLUDE FILE="config.asp" -->
<!--#INCLUDE FILE="inc_functions.asp" -->
<!--#INCLUDE FILE="inc_top.asp" -->
<!--#INCLUDE FILE="solelim_db_conn.asp" -->
<script language="JavaScript" type='text/javascript'>
<!--
function do_option (ind,runner)
{
   var type = document.form1.l_type.options[ind].value;
   var year = document.form1.l_year.value;
   var month = document.form1.l_month.value;
   var day = document.form1.l_day.value;
   window.location.href = "add_result.asp?l_type=" + type + "&l_year=" + year + "&l_month=" + month + "&l_day=" + day + "&l_runner=" + runner
   
}

function do_option1 (ind,runner)
{
   var race = document.form1.race_name.options[ind].value;
   var year = document.form1.l_year.value;
   var month = document.form1.l_month.value;
   var day = document.form1.l_day.value;
   var type = document.form1.l_type.value;
   if (race == "ORACE")
	  window.location.href = "add_result.asp?race_name=ORACE&l_type=" + type + "&l_year=" + year + "&l_month=" + month + "&l_runner=" + runner + "&l_day=" + day; 
   
}

-->
</script>
<%
Response.CharSet="windows-1255"
codepage=1255
'if strDBNTUserName = "" then
'doNotLoggedInForm
'end if
Nmember=session("user")
theRunner = request("l_runner")
if theRunner = "" then
	theRunner = Nmember
end if

dim DAY_ZERO
DAY_ZERO = "Dec 30 1899 "
theRace = request("race_name")
theAction = request("submit1")
theType = request("l_type")
theYear = request("l_year")
theResult = request("l_hour") & ":" & request("l_min") & ":" & request("l_sec")
theDate = request("l_month") & "/" & request("l_day") & "/" & request("l_year")
if theRace <> "" and theResult <> "0:0:0" and theAction = "הוסף" then
%><!--#INCLUDE FILE="open_db.asp" --><%
	MySQL = "INSERT INTO result (mresult_name,mresult_time,race_id,mresult_status,mresult_race,mresult_date,mresult_type) VALUES ('" & theRunner & "', Convert(datetime, '" & DAY_ZERO & theResult & "', 8), '99999', 1, '" & theRace & "', '" & theDate & "', '" & theType & "')"
	set rs = SOLELIM_conn.Execute(MySQL)
	swOK=true
%><!--#INCLUDE FILE="close_db.asp" --><%	
end if

%>
<table border="0" width="99%" align="center">

<tr>

<td valign="top" width="100%">

<TABLE align=center bgcolor="#EFFDFF" WIDTH=80% BORDER=0 CELLSPACING=1 CELLPADDING=1>
	<tr>
	  <TABLE align=center bgcolor="#EFFDFF" WIDTH=80% BORDER=0 CELLSPACING=1 CELLPADDING=1>
	   <tr> 
	    <td width=33% align=right>
		 <a href="bc_runner.asp" title=חזרה><img alt="חזרה" src="Images/arrow_l.gif"></img></a>
		</td>
		<td width=33% align=center  bgcolor=Yellow>
	     <strong>הוספת תוצאת מרוץ</strong>
	    </td>
	    <td width=33% align=left>
	     <A HREF="javascript:print();"><img alt="הדפס" src=print.gif></img></A>
	    </td>

	   </tr></table>  
	</tr>
	<TR>
		<TD valign=top width=100%>
				
			<%

			mwpThemeBlock_open()
			Response.Write "שלום	" & theRunner
			%>
<P><LABEL><STRONG>נא לדייק בהכנסת הנתונים על מנת שלא ייכנסו נתוני זבל ! <br> כמו כן, נא לבדוק לפני אם התוצאה כבר לא הוכנסה על מנת שלא תהיינה כפילויות.
<% if swOK = true then %>
	<P><LABEL><FONT color=red><STRONG>הנתונים הוכנסו בהצלחה !</STRONG></FONT></LABEL></P>
<%end if%></STRONG></LABEL>
</P>
<FORM action="add_result.asp" method=get id=form1 name=form1>				
	<TABLE>
	  <tr>
	  <%if Nmember="יורם איינר" then%>
	    <td>
	    <LABEL>רץ:</LABEL>
		<SELECT id=l_runner name=l_runner >
<!--#INCLUDE FILE="open_db.asp" -->		   
<%			 set membersRS=Server.CreateObject("ADODB.recordset")
			 membersSQL="select * from members order by member_name"
		 	 membersRS.Open membersSQL, SOLELIM_conn, adOpenStatic
			 	 
		 	 Response.Write "<OPTION value=''></OPTION>"
		     while not membersRS.EOF   
			     if theRunner = membersRS("member_name") then
			        swFound = " selected"
			     else
			        swFound = ""
				 end if
		  		 Response.Write "<OPTION value='" & membersRS("member_name") & "'"  & swFound & ">" & membersRS("member_name") & "</OPTION>" 
		  		 Response.Write "<br>"
		  		 membersRS.MoveNext
		 	 wend
		 	 membersRS.Close
			 set membersRS=nothing
		   %>
<!--#INCLUDE FILE="close_db.asp" -->		   
		</SELECT>
		</td>
	   <%end if%>	
    
    	<td>
	    <LABEL>סוג מרוץ:</LABEL>
		<SELECT id=l_type name=l_type onChange="javascript:do_option(selectedIndex,'<%=theRunner%>');">
			<OPTION value=''></OPTION>
			<OPTION value='10K' <%if theType="10K" then Response.Write "selected" end if %>> 10 קילומטר כביש</OPTION>		
			<OPTION value='HM' <%if theType="HM" then Response.Write "selected" end if %>> חצי מרתון</OPTION>								
			<OPTION value='MARATHON' <%if theType="MARATHON" then Response.Write "selected" end if %>> מרתון</OPTION>
			<OPTION value='1500' <%if theType="1500" then Response.Write "selected" end if %>> 1500</OPTION>
			<OPTION value='3000' <%if theType="3000" then Response.Write "selected" end if %>> 3000</OPTION>		
			<OPTION value='5000' <%if theType="5000" then Response.Write "selected" end if %>> 5000</OPTION>		
			<OPTION value='10000' <%if theType="10000" then Response.Write "selected" end if %>> 10000</OPTION>		
			<OPTION value='5K' <%if theType="5K" then Response.Write "selected" end if %>> 5 קילומטר כביש</OPTION>		
			<OPTION value='15K' <%if theType="15K" then Response.Write "selected" end if %>> 15 קילומטר כביש</OPTION>
			<OPTION value='CCS' <%if theType="CCS" then Response.Write "selected" end if %>> מרוצי שדה קצר</OPTION>
			<OPTION value='CCL' <%if theType="CCL" then Response.Write "selected" end if %>> מרוצי שדה ארוך</OPTION>
			<OPTION value='CCW' <%if theType="CCW" then Response.Write "selected" end if %>> מרוצי שדה נשים</OPTION>
		</SELECT>
		</td>
    	<td>
		<LABEL>מרוץ:</LABEL>
		<% if theRace <> "ORACE" then %>
		<SELECT id=race_name name=race_name onChange="javascript:do_option1(selectedIndex,'<%=theRunner%>');">
		<% select case theType
			case "1500"
		%>
			<OPTION value='מסלול'   > מסלול</OPTION>
		<%
			case "3000"
		%>
			<OPTION value='מסלול'   > מסלול</OPTION>
		<%
			case "5000"
	    %>
			<OPTION value='מסלול'   > מסלול</OPTION>
		<%
			case "10000"
		%>
			<OPTION value='מסלול'   > מסלול</OPTION>
		<%
			case "10K"
		%>
			<OPTION value='אשדוד'  > אשדוד</OPTION>
			<OPTION value='אשקלון' > אשקלון</OPTION>
			<OPTION value='געש'  > געש</OPTION>
			<OPTION value='זכרון יעקב'  > <STRONG>זכרון יעקב</STRONG></OPTION>
			<OPTION value='חולון'  > <STRONG>חולון</STRONG></OPTION>			<OPTION value='10 קילומטר ירושלים' > 10 קילומטר ירושלים</OPTION>			<OPTION value='כפר סבא' > <STRONG>כפר סבא</STRONG></OPTION>			<OPTION value='נס ציונה' > <STRONG>נס ציונה</STRONG></OPTION>			<OPTION value='עין גדי'  > <STRONG>עין גדי</STRONG></OPTION>			<OPTION value='ראשון לציון' > <STRONG>ראשון לציון</STRONG></OPTION>			<OPTION value='רמת השרון'   > <STRONG>רמת השרון</STRONG></OPTION>			<OPTION value='רעננה'   > <STRONG>רעננה</STRONG></OPTION>			<OPTION value='רשפון'   > <STRONG>רשפון</STRONG></OPTION>
			<OPTION value='הרצליה'   > <STRONG>הרצליה</STRONG></OPTION>			<OPTION value='ORACE'   > <STRONG>מרוץ אחר</STRONG></OPTION>
		<%
			case "15K"
		%>
			<OPTION value='אייל'  > אייל</OPTION>
			<OPTION value='ORACE'   > <STRONG>מרוץ אחר</STRONG></OPTION>		<% 	
			case "HM"
		%>
			<OPTION value='בית שאן'   > חצי מרתון בית שאן</OPTION>
			<OPTION value='חצי מרתון ירושלים'   > חצי מרתון ירושלים</OPTION>
			<OPTION value='עין גדי'   > <STRONG>עין גדי</STRONG></OPTION>
			<OPTION value='ORACE'   > <STRONG>מרוץ אחר</STRONG></OPTION>
		<% 	
			case "MARATHON"
		%>
			<OPTION value='מרתון טבריה'   > מרתון טבריה</OPTION>
			<OPTION value='מרתון ברלין'   > <STRONG>מרתון ברלין</STRONG></OPTION>			<OPTION value='ORACE'   > <STRONG>מרוץ אחר</STRONG></OPTION>
		<% end select%>		</SELECT>
		<%else%>
			<INPUT type="text" id=race_name name=race_name>
		<%end if%>
		</td>
	 </tr>
	 <tr>
		<td>
		<LABEL>תוצאה (hh:mm:ss) :</LABEL>
	    <SELECT id=l_sec name=l_sec >
		    <% for i=0 to 59 
				 Response.Write "<OPTION value='" & i & "'>" & i & "</OPTION>"
			   next 
			%>
		</SELECT>
		<LABEL><strong>:</strong></LABEL>
	    <SELECT id=l_min name=l_min >
		    <% for i=0 to 59 
				 Response.Write "<OPTION value='" & i & "'>" & i & "</OPTION>"
			   next 
			%>
		</SELECT>
		<LABEL><strong>:</strong></LABEL>
	    <SELECT id=l_hour name=l_hour>
			<OPTION value='0'>0</OPTION>
			<OPTION value='1'>1</OPTION>
			<OPTION value='2'>2</OPTION>
			<OPTION value='3'>3</OPTION>
			<OPTION value='4'>4</OPTION>
			<OPTION value='5'>5</OPTION>
		</SELECT>
		</td>
	 </tr>
	 <tr>
		<td>
		<LABEL>תאריך (dd/mm/yyyy) : </LABEL>
	    <SELECT id=l_year name=l_year >
		    <% for i=Year (Date) to 1980 step -1
		         if i = int(theYear) then
					swSelected = " selected"
				 else
					swSelected = ""
				 end if
				 Response.Write "<OPTION value='" & i & "'" & swSelected & ">" & i & "</OPTION><br>"
			   next 
			 %>
		</SELECT>
		
		<LABEL><strong>/</strong></LABEL>
	    <SELECT id=l_month name=l_month >
		    <% for i=1 to 12 
		         if i = int(request("l_month")) then
					swSelected = " selected"
				 else
					swSelected = ""
				 end if
				 Response.Write "<OPTION value='" & i & "'" & swSelected & ">" & i & "</OPTION>"
			   next 
			%>
		</SELECT>
		<LABEL><strong>/</strong></LABEL>
	    <SELECT id=l_day name=l_day >
		    <% for i=1 to 31 
		         if i = int(request("l_day")) then
					swSelected = " selected"
				 else
					swSelected = ""
				 end if
				 Response.Write "<OPTION value='" & i & "'" & swSelected & ">" & i & "</OPTION>"
			   next 
			%>
		</SELECT>
		</td>
	 </tr>
	</TABLE>		
	<INPUT type='submit' value='הוסף' id=submit1 name=submit1>
</FORM>
            <%'############## END CONTENT ##############%>
			<%mwpThemeBlock_close()%>
            </TD></TR></TABLE></body></html>
</td></tr></table>
