function ShowPopupWindow(url, width, height)
{
  if (window.showModalDialog)
  {
    window.showModalDialog(url,null,"dialogWidth="+width+"px;dialogHeight="+height+"px");
  }
  else
  {
    window.top.captureEvents (Event.CLICK|Event.FOCUS);
	window.top.onclick=null;
	window.top.onfocus=null;
    winModalWindow = window.open (url,null, "modal=yes,dependent=yes,scrollbars=yes,width=" + width + ",height=" + height);
  }
}

function getXY(Obj) 
{
	for (var sumTop=0,sumLeft=0;Obj!=document.body;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.offsetParent);
	return {left:sumLeft,top:sumTop}
}



// --------------------
// Scrolling news functions
// --------------------

function getObject( obj ) {
	var strObj
	if ( document.all ) {
		strObj = document.all.item( obj );
	} else if ( document.getElementById ) {
		strObj = document.getElementById( obj );
	}
	return strObj;
}

var theHeight = 200;
var theWidth = 200;
var theLeft = 5;
var toClip = 195;

var news = 0;
var events = 1;
var Divs = new Array();
Divs[news] = 'news';
Divs[events] = 'events';


var DivParents = new Array();
DivParents[0] = 'news_container';
DivParents[1] = 'events_container';


function scrollDiv( idx , toMove ) {
	newsDiv = Divs[idx];
	theDiv = getObject( newsDiv.toString() );
	if( theDiv != undefined )
	{
		theTop = 0;
		theTop = getXY(getObject(DivParents[idx])).top;
 		if ( theDiv == null ) { return; }

		if ( document.layers ) {
			theDiv.clip.top = toMove;
			theDiv.clip.bottom = toMove + toClip;
			theDiv.top = theTop - toMove;
		} else {
			theDiv = theDiv.style;
			theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)";
			theDiv.top = theTop - toMove + 'px';
		}

	//	if ( ( theTop + theHeight - toMove ) < ( theTop - theHeight ) ) {
		if ( toMove >= theHeight ) {
			toMove = 0;

			if ( document.layers ) {
				theDiv.clip.top = theTop;
				theDiv.clip.bottom = toClip;
				theDiv.top = theTop;
			} else {
				theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " + (toMove + toClip) + "px 0px)";
				theDiv.top = theTop + 'px';
			}
		}
		toMove = (toMove + 1);
		setTimeout("scrollDiv(" + idx + "," + toMove + ")", 150);
	}
}

