<!-- #INCLUDE FILE="Common.asp" -->
<!-- #INCLUDE FILE="Headereng.asp" -->
<!-- #INCLUDE FILE="Menueng.asp" -->


<%


sFileName = "News.asp"

sAction = GetParam("FormAction")
sForm = GetParam("FormName")
Select Case sForm
  Case "Detail"
    DetailAction(sAction)
  end select


%><html>
<head>
<title>HO-CIRED</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0"> 
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>

<body marginheight="0" marginwidth="0" bgcolor="#CCCCCC">
		<center>
			
									</center>
		<div align="center">
			<table width="780" border="0" cellspacing="0" cellpadding="0" bgcolor="white">
				<tr height="10">
					<td bgcolor="white" height="10"></td>
				</tr>
				<tr>
					<td>
						<div align="center">
							<table width="760" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td width="760">
										<table width="760" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="760"><% header%></td>
											</tr>
											<tr>
												<td valign="top" width="760">
													<div align="center">
														<table width="760" border="0" cellspacing="0" cellpadding="0">
															<tr>
																<td valign="top" width="180"><% menu%></td>
																<td width="2"></td>
																<td width="10"></td>
																<td valign="top" width="568">
																	<div align="left">
																		<br>
																		<font face="Verdana, Arial" size="2"><b><font color="#0066cc">News</font></b><br>
																		</font><br>
																		<% Sadrzaj_prikaz %></div>
																</td>
															</tr>
														</table>
													</div>
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
							<table width="762" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td>
										<div align="center">
											<font size="1" color="#999999" face="Verdana,Arial">Copyright 2008. HO - CIRED • </font><a href="http://www.midicom.hr" target="_blank"><span class="main"><b>site by MidiCOM</b></font></a></font></div>
									</td>
								</tr>
							</table>
						</div>
					</td>
				</tr>
				<tr height="10">
					<td height="10"></td>
				</tr>
			</table>
		</div>
	</body>
</html>
<% 



'********************************************************************************

Sub Sadrzaj_Prikaz()
  

  Dim sWhere
  sWhere = ""
  sOrder = ""
  sSQL = ""



  ' Build ORDER statement
  sOrder = " order by i.Red Desc"
  iSort = GetParam("FormResults_Sorting")
  iSorted = GetParam("FormResults_Sorted")

  sDirection = ""
  sSortParams = ""
  if not IsEmpty(iSort) then
    if iSort = iSorted then
      form_sorting = ""
      sDirection = " DESC"
      sSortParams = "FormResults_Sorting=" & iSort & "&FormResults_Sorted=" & iSort & "&"
    else
      form_sorting = iSort
      sDirection = " ASC"
      sSortParams = "FormResults_Sorting=" & iSort & "&FormResults_Sorted=" & "&"
    end if

    
    if iSort = 1 then sOrder = " order by i.item_id" & sDirection
    if IsNull(sOrder) then sDirection = ""
  end if
  

%>
<table width="568" border="0" cellspacing="0" cellpadding="0">

      <%

  sWhere = ""
  
' Build WHERE statement

  pTitle = GetParam("Title")
  if not isEmpty(pTitle) then
    HasParam = true
    sWhere = sWhere & "i.Title like '%" & replace(pTitle, "'", "''") & "%'"
  end if
  
  pcategory_id = GetParam("category_id")
  if IsNumeric(pcategory_id) and not isEmpty(pcategory_id) then pcategory_id = CLng(pcategory_id) else pcategory_id = Empty
  if not isEmpty(pcategory_id) then
    if not (sWhere = "") then sWhere = sWhere & " and "
    HasParam = true
    sWhere = sWhere & "i.category_id=" & pcategory_id
  end if
  

  if HasParam then sWhere = " AND (" & sWhere & ")"

  ' Build full SQL statement
  
  sSQL = "select i.Title as i_Title, " & _
    "i.category_id as i_category_id, " & _
    "i.SDesc as i_SDesc, " & _
    "i.Dan as i_Dan, " & _
    "i.Mjesec as i_Mjesec, " & _
    "i.Godina as i_Godina, " & _
    "i.item_id as i_item_id, " & _
    "i.LDesc as i_LDesc, " & _
    "i.Red as i_Red, " & _
    "i.LinkENG as i_LinkENG " & _
    " from Novosti i, Kategorije c" & _
    " where c.category_id=i.category_id  "

  sSQL = sSQL & sWhere & sOrder
  ' Select current page
  iPage = GetParam("FormResults_Page")
  if IsEmpty(iPage) then iPage = 1

  ' Open recordset
	openrs rs, sSQL

  if rs.eof then
    ' Recordset is empty
    fldcategory_id = GetValue(rs, "c_Naziv")

%>
     <tr>
      <td colspan="5" style="border-width: 1"><font face="Verdana, Arial" size="2" color="000000">Under construction</font></td>
     </tr><%

  else
    iCounter = 0
    while not rs.eof and iCounter < (iPage-1)*100
      rs.movenext
  		iCounter = iCounter + 1
    wend
    iCounter = 0
  end if



  ' Show main table based on recordset
  while not rs.EOF  and iCounter < 100
    fldTitle = GetValue(rs, "i_Title")
    fldSDesc = GetValue(rs, "i_SDesc")
    fldDan = GetValue(rs, "i_Dan")
    fldMjesec = GetValue(rs, "i_Mjesec")
    fldGodina = GetValue(rs, "i_Godina")
    fldLDesc = GetValue(rs, "i_LDesc")
    fldLinkENG = GetValue(rs, "i_LinkENG")
    fldRed = GetValue(rs, "i_Red")

%>
	
		<tr>
				<td colspan="2" width="568"><font face="Verdana, Arial" color="000000" size="2"><%=ToHTML(fldDan)%>.<%=ToHTML(fldMjesec)%>.<%=ToHTML(fldGodina)%>. </font><font face="Verdana, Arial" color="0066CC" size="2"><%=fldTitle%></font></td>
			</tr>
			<tr>
				<td width="20"></td>
				<td width="548"><br>
				</td>
			</tr>
			<tr>
				<td width="20"><img src="../img-misc/strelica.gif" alt="" height="18" width="15" border="0"></td>
				<td width="548"><font face="Verdana, Arial" color="000000" size="2"><a href="<%=fldLinkENG%>" target="_blank"><font size="2" color="000000" face="Verdana,Arial"><b>Click here</b></font></td>
			</tr>

			<tr>
				<td width="20"></td>
				<td width="548"><br>
				</td>
			</tr>
			<tr height="1">
				<td bgcolor="#cccccc" width="20" height="1"></td>
				<td bgcolor="#cccccc" width="548" height="1"></td>
			</tr>
			<tr>
				<td width="20"></td>
				<td width="548"><br></td>
			</tr>

		
      <tr><%


  
    rs.MoveNext

    iCounter = iCounter + 1
  wend

 
  %>
    
    <% if not rs.EOF or not iPage=1 then %>
      <tr><td colspan="6" style="background-color: #FFFFFF; border-style: inset; border-width: 0"><font style="font-size: 10pt; color: #999999; font-weight: bold"><font face="Verdana, Arial">
    <% end if %>
    
  <%
' Handle scroller
  if not rs.EOF or not iPage=1 then
    if iPage = 1 then
      scroller_prev = "<a href_="""&sFileName&"?"&form_params&sSortParams&"FormResults_Page="&prev_page&"#Results"">"
    else
      prev_page = iPage - 1
      scroller_prev = "<a href="""&sFileName&"?"&form_params&sSortParams&"FormResults_Page="&prev_page&"#Results"">"
    end if
		%>
    <%=scroller_prev%><center><font style="font-size: 10pt; font-weight: bold"><font face="Verdana, Arial">Prethodna stranica</font>
		<%
    if not IsNull(scroller_prev) then response.write "</a>"

    response.write " [ "&iPage&" ] "

    if rs.EOF then
      scroller_next = "<a href_="""&sFileName&"?"&transit_params&sSortParams&"FormResults_Page="&next_page&"#Results"">"
    else
      next_page = iPage + 1
      scroller_next = "<a href="""&sFileName&"?"&transit_params&sSortParams&"FormResults_Page="&next_page&"#Results"">"
    end if
    
		%>
		<%=scroller_next%><font style="font-size: 10pt; font-weight: bold"><font face="Verdana, Arial">Slijedeća stranica</font></center>
		<%

    if not IsNull(scroller_next) then response.write("</a>")
  end if

  set rs = nothing

  %>
      </font></td></tr>
    </table>
  <%
  
end sub

%>