function setTop(elementId,newTop)
{
  getStyleReference(elementId).top=newTop;
}

function showIt(elementId)
{
  getStyleReference(elementId).visibility="visible";
}

function hideIt(elementId)
{
  getStyleReference(elementId).visibility="hidden";
}

function isVisible(elementId)
{
  var vis=getStyleReference(elementId).visibility;

  return vis=="visible"||vis=="show";
}

function initialise()
{
  var currTop=startHeight;

  for(var i=0;i<sectionNames.length;i++)
  {
    setTop("closed"+i,currTop);
    showIt("closed"+i);
    currTop+=panelHeight;
  }

  var flag=false;

  for(var i=0;i<sectionNames.length;i++)
  {
    for(var j=0;j<pages[i].length;j++)
    {
      var currURL=self.location.href;
	 

      if(currURL.indexOf(URLs[i][j])!=-1)
      {
        flag=true;
        break;
      }
	 
    }

    if(flag)
    {
      display(i);
      break;
    }
  }
  
  var isIndex=self.location.href.indexOf('index.jsp')!=-1;
  if(isIndex) display(0);
  
 /*
var ran_unrounded=Math.random()*6;
var ran_number=Math.round(ran_unrounded); 


//display(0);
display(ran_number);
//display(ran_number);
*/
}


//window.onload=initialise;





function hideAll()
{
	for(i=0;i<sectionNames.length;i++) hide(i);
}


function hide(index)
{
	
		
	 var currTop=startHeight;

  for(var i=0;i<sectionNames.length;i++)
  {
    if(i!=index)
    {
      if(isVisible("closed"+i))
      {
        setTop("closed"+i,currTop);
        currTop+=panelHeight;
      }
      else
      {
        setTop("open"+i,currTop);
        currTop+=panelHeight*(pages[i].length+1);
      } 
    }
    else
    {
      if(isVisible("open"+i))
      {
        hideIt("open"+i);
        showIt("closed"+i);
        setTop("closed"+i,currTop);
        currTop+=panelHeight;
      }

    }
  }
	
	getStyleReference("menu_td").height="265";
	
	
}




function display(index)
{
	
	if(isVisible("open"+index))
	{
		hide(index);
		return;		
	}
	else
	{
		hideAll();
	}
	
	
  var currTop=startHeight;

  for(var i=0;i<sectionNames.length;i++)
  {
    if(i!=index)
    {
      if(isVisible("closed"+i))
      {
        setTop("closed"+i,currTop);
        currTop+=panelHeight;
      }
      else
      {
	
        setTop("open"+i,currTop);
        currTop+=panelHeight*(pages[i].length+1);
      }
    }
    else
    {

	 if(isVisible("open"+i))
      {
        hideIt("open"+i);
        showIt("closed"+i);
        setTop("closed"+i,currTop);
        currTop+=panelHeight;
      }
      else
      {
	
        hideIt("closed"+i);
        showIt("open"+i);
        setTop("open"+i,currTop);
        currTop+=panelHeight*(pages[i].length+1);
      }
    }
  }
	var   new_height=415 + pages[index].length*24;
	getStyleReference("menu_td").height=new_height;

	if (getElementReference("left_td") != null)
		getStyleReference("left_td").height=new_height-200;

}

function openComposer()
{
/*
	var screen_width=0;
	var screen_height=0;
	var window_width=530;
	var window_height=430;
	
	player=window.open('composer/index.jsp','','scrollbars=no,menubar=no,height='+window_height+',width='+window_width+',resizable=no,toolbar=no,location=no,status=no');
	*/
/*
# url - The URL of the page to open. Example: "http://scriptasylum.com".
# w - The width of the window in pixels.
# h - The height of the window in pixels (doesn't include menubars).
# tb - Toolbar visible? 1 = yes, 0 = no.
# stb - Status bar visible? 1 = yes, 0 = no.
# L - Linkbar visible? 1 = yes, 0 = no.
# mb - Menubar visible? 1 = yes, 0 = no.
# sb - Scrollbars visible? 1 = yes, 0 = no.
# rs - Resizable window? 1 = yes, 0 = no.
# x - The horizontal position of the window from the left of the screen.
# y - The vertical position of the window from the top of the screen.
*/
var screenW = 640, screenH = 480;

if (parseInt(navigator.appVersion)>3) 
{
 screenW = screen.width;
 screenH = screen.height;
}
else if (navigator.appName == "Netscape"   && parseInt(navigator.appVersion)==3  && navigator.javaEnabled()  ) 
{
 var jToolkit = java.awt.Toolkit.getDefaultToolkit();
 var jScreenSize = jToolkit.getScreenSize();
 screenW = jScreenSize.width;
 screenH = jScreenSize.height;
}

var url="composer/index.jsp";
var w=530
var h=430
var tb=0
var stb=1
var l=0
var mb=0
var sb=0
var rs=0
var x=(screenW-w) / 2
var y=(screenH-h) / 2
var t=(document.layers)? ',screenX='+x+',screenY='+y: ',left='+x+',top='+y; 		//A LITTLE CROSS-BROWSER CODE FOR WINDOW POSITIONING
tb=(tb)?'yes':'no'; stb=(stb)?'yes':'no'; l=(l)?'yes':'no'; mb=(mb)?'yes':'no'; sb=(sb)?'yes':'no'; rs=(rs)?'yes':'no';
var x=window.open(url, 'newWin'+new Date().getTime(), 'scrollbars='+sb+',width='+w+',height='+h+',toolbar='+tb+',status='+stb+',menubar='+mb+',links='+l+',resizable='+rs+t);
x.focus();

	
}
