    // megosztott, közös dolgok
    var Hallatlan = {

        options: {

            url: "",
            mediaBaseUrl: "http://www.hallatlan.hu/media/",
//            mediaBaseUrl: "http://localhost/hallatlan3/",
            lang: "hu"

        },
        
        goToUrl: function(url) {
          
            document.location.href = this.options.url + this.options.lang + "/" + url;
          
        },
        
        jumpTo: function(_select, url) {

            var v = $(_select).get("value");
            if (!v || v == "-") return;
            document.location.href = this.options.url + this.options.lang + url + v;

        },
        
        jumpToJel: function(_select, params) {
          
            var v = $(_select).get("value");
            if (!v || v == "-") return;
            document.location.href = this.options.url + this.options.lang + "/jelek/" + params + "/" + v + ".html";
          
        },
        
        Flash: {
          
            mediaData: [],
          
            show: function(id, fileName, extra_variables) {
              
                var container = "flashcontent_"+id;
                var meret = "normal";
                
                if (id == "hir") {
                  
                    meret = "big";
                  
                }

                var filepath = Hallatlan.options.mediaBaseUrl+fileName;
                
                // local teszt
                if (fileName == "26/bavar00.flv") filepath = Hallatlan.options.url+"media/"+fileName;
                
                // a jeleknél más lejátszóra van szükség
                var playertype = "general";
                if (extra_variables == "jelplayer") {
                  extra_variables = "";
                  playertype = "jel";
                }

                this.mediaData[id] = {
                    url: filepath,
                    meret: meret,
                    container: container,
                    playertype: playertype,
                    kit: fileName.substr(fileName.length-3, 3),
                    vars: $pick(extra_variables, {} )
                }
                this.insertFlash(id);
                // $("flashcontent").set("html", "<img src='http://localhost/hallatlan3/templates/images/flv_shot.png'>");
                // var div = new Element("div");
                // div.set("html", '<p align="center"><input type="button" value="Nagyobb méret" id="zoomBtn_'+id+'" class="zoomBtn" onclick="Hallatlan.Flash.zoom(\''+id+'\')"></p>');
                // div.inject($("flashcontent"), "after");

            },

            insertFlash: function(id) {
              
                var w = 335;
                var h = 296;
                
                if (this.mediaData[id].meret == "big") {
                    w = 470;
                    h = 415;
                }
                
                // általános lejátszó
                if (this.mediaData[id].playertype == "general") {
                
                        if (this.mediaData[id].kit == "swf") {
                          
                            // régi swf jelek
                            new Swiff(this.mediaData[id].url, {
                                id: "flashMedia_"+id,
                                width: w,
                                height: h,
                                container: this.mediaData[id].container,
                                params: {
                                    wmode: "opaque",
                                    salign: "lt",
                                    menu: "false",
                                    bgcolor: "#000000"
                                },
                                vars: Hallatlan.Flash.mediaData[id].vars
                            });
        
                        } else {
        
                            // új flv jelek, közös lejátszóval
                            new Swiff(Hallatlan.options.url+"media/player/player.swf", {
                                id: "flashMedia_"+id,
                                width: 400,
                                height: h,
                                container: this.mediaData[id].container,
                                params: {
                                    wmode: "opaque",
                                    bgcolor: "#F2F0E9",
                                    loop: "true",
                                    allowScriptAccess: "sameDomain",
                                    allowFullScreen: "true"
                                },
                                vars: {
                                    VidURL: this.mediaData[id].url,
                                    SkinURL: Hallatlan.options.url+"media/player/skin.swf"
                                }
                            });
        
        
                        }
                }

                // jeleknél használt lejátszó
                if (this.mediaData[id].playertype == "jel") {
                  
//                    new Swiff(Hallatlan.options.url+"media/player/jelplayer_dialektusrol.swf", {
                    new Swiff(Hallatlan.options.url+"media/player/jelplayer_jw_4.4.swf", {
//                    new Swiff(Hallatlan.options.url+"media/player/jelplayer_jw_3.99.swf", {
                        id: "flashMedia_"+id,
                        width: 335,
                        height: (296+10),
//                        height: 296,
                        container: this.mediaData[id].container,
                        params: {
                            wmode: "transparent",
                            loop: "true",
                            allowScriptAccess: "sameDomain",
                            allowFullScreen: "true",
                            bgcolor: "#F2F0E9"
                        },
                        vars: {
                            shownavigation: "true",
                            repeat: "always",
                            autostart: "true",
                            file: this.mediaData[id].url,
                            fullscreen: "true",
                            stretching: "none"
                        }
                    });
                            
                }
                
            },
            
            zoom: function(id) {

                if (this.mediaData[id].meret == "normal") {
                  
                    this.mediaData[id].meret = "big";
                    $("zoomBtn_"+id).value = "Kisebb méret";
                  
                } else {
                  
                    this.mediaData[id].meret = "normal";
                    $("zoomBtn_"+id).value = "Nagyobb méret";
                  
                }
                this.insertFlash(id);
          
            }
            
        },
        
        Komment: {
          
            checkForm: function() {
              
              
                var f = $("kommentform");
                f.getElement("textarea").value = f.getElement("textarea").value.stripScripts().trim();
                if (f.getElement("textarea").value.length == 0) {
                  
                    alert("Nem írt be üzenetet!");
                    return;
                  
                }
                f.submit();

            }
          
        },
        
        Ertekeles: {
          
            sendErtekeles: function(dialektusid, _select) {
              
                if (Hallatlan.options.logged_in == false) {

                    alert(lang.error_not_logged_in);
                    return;

                }
              
                var szam = $(_select).getSelected().get('value')[0].toInt();
                var jsonRequest = new Request.JSON({
                  url: Hallatlan.options.url+Hallatlan.options.lang+"/ajax/",
                  onComplete: function(atlag){
                      
                      $("sajatErtekelesDiv"+dialektusid).set("html", szam);
                      $("atlag"+dialektusid).set("html", atlag);
                      
                  }
                }).post({
                  'module': 'dialektus',
                  'action': 'sendErtekeles',
                  'szam': szam,
                  'dialektusid': dialektusid
                });
              
            },
          
            sendIgenNem: function(dialektusid, tipus, ertek) {
              
                if (Hallatlan.options.logged_in == false) {

                    alert(lang.error_not_logged_in);
                    return;

                }
              
                var jsonRequest = new Request.JSON({
                  url: Hallatlan.options.url+Hallatlan.options.lang+"/ajax/",
                  onComplete: function(ret){
                      
                      $(tipus+"Div"+dialektusid).set("html", "<input type='radio' disabled checked /> "+ertek);
                      $(tipus+"Ertekek"+dialektusid).set("html", "igen: "+ret.igen+", nem: "+ret.nem);
                      
                  }
                }).post({
                  'module': 'dialektus',
                  'action': 'sendIgenNem',
                  'tipus': tipus,
                  'ertek': ertek,
                  'dialektusid': dialektusid
                });
              
            }

       },

       startChat: function() {
          var w = 810;
          var h = 550;
          var xc =(screen.width - w) / 2;
          var yc =(screen.height - 25 - h) / 2;
          popupwin = window.open('http://www.hallatlan.hu/chatr/','','width='+w+',height='+h+',status=0,resizable=0,scrollbars=yes');
          popupwin.moveTo(xc, yc);
       },
       
       Ajax: {
       
           lapozas: function(merre, id) {
           
                var url = $(merre+"URL").getProperty("href");
                if (!url) return;
                
                if (window.location.href.contains("#")) {
                
                    var temp = window.location.href.split("#");
                    var urlWithHashmark = temp[0]+"#";
                
                } else {

                    var urlWithHashmark = window.location.href+"#";

                }
                window.location.href = urlWithHashmark + id;
                
                url = url + "?ajax=1";
                if (lapozas != "") url = url + "&lapozas="+lapozas+"&betuid="+betu;
                $("content").load(url);
                
                window.setTimeout("Hallatlan.Ajax.setTitle()", 750);
           
           },
           
           setTitle: function() {
                document.title = $$("#jelnev h2").get("text");
           }
       
       }
       
    }

    function on(mi)   { mi.style.backgroundColor='#f1f1e9'; mi.style.cursor = 'pointer'; }
    function off(mi)  { mi.style.backgroundColor='#FFFFFF'; }

    var marquee_obj;

    window.addEvent('domready', function() {

        if (Cookie.read("fontSize")) fontResize.resize('', Cookie.read("fontSize"));
        if ($('marquee')) {
            marquee_obj = new mooquee($('marquee'), {
              direction: "left",
              marWidth: 470
            });
        }

        // megnézzük, hogy van-e hashmark a linkben
        // ha van, akkor redirecteljük az embert
        if (window.location.href.contains("#")) {
        
            var temp = window.location.href.split("#");
            window.location.href = Hallatlan.options.url + Hallatlan.options.lang + "/jel/get-"+temp[1]+".html";
        
        }

        // ha jel oldalon vagyunk, inicializáljuk a slideshow-t is.
        if ($("slideShowTimeout")) Slideshow.init();

    });
