var cutwin = null; var detwin = null; function closePopup() { // if (detwin != null && !detwin.closed) { // detwin.close(); // } // if (cutwin != null && !cutwin.closed) { // cutwin.close(); // } } function showStory(rec,tcin,tcout,cut) { var loc = '/' + subsystem + '/query/storyboard.php?sid=?' + '&id=' + rec + '&in=' + tcin + '&out=' + tcout + '&cut=' + cut + '&mode=list' + '&maxdepth=hour' + '&public=1'; cutwin = open(loc,'popup_storyboard','width=1024,height=736,resizable=1'); cutwin.moveTo(0,0); cutwin.focus(); return false; } var playouturl = ''; var staturl = ''; var statpars = ''; var currplaycnt = null; var checktimeout = null; var tocachestarted = false; function showPreview(rec,tcin,tcout,cliptitle,format, document_id, playcnt) { if (format == null) { format = 'auto'; } if (format != 'mpeg') { var loc = '/' + subsystem + '/query/playout.php?' + 'id=' + rec + '&public=1' + '&document_id=' + document_id + '&in=' + tcin + '&out=' + tcout + '&format=' + format + '&title=' + cliptitle; //alert(loc); top.location.href = loc; return false; } else { // mpeg staturl = '/' + subsystem + '/query/mpeg_cache.php'; playouturl = '/' + subsystem + '/query/playout.php?' + 'id=' + rec + '&public=1' + '&document_id=' + document_id + '&in=' + tcin + '&out=' + tcout + '&format=' + format + '&title=' + cliptitle; statpars = 'id=' + rec + '&in=' + tcin + '&out=' + tcout; if (currplaycnt != null) { Element.hide('video_status_' + currplaycnt); } currplaycnt = playcnt; stopMpegCheck(); tocachestarted = false; checkMpeg(0); } } function onMpegCheckComplete(req) { var resp = req.responseText.split('\n'); if (resp.length > 0) { if (resp[0] == 'INCACHE') { hideCheckInfo(); top.location.href = playouturl; } else if (resp[0] == 'NOTINCACHE') { if (tocachestarted) { if (!Element.visible('video_status_' + currplaycnt)) { Element.show('video_status_' + currplaycnt); } eta = (resp.length > 1) ? resp[1] : ''; $('video_status_eta_' + currplaycnt).innerHTML = eta; checktimeout = setTimeout("checkMpeg(0)", 3000); } else { if (confirm('A videó betöltése akár egy fél óráig is eltarthat,\nbiztosan be akarod tölteni?')) { tocachestarted = true; checkMpeg(1); } else { hideCheckInfo(); } } } else { hideCheckInfo(); alert('A keresett felvetel nem erheto el MPEG formatumban.'); } } } function checkMpeg(tocache) { req = new Ajax.Request(staturl, { method: 'get', parameters: statpars + '&tocache=' + tocache + '&time=' + (new Date()).getTime(), onComplete: onMpegCheckComplete }); } function stopMpegCheck() { if (checktimeout != null) { clearTimeout(checktimeout); checktimeout = null; } } function hideCheckInfo() { Element.hide('video_status_' + currplaycnt); } /* Original taken from http://faqts.com/knowledge_base/view.phtml/aid/1606 */ function containsDOM (container, containee) { var isParent = false; do { if ((isParent = container == containee)) break; containee = containee.parentNode; } while (containee != null); return isParent; } function checkMouseEnter (element, evt) { if (element.contains && evt.fromElement) { return !element.contains(evt.fromElement); } else if (evt.relatedTarget) { return !containsDOM(element, evt.relatedTarget); } } function checkMouseLeave (element, evt, except) { if (element.contains && evt.toElement) { return !element.contains(evt.toElement) && (except == null || evt.toElement != except); } else if (evt.relatedTarget) { return !containsDOM(element, evt.relatedTarget) && (except == null || evt.relatedTarget != except); } }