
;;; Qui abbiamo pezzi di HTML
(use-plugin maruska)
(use-plugin caratter)
(use-plugin video)


;; ticket:
(use pg.persistent)
(use pg.agenzia)
;; trad hook!
(use pg)                                ;pg-ntuples
(use pg.sql)
(use pg-hi)
(use pg.types)


;; Qui abbiamo programmi/funzioni, che sono utili in generale. Alcune producono anche HTML.
(use fs.my-utils)
(use file.util)

;; maybe these 2 only in ticket.scm !! todo!
(use text.html-lite)
(use rfc.uri)

(use srfi-19)
(use srfi-13)

(use kahua.html)
(use kahua.wiki)
(use kahua.widgets)

(use mmc.log)
(use adt.string)
(use adt.alist)

(use kahua.language)
(use kahua.maruska)
(use kahua.style)
(use kahua.trad)
(use kahua.include)

(use kahua.ticket)

;;; 
(kahua-add-hook! 'initial open-translator)
(kahua-add-hook! 'terminal
                 (lambda ()
                   (logformat-color 'red "closing!")
                   (close-trad-db (translator-db))))




;; fixme: move elsewhere!  see ~/gauche/ga/gauche-kahua-mmc/kahua/html.scm  `foto-thumbnail-with-link'
;; foto-strip 


;; both text and img (foto) point at URL
(define (foto+text-cell url text sotto img-url img-title destra?) ;destra?... FOTO
  (let ((a (td: (div: (@: (align "center")) ;fixme: Why div?
		      (a: (@: (target "_top")
			      (href
			       url))
			  text
			  sotto))))
	(b (td:
	       ;;(div: align ="center" >
	       (a: (@: (target "_top")
		       (href
			url))
		   (img: (@: (align "middle")
			     (src img-url)
			     (alt " foto")
			     (title img-title)
			     ))))))
    (if destra?
	(node-set: a b)
      (node-set: b a))))


;; Crea 2 cellule di tabella, che contengono NOME & FOTO x rappresentare il TIKET.
;; todo: hide HELP
(define (ticket-widget destra? ticket help . rest)
  ;;  foto-url foto-title
  (let-optionals* rest
      ((sotto ""))                      ;fixme!
    (let* ((ticket-o (pg:find-tuple <pg:ticket-info> (x->string ticket)))
           (nome (slot-ref ticket-o 'nome)))
      (let ((numero (tickets-best pg ticket))) ;; `tickets-best'
        ;; (ticket-shift-donna numero)
        (let1 this-ticket-url (special-ticket-url help ticket)
          (foto+text-cell this-ticket-url
			  (__ "ticket" nome)
			  sotto
			  ;; (foto-thumbnail-with-link numero findex size width height)
			  (foto-url numero 0 2)
			  (s+ (_translate "foto di") " " (number->string numero))
			  destra?))))))


;; Central part (of 2nd column): 
(define (vetrina-ticket)
  ;;<table STYLE="background-image: url(/foto/icons/rosso.jpg)">
  ;; <!----parte interna -->
  (center:
   (table: (@:				;(width "98%")
	    (style "background-image: url(/foto/icons/white.jpg)")
					;(cellpadding "12")
	    (border "1"))
    (tr:
        (ticket-widget
         #t 0
         "/db/prima_pag.html")

      (ticket-widget
       #f 3                                ; uomini
       "/db/prima_pag_u.html"))

               
    (tr: (@: (bgcolor "FFFFFF"))
      (ticket-widget
       #t
       18
       "/db/prima_presentazione.html"
       (node-set:
        '(br)
        (img: (@: (alt (_translate "ragazze ancora senza proposte"))
                  (border "none")
                  (align "middle")
                  (src "/foto/icons/maruskamail.jpg")
                  (title (_translate "ragazze ancora senza proposte"))))))
      
      ;; amica in italia 15-->
      (ticket-widget
       #f
       70                               ;fixme!
       "/db/parla_italiano.html.it"	; amica_in_italia.html
       (node-set:
        '(br);; "friend in Italy"
        (img: (@: (alt (_translate "ragazze che parlano italiano"))
                  (border "none")
                  (align "middle")
                  (src "/foto/icons/dizionario.jpg") ;"/foto/icons/.thumbnails3/amiche.jpg"
                  (title (_translate "ragazze che parlano italiano"))))))) ;"friend in Italy"
    
    (tr: (@: (bgcolor "FFFFFF"))
      ;; Different!
      (foto+text-cell "/db/template_uomini/russo/parla_russo/elenco.html"
		      (_ "uomini che parlano russo")
		      ""
		      "/foto/icons/.thumbnails/phone.jpg"
		      ""
		      #t)

      (foto+text-cell (special-ticket-url
                                    "/db/oggi.html" 16)
		      (_ "Donne di oggi")
		      ""
		      "/foto/icons/monitor.jpg"
		      (_translate "le ragazze online oggi")
		      #f))

    (tr: (@: (bgcolor "FFFFFF"))
      (ticket-widget
       #t
       4
       "/db/compleanno.html"
       (node-set:
        `(br)
        (img:
         (@: (alt "foto")
             (border "none")
             (align "middle")
             (src "/foto/icons/.thumbnails/torta_candelina.jpg")
             (height "100")
             (title "chi compie gli anni oggi")))))
      (ticket-widget
       #f
       17
       "/db/compleanno_domani.html"
       (node-set:
        `(br)
        (img:
         (@: (alt "foto")
             (border "none")
             (align "middle")
             (src "/foto/icons/.thumbnails/torta_candelina.jpg")
             (height "100")
             (title "chi compie gli anni domani"))))))

    (tr: (@: (bgcolor "FFFFFF"))
      ;; <!-- speed-up !! 05 Oct 01 quelle in Italy  -->
                 
      (ticket-widget
       #t 7                             ; "женщины в Италии"
       "/db/italia.html"
       (node-set:
        '(br)
        (img: (@: (alt "foto")
                  (border "none")
                  (align "middle")
                  (src "/foto/icons/italia.jpg")
                  (height "80")
                  ;; fixme: translate!
                  (title "alcune ragazze che sono ora in Italia")))))


      ;;<td bgcolor="FFFFFF"  ><DIV ALIGN ="center" >
      ;;  speed-up !! intervista del giorno ticket=14-->

      ;; mmc: This is different!
      ;(td: (@: (colspan "2"))
      (video-frame-table
       "/elenco_video.html"
       (video-foto-link (video-rotate pg 18 24))
					;"/v/45846/0/f"                   ;fixme!
                                        ;"fotogramma della ripresa video di 45846/0"
       ;;"видео-интервью"
       (__ "ticket" "video")))

    (tr: (@: (bgcolor "FFFFFF"))
      ;; <!-- speed-up !! 05 Oct 01 quelle in Europa  -->
      (ticket-widget
       #t				;sinistra ?
       8
       "/db/europa.html"
       (node-set:
        ;; "женщины в UE"
        '(br)
        (img: (@: (alt "foto")
                  (border "none")
                  (align "middle")
                  (src "/foto/icons/europa_bandiera.jpg")
                  (height "60")
                  (title "alcune delle ragazze che vivono ora nella nuova Europa")))))

      (ticket-widget
       #f
       13
       ;; "/db/amica_in_italia.html"
       "/db/mamma_lontana.html"
       (node-set:
        ;; "женщины с родственниками в Италии!"
        ;; "женщины с подругами в Италии!"
        '(br)
        (img: (@: (alt "foto")
                  (border "none")
                  (align "middle")
                  (src "/foto/icons/.thumbnails3/busta.jpg")
                  (title "женщины с родственниками в Италии!"))))))


    
    ;; last line, different:
    (tr:
        (th: (@: (colspan "2"))
             (a: (@: (target "_top")
                     (href "/db/template_uomini/elenco.html"))
                 (_ "tutti gli uomini")))

      (th: (@: (colspan "2"))
           (a: (@: (target "_top")
                   (href "/db/elenco.html")) ;fixme: .en ??
               (_ "tutte le donne")))))))


;; Todo!
;; I could have a hook for `body', and here register (when in `admin' mode) to put some trad links!
(define (meta-information lingua)
  ;; (let ((lingua "ru"))
  (node-set:
   ;;
   (meta: (@: (http-equiv "Content-Type")
	      (content "text/html; charset=utf-8")))
     
   (meta: (@: (name "robots")
	      (content "index,follow")))

   ;; fixme: divide!
   (cond

    ((string=? "italiano" lingua)
     (meta: (@:
	     (name "Description")
	     (lang "it")
	     (content "agenzia matrimoniale Maruska"))))

    ((string=? "inglese" lingua)
     (meta: (@: (name "description")
		(lang "en")
		(content "maruska, international marriage agency"))))

    ((string=? "russo" lingua)
     (meta: (@: (name "Description")
		(lang "ru")
		(content
		 "Марушка, брачное агентство, всё бесплатно. новости на Интернете. Разрешите поблагодарить вас за то, что вы обратились в наше агентство. Прежде всего мы хотим объяснить вам, какие услуги мы вам предлагаем и как работаем. Наше агентство одно из самых больших в Европе (агентство работает с 1991 года)"))))


    ;; must be:
    (else "")
    )

   ;; keywords:
   (cond

    ((string=? "italiano" lingua)
     (meta: (@: (name "keywords")
		(lang "it")
		(content "agenzia matrimoniale Maruska,marriage agency,agenzie matrimoniali internazionali,ragazze russe,donne est europa,viaggi singles,agenzia russia,matrimonio,agenzia matrimoniale, bielorussia, russia, estonia, Lettonia, Lituania, ukraina, uzbekistan, Slovacchia, moldavia, repubblica Ceca, russo, marriage agency"))))

    ((string=? "russo" lingua)
     (meta: (@: (name "keywords")
	      (lang "ru")
	      (content "Марушка, брачное агентство, знакомства, поиск супруга, людей, супруги, семья,любовь,служба знакомств, люди,переписка,девушки  ,всё бесплатно, бесплатно,Интернет,встречи, agenzia matrimoniale maruska, marriage  agency, agence de marriage,italia"))))


    (else "")
    )))



;; new-line-in-table
;; 
(define (index-new-line)
  (tr:					;(@: (class "white"))
      (td:				;(@: (colspan "2")) ;why 2?
	  " " nbsp '(br))))


;;; elenco nell'indice e' diviso, ed ogni parte ha un `titolo:'
(define (index-title text)
  (node-set:
   (index-new-line)
   (tr: (@: (class "white"))            ; "vario"
     (td:                               ;(@: (colspan "2"))
         (strong: (__ "index" text))))))


;; We have a 1-column table, full of  links.
;; fixme: why table then?

;; todo:  `link-with-popup' (trad in admin)
;; invece le altre righe sono tutti dei link:
;; `title': LINK-NAME  (popup?)
;; 
(define (index-link-body link-name url body . rest)
  (let-optionals* rest
      ((top? #f)                        ; fixme!
       (row-class "white"))             ;"vario"
                                        ;(node-set:
    ;; Row in a table!
    (tr: (@: (class row-class))
      (td:                              ;(@: (colspan "2"))
          ;; mmc: I want to trad-edit the  link-name, which pops-up!
          (if (admin?)
              ;; (edit-trad
              (node-set: "[" (__ "link" link-name) "]")
            "")
        (a: `(@ (title ,(__ "link" link-name))
                ;; fixme!
                ,@(if top?
                      '((target "_top"))
                    ())
                (href ,url))
            body)))))

(define (index-link link-name url text . rest)
  (apply index-link-body link-name url (__ "index-text" text) rest))


;; Questo non traduce il testo
;; fixme: use  `index-link'
(define (index-link-quote link-name url text . rest)
  (apply index-link-body link-name url text rest))


;; Paragrafo (nella tabella dei link) dedicato ai meeting:
(define (index:meeting)
  (node-set:
   ;; Prima HOT topic

   ;; Scusate, ma disabilito!
   ;; (index-link
   ;;     "racconti dei meeting"
   ;;     "/ep/frame2?cols=28,72&amp;frame=meeting&amp;src=/meeting/index.ep&amp;frame=alice&amp;src=/meeting/alice.html"
   ;;     "racconti dei meeting" #t)

   ;; meeting futuri:
   (if #f
       (node-set:
	(index-link "la maniera migliore per incontrare di persona le ragazze nostre iscritte"
		    "/meeting/2007/index.html"
		    "prossimi meeting" #t)

	(index-link "" "/db/template_uomini/russo/meeting/elenco.html" "uomini ai meeting" #t)
	)
     "")

   (index-link "riprese video generali dei nostri meeting"
               "/ep/frame2?cols=240,1*&amp;frame=generali&amp;src=/video/generali.html&amp;frame=video&amp;src=/elenco_video.html"
               "video dei meeting" #t)
					; (tr: '(hr))
   ;; Poi interessante storia
   ;; link-name url text
   (index-link-quote "il racconto del viaggio del 2006" "/meeting/2006/racconto/index.html" "2006")
   (index-link-quote "il racconto del viaggio del 2005" "/meeting/2005/racconto/index.ep" "2005")
   (index-link-quote "il racconto del viaggio del 2004" "/meeting/2004/racconto/index.ep" "2004")
   (index-link-quote "il racconto del viaggio del 2003" "/meeting/2003/racconto/index.ep" "2003")
   (index-link-quote "il racconto del viaggio del 2002" "/meeting/2002/racconto/index.ep" "2002")
   (index-link-quote "il racconto del viaggio del 2001" "/meeting/2001/index.ep" "2001")
   (index-link-quote "il racconto del viaggio del 1999" "/meeting/index.html"  "1999")
					;'(hr)
   ;; Infine proprio il fondo
   (index-link "tutti i nostri meeting, dal 1991 ad oggi"
               "/meeting/elenco_meeting.html" "elenco tutti meeting")))


;;; Paragrafo di info generali
(define (index:agenzia)
  (node-set:
   (index-title "agenzia")
   (index-link "il nostro ufficio di Torino" "/info/agenzia/utili.html" "ufficio a Torino")
   (index-link "agenzia matrimoniale autorizzata" "/gov/agenzia/autorizzazioni.html" "licenze")
   ;;(index-link "ciao!" "/misc/appendice.html" "ciao!")
   ;; (index-link "anniversario" "/edu/saggi/anniversario_di_matrimonio.html" "anniversario")
   (index-link "aggiornamenti" "/aggiornamenti.html" "aggiornamenti")
   (index-link "la moglie nell'Est" "/edu/saggi/agenzia_matrimoniale_estero.html" "moglie dell'Est")
   (index-link "le frasi storiche" "/edu/saggi/frasi_storiche.html" "frasi storiche")
   (index-link "la storia dell'agenzia Maruska" "/storia/index.html"  "i nostri inizi")
   (index-link "GNU/LINUX" "/edu/comp/gnu_linux.html" "GNU/linux")
   (index-link "movimento degli invisibili" "http://movimentodegliinvisibili.it/gli-invisibili/" "movimento degli invisibili")))   
   ;; fixme:


;;<a target="_top" href="http://movimentodegliinvisibili.it/"><img border=none width="100" title="invisibili" src="/foto/icons/invisibili.jpg"></a>

;; (index-link "olimpiadi torino" "/olimpiadi_torino.html" "olimpiada Torino 2006")
   ;; (index-link "elenco delle iscritte all'agenzia Maruska" "/db/elenco.html" "elenco donne")
   ;; (index-link "elenco degli iscritti all'agenzia Maruska" "/db/template_uomini/elenco.html" "elenco uomini")


;; Info sui paesi
(define (index:info-est)
  (node-set:
   (index-title "info sull'est")
   ;; fixme:
   (index-link "le città e i paesi nei quali lavoriamo" "/edu/geo/info/index.html" "citta") ;fixme!
   (index-link "time-zone a est" "/ora_esatta.html" "zone orarie")

   (index-link "webcam nei paesi dell'est" "/webcam/index.html" "webcam" #t)
   (index-link "viaggiare a Est" "/meeting/percorsi/index.html" "viaggi all'est") ;fixme: nell'est
   (index-link "le banconote" "/edu/geo/soldi/index.ep" "soldi")
   (index-link "i prefissi telefonici" "/edu/geo/phone/index.html" "prefissi telefonici")
   (index-link "servizio postale" "/edu/corso/part/servizio_postale.ep"  "posta" #t)

   (index-link "email con i paesi dell'est" "/edu/corso/part/internet.html" "email" #t)
   (index-link "cartine e mappe" "/edu/geo/cartine/index.html" "carte")
   (index-link "curiosita' e consigli" "/edu/corso/part/index.html" "curiosità")
   (index-link "prodotti russi" "/edu/corso/part/negozi.html" "prodotti russi") ;fixme! 


   (index-link "dalle Anime morte di Gogol"
               "/ep/frame2?cols=150,150&amp;frame=terra_di_russiaindice&amp;src=/edu/corso/terra_di_russia.html&amp;frame=rus&amp;src=/edu/corso/rus.html"
               "Gogol" #t)

   (index-link "alcune canzoni ukraine" "/edu/corso/ukrajno/index.html" "canzoni ukraine")
   (index-link "i poeti e gli scrittori" "/edu/poe/index.ep" "scrittori")
   (index-link "arte" "/art/index.html" "arte")
   (index-link "gli inni nazionali" "/art/musica/index.html" "inni")
   (index-link "la cucina dell'Est" "/edu/geo/cucina/index.html" "cucina dell'est")))



;;; Elenco di link sulle pagine principali, organizzato ...
(define (indice static)
  ;; pagine in altre lingue:
  (table: (@: (cellpadding "0")
              (cellspacing "0")
              (border "0")
              ;;(bgcolor "#FF0000")
              (rules "none")
              (width "100%"))
    ;; list of Rows:
    ;;(node-set:
    ;; pagine in altre lingue:
    (tr: (td:
	     (if static
		 (static-page-in-languages "/index.html")
	       (page-in-languages))
	   
	   ;(page-in-languages)
	   ))      ;"path" () fixme: w/o admin!
    ;; Site-wide Text-Search
    ;;    (tr: (td:
    ;;             (site-wide-text-search)))
      (index-new-line)
    ;; Search for a person/numero
    (tr: (td:
             (form:cerca-caratter)))
    (index-new-line)
    
    (index-link "viaggiamo insieme" "/viaggiamo_insieme.html" "viaggiamo insieme" #t) ;top ?
    ;; FAQ
    (index-new-line)    
    (tr:
      (td:
	  ;; fixme: just to make a color?
          (table: (@: (order "0")
		      (rules "none"))
	    (tr: (@:
		  (class "white")
		  (bgcolor "FFFFFF"))	;white!
	      (td:
		  (a: (@: (href "/info/faq/")) "FAQ")))))) ;aprile_2006.html

    (index-new-line)
    (index-link "login" "/login" "login" #t)
    (index-link "new person" "/ep/f/new_person" "registrazione" #t)
    (index-new-line)
    (index-link "rispondiamo sempre" "/edu/corso/part/rispondiamo_sempre.html" "rispondiamo sempre" #f "white")
    
    (index-title "come funziona?")
    ; (index-new-line)

    ;; mmc: Switching:
    ;;(index-link "sintesi del lavoro che facciamo" "/m/sintesi.html" "info per uomo" #f "white")
    ;(tbody:
    (index-link "sintesi del lavoro che facciamo" "/m/index.html" "info per uomo" #f "white")
    (index-link "listino" "/m/listino.html" "listino" #f "white")

    ;(tr: (td: '(hr)))
    ;'(hr)
    ;; fixme?
    ; (index-new-line)
    ;(tbody:
    (index-link "per la donna" "/f/index.html" "info per donna");)
    
    (index-title "media") ;; Медиа о нас
    (index-link "gli articoli che parlano di noi" "/pr/articoli/index.html" "articoli")
    (index-link "le trasmissioni televisive" "/pr/tv/index.html" "TV")
    (index-link "le lettere dei nostri clienti" "/clienti/lettere/index.ep" "lettere")
    (index-link "alcune delle nostre coppie"
		(if (string=? (ref (current-translator) 'lingua) "russo")
		    "/clienti/index.ru.ep"
		  "/clienti/index.ep")
		"coppie")

    (index:info-est)

    (index-title "formalita") ;; <!-- burocrazia --></tr>
    (index-link "ambasciate" "/gov/ambasciate/index.html" "ambasciate")
    (index-link "visti" "/info/visti/index.html" "visti")


    ;; (index-link &nbsp 
    (index-title "lingue")
    ;; fixme:
    (index-link "appunti di russo" "/edu/corso/index.html" "appunti di russo")
    (index-link "corso d'italiano" "http://www.anriintern.com/ital/spisok.shtml" "corso d'italiano")
    (index-link "la traslitterazione" "/edu/translitterazione_ceca.html" "translitterazione")
    (index-link "le lingue slave" "/edu/corso/lingue_slave.html" "lingue slave")
    (index-link "le lingue slave" "/edu/corso/dizionari_online.html" "traduttori")
    (index-link "le lingue slave" "/edu/corso/dizionari_online.html" "dizionari")



    (index-title "viaggi")
    (index:meeting)

    
    (index:agenzia)

    ;; встречи 2006
    ;;"/meeting/2006/index.html")
    )
  ;; Todo:
  ;; links

  ;; free space, so we can use named links and skip to them..... Should they blink instead?..... just a hack!
  )


(define (login-box)
  ;; login:
  (round-frame
   (form: (@: (target "_top")
	      (method "post")
	      ;; (kahua-uri "login" "check-login" )
	      (action "/login"))
     ;; note: this style is bound w/ the round-frame!
     (table: (@: (style "background-image: url(/foto/icons/white.jpg)"))
       (tr:
	   (td: (@: (bgcolor "#FF0000"))
                                        ;(font color="#FFFFFF">
	     (font: (@: (color "#FFFFFF"))
	       (_ "numero") ;; "ID" nbsp "номер" nbsp

	       (input: (@: (type "hidden")
			   (name "expire")
			   (value "180")))))

	 (td: (@: (bgcolor "#FF0000"))
	   (input: (@: (type "text")
		       (size 8)
		       (maxlength 8)
		       (name "user")
		       (value "")))))
       (tr:
	   (td: (@: (bgcolor "#FF0000"))
	     (font: (@: (color "#FFFFFF"))
	       (_ "password")		; "секрет/пароль"
	       ))
	 (td: (@: (bgcolor "#FF0000"))
	   (input: (@: (type "password")
		       (size 15)
		       (maxlength 15)
		       (class "autosubmit")
		       (name "password")
		       (onchange "submit ()")
		       ))))
       (tr:
	   (td: (@: (bgcolor "#FF0000")
		    (colspan "2")
		    (align "right"))
	     (submit: (@:
		       (name "enter")	; fixme?
		       (value "enter")
		       (trad "entrare")
		       ;; (text (_ "entrare"))
		       ))))))))

;; 
(define (indirizzo-box)
  (round-frame
   ;; fixme!
   (let1 riga-di-indirizzo
       (lambda (body)
	 (tr: (td: (@: (nowrap "nowrap"))
		(font: (@: (size "1"))
		  body))))
     (table: (@: ;; (width "99%")
	      (style "background-image: url(/foto/icons/white.jpg)"))

       (riga-di-indirizzo (node-set:
			   (a: (@:
			       (href "http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+Bellotti+Bon+2,+Torino,&sll=45.08946,7.656999&sspn=0.011089,0.025105&ie=UTF8&ll=45.089551,7.656784&spn=0.011089,0.025105&z=15&iwloc=addr"))
			      
			      "via ")
			   (a: (@: (href "/info/agenzia/utili.html"))
			       "Bellotti Bon")
			   nbsp "2"  " - 10144 "  "Torino" ", "
			   (__ "stato" "Italia")))
       (riga-di-indirizzo (node-set:
			   ;; fixme:  orario!
			   (a: (@: (href "javascript:apri_orario();"))
			       (_ "orario")) " "
			   (__ "indirizzo" "telefono")  ": " "+39 0114374472"))

       (riga-di-indirizzo (node-set:
			   (__ "indirizzo" "mobil") ": " "+39 3406197704"))             (riga-di-indirizzo (node-set:
			   (__ "indirizzo" "tel-finlandia") ": "
			   "+35 8408696111"
			   ;;"+7 812 3235588"
			   ))
                                
;;       (riga-di-indirizzo
;;	(node-set:
;;	 (__ "indirizzo" "fax") ": " "+39 011480187"))

       (riga-di-indirizzo 
	(node-set: "skype: "
		   (a: (@: (href "skype:elisabettadecarli?chat"))
		       "elisabettadecarli")))


       (riga-di-indirizzo (node-set: (__ "indirizzo" "email") ":"
				     (a: (@: (href "mailto:m@ruska.it"))
					 "m@ruska.it")))
       ;; fixme: WE LOST:
       ;; (riga-di-indirizzo (node-set: (__ "indirizzo" "email") ":"
       ;;                                            (a: (@: (href "mailto:info@maruska.dyndns.org"))
       ;;                                                "info@maruska.dyndns.org")))


       (riga-di-indirizzo (node-set: "http://" (a: (@: (target "_top") (href "/"))
						   maruska-www-hostname)))))))

(define (home-superiore)
  (table:
      (tr:
          (td:
              ;;<!-- registrazione -->
              (round-frame
               (table: (@: (style "background-image: url(/foto/icons/white.jpg)"))
                 (tr:
                     (th: (@: (width "20%"))
                          (a: (@: (href "/ep/f/new_person")) ;fixme!
                              (_ "registrarsi")))))))

        (td: 
	    ;; Swapped Maruska
	    (round-frame
                                        ;<center>
	     (table: (@: (width "80%"))
	       (tr: (@: (bgcolor "white"))
		 (th: (@: (align "center")
			  (valign "top")
			  (nowrap "nowrap")) 
		      ;;(strong:
		      (__ "html_intestazione" "maruska")
		      ;; "МАРУШКА, брачное агентство"
		      ))))
	  )
        
        (td:
	    (login-box)))
    ;; 2nd row:
    (tr:
        ;;  aggiornamenti
        ;; todo:
        ;; (round-frame
        ;; (td bgcolor="#FF0000" width="4" height="4">
        ;; (img alt="bordo" src="/foto/icons/bordi/clear.gif"  width="4" height="4" border="0"></td>
        (td: (@: (colspan  "2")
		 (bgcolor "white"))
	  (node-set:

	   (if (string=? (ref (current-translator) 'lingua) "russo")
	       (javascript: "/jscript/data_r.js")
	     (javascript: "/jscript/data.js"))
	   (server-side-data-ora (current-date))))
      (td: (@: (rowspan "4"))
        ;;  `indirizzo' 
        ;; (td:  width="30%" rowspan="2">
	(indirizzo-box)))

    ;; mmc: if this one is removed we have to change above ... rowspan to only "2"
    (iff #f
	(tr:
	    (td: (@: (colspan "2"))
	      ;; Bettina's Add:
	      (round-frame
	       (table:
		   (@:  (width "99%")
			(style
			    "background: yellow"
			  ;;"background-image: url(/foto/icons/orange.jpg)" ;grey.jpg
			  )) 
		 (tr:
		     (td: (@: (nowrap "nowrap"))
		       (a: (@: (href "/meeting/invito.html"))
			   (__ "slogan" "Venite ai meeting")))

		   (td: (@: (nowrap "nowrap"))
		     (a: (@: (href "/m/iscrizione/2007/meeting_listino.html"))
			 (__ "slogan" "scadono gli sconti"))
		     ;; <!--приходите на нашу следушую <a target="_top" href="/meeting/2005/russo.ep"><strong> встречу!!!</a>-->

		     ;; <!--</td><td valign="middle" bgcolor="#FFFFFF"><a target="_top" href="/meeting/2005/russo.ep"><img border=none width="100" title="meeting" src="/foto/icons/gruppo.jpg"></a>-->
		     )))))))
    (tr:
	(td: (@: (colspan "2"))
	  (table: (@: (style "background: yellow"))
	    (tr: (@:)
	      (td: (@:)
		;;(round-frame
					;(node-set:
		(div: (@:)
					;(style "background: yellow"))
		      (wiki "index" "annuncio-top")

		      ;; [[/presentazioni-express.html][presentazioni express]]
		      ;;(include-file "annuncio-top.html")
		      ))
	      (td:
					;(div: (@:
					;	   (style "background: yellow"))
		  (a: (@:
		       (href "/m/offerte/")
					;(style "text-align: center")
		       )
		      (img: (@:
			     (height 75)
			     (alt "foto pubblicitaria")
			     (src "/foto/offerte.jpg")
			     ))))))))
    (tr:
	(td: (@: (colspan "2"))
	  (table: (@: (style "background: white"))
	    (tr: (@:)
	      (td: (@:)
		(div: (@:)
		      (wiki "index" "annuncio-novita")))
	      (td:
		  ;;(a: (@: (href "/novita.html"))
		  (img: (@:
			 (height 50)
			 (alt "Novita'")
			 (src "/foto/new.jpg"))))))))
    (tr:
        (td: (@: (colspan "2"))
          (round-frame
           (table:
               (@:  (width "99%")
                    (style
			"background: aquamarine"
		      ;;"background-image: url(/foto/icons/orange.jpg)" ;grey.jpg
		      )) 
             (tr:
                 (td: (@: (nowrap "nowrap"))
                   (a: (@: (href "/aggiornamenti.html"))
                       (__ "index-text" "aggiornamenti"))))))))
    (if (string=? (ref (current-translator) 'lingua) "italiano")
	""
      (tr:
	  (td: (@: (colspan "2"))
	    ;; Bettina's Add:
	    (round-frame
	     (table:
		 (@:  (width "99%")
		      (style "background-image: url(/foto/icons/white.jpg)"))
	       (tr:
		   (td: (@: (nowrap "nowrap"))
		     (__ "slogan" "Volete sposarvi") " "
		     (a: (@: (href "/f/index.html"))
			 (__ "slogan" "in Italia?") "..."))))))))))



;; non italiano:
(define (home-inferiore)
  (node-set:
   ;; fixme: `in-white-background' ... in-bianco
   (table: (@: (style "background-image: url(/foto/icons/white.jpg)"))
     (tr:
         (td:
          ;`(hr)
           (h2: (@: (class "node"))
                (_ "articoli"))
           (ul:
            ;; todo: Get it from a DB ?
            (li: (a: (@: (href "/pr/articoli/rigas_balss_ru.html"))
                     (__ "articolo" "rigas-balss")))
            (li: (a: (@: (href "/pr/articoli/lilit_russo.html"))
                     ;; fixme! no translation!
                     (__ "articolo" "lilit")))
            (li: (a: (@: (href "/pr/articoli/index.html"))
                     (__ "articolo" "in italiano"))))))
     (tr:
         (td:
          ;`(hr)
           (h2: (_ "lettere"))
           (ul:
            (li: (a: (@: (href "/clienti/lettere/index.ep"))
                     (_ "lettere in inglese ed italiano"))))
           ;;<table  STYLE="background-image: url(/foto/icons/white.jpg)">
           )))))



;;  abs-filename (build-path image-path anc-name))


(define-entry (index :keyword lingua admin static)
  (if lingua
      (declare lingua valid-lingua?)
    ;; fixme: in other apps I don't have this:
    (set! lingua (automatic-language)))
  ;; fixme: 
  (let1 t (prepare-translator
           lingua
           "m" ;;(x->string (row "sex"))
           admin (translator-db) pg)
    (with-translator t
      (if (admin?)
          (slot-set! t 'missing-hook keep-track-of-missing-trad))
      (list
       (html:
        (head:
         ;;<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"  "http://www.w3.org/TR/REC-html40/loose.dtd">
         (stylesheet: "/style/default.css")

         (title:
          (__translate "html_intestazione" "maruska")) ;; "Марушка, брачное агентство")
         (meta-information lingua)

         (javascript: "/jscript/promo.js")
         (javascript: "/jscript/data_r.js")

         ;; fixme: may I move it to where it is used?
         (javascript: "/jscript/swap.js")


         ;; fixme:  lingua!
         (javascript-source:
          "function apri_orario()
  {open('/info/agenzia/orario.html','orario', 'height=400, width=400, toolbar=1, scrollbars =no,resizable = no');};

function apri_ora_esatta()
  {open('/ora_esatta.html','ora_esatta',
'height=750, width=600, toolbar=1, scrollbars =no,resizable = no,title=\"время В восточной Европе\"')
;}") ;fixme!
  
         ;; <link REL="icon" HREF="/foto/icons/cuore.jpg" TYPE="image/jpg"  title="Марушка, брачное агентство">
         )

        (body: (@: (class "homew"))
          ;; The page is divided into 2 columns.

          (table: (@: (title "Maruska")
                      (style "background-image: url(/foto/icons/sfondi/margherite.jpg)") ;neve_blu.jpg
                                        ;(style "background-image: url(/foto/icons/sfondi/azzurro.jpg)")
                      (width "100%"))

            ;; mmc: Come e' la divisione di larghezza tra queste 2 colonne?
            ;; `Column-1'
            (tr:
                (td: (@: (valign "top")) ;fixme!  Should we have 2 TRs?
                  (indice static))

              ;; `Column-2':
              (td: (@: (valign "top"))

                                        ;(node-set:
                ;;  at the top:  |--- |-----| -----|
                ;;               |--------- |------|
                ;;
                (home-superiore)
                (vetrina-ticket)
		(iff (not (string=? lingua "italiano"))
		  (home-inferiore))
                '(br)
                ;; todo:  altri articoli!
                (include-file "articoli-top.html")))

            (tr:
                ;; licenza:
                ;; todo: include HTML file!  no-escape!
                (node-set:
                 (include-file "articoli.html")
                 (in-bianco
                  (address:
                   (__ "html_intestazione" "maruska") ": " ;; "Марушка, брачное агентство: ")
                   (a: (@: (href (s+ "mailto:" maruska-webmaster-email)))
                       "Michal Maruska & Elisabetta de Carli Maruskova.")))
                 (include-file "licenza.html"))
              ;; link di cortesia:
              ;; полезные ссылки
              ))
	  (youtube "H9ebMSsIEyc")
	  (youtube "bxZcxlUISmc")
	  ))))))


(initialize-main-proc index)
