
function closewindow(win){
	win.close();
}

function closewindowreloadparent(win){
//	win.location.reload(true);
	win.close();
}

function openwindow(master){
newWindow=window.open(master,"conti_sub","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,dependent=yes,copyhistory=no,width=640,height=480,left=250,top=150");
if (newWindow) 
	if (newWindow.opener==null) newWindow.opener=self;
newWindow.focus();
}

function openwindow2(master){
newWindow=window.open (master,"conti_sub","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=500,height=400,left=250,top=150");
if (newWindow) 
	if (newWindow.opener==null) newWindow.opener=self;
newWindow.focus();
}

function openwindow3(master){
newWindow=window.open (master,"conti_sub","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=250,left=250,top=150");
if (newWindow) 
	if (newWindow.opener==null) newWindow.opener=self;
newWindow.focus();
}

function openwindow4(master){
newWindow=window.open (master,"conti_sub","toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=530,height=520,left=250,top=150");
if (newWindow) 
	if (newWindow.opener==null) newWindow.opener=self;
newWindow.focus();
}

function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name)
{
	createCookie(name,"",-1);
}


//////////////////////////////////////////////////////////////////////////////

var stayFolded=false;

function CheckBrowser() 
{
 n = (document.layers) ? 1:0;
 ie = (document.all) ? 1:0;
 dom = (document.getElementById)? 1:0;
 browser=((n || ie || dom) && parseInt(navigator.appVersion)>=4)  

}


/************************************************************************************
Making cross-browser objects
************************************************************************************/
function getAddress(objectId,nest)
{
    if(document.getElementById && document.getElementById(objectId)) {
		return document.getElementById(objectId).style;
    } else if (document.all && document.all.objectId) {
	return document.all.objectId.style;
    } else if (document.layers) {
		return eval('document.'+nest+'.document.'+objectId);
    } else {
	return false;
    }
}

function getHeight(objectId,nest)
{
    if(document.getElementById && document.getElementById(objectId)) {
		if (document.getElementById(objectId).style.pixelHeight>0) 
			return document.getElementById(objectId).style.pixelHeight;
	else if (document.getElementById(objectId).offsetHeight>0)
			return document.getElementById(objectId).offsetHeight;
    } else if (document.all && document.all.objectId) {
	return document.all.objectId.offsetHeight;
    } else if (document.layers) {
		return eval('document.'+nest+'.document.'+objectId+'.document.height');
    } else {
	return false;
    }
}

function makeMenu_(obj,nest)
{
	this.css=getAddress(obj,nest);
	this.height=18;
	this.posx=0;	this.posy=0;	
	this.hideIt=b_hideIt;	this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt											
	return this
}

function makeMenu(obj,nest)
{
	this.css=getAddress(obj,nest);
	this.height=getHeight(obj,nest);
	this.posx=0;	this.posy=0;
	this.hideIt=b_hideIt;	this.showIt=b_showIt; this.vis=b_vis; this.moveIt=b_moveIt											
	return this
}

function b_showIt()
{
this.css.visibility="visible"
}

function b_hideIt()
{
this.css.visibility="hidden"
}

function b_vis()
{
if(this.css.visibility=="hidden" || this.css.visibility=="hide" || this.css.visibility=="HIDDEN" || this.css.visibility=="HIDE") return true;
}

function b_moveIt(x,y)
{
 this.posx=x; this.posy=y; 
 this.css.left=this.posx;
 this.css.top=this.posy;
 this.css.pixelLeft=this.posx;
 this.css.pixelTop=this.posy;
}

/************************************************************************************
Initiating the page. Just add to the arrays here to get more menuitems
and add divs in the page
************************************************************************************/
function init(){
	oTop=new Array()
	oTop[0]=new makeMenu_('divTop1','divCont')
	oTop[1]=new makeMenu_('divTop2','divCont')
	oTop[2]=new makeMenu_('divTop3','divCont')
	oTop[3]=new makeMenu_('divTop4','divCont')
	oTop[4]=new makeMenu_('divTop5','divCont')
	oTop[5]=new makeMenu_('divTop6','divCont')
	oTop[6]=new makeMenu_('divTop7','divCont')
	oTop[7]=new makeMenu_('divTop8','divCont')
	oTop[8]=new makeMenu_('divTop9','divCont')

	oSub=new Array()

	oSub[0]=new makeMenu('divSub1','divCont.document.divTop1')
	oSub[1]=new makeMenu('divSub2','divCont.document.divTop2')
	oSub[2]=new makeMenu('divSub3','divCont.document.divTop3')
	oSub[3]=new makeMenu('divSub4','divCont.document.divTop4')
	oSub[4]=new makeMenu('divSub5','divCont.document.divTop5')
	oSub[5]=new makeMenu('divSub6','divCont.document.divTop6')
	oSub[6]=new makeMenu('divSub7','divCont.document.divTop7')
	oSub[7]=new makeMenu('divSub8','divCont.document.divTop8')
	oSub[8]=new makeMenu('divSub9','divCont.document.divTop9')

	for(i=0;i<9;i++){ oSub[i].hideIt() }
	for(i=1;i<9;i++){ oTop[i].moveIt(0,oTop[i-1].posy+oTop[i-1].height) }
}
/************************************************************************************
This is the function that changes the sub menus to folded or unfolded state.
************************************************************************************/

function menu(num){
	if(browser){
	oSub[num].vis()?createCookie("ContiMenuCookie",num):eraseCookie("ContiMenuCookie",num);

		if(!stayFolded){
			for(i=0;i<oSub.length;i++){
				if(i!=num) oSub[i].hideIt()
			}
			for(i=1;i<oTop.length;i++){
				oTop[i].moveIt(0,oTop[i-1].posy+oTop[i-1].height)
			}
		}

		oSub[num].vis()?oSub[num].showIt():oSub[num].hideIt()

		for(i=1;i<oTop.length;i++){ 
			if(!oSub[i-1].vis()) oTop[i].moveIt(0,oTop[i-1].posy+oTop[i-1].height+oSub[i-1].height) 
			else oTop[i].moveIt(0,oTop[i-1].posy+oTop[i-1].height)
			
		}
	}
}
//Initiating the menus onload, if it's a 4.x+ browser.


function load()
{
CheckBrowser();
init();
menuc=readCookie("ContiMenuCookie");
if (menuc) menu(menuc); 

}

onload=load;
