// JavaScript Document
// iauea ne?eiou

function OpenWindow( sUri, iWidth, iHeight )
{

	var sWindowName = 'win' + Math.floor( Math.random()*1000 )
	var iRealWidth = iWidth ? iWidth : 600
	var iRealHeight = iHeight ? iHeight : screen.height - 300

	var iLeft = Math.round( (screen.width-iRealWidth)/2 )
	var iTop =  Math.round( (screen.height-iRealHeight)/2 ) - 35

	var sWindowOptions = 'status=yes,menubar=no,toolbar=no'
	sWindowOptions += ',resizable=yes,scrollbars=yes,location=no'
	sWindowOptions += ',width='  + iRealWidth
	sWindowOptions += ',height=' + iRealHeight
	sWindowOptions += ',left='   + iLeft
	sWindowOptions += ',top='    + iTop

	var win = window.open( sUri, sWindowName, sWindowOptions )
	win.focus()

	return win
}


function CloseWindow()
{
	if( window.opener )
	{
		window.opener.top.location.href = window.opener.top.location.href + '?%20'
		window.opener.focus()
	}
	window.close()
	return false
}




function LoadXml( sUrl )
{
	var oXMLHttpRequest

	// MSIE?
	try { oXMLHttpRequest = new ActiveXObject('Msxml2.XMLHTTP') }
	catch ( oError )
	{
		// Mozilla?
		try { oXMLHttpRequest = new XMLHttpRequest() }
		catch ( oError ) { return null }
	}

	oXMLHttpRequest.open('GET', sUrl, false)
	oXMLHttpRequest.setRequestHeader('If-Modified-Since', 'Thu, 22 Nov 2001 00:00:01 GMT')
	oXMLHttpRequest.send(null)
	return oXMLHttpRequest.responseXML
}


/*****************************
**   Event listeners
******************************/

function addEvent(objElement, strEventType, ptrEventFunc) {
	if (objElement.addEventListener) objElement.addEventListener(strEventType, ptrEventFunc, false);
		else if (objElement.attachEvent) objElement.attachEvent('on' + strEventType, ptrEventFunc);
}

function removeEvent(objElement, strEventType, ptrEventFunc) {
	if (objElement.removeEventListener) objElement.removeEventListener(strEventType, ptrEventFunc, false);
		else if (objElement.detachEvent) objElement.detachEvent('on' + strEventType, ptrEventFunc);
}


// Additional functions

var CurrentCategory = 1;

function OpenDiscoCategory(pos)
{
	if(CurrentCategory != pos){
		var oldcat = document.getElementById("category" + CurrentCategory);
		var newcat = document.getElementById("category" + pos);
		var oldcattitle = document.getElementById("categorytitle" + CurrentCategory);
		var newcattitle = document.getElementById("categorytitle" + pos);
		oldcattitle.className = "discocategoryopener";
		newcattitle.className = "discocategoryopener-hit";
		oldcat.style.display = "none";
		newcat.style.display = "";
		CurrentCategory = pos;
	}
}



