/* 
 * resize autoget window measures
 */
var height = 0;
var width = 0;
 
function getWindowWidth() {
  if (window.innerWidth)
    return window.innerWidth;
  if (document.documentElement && document.documentElement.clientWidth)
    return document.documentElement.clientWidth;
  return 0;
}

function getWindowHeight() {
  if (window.innerHeight)
    return window.innerHeight;
  if (document.documentElement && document.documentElement.clientHeight)
    return document.documentElement.clientHeight;
  return 0;
}

function adjustResize () {
	width = getWindowWidth();
	height = getWindowHeight();
	
	document.getElementById('td_pane').height = height - 96;
	document.getElementById('contentframe').height = height - 96;
	document.getElementById('td_bluetube').height = height - 152;
}

// event handler initialization for Netscape
if (!window.width && window.innerWidth) {
	window.onresize = adjustResize;
	width = getWindowWidth();
	height = getWindowHeight();
}


/* Event handler initialization of onresize for IE
 * we have to put this into a function and call it after the body tag was written,
 * because otherwise it won't work for IE. For Netscape this is not nessecary, so
 * we call it directly in the prebody-script block above
 */
function initAdjustResizeEventIE ()
{
	if (!window.width && document.body && document.body.offsetWidth) {
 		window.onresize = adjustResize;
		width = getWindowWidth();
		height = getWindowHeight();
	}
}


/*
 * unhilight all menu points
 */
function unhilight ()
{
	// Unhilight Menu Categories
	var i=1;
	var mcat = document.getElementById('mcat'+i);

	while (mcat != null)
	{  
		mcat.className='submenuheader';
		i++;
		mcat = document.getElementById('mcat'+i);
	}
	
	
	// Unhilight Submenupoints
	i=1;
	var mp = document.getElementById('mp'+i);
	
	while (mp != null)
	{
		mp.className='menu';
		i++;
		mp = document.getElementById('mp'+i);
	}
}

/*
 * hilighting a menu point
 */
function hilight (obj)
{
	unhilight();
	obj.className='menu_hi';
}

/*
 * hilighting a menu category
 */
function hilightCat (obj)
{
	unhilight();
	obj.className='submenuheader_hi';
}


/*
 * expand a submenu
 */
function expand_collapse(mcatid)
{
	var mcat = document.getElementById('mcat'+mcatid+'_table');
	
	if( mcat.style.visibility == 'visible')

		mcat.style.visibility = 'collapse';
	else
		mcat.style.visibility = 'visible';
}

function collapseAll()
{
    var i=1;
	var mcat = document.getElementById('mcat'+i+'_table');
	
	while (mcat != null)
	{  
		mcat.style.visibility='collapse';
		i++;
		mcat = document.getElementById('mcat'+i+'_table');
	}
}

/*
 * moving the light vertically
 */
var ylight = 100;
var ystop = -62;
function moveLight ()
{
  if (ylight > ystop)
  { 
    document.getElementById('light').style.top = ylight+'px';
    ylight -= 2;
    
    //http://developer.mozilla.org/en/docs/DOM:window.setInterval !!!!!!!!!
    
    window.setInterval ('moveLight()',50);
  }
  else
  {  ylight=340;
     window.setTimeout ('moveLight()',50);
  }
} 


function page (name)
{
  document.getElementById('contentframe').src = name;
}


function openwnd (url, width, height, scrollbars, properties_string)
{
  var gallerywnd;
  var ns4up = (document.layers) ? 1 : 0;
  var ie4up = (document.all) ? 1 : 0;
  var xsize = screen.width;
  var ysize = screen.height;
  
  var width=xsize;
  var height=ysize;
  var xpos=(xsize-width)/2;
  var ypos=(ysize-height)/2;
  gallerywnd = window.open(url,"",proberties_string + ",width="+width+",height="+height+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos);
}


function openDynamicWnd(url, width, height)
{ 
  openwnd(url, width, height, 
	"scrollbars=yes,status=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,menubar=yes");
}
	

function openStaticWnd(url, width, height)
{ 
  openwnd(url, width, height, 
	"scrollbars=no,status=no,toolbar=no,location=no,directories=no,resizable=no,menubar=no");
}



