<%
@LANGUAGE="VBSCRIPT" CODEPAGE="28592"
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
Response.redirect("http://"&request.ServerVariables("HTTP_HOST"))
  const GT_ZLITERAMI=0
  const GT_BEZLITER=1
  const GT_NAZWA=0
  const GT_LINK=1
  const GT_SUBDOMENA=2
%>
<%
  testw=0
  if request.QueryString("test")="1" or session("testw")=1 or lcase(request.ServerVariables("HTTP_HOST"))="test.apartamenty.pl" then
    testw=1
	session("testw")=1
  end if 
%>
<!-- Apartamenty -->
<% miesiace = Array("stycznia", "lutego", "marca", "kwietnia", "maja", "czerwca", "lipca", "sierpnia", "września", "października", "listopada", "grudnia") %>
<% start=Timer %>
<!-- #include file="dbopen.asp" -->
<!--#include file = "ap_parametry_inc.asp" -->

<%
if request.ServerVariables("HTTP_HOST")="apartamenty.pl" then
  response.redirect "http://www.apartamenty.pl"
end if

  httphost = request.ServerVariables("HTTP_HOST")
  httphost = replace(httphost, "www.", "")
  httphost = replace(httphost, ".apartamenty.pl", "")
subgraf = httphost



if request.QueryString("p")="" then
set objdom=server.CreateObject("adodb.recordset")
objdom.open "select * from t_subdomeny where subdomena='"&httphost&"'",conn,1,3
if not objdom.eof then
    subdomena=true
    if objdom("typ")=1 then
      konf_param="48,"&objdom("id_typu")&",7"
    end if  
'    if objdom("typ")=2 then
'      konf_param="144,"&objdom("id_typu")&",3"
'    end if  
    if objdom("typ")=3 then
      konf_param="12,"&objdom("id_typu")&",1"
    end if  
    if objdom("typ")=4 then
      konf_param="144,"&objdom("id_typu")&",11"
    end if  
	if objdom("typ")=5 then
	  tmp_id_podgrupy = objdom("id_typu")
	  tmp_id_grupy = conn.execute("select id_grupy from t_produkty_podgrupy where id_podgrupy="&tmp_id_podgrupy)(0)
	  konf_param="4144,"&tmp_id_podgrupy&","&tmp_id_grupy&",7"
	  
	end if
end if
objdom.close
end if 
%>

<% conn.execute "set dateformat ymd" %>
<% 
if request.Form("pierwotny_miasto")<>"" then 
  set objm=server.CreateObject("adodb.recordset")
  objm.open "select * from t_miejscowosci where nazwa_miasta like '%"&SQLRepl(request.Form("pierwotny_miasto"))&"%' order by id_miejscowosci", conn,1,3
  if objm.recordcount > 0 then
		pn = SQLRepl(Trim(request.Form("pierwotny_nazwa")))
		dev = SQLRepl(Trim(request.Form("pierwotny_developer")))
		if pn<>"" then pn = "&pnazwa="& pn
		if dev<>"" then dev = "&dev="& dev
		'Response.Write("ap.asp?p=12,"&objm("id_miejscowosci")&",1"&pn&dev)
		response.redirect "ap.asp?p=12,"&objm("id_miejscowosci")&",1"&pn&dev
  end if   
  objm.close
end if
Set rs = CreateObject("ADODB.RecordSet")
if isempty(konf_param) or isnull(konf_param) then
konf_param=SQLRepl(request.QueryString("p"))
end if

if request.Form("param")<>"" then 
  konf_param=SQLRepl(request.form("param"))
end if
if IsEmpty(konf_param) then
  konf_param="0"
end if
Rozpakuj_parametry(konf_param)
'response.write konf_param
'response.end
  sv_http_host = lcase(request.ServerVariables("HTTP_HOST"))
	pos1=InStr(sv_http_host, ".")
	koniec1=Len(sv_http_host)
	tempsv=Mid(sv_http_host,pos1+1,koniec1)
	pos2=InStr(tempsv, ".")
  tempsv=Mid(tempsv,1,pos2-1)
	tempupper=Mid(tempsv,1,1)
	tempupper=UCase(tempupper)
	koniec2=Len(tempsv)
	tempsv=Mid(tempsv,2,koniec2)
	tempsv=tempupper+tempsv
	if tempsv = "Lazienki" then tempsv = "Łazienki"
	if tempsv = "Oswietlenie" then tempsv = "Oświetlenie"
	if tempsv = "Wykonczeniescian" then tempsv = "Wykończenie ścian"
	if tempsv = "Podlogi" then tempsv = "Podłogi"
	if tempsv = "Drzwi " then tempsv = "Drzwi i Okucia"
	if tempsv = "Szafyigarderoby" then tempsv = "Szafy i garderoby"
	if tempsv = "Okna" then tempsv = "Okna i Dekoracje"
	if tempsv = "Salonyijadalnie" then tempsv = "Salony i Jadalnie"
	if tempsv = "Klimatyzacja" then tempsv = "Klimatyzacja / wentylacja"
	if tempsv = "Gabinet" then tempsv = "Pokój do pracy, gabinet"
	if tempsv = "Pokojdzieciecy" then tempsv = "Pokój dziecięcy"
	if tempsv = "Pokojmlodziezowy" then tempsv = "Pokój młodzieżowy"
	if tempsv = "Balkony" then tempsv = "Balkony, loże, werandy"
	

  glowna_domena = true

  if session("crm")<>"OK" and sv_http_host<>"test.apartamenty.pl" and sv_http_host<>"www.test.apartamenty.pl" and sv_http_host<>"administracja.apartamenty.pl" then
  set objsub = server.CreateObject("adodb.recordset")

  objsub.open "select * from t_subdomeny where typ=5",conn,1,3  
  bez_artykulow = false


  while not objsub.eof
    if id_podgrupy=objsub("id_typu")  then
	  bez_artykulow=true
      if sv_http_host = "www."&lcase(objsub("subdomena"))&".apartamenty.pl" then
        glowna_domena = false
	  subdomena_meta_title = objsub("title")
	  subdomena_meta_desc = objsub("description")
      else
        if konf_param="" or konf_param="0" or konf_param="144,"&objsub("id_typu")&","&id_artykulu&",11" then
          response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl"
        else
          response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl?p="&konf_param
        end if
      end if
    end if
    objsub.movenext
  wend
  objsub.close

	if sv_http_host = "kuchnie.apartamenty.pl" then
		Response.Status="301 Moved Permanently"
		Response.AddHeader "Location", "http://www.kuchnie.apartamenty.pl/"
		response.end
	end if


if not bez_artykulow then
  objsub.open "select * from t_subdomeny where typ=1",conn,1,3  

  while not objsub.eof
    if id_artykulu=objsub("id_typu")  then
      if sv_http_host = "www."&lcase(objsub("subdomena"))&".apartamenty.pl" then
        glowna_domena = false
      else
        if konf_param="" or konf_param="0" then
          response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl"
        else
          'response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl?p="&konf_param
        end if
      end if
    end if
    objsub.movenext
  wend
  objsub.close
end if

'  objsub.open "select * from t_subdomeny where typ=2",conn,1,3  
 ' while not objsub.eof
  '  if id_uslugi=objsub("id_typu") then
 '     if sv_http_host = "www."&lcase(objsub("subdomena"))&".apartamenty.pl" then
 '       glowna_domena = false
 '     else
 '       if konf_param="" or konf_param="0" then
 '         response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl"
 '       else
  '        response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl?p="&konf_param
 '       end if
 '     end if
 '   end if
 '   objsub.movenext
 ' wend
 ' objsub.close

  objsub.open "select * from t_subdomeny where typ=3",conn,1,3  
  while not objsub.eof
    if id_miasta=objsub("id_typu") and rynek=TR_PIERWOTNY  then
      if sv_http_host = "www."&lcase(objsub("subdomena"))&".apartamenty.pl" then
        glowna_domena = false
				if objsub("czy_dom")=1 or objsub("czy_dom")=2 then
					pierwotny_czydom=objsub("czy_dom")
				end if
	  subdomena_meta_title = objsub("title")
	  subdomena_meta_desc = objsub("description")
      else
        if konf_param="" or konf_param="0" or konf_param="12,"&objsub("id_typu")&",1" then
          'response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl"
        else
          'response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl?p="&konf_param
        end if
      end if
    end if
    objsub.movenext
  wend
  objsub.close

  objsub.open "select * from t_subdomeny where typ=4",conn,1,3  
  while not objsub.eof
    if typ_pokazuj=TP_SALONY and id_uslugi=objsub("id_typu")  then
      if sv_http_host = "www."&lcase(objsub("subdomena"))&".apartamenty.pl" then
        glowna_domena = false
				subdomena_meta_title = objsub("title")
				subdomena_meta_desc = objsub("description")
      else
        if konf_param="" or konf_param="0" or konf_param="144,"&objsub("id_typu")&",11" then
          response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl"
        else
          response.Redirect "http://www."&objsub("subdomena")&".apartamenty.pl?p="&konf_param
        end if
      end if
    end if
    objsub.movenext
  wend
  objsub.close

  if glowna_domena and sv_http_host <> "www.apartamenty.pl" and sv_http_host <> "test.apartamenty.pl" and sv_http_host <> "www.test.apartamenty.pl" then
    if konf_param="" or konf_param="0" then
      response.Redirect "http://www.apartamenty.pl"
    else
			if(inStr(Request.ServerVariables("Query_String"),"dyn") = 0) then
				response.Redirect "http://www.apartamenty.pl?p="&konf_param
			else
				Response.Redirect "http://www.apartamenty.pl?p="&konf_param&"&dyn="&SQLRepl(Request.QueryString("dyn"))
			end if
    end if
  end if
  end if


if request("termin")<>"" then 
  if request("termin")="-1" then
    termin_oddania = null
  else
    termin_oddania = SQLRepl(request("termin"))
  end if
end if
if request("id_dzielnicy")<>"" then 
  id_dzielnicy = SQLRepl(request("id_dzielnicy"))
end if
if request.querystring("iddz")<>"" then 
  id_dzielnicy = SQLRepl(request.querystring("iddz"))
end if
if request.Form("pierwotny_nazwa")<>"" then
  pierwotny_nazwa = SQLRepl(request.Form("pierwotny_nazwa"))
end if
if request.QueryString("pnazwa")<>"" then
  pierwotny_nazwa = SQLRepl(request.QueryString("pnazwa"))
end if
'Response.Write(" a "&pierwotny_nazwa)
if request.Form("pierwotny_developer")<>"" then
  pierwotny_developer = SQLRepl(request.Form("pierwotny_developer"))
end if
if request.QueryString("dev")<>"" then
  pierwotny_developer = SQLRepl(request.QueryString("dev"))
end if
'Response.Write(" a "&pierwotny_developer)

if pierwotny_nazwa<>"" OR pierwotny_developer<>"" then
  rynek = TR_PIERWOTNY
end if

if request.QueryString("log")="1" then 
  session("ap_login")="adt" 
  session("ap_haslo")="1111" 
end if 
%>
<% 
  set objal=server.CreateObject("adodb.recordset")
  log_id = null
  if session("ap_login")<>"" and session("ap_typ")="wtorny" then 
  objal.open "select * from v_agencje where login='"&session("ap_login")&"' and haslo='"&session("ap_haslo")&"'",conn,1,3
  if objal.recordcount > 0 then
    log_id = objal("id_agencji")
    log_nazwa = objal("nazwa")
    log_adres = objal("adres")
    log_miasto = objal("nazwa_miasta")
    log_telefon = objal("telefon")
  end if
  objal.close
  end if
  log_did = null
  if session("ap_login")<>"" and session("ap_typ")="pierwotny" then 
  objal.open "select * from v_deweloperzy where login='"&session("ap_login")&"' and haslo='"&session("ap_haslo")&"'",conn,1,3
  if objal.recordcount > 0 then
    log_did = objal("id_dewelopera")
    log_nazwa = objal("nazwa")
    log_adres = objal("adres")
    log_miasto = objal("nazwa_miasta")
    log_telefon = objal("telefon")
  end if
  objal.close
  end if
%>
<html>
<head>
<%
 if isnull(id_miasta) then
	nazwa_miasta=""
 elseif  id_miasta = -1 then
	nazwa_miasta="kurorty"
 else
	nazwa_miasta=conn.execute("select nazwa_miasta from t_miejscowosci where id_miejscowosci="&id_miasta)(0)
	meta_nazwa_miasta = nazwa_miasta
	
 end if
  
	if not isnull(id_regionu) then
    select case id_regionu 
      case 1 meta_nazwa_miasta=" nad morzem"
      case 2 meta_nazwa_miasta=" nad jeziorem"
      case 3 meta_nazwa_miasta=" w górach"
    end select
  end if
'  if not isnull(id_prezentacji) then
 '   nazwa_osrodka = conn.execute("select to_nazwa from t_osrodki where id_osrodka="&id_prezentacji)(0)
 ' end if
 
if subdomena_meta_title<>"" then
  meta_title = subdomena_meta_title
else
meta_title = "Apartamenty"
if meta_nazwa_miasta <> "" then
  meta_title = "Apartamenty "&meta_nazwa_miasta
end if 
end if

if not isnull(id_prezentacji) and rynek=TR_PIERWOTNY then
  meta_prezentacja = conn.execute("select nazwa from t_inwestycje where id_inwestycji="&id_prezentacji)(0)
  meta_title = meta_prezentacja
end if

if not isnull(id_prezentacji) and rynek=TR_WTORNY then
  meta_prezentacja = conn.execute("select ulica from t_wtorny_mieszkania where id_mieszkania="&id_prezentacji)(0)
  meta_title = meta_prezentacja
end if

if not isnull(id_prezentacji_bezpl)  then
  meta_prezentacja = conn.execute("select nazwa from t_inwestycje where id_inwestycji="&id_prezentacji_bezpl)(0)
  meta_title = meta_prezentacja
end if

if not isnull(id_artykulu) then
	set rs = Server.CreateObject("ADODB.RecordSet")
	rs.Open "select temat from t_artykuly where id_artykulu="&id_artykulu, conn, 1, 3
  'meta_artykul = conn.execute("select temat from t_artykuly where id_artykulu="&id_artykulu)(0)
	if(rs.RecordCount > 0) then meta_artykul = rs("temat") end if
	rs.Close() : set rs = nothing
  meta_title = meta_artykul
	if id_artykulu = 2 then meta_title="Meble łazienkowe"
	if id_artykulu = 6 then meta_title = "Drzwi"
	if id_artykulu = 6 AND sv_http_host = "www.drzwizewnetrzne.apartamenty.pl" then meta_title = "Drzwi zewnętrzne"
	if id_artykulu = 6 AND sv_http_host = "www.drzwiwewnetrzne.apartamenty.pl" then meta_title = "Drzwi wewnętrzne"
	if id_artykulu = 7 AND sv_http_host = "www.szafywnekowe.apartamenty.pl" then meta_title = "Szafy wnękowe"
	
	if sv_http_host = "www.lazienki.apartamenty.pl" then meta_title = "Łazienki"
	if sv_http_host = "www.meblepokojowe.apartamenty.pl" then meta_title = "Meble pokojowe"
	if sv_http_host = "www.mebledzieciece.apartamenty.pl" then meta_title = "Meble dziecięce"
	if sv_http_host = "www.meblewypoczynkowe.apartamenty.pl" then meta_title = "Meble wypoczynkowe"
end if

if typ_pokazuj = TP_USLUGI then 
 nazwa_uslugi = conn.execute("select usluga from t_uslugi_budowlane where id_uslugi="&id_uslugi)(0) 
  meta_title = nazwa_uslugi & " " &nazwa_miasta
end if

if typ_pokazuj = TP_INNE then 
 nazwa_uslugi = conn.execute("select kategoria from t_inne_kategorie where id_kategorii="&id_uslugi)(0) 
  meta_title = nazwa_uslugi & " " &nazwa_miasta
end if

if typ_pokazuj = TP_SALONY then
  meta_title = "Salony meblowe" & " " &nazwa_miasta
end if

if subdomena_meta_desc <>"" then
meta_desc =subdomena_meta_desc
else
meta_desc = "Rynek pierwotny, rynek wtórny, wyposażenie wnętrz, baza usługodawców. Polecamy Apartamenty.pl"
end if
Function URLDecode(ByVal What)
	'URL decode Function
	'2001 Antonin Foller, PSTRUH Software, http://www.motobit.com
		Dim Pos, pPos

		'replace + To Space
		What = Replace(What, "+", " ")

		on error resume Next
		Dim Stream: Set Stream = CreateObject("ADODB.Stream")
		If err = 0 Then 'URLDecode using ADODB.Stream, If possible
			on error goto 0
			Stream.Type = 2 'String
			Stream.Open

			'replace all %XX To character
			Pos = InStr(1, What, "%")
			pPos = 1
			Do While Pos > 0
				Stream.WriteText Mid(What, pPos, Pos - pPos) + _
					Chr(CLng("&H" & Mid(What, Pos + 1, 2)))
				pPos = Pos + 3
				Pos = InStr(pPos, What, "%")
			Loop
			Stream.WriteText Mid(What, pPos)

			'Read the text stream
			Stream.Position = 0
			URLDecode = Stream.ReadText

			'Free resources
			Stream.Close
		Else 'URL decode using string concentation
			on error goto 0
			'UfUf, this is a little slow method. 
			'Do Not use it For data length over 100k
			Pos = InStr(1, What, "%")
			Do While Pos>0 
				What = Left(What, Pos-1) + _
					Chr(Clng("&H" & Mid(What, Pos+1, 2))) + _
					Mid(What, Pos+3)
				Pos = InStr(Pos+1, What, "%")
			Loop
			URLDecode = What
		End If
	End Function
function utftoiso2(str)
	if Trim(str) = "" then
		utftoiso2 = ""
		Exit Function
	end if
	Dim ch, wyjscie
	wyjscie = ""
	ch = ""
		for i = 1 to len(str)
			
			if ch = "C3" Or ch = "C4" Or ch = "C5" then
				on error resume next
					ch = ch & hex(asc(Mid(str,i,1)))
					if err.number<>0 then ch = "?"
				on error goto 0
				select case ch
					case "C484": wyjscie = wyjscie & chr(cInt("&HA1"))
					case "C486": wyjscie = wyjscie & chr(cInt("&HC6"))
					case "C498": wyjscie = wyjscie & chr(cInt("&HCA"))
					case "C581": wyjscie = wyjscie & chr(cInt("&HA3"))
					case "C583": wyjscie = wyjscie & chr(cInt("&HD1"))
					case "C393": wyjscie = wyjscie & chr(cInt("&HD3"))
					case "C59A": wyjscie = wyjscie & chr(cInt("&HA6"))
					case "C5B9": wyjscie = wyjscie & chr(cInt("&HAC"))
					case "C5BB": wyjscie = wyjscie & chr(cInt("&HAF"))
					case "C485": wyjscie = wyjscie & chr(cInt("&HB1"))
					case "C487": wyjscie = wyjscie & chr(cInt("&HE6"))
					case "C499": wyjscie = wyjscie & chr(cInt("&HEA"))
					case "C582": wyjscie = wyjscie & chr(cInt("&HB3"))
					case "C584": wyjscie = wyjscie & chr(cInt("&HF1"))
					case "C3B3": wyjscie = wyjscie & chr(cInt("&HF3"))
					case "C59B": wyjscie = wyjscie & chr(cInt("&HB6"))
					case "C5BA": wyjscie = wyjscie & chr(cInt("&HBC"))
					case "C5BC": wyjscie = wyjscie & chr(cInt("&HBF"))
					case else: wyjscie = wyjscie & "?"
				end select
			else
				on error resume next
				ch = hex(asc(Mid(str,i,1)))
				if err.number<>0 then ch = "?"
				on error goto 0
				if ch <> "C3" And ch <> "C4" And ch <> "C5" then wyjscie = wyjscie & Mid(str,i,1)
			end if
		next
		utftoiso2 = wyjscie
	on error goto 0
end function


Dim produkty_tylko_jego
produkty_tylko_jego = 0
if request.querystring("meta")<>"" then 
	meta2 = SQLRepl(request.querystring("meta"))
	meta_title = ""
	if inStr(meta2,"__") > 0 then
		url_tab_tmp = Split(meta2,"__")
		if UBound(url_tab_tmp) = 2 then
			meta_title = utftoiso2(url_tab_tmp(0)) & " - " & utftoiso2(url_tab_tmp(1))
			on error resume next
			produkty_tylko_jego = cInt(url_tab_tmp(2))
			if err.Number<>0 then 
				Response.Status="301 Moved Permanently"
				Response.AddHeader "Location", SQLRepl(Request.QueryString("p")) & "," & url_tab_tmp(0) & ".html"
			end if
			on error goto 0
		end if
	end if
	if meta_title = "" then meta_title = utftoiso2(meta2)
end if


%>
<%
if tempsv<>meta_title then
meta_title=tempsv + ", " + meta_title
meta_title = replace(meta_title,"Nowemieszkaniatrojmiasto,","") : meta_title = replace(meta_title,"Nowemieszkaniawarszawa,","") : meta_title = replace(meta_title,"Nowemieszkaniakrakow,","") : meta_title = replace(meta_title,"Nowemieszkaniakatowice,","") : meta_title = replace(meta_title,"Nowemieszkanialodz,","") : meta_title = replace(meta_title,"Nowemieszkaniawroclaw,","") : meta_title = replace(meta_title,"Nowemieszkaniapoznan,","") : meta_title = trim(meta_title)
meta_title = replace(meta_title,"Nowedomytrojmiasto,","") : meta_title = replace(meta_title,"Nowedomywarszawa,","") : meta_title = replace(meta_title,"Nowedomykrakow,","") : meta_title = replace(meta_title,"Nowedomykatowice,","") : meta_title = replace(meta_title,"Nowedomylodz,","") : meta_title = replace(meta_title,"Nowedomywroclaw,","") : meta_title = replace(meta_title,"Nowedomypoznan,","") : meta_title = trim(meta_title)
end if
%>
<META name="robots" content="index,follow,all">
<meta name="description" content="<%=meta_title%>">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
<meta name="keywords" content="<%=meta_title%>">
<meta name="google-site-verification" content="W46aOeWJlXijJXl0MP-on82mw7i_TyQLcahlzUIP-NQ" />
<meta name="Author" content="Rafał Jaczyński">
<meta name="Copyright" content="Copyright 2006 - Apartamenty">
<LINK REL="stylesheet" type="text/css" href="style.css">
<title><%=meta_title%></title>
<%
if subgraf="apartamenty.pl" then
  lok_strona_glowna = true
else 
  lok_strona_glowna = false
end if
%>

<% if lok_strona_glowna then %>

<% elseif rynek = TR_PIERWOTNY then  %>

<% elseif typ_pokazuj = TP_PRODUKTY or typ_pokazuj = TP_PORADNIK or typ_pokazuj = TP_PRODUCENCI then %>

<% else %>

<% end if %>
</head>
<body>
<table cellpadding="0" cellspacing="0" align="center">
<tr><td colspan="3">
<!-- #include file="gora.asp" -->
</td></tr>
<tr><td>

<table width="760" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
	<td width="520" valign="top">
<% if not lok_strona_glowna then %>

<% end if %>
<% if request.querystring("partnerzy")<>"" then %>
<!-- #include file="ap_partnerzy.asp" -->
<% else %>
<% if request.QueryString("adm")<>"" then %>
<% if not isnull(log_id) then %>
<% if request.QueryString("adm")="1" then %>
<iframe src="http://www.info1.pl/administracja/apartamenty/wtorny/agencje/edycja.asp?id=<%=log_id%>" width="520" height="800" frameborder="0"></iframe>  
<% end if %>
<% if request.QueryString("adm")="2" then %>
<iframe src="http://www.info1.pl/administracja/apartamenty/wtorny/agencje/mieszkania/edycja.asp?idnad=<%=log_id%>" width="520" height="1400" frameborder="0"></iframe>  
<% end if %>
<% if request.QueryString("adm")="3" then %>
<iframe src="http://www.info1.pl/administracja/apartamenty/wtorny/agencje/mieszkania/edycja.asp?idnad=<%=log_id%>&id=<%=SQLRepl(request.QueryString("id"))%>" width="520" height="1400" frameborder="0"></iframe>  
<% end if %>
<% if request.QueryString("adm")="4" then %>
<table>
<% conn.execute ("delete from t_wtorny_mieszkania where id_mieszkania="&SQLRepl(request.QueryString("id"))) %>
<tr><td height="20"><font size="2">Oferta została usunięta</font></td></tr>
<td height="20"><a href="ap.asp">Powrót <img src="img/bullet.gif"></a></td></tr>

</table>
<% end if %>
<% 
	if request.QueryString("adm")="5" then 
		%><!--#include file="devpanel.asp"--><%
		'<iframe src=""http://administracja.apartamenty.pl/devpanel.asp?id="&SQLRepl(Request.QueryString("developer_id"))&""" width=""740"" height=""1400"" frameborder=""0""></iframe>  
	end if
%>


<% end if %>

<% if not isnull(log_did) then %>
<% if request.QueryString("adm")="1" then %>
<iframe src="http://www.info1.pl/administracja/apartamenty/pierwotny/deweloperzy/edycja.asp?id=<%=log_did%>" width="520" height="800" frameborder="0"></iframe>  
<% end if %>
<% if request.QueryString("adm")="2" then %>
<iframe src="http://www.info1.pl/administracja/apartamenty/pierwotny/deweloperzy/inwestycje/edycja.asp?idnad=<%=log_did%>" width="520" height="800" frameborder="0"></iframe>  
<% end if %>
<% if request.QueryString("adm")="3" then %>
<iframe src="http://www.info1.pl/administracja/apartamenty/pierwotny/deweloperzy/inwestycje/edycja.asp?idnad=<%=log_did%>&id=<%=SQLRepl(request.QueryString("id"))%>" width="520" height="800" frameborder="0"></iframe>  
<% end if %>
<% 
	if request.QueryString("adm")="5" then 
		%><!--#include file="devpanel.asp"--><%
	end if 
%>
<% end if %>
<% else %>
<%if (httphost <> "apartamenty.pl" and Request.ServerVariables("Query_String") = "") then%>
<table width="520" cellpadding="0" cellspacing="0">
<!-- #include file="ap_prasowy_lista.asp" -->
</table> 
<%end if%>
<%
if typ_pokazuj = TP_AKTUALNOSCI3 then
	%><!-- #include file = "ap_aktuaulnosci_glowna.asp" --><%
else %>
	<% if typ_pokazuj = TP_SALONY then %>
		<% if isnull(id_producenta) then %>
			<% if isnull(id_miasta) then %>
				<!-- #include file="ap_lokalizacja_sklepy.asp" --> 
			<% else %>
				<!-- #include file="ap_zapytanie_salony_inc.asp" -->
				<!-- #include file="ap_srodek_salony.asp" -->
			<% end if %>
		<% else %>
			<!-- #include file="ap_salony_prezentacja.asp" -->
		<% end if %>
	<% else %>
		<% if typ_pokazuj = TP_PORADNIKI then %>
			<!-- #include file="ap_produkty_srodek_poradniki.asp" --> 
		<% else %>
			<% if typ_pokazuj = TP_PRODUKTY or typ_pokazuj = TP_PORADNIK or typ_pokazuj = TP_PRODUCENCI then %>
				<!-- MOJE -->
				<!-- #include file="ap_produkty_zapytanie.asp" --> 
				<!-- #include file="ap_produkty_srodek.asp" --> 
			<% else %>
				<% if typ_pokazuj = TP_INNE then %>
					<% if isnull(id_miasta) then %>
						<!-- #include file="ap_lokalizacja_inne.asp" --> 
					<% else %>
						<!-- #include file="ap_zapytanie_inne_inc.asp" --> 
						<!-- #include file="ap_inne_srodek.asp" --> 
					<% end if %>
				<% else %>
					<% if typ_pokazuj = TP_USLUGI then %>
						<% if isnull(id_miasta) then %>
							<!-- #include file="ap_lokalizacja_uslugi.asp" --> 
						<% else %>
							<!-- #include file="ap_zapytanie_firmy_inc.asp" --> 
							<!-- #include file="ap_firmy_srodek.asp" --> 
						<% end if %>
					<% else %>
						<% if not isnull(id_prezentacji_bezpl) then %>
							<!-- #include file="ap_prezentacja_bezpl.asp" --> 
							<!-- #include file="ap_zapytanie_inc.asp" --> 
							<!-- #include file="ap_srodek_inc.asp" --> 
						<% else %>
							<% if not isnull(id_prezentacji) then %>
								<% if rynek = tr_pierwotny then %>
									<!-- #include file="ap_prezentacja.asp" --> 
								<% else %>
									<!-- #include file="ap_prezentacja_wtorny.asp" --> 
								<% end if %>
							<% else %>
								<% if typ_pokazuj=TP_LOKALIZACJA  then %>
									<% if rynek = TR_PIERWOTNY then %>
										<!-- #include file="ap_lokalizacja.asp" -->
									<% else %>
										<!-- #include file="ap_lokalizacja_wtorny.asp" -->
									<% end if %>
								<% else %>
									<% if Request.Querystring("ida")<>"" or Request.Querystring("idp")<>"" then %>
										<!-- #include file="ap_pokaz_artykul_sponsorowany.asp" -->
									<%elseif Request.QueryString("idm")<>"" then 
												Session("idm")=SQLRepl(Request.QueryString("idm"))
												Session("ds")=SQLRepl(Request.QueryString("ds"))
												Randomize
												Dim max,min
												set rsbaner = Server.CreateObject("ADODB.Recordset")
												set rsgorabaner = Server.CreateObject("ADODB.Recordset")
												set rsdolbaner = Server.CreateObject("ADODB.Recordset")
												if Request.QueryString("idm")<>"7" then
													rsbaner.open "SELECT * FROM t_banery a JOIN t_inwestycje b ON (a.id_inwestycji = b.id_inwestycji) WHERE miejscowosc="&SQLRepl(Request.QueryString("idm"))&" AND baner=1 and (gdzie=0 OR gdzie=2)",conn,1,3
												else
													rsbaner.open "SELECT * FROM t_banery a JOIN t_inwestycje b ON (a.id_inwestycji = b.id_inwestycji) WHERE (miejscowosc=32 or miejscowosc=39 or miejscowosc=40) AND baner=1 and (gdzie=0 OR gdzie=2)",conn,1,3
												end if
													rsgorabaner.open "SELECT * FROM t_banery a JOIN t_inwestycje b ON (a.id_inwestycji = b.id_inwestycji) WHERE miejscowosc="&SQLRepl(Request.QueryString("idm"))&" AND (baner=1 or a.id_inwestycji=1186) and (gdzie=0 OR gdzie=2) and (gora=1 or gora=2) ORDER by gora",conn,1,3
													rsdolbaner.open "SELECT * FROM t_banery a JOIN t_inwestycje b ON (a.id_inwestycji = b.id_inwestycji) WHERE miejscowosc="&SQLRepl(Request.QueryString("idm"))&" AND baner=1 and (gdzie=0 OR gdzie=2) and (dol=1 or dol=2) ORDER by dol",conn,1,3
												%>
												<% if rsbaner.recordcount>0 then
													max=rsbaner.recordcount
													min=1
													nrbaner = (Int((max-min+1)*Rnd+min))
													rsbaner.move(nrbaner-1) %>
													<% if rsgorabaner.recordcount>0 then %>
														<a href="?p=6,1,<%=rsgorabaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsgorabaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
													<% else %>
														<a href="?p=6,1,<%=rsbaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsbaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
													<% end if %>
													<br /><br />
													<% if rsbaner.recordcount>1 then 
														rsbaner.movenext
														if rsbaner.eof then
															rsbaner.movefirst
														end if%>
														<% if rsgorabaner.recordcount>1 then %>
															<% rsgorabaner.movenext %>
															<a href="?p=6,1,<%=rsgorabaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsgorabaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
														<% else %>
															<a href="?p=6,1,<%=rsbaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsbaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
														<% end if %>
														<br /><br />
													<% end if %>
												<% end if %>
                          <!-- #include file="gm3.asp" -->
													<script type="text/javascript"> 
												if( window.addEventListener )
													window.addEventListener( 'load', load, false ); 
												else 
													window.attachEvent( 'onload', load );
												</script>
												<% if rsbaner.recordcount>2 or rsdolbaner.recordcount>0 then 
													rsbaner.movenext
													if rsbaner.eof then
														rsbaner.movefirst
													end if%>
													<br /><br />
													<% if rsdolbaner.recordcount>0 then %>
														<a href="?p=6,1,<%=rsdolbaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsdolbaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
													<% else %>
														<a href="?p=6,1,<%=rsbaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsbaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
													<% end if %>
													<br /><br />
													<% if rsbaner.recordcount>3 or rsdolbaner.recordcount>1 then 
														rsbaner.movenext
														if rsbaner.eof then
															rsbaner.movefirst
														end if%>
														<% if rsdolbaner.recordcount>1 then %>
															<% rsdolbaner.movenext %>
															<a href="?p=6,1,<%=rsdolbaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsdolbaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
														<% else %>
															<a href="?p=6,1,<%=rsbaner("id_inwestycji")%>" target="_blank"><img src="oferty/pierwotny/<%=rsbaner("galeria")%>/b0.jpg" alt="" border="0" width="530"/></a>
														<% end if %>
														<br /><br />
													<% end if %>
												<% end if %>
												<table>
												<!-- #include file="ap_kurorty.asp" -->
												</table>
									<% else %>
										<% if not isnull(id_artykulu) then %>
											<% if(Request.QueryString("dyn") = "1") then %>
												<table width="520" cellpadding="0" cellspacing="0">
												<!-- #include file="ap_prasowy.asp" -->
												</table>
											<%else%>
												<!-- #include file="ap_pokaz_artykul.asp" -->
											<%end if%> 
										<% else %>
											<% if isnull(id_miasta) and isnull(id_agencji) and pierwotny_nazwa="" and pierwotny_developer="" then %>
												<!-- #include file="ap_glowna.asp" --> 
											<% else %>
												<!-- #include file="ap_zapytanie_inc.asp" --> 
												<% if rynek=TR_PIERWOTNY then %>
													<!-- #include file="ap_srodek_inc.asp" --> 
												<% else %>
													<!-- #include file="srodek_wtorny.asp" --> 
												<% end if %>
											<% end if %>
										<%end if%>
									<% end if %>
								<% end if %>
							<% end if %>
						<% end if %>
					<% end if %>
				<% end if %>
			<% end if %>
		<% end if %>
	<% end if %>
<% end if %>
<% end if %>
<% end if %>

<% if subdomena then %>
<!-- #include file="ap_pytanie_do_eksperta_inc.asp" -->
<% end if %>

<% if request("a") = 1 or admin = 1 and 1=0 then %>
<!-- #include file="ap_pytanie_do_eksperta_lista_inc.asp" -->
<% end if %>
<!-- #include file="last_topics_bottom.asp" -->
    </td>
	<td width="10"><img alt="" src="img/pix.gif" width="10" height="1" border="0"></td>
<td width="220" valign="top">
<!-- #include file="ap_prawa_inc.asp" -->
</td>
</tr>
</table>

</td><td width="10"></td><td valign="top">
<% 
	'response.write rynek &":P:"& TR_PIERWOTNY
	if rynek = TR_PIERWOTNY  then
%>

<%
	elseif lok_strona_glowna then 
%>

<% elseif typ_pokazuj = TP_PRODUKTY or typ_pokazuj = TP_PORADNIK or typ_pokazuj = TP_PRODUCENCI then %>

<% else %>

<% end if %>
</td></tr>

<tr><td colspan="3">
<!-- #include file="ap_stopka_inc.asp" -->
</td></tr>
</table>

<% if false then %>
<% end if %>

<!--#include file = "t_stat.asp" -->
<% if lok_strona_glowna then %>

<% elseif typ_pokazuj = TP_PRODUKTY or typ_pokazuj = TP_PORADNIK or typ_pokazuj = TP_PRODUCENCI then %>

<% elseif rynek = TR_PIERWOTNY then %>

<% else %>

  <% end if %>
</body>
</html>
<!-- Apartamenty -->
