PDA

View Full Version : Joomla CMS popup window needs to be centered.



jholstein
01-19-2006, 05:55 PM
Hello. I'm trying to figure out how to get this joomla add-on script to center the popup window on any size screen. I'm only seeing how to put it into an 'absolute' position. Does anyone know what needs to be changed in the code below to accomplish it being centered?




<?php
/**
* @copyright (C) 2000 - 2004 ExtremeTemplates.com
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* This module is Free
*/

/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

require_once( $mainframe->getPath( 'front_html', 'com_content') );


global $my, $mosConfig_shownoauth, $mosConfig_offset;

$access = !$mosConfig_shownoauth;

$contentid = intval( $params->get( 'contentid' ) );

$params->set( 'intro_only', 1 );
$params->set( 'hide_author', 1 );
$params->set( 'hide_createdate', 0 );
$params->set( 'hide_modifydate', 1 );

$row = new mosContent( $database );


?>
<SCRIPT language=JavaScript1.2>
// StopPressModule
// By Andy Sikumbang
// http://www.kanvasdigital.net
// Based on ContentAnywhere Module By Vrajesh And
// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use

//Specify rate of display (1/freq)
var freq=1

var random_num=Math.floor(Math.random()*freq)
if (random_num==0)
window.onload=initbox
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=16 //(must be divisible by 8)
var direction="up"

function initbox(){
if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie?
document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-410+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<45+scroll_top)
crossobj.top=parseInt(crossobj.top)+150+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode &&
document.compatMode!="BackCompat")? document.documentElement : document.body
}
</SCRIPT>

<div id=dropin style=" left: 266px; visibility: hidden; width: 620px; position: absolute; TOP: 222px; HEIGHT: 440px; padding:5px; border:1px solid #cccccc; BACKGROUND-COLOR: #ffffff">
<TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
<TBODY>
<TR>
<TD bgColor=#999999>
<DIV align=center style="font-family:Arial, Helvetica, sans-serif; font-size:14px; color:#FFFFFF; "><STRONG>LQCAL OPEN</STRONG> | <A style="color:#000000; " onclick="dismissbox();return false"
href="index.php?option=com_mamboezine&Itemid=84" ?>Close</A> </DIV></TD>
</TR></TBODY></TABLE>
<div style=" height:440px;overflow:auto; padding:5px; "><? $row->load( $contentid );
$row->text = $row->introtext;
HTML_content::show( $row, $params, $access, 0, 'com_content' ); ?>
</div>
</DIV>