document.onselectstart = function() {
	if (event.srcElement != document.getElementById('searchInput')) return false;
	return true;
};

function AddToInput(s)  {
	mezo = document.getElementById('searchInput');
	if (document.selection) { //Internet Explorer
		mezo.focus();
		var sel = document.selection.createRange();
		sel.select();
		sel.text = '';
		sel.select();
		sel.text = s;
	} else { //MOZILLA & others
		var leftText = mezo.value.slice(0, mezo.selectionStart);
		var rightText = mezo.value.slice(mezo.selectionEnd);
		mezo.value = leftText + s + rightText;
		mezo.selectionStart=mezo.value.length-rightText.length;
		mezo.selectionEnd=mezo.selectionStart;
	};
	mezo.focus();
	return false;
};


function flash() {
    var obj, version;
    if (window.ActiveXObject) {
        try {
            obj = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.7');
        } catch(e) {
            try { 
                obj = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');                     
                version = [6, 0, 21];
                obj.AllowScriptAccess = 'always';
            } catch(e) {
                try {
                    obj = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
                } catch(e) {
                    return 0;
                }
            }
              
        }
        try {
            version = obj.GetVariable('$version').split(' ')[1].split(',');
        } catch(e) { }
    } else {
        if (navigator.plugins && navigator.mimeTypes.length) {
            obj = navigator.plugins['Shockwave Flash'];
            if (obj && obj.description) {
                version = obj.description.replace(/([a-z]|[A-Z]|\s)+/, '').replace(/(\s+r|\s+b[0-9]+)/, '.').split('.');
            }
        }               
    }
    return ((!!version) ? 1 : 0);
}

if(typeof(p) == 'undefined') p = {}
p.m = {
    x: null,
    y: null,
    toggle: function(r, u) {
        if (p.m.x == r) p.m.destroy()
        else {
            if (p.m.x) p.m.destroy();
            if (flash()) {
                r.src = '/kereso/s2.png'; r.title = 'stop'; p.m.x = r;
                p.m.y = document.createElement('span');
                p.m.y.innerHTML =
                '<object id="s" width="0" height="0" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">' +
                '<param value="sameDomain" name="allowScriptAccess" />' +
                '<param value="/kereso/s.swf" name="movie" />' +
                '<param value="u='+u+'.mp3" name="flashVars" />' +
                '<param value="high" name="quality" />' +
                '<param value="transparent" name="wmode" />' +
                '<embed width="0" height="0" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="sameDomain" name="s" quality="high" flashvars="u='+u+'.mp3" src="/kereso/s.swf" />' +
                '</object>';
                r.parentNode.insertBefore(p.m.y, r.nextSibling)
            } else {
                window.open(u, 'SVMP3', '');
            }
        }
        },
    destroy: function() {
        p.m.x.src = '/kereso/s.png'; p.m.x.title='play'; p.m.x = null
        p.m.y.removeChild(p.m.y.firstChild); p.m.y.parentNode.removeChild(p.m.y); p.m.y = null
    },
    makeToggle: function(r, u) { 
        return function(){
            p.m.toggle(r, u)
        }
        }
}
function g(id) {
    var table=document.getElementById(id);
    if (table) {
        var rows=table.rows;
        for (var i = 0; i <rows.length; i++) {
            var cells = rows[i].cells;
            for (var j=0; j<2; j++) {
                var o = null;
                var r = null;
                if (j==0) {
                    o=cells[0].childNodes[0];
                    r = playCreate(o);
                    if (r) {
                        cells[j].insertBefore(r, o);
                    }
                } else {
					o=cells[1].childNodes[0]; 
                    r = playCreate(o);
                    if (r) {
                        cells[j].insertBefore(r, o);
                    }
                }
            }
        }
    }
}
function playCreate(o) {
    if (!o) return false;
    if (o.href && o.href.indexOf('/mp3/') !=-1 ) {
        var r = document.createElement('img');
        r.src = '/kereso/s.png';
        r.title = 'Play';
        r.height = 12;
        r.width = 14;
        r.style.marginRight = '4px';
        r.style.cursor = 'pointer';
        r.style.verticalAlign = 'middle';
        r.style.border = '0';
        r.onclick = p.m.makeToggle(r, o.href.substring(o.href.indexOf(document.domain)+document.domain.length));
        return r;
    } else {
        return false;
    }
}
