diff -r 334e5669e158 -r 44647228cfb9 web/static/res/js/popup.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/static/res/js/popup.js Tue Jan 22 14:44:32 2013 +0100 @@ -0,0 +1,49 @@ +function toggle(div_id) +{ + var el = document.getElementById(div_id); + if ( el.style.display == 'none' ) { el.style.display = 'block';} + else {el.style.display = 'none';} +} + +var popupOn = false; +var playOnClose = false; +function popupPosition(windowname, contantId) +{ + if (!popupOn) { + return; + } + var blanket_height = $("#" + contantId).height(); + var window_width = $("#" + contantId).width(); + + var blanket = $("#blanket"); + + var popup = $("#"+windowname); + var popupHeight = popup.height(); + var popupTop = (blanket_height - popupHeight) / 2; + popup.css({"top" : + popupTop +'px'}); + + var popupWidth = popup.width(); + var popupLeft = (window_width - popupWidth) / 2; + popup.css({"left" : + popupLeft +'px'}); +} + +function popup(windowname, contantId) +{ + popupOn = !popupOn; + popupPosition(windowname, contantId); + toggle('blanket'); + toggle(windowname); +} + +function openClosePopup() { + if (popupOn) { + if (!incPlayer.popSeq.playing && playOnClose) { + incPlayer.ctrlPlay(); + playOnClose = false; + } + } else if (incPlayer.popSeq.playing) { + incPlayer.ctrlPlay(); + playOnClose = true; + } + popup('popUpDiv', 'content'); +}