<!--#include file="conn.asp"-->
<%
	if app_timming=1 then
		dim objxml,xmlnode,name,des,status,file,paramets,weeks,hours,runtime,i
		dim curweek,curhours,oldweek,oldhours
		set objxml = new AppXmlDom
		objxml.OpenXml(app_installdir&"inc/timmingset.xml")
		set xmlnode = objxml.FindNodes("timmings/timming")
		
		for i=0 to xmlnode.length-1
			name = xmlnode(i).selectNodes("name")(0).text
		    des = xmlnode(i).selectNodes("des")(0).text
		    status = xmlnode(i).selectNodes("status")(0).text
		    file = xmlnode(i).selectNodes("file")(0).text
		   	paramets = xmlnode(i).selectNodes("paramets")(0).text
		   	weeks = xmlnode(i).selectNodes("weeks")(0).text
		   	hours = xmlnode(i).selectNodes("hours")(0).text
		   	runtime = xmlnode(i).selectNodes("runtime")(0).text
		   	if not isN(runtime) then oldweek=weekday(runtime) : oldhours=hour(runtime)
			curweek=weekday(now) : curhours=hour(now)
			paramets = replaceStr(paramets,"&amp;","&")
			
			if status=1 and ( isN(runtime) or (oldweek&"-"&oldhours) <> (curweek&"-"&curhours) and instr(weeks,curweek) > 0 and instr(hours,curhours)>0) then
				xmlnode(i).selectNodes("runtime")(0).text = now()
				objxml.SaveXML()
				response.Clear : response.Redirect( app_installdir&"inc/"&file&"?"&paramets )
			end if
		next
		set xmlnode = nothing
		set objxml = nothing
	end if
%>