/* ********************************** * By: Johan Larsson, imCode * * Copyright © imCode AB * * www.imcode.com * ************************************/ function openInPopup ( metaId, windowName, template ) { var url = '/en' + '/' + metaId; if ( undefined != template && template.length > 2 ) { url += '?template=' + template } var width = 750; var height = 750; var left = centerLeft (width); var top = centerTop (height); return window.open(url, windowName, 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',resizable=yes,scrollbars=yes,status=no,menubar=no,location=no,directories=no,toolbar=no,personalbar=no,dependent=yes'); } function openTheory ( metaId ){ var url = '/en' + '/' + metaId; var width = 750; var height = 750; var left = centerLeft (width); var top = centerTop (height); return window.open(url,'Theory','width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',resizable=yes,scrollbars=yes,status=no,menubar=no,location=no,directories=no,toolbar=no,personalbar=no,dependent=yes'); } function openWhy ( metaId, headlineId, textId ){ var url = '/en' + '/' + '1068?meta=' + metaId + '&headline=' + headlineId + '&bodyText=' + textId; var width = 725; var height = 380; var left = centerLeft (width); var top = centerTop (height); return window.open(url,'Theory','width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',resizable=yes,scrollbars=yes,status=no,menubar=no,location=no,directories=no,toolbar=no,personalbar=no,dependent=yes'); } function centerLeft (width){ var windowPosX = 0; var windowWidth = 0; if ( window.screenX ) { windowPosX = window.screenX; } else { if ( window.screenLeft ) { windowPosX = window.screenLeft; } } if ( window.outerWidth ) { windowWidth = window.outerWidth; } else { if ( null != document.body.clientWidth ) { windowWidth = document.body.clientWidth; } } return windowPosX + ((windowWidth-width)/2); } function centerTop (height){ var windowPosY = 0; var windowHeight = 0; if ( window.screenX ) { windowPosY = window.screenY; } else { if ( window.screenLeft ) { windowPosY = window.screenTop; } } if ( window.outerWidth ) { windowHeight = window.outerHeight; } else { if ( null != document.body.clientWidth ) { windowHeight = document.body.clientHeight; } } return windowPosY + ((windowHeight-height)/2); }