
function stopError() {
	return true;
}
window.onerror=stopError;

currentSection="defaultState"

// active section
SEC_ACTIVE=0 
SEC_ACTIVE_TITLE=""
SEC_ACTIVE_ID=0

// active project
PRO_ACTIVE=0 
PRO_ACTIVE_TITLE=""

// active content
CON_ACTIVE=0 
CON_ACTIVE_TITLE=""  
CON_PAGE=0

CURRENT_COLOR="#000000"

currentSection=""

CON_BAK=0
PROP_BAK=0
LOG_BAK=""
THE_USERNAME=""
THE_PASSWORD=""
IS_LOGGEDIN=0

SEC_TIMER=0
PRO_TIMER=0
CON_TIMER=0

isIE = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
op5 = (navigator.userAgent.indexOf("Opera 5")!=-1) ||(navigator.userAgent.indexOf("Opera/5")!=-1)

function getOBJHeight(obj) {
	var yPos
	if (op5) { 
		yPos = obj.style.pixelHeight;
	} else {
		yPos = obj.offsetHeight;
	}
	return yPos
}

function updateLeftLineHeight() {
	// adjust line on left
	if (MENU_LOADED) {
		var obj=getObj("thecontentcontainer")
		var h=getOBJHeight(obj)
		h+=160
		var wh=winH()
		if (h<wh) {
			h=wh
		}	
		obj=getStyle("colorbar")
		obj.height=h+"px"
	
	}
	setTimeout("updateLeftLineHeight()", 500)
}
updateLeftLineHeight()

function doEVERYTHING() {
		
	// analyse URL
	if (currentSection=="defaultState" || currentSection=="") {
		var tempSEC=SEC_DEFAULT_TITLE
		var tempPRO=PRO_DEFAULT_TITLE
		var tempCON=CON_DEFAULT_TITLE
		var tempPAGE=CON_DEFAULT_PAGE
		
		SEC_ACTIVE=0
		SEC_ACTIVE_TITLE=SEC_DEFAULT_TITLE
		PRO_ACTIVE=0 
		PRO_ACTIVE_TITLE=PRO_DEFAULT_TITLE
		CON_ACTIVE=0 
		CON_ACTIVE_TITLE=CON_DEFAULT_TITLE  
		CON_PAGE=CON_DEFAULT_PAGE // ?? 
		SEC_ACTIVE_ID=SEC_DEFAULT_ACTIVE
	
	} else {
		var temp=currentSection.split("_/_")
		var tempSEC=temp[0].substr(1,temp[0].length-1)
		var tempPRO=temp[1]
		var tempCON=temp[2]
		var tempPAGE=temp[3]
		
		SEC_ACTIVE_TITLE=tempSEC
		PRO_ACTIVE_TITLE=tempPRO
		CON_ACTIVE_TITLE=tempCON
		CON_PAGE=(tempPAGE==undefined) ? 0:tempPAGE;
	}

	var temp=0 // position of project & project ID in array SEC
	for (a=0; a<SEC.length; a++) {
		if (SEC[a][0]==tempSEC) {
			temp=a
		}	
	}
	
	var temp2=0 // positon of the project in array PRO
	for (a=0; a<PRO.length; a++) {
		if (PRO[a]==tempPRO) {
			temp2=a
		}	
	}
	
	SEC_ACTIVE_ID=SEC[temp][1]
	
	// set the color
	CURRENT_COLOR=SEC_COLORS[SEC_ACTIVE]

	obj=getStyle('colorbar')
	obj.backgroundColor=CURRENT_COLOR
	
	// adjust the dimmers
	SEC_dimmer()
	PRO_dimmer()

	var temp3=-1 // position of the project in PIDS array to get the right DIV
	for (a=0; a<PIDS[SEC_ACTIVE_ID].length; a++) {
		if (PIDS[SEC_ACTIVE_ID][a]==temp2) {
			temp3=a
		}	
	}
	if (temp3<0) {
		temp3=0
	}
	UL_SEC(temp) // underline section
	UL_PRO(temp3) // underline project

	SHOW_CONTENT(temp2) // activate content links
	CHANGE_PROJECTS(SEC_ACTIVE_ID) // change projects
	
	temp=0
	for (a=0; a<WORDS.length; a++) {
		if (WORDS[a]==tempCON) {
			temp=a
		}
	}
	UL_CON(temp) // inderline content type
	

	makeULarray()
	
	// show/hide prev/next links
	var pid=PIDS[SEC[SEC_ACTIVE][1]][PRO_ACTIVE] // get project ID
	var pageAmount=PROP[pid][WORDORDER[CON_ACTIVE]]
	
	if (pageAmount<2) {
		obj=getStyle('conContNEXT')
		obj.display="none"
		obj=getStyle('conContPREV')
		obj.display="none"
	} else {
		obj=getStyle('conContNEXT')
		obj.display="inline"
		obj=getStyle('conContPREV')
		obj.display="inline"
	}
		
	// ######################################
	// load content
	// ######################################
	
	loadNewContent('incl/contentloader.php?sec='+tempSEC+'&pro='+tempPRO+'&con='+tempCON+'&p='+CON_PAGE+'&usr='+THE_USERNAME+'&ps='+THE_PASSWORD)
	

}


function nextPAGE(t) {
	if (MENU_LOADED) {
		bl(t)
		
		var pid=PIDS[SEC[SEC_ACTIVE][1]][PRO_ACTIVE] // get project ID
		var pageAmount=PROP[pid][WORDORDER[CON_ACTIVE]]
		var temp=currentSection.split("_/_")
		var tempSEC=temp[0].substr(1,temp[0].length-1)
		var tempPRO=temp[1]
		var tempCON=temp[2]
		var tempPAGE=temp[3]
		
		if (tempPAGE<pageAmount) {
			tempPAGE++
		} else {
			tempPAGE=1
		}
		
		var linktitle='_'+tempSEC+'_/_'+tempPRO+'_/_'+tempCON+'_/_'+tempPAGE
		StateManager.setState(linktitle)
		moveLines()

	}
}


function prevPAGE(t) {
	if (MENU_LOADED) {
		bl(t)
		
		var pid=PIDS[SEC[SEC_ACTIVE][1]][PRO_ACTIVE] // get project ID
		var pageAmount=PROP[pid][WORDORDER[CON_ACTIVE]]
		var temp=currentSection.split("_/_")
		var tempSEC=temp[0].substr(1,temp[0].length-1)
		var tempPRO=temp[1]
		var tempCON=temp[2]
		var tempPAGE=temp[3]
		
		if (tempPAGE>1) {
			tempPAGE--
		} else {
			tempPAGE=pageAmount
		}
		
		var linktitle='_'+tempSEC+'_/_'+tempPRO+'_/_'+tempCON+'_/_'+tempPAGE
		StateManager.setState(linktitle)
		moveLines()

	}
}

function winW() {
	if (document.all) {
		return document.body.offsetWidth	
	} else {
		return window.innerWidth
	}
}

function winH() {
	if (window.innerWidth) {
		  return window.innerHeight;
	} else if (document.documentElement && document.documentElement.offsetHeight) {
		return document.documentElement.offsetHeight
	} else if (document.body) {
		  return document.body.offsetHeight
	}
}

function moveLines() {
	newWW=winW()
	newHH=winH()
	flashProxy.call("moveLines", {newW:newWW, newH:newHH, color:CURRENT_COLOR});
}

function bl(t) {
	if (!isIE) {
		t.blur()
	}
}

function getStyle(n){
	return getObj(n).style;
}

function getObj(n){
	if(document.getElementById){
		return document.getElementById(n);
	}else if(document.all){
		return document.all[n];
	}
}

Array.prototype.in_array = function ( obj ) {
	var len = this.length;
	for ( var x = 0 ; x <= len ; x++ ) {
		if ( this[x] == obj ) return true;
	}
	return false;
}


function makeULarray() {
	underlineARR=new Array()
	var tempArr=PIDS[SEC_ACTIVE_ID] // alle projectids
	for (i=0; i<tempArr.length; i++) {
		underlineARR[i]=new Array();
		for (a=0; a<SEC.length; a++) {
			var t=PIDS[SEC[a][1]]

			if (t.in_array(tempArr[i])) {
				underlineARR[i].push(1)
			} else {
				underlineARR[i].push(0)
			}
		}
		//alert(underlineARR[i].toString())
	}
}


function ACTIVATE_SEC(divID, th) {
	if (MENU_LOADED) {
		SEC_ACTIVE_TITLE=SEC[divID][0]
		SEC_ACTIVE_ID=SEC[divID][1]
		
		//get first project of that section
		PRO_ACTIVE=PIDS[SEC[divID][1]][0]
		if (PRO[PRO_ACTIVE]=="" || PRO[PRO_ACTIVE]==undefined || PRO[PRO_ACTIVE]=="undefined" ||PRO[PRO_ACTIVE]=="NULL") {
			// no project yet defined for that section
			alert("LINK A PROJECT TO THIS SECTION!")
			return false
		}
		
		PRO_ACTIVE_TITLE=PRO[PRO_ACTIVE]
		
		makeULarray()
		
		// get first content type
		var temp=-1
		for (a=0; a<WORDS.length; a++) {
			var b=WORDORDER[a]
			if (CON[PRO_ACTIVE][b]=="1" && temp==-1) {
				temp=b
			}		 
		}
		if (temp==-1) {
			temp=0
		}
		CON_ACTIVE_TITLE=WORDS[temp]
		
		if (temp==1 || temp==2 || temp==3 || temp==4) {
			var showPage="_/_1"
		} else {
			var showPage=""
		}
		
		UL_CON(temp) // undeline content type
		SHOW_CONTENT(PRO_ACTIVE) // show content types
		CHANGE_PROJECTS(PRO_ACTIVE) // change projects
		UL_SEC(divID) // underline section
		UL_PRO(0) // activate project
	
		// update URL
		var linktitle='_'+SEC_ACTIVE_TITLE+'_/_'+PRO_ACTIVE_TITLE+'_/_'+CON_ACTIVE_TITLE+showPage
		StateManager.setState(linktitle)
		bl(th)
		SEC_dimmer()
		PRO_dimmer()
		moveLines()
	}

}


function ACTIVATE_PRO(i, th) {
	
	
	pid=PIDS[SEC_ACTIVE_ID][i]
	//
	// ACTIVATE A PROJECT
	if (MENU_LOADED) {
		bl(th)
		moveLines()
		UL_PRO(i)
		SHOW_CONTENT(pid)
		// get first content type
		var temp=-1
		for (a=0; a<WORDS.length; a++) {
			var b=WORDORDER[a]
			if (CON[pid][b]=="1" && temp==-1) {
				temp=b
			}		 
		}
		if (temp==-1) {
			temp=0
		}
		
		if (temp==1 || temp==2 || temp==3 || temp==4) {
			var showPage="_/_1"
		} else {
			var showPage=""
		}

		CON_ACTIVE_TITLE=WORDS[temp]
	
		// update URL
		PRO_ACTIVE_TITLE=PRO[pid]

		var linktitle='_'+SEC_ACTIVE_TITLE+'_/_'+PRO_ACTIVE_TITLE+'_/_'+CON_ACTIVE_TITLE+showPage
		StateManager.setState(linktitle)
	}
}

function ACTIVATE_CON(i, th, w) {

	if (MENU_LOADED) {
		bl(th)
		moveLines()
		
		
		if (w==WORDS[5] && IS_LOGGEDIN==1) {
			do_logout()
		} else {
			UL_CON(i)
	
			var temp=WORDORDER[i]
	
			if (temp==1 || temp==2 || temp==3 || temp==4) {
				var showPage="_/_1"
			} else {
				var showPage=""
			}
			
			CON_ACTIVE_TITLE=w
			var linktitle='_'+SEC_ACTIVE_TITLE+'_/_'+PRO_ACTIVE_TITLE+'_/_'+CON_ACTIVE_TITLE+showPage
			StateManager.setState(linktitle)
		}
		
	}
}



function CHANGE_PROJECTS(id) {
	// change projects in the menu
	for (a=0; a<PROJECTAMOUNT; a++) {
		obj=getObj('pr'+a)
		obj2=getStyle('prCont'+a)
		
		if (PIDS[SEC_ACTIVE_ID][a]>0) {
			obj.innerHTML=PRO[PIDS[SEC_ACTIVE_ID][a]]
			obj2.display='inline'
		} else {
			obj.innerHTML=""
			obj2.display='none'
		}	
	}
}

function SHOW_CONTENT(id) {
	// make content types visible
	for (a=0; a<WORDS.length; a++) {
		b=WORDORDER[a]
		var viz=(CON[id][b]=="1") ? "inline":"none"
		var obj=getStyle('conCont'+a)
		obj.display=viz			 
	}
}

function UL_SEC(id) {
	// remove all underlines from other sections
	for (a=0; a<SEC_COLORS.length; a++) {
		obj=getStyle('sec'+a)
		obj.borderBottom='none'
	}
	SEC_ACTIVE=id
	obj=getStyle('sec'+id)
	obj.borderBottom='solid 3px '+SEC_COLORS[id]
}
	
	
function UL_PRO(id) {
	// remove all underlines from other projects
	for (a=0; a<PROJECTAMOUNT; a++) {
		obj=getStyle('prC'+a)
		obj.borderBottom='none'
	}
	PRO_ACTIVE=id
	var obj=getStyle('prC'+PRO_ACTIVE)
	obj.borderBottom='solid 3px '+CURRENT_COLOR
	
}

function UL_CON(id) {
	// remove all underlines from other content
	for (a=0; a<WORDS.length; a++) {
		obj=getStyle('con'+a)
		obj.borderBottom='none'
	}
	CON_ACTIVE=WORDORDER[id]
	obj=getStyle('con'+CON_ACTIVE)
	obj.borderBottom='solid 3px #cccccc'
}


function SOV(i) {
	if (SEC_ACTIVE!=i) {
		obj=getStyle('sec'+i)
		obj.borderBottom='solid 3px '+SEC_COLORS[i]
	}
}

function SOT(i) {
	if (SEC_ACTIVE!=i) {
		obj=getStyle('sec'+i)
		obj.borderBottom='none'
	}
}

function POV(i) {

	for (a=0; a<underlineARR.length; a++) {
		if (underlineARR[i][a]==1 && SEC_ACTIVE!=a) {
			obj=getStyle('sec'+a)
			obj.borderBottom='solid 3px '+SEC_COLORS[a]
		}
	}
		
	if (PRO_ACTIVE!=i) {
		obj=getStyle('prC'+i)
		obj.borderBottom='solid 3px '+CURRENT_COLOR	
	}
}

function POT(i) {
	
	for (a=0; a<SEC_COLORS.length; a++) {
		if (SEC_ACTIVE!=a) {
			obj=getStyle('sec'+a)
			obj.borderBottom='none'
		}
	}
		
	if (PRO_ACTIVE!=i) {
		obj=getStyle('prC'+i)
		obj.borderBottom='none'
	}
}

function COV(i) {
	if (CON_ACTIVE!=i) {
		obj=getStyle('con'+i)
		obj.borderBottom='solid 3px #cccccc'
	}
}

function COT(i) {
	if (CON_ACTIVE!=i) {
		obj=getStyle('con'+i)
		obj.borderBottom='none'
	}
}

function PNUL(o) {
	obj=getStyle(o)
	obj.borderBottom='solid 3px #cccccc'
}
function PNOT(o) {
	obj=getStyle(o)
	obj.borderBottom='none'
}

function toHex(dec) {
        var hexCharacters = "0123456789ABCDEF"
        if (dec < 0) return "00"
        if (dec > 255) return "FF"
        var i = Math.floor(dec / 16)
        var j = dec % 16
        return hexCharacters.charAt(i) + hexCharacters.charAt(j)
}

function hex2num (s_hex) {
	eval("var n_num=0X" + s_hex);
	return n_num;
}
function half(a) {
	var na=new Array(Math.round(160+a[0]/2), Math.round(160+a[1]/2), Math.round(160+a[2]/2))
	return na	
}

function SEC_fader() {
       if (SEC_CC<=SEC_STEP) { 
		   	var red = Math.floor( SEC_STARTCOLOR[0]-(SEC_CC*( (SEC_STARTCOLOR[0]-SEC_ENDCOLOR[0])/SEC_STEP ) ) ) 
			var green = Math.floor( SEC_STARTCOLOR[1]-(SEC_CC*( (SEC_STARTCOLOR[1]-SEC_ENDCOLOR[1])/SEC_STEP ) ) )
			var blue = Math.floor( SEC_STARTCOLOR[2]-(SEC_CC*( (SEC_STARTCOLOR[2]-SEC_ENDCOLOR[2])/SEC_STEP ) ) )
			obj=getStyle("sec"+SEC_ACTIVE)
			obj.borderBottomColor = "#" + toHex(red) + toHex(green) + toHex(blue)
			SEC_CC++
			SEC_TIMER=setTimeout("SEC_fader()", SEC_TIME)
        } else {
			if (SEC_DIR==0) {
				SEC_DIR=1
				var temp=SEC_STARTCOLOR
				SEC_STARTCOLOR=SEC_ENDCOLOR
				SEC_ENDCOLOR=temp
			} else {
				SEC_DIR=0
				var temp=SEC_STARTCOLOR
				SEC_STARTCOLOR=SEC_ENDCOLOR
				SEC_ENDCOLOR=temp
			}
			SEC_CC=0
			SEC_TIMER=setTimeout("SEC_fader()", SEC_TIME)
        }
}

function PRO_fader() {
       if (PRO_CC<=PRO_STEP) { 
		   	var red = Math.floor( PRO_STARTCOLOR[0]-(PRO_CC*( (PRO_STARTCOLOR[0]-PRO_ENDCOLOR[0])/PRO_STEP ) ) ) 
			var green = Math.floor( PRO_STARTCOLOR[1]-(PRO_CC*( (PRO_STARTCOLOR[1]-PRO_ENDCOLOR[1])/PRO_STEP ) ) )
			var blue = Math.floor( PRO_STARTCOLOR[2]-(PRO_CC*( (PRO_STARTCOLOR[2]-PRO_ENDCOLOR[2])/PRO_STEP ) ) )
			obj=getStyle("prC"+PRO_ACTIVE)
			obj.borderBottomColor = "#" + toHex(red) + toHex(green) + toHex(blue)
			PRO_CC++
			PRO_TIMER=setTimeout("PRO_fader()", PRO_TIME)
        } else {
			if (PRO_DIR==0) {
				PRO_DIR=1
				var temp=PRO_STARTCOLOR
				PRO_STARTCOLOR=PRO_ENDCOLOR
				PRO_ENDCOLOR=temp
			} else {
				PRO_DIR=0
				var temp=PRO_STARTCOLOR
				PRO_STARTCOLOR=PRO_ENDCOLOR
				PRO_ENDCOLOR=temp
			}
			PRO_CC=0
			PRO_TIMER=setTimeout("PRO_fader()", PRO_TIME)
        }
}

function CON_fader() {
       if (CON_CC<=CON_STEP) { 
		   	var red = Math.floor( CON_STARTCOLOR[0]-(CON_CC*( (CON_STARTCOLOR[0]-CON_ENDCOLOR[0])/CON_STEP ) ) ) 
			var green = Math.floor( CON_STARTCOLOR[1]-(CON_CC*( (CON_STARTCOLOR[1]-CON_ENDCOLOR[1])/CON_STEP ) ) )
			var blue = Math.floor( CON_STARTCOLOR[2]-(CON_CC*( (CON_STARTCOLOR[2]-CON_ENDCOLOR[2])/CON_STEP ) ) )
			obj=getStyle("con"+CON_ACTIVE)
			obj.borderBottomColor = "#" + toHex(red) + toHex(green) + toHex(blue)
			CON_CC++
			CON_TIMER=setTimeout("CON_fader()", CON_TIME)
        } else {
			if (CON_DIR==0) {
				CON_DIR=1
				var temp=CON_STARTCOLOR
				CON_STARTCOLOR=CON_ENDCOLOR
				CON_ENDCOLOR=temp
			} else {
				CON_DIR=0
				var temp=CON_STARTCOLOR
				CON_STARTCOLOR=CON_ENDCOLOR
				CON_ENDCOLOR=temp
			}
			CON_CC=0
			CON_TIMER=setTimeout("CON_fader()", CON_TIME)
        }
}




function SEC_dimmer() {
	
	clearTimeout(SEC_TIMER)
	var r=hex2num(CURRENT_COLOR.substr(1,2))
	var g=hex2num(CURRENT_COLOR.substr(3,2))
	var b=hex2num(CURRENT_COLOR.substr(5,2))

	SEC_STARTCOLOR=new Array(r,g,b)
	SEC_ENDCOLOR=half(SEC_STARTCOLOR)
	SEC_STEP=20
	SEC_CC=0
	SEC_DIR=0
	SEC_TIME=200

	SEC_fader()
}

function PRO_dimmer() {
	
	clearTimeout(PRO_TIMER)
	var r=hex2num(CURRENT_COLOR.substr(1,2))
	var g=hex2num(CURRENT_COLOR.substr(3,2))
	var b=hex2num(CURRENT_COLOR.substr(5,2))

	PRO_STARTCOLOR=new Array(r,g,b)
	PRO_ENDCOLOR=half(PRO_STARTCOLOR)
	PRO_STEP=20
	PRO_CC=0
	PRO_DIR=0
	PRO_TIME=120

	PRO_fader()
}

function CON_dimmer() {
	clearTimeout(CON_TIMER)
	CON_STARTCOLOR=new Array(204,204,204)
	CON_ENDCOLOR=new Array(224,224,224)
	CON_STEP=20
	CON_CC=0
	CON_DIR=0
	CON_TIME=70

	CON_fader()
}


function dimmer() {

	SEC_TIMER=0
	PRO_TIMER=0
	CON_TIMER=0
	
	SEC_dimmer()
	PRO_dimmer()
	CON_dimmer()
}

function LOG_IN() {
	var tempUSER=document.forms["thelogin"].elements['the_login'].value
	var tempPASS=document.forms["thelogin"].elements['the_pass'].value
	moveLines()
	verifyLOGIN(tempUSER, tempPASS)
}


function verifyLOGIN(u,p) {
	var xmlHttp;
	
	obj=getObj("thecontent")
	obj.innerHTML="VERIFYING USER.<br>Please wait a short moment."
			
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert("Please use a modern browser, such as the latest Firefox, Safari, Opera or Internet Explorer. Sorry for the inconvenience.");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			
			var t=xmlHttp.responseText;
			obj=getObj("thecontent")
			
			if (t=="BAD!") {
				obj.innerHTML="SORRY.<br>No such username/password. Please click on login and try again."
			} else {
				
				eval(t)
				
				obj.innerHTML="YOU HAVE BEEN LOGGED IN."
				CON_BAK=CON
				PROP_BAK=PROP
				CON=P_CON
				PROP=P_PROP
				
				
				obj=getObj("con5")
				LOG_BAK=obj.innerHTML
				THE_USERNAME=u
				THE_PASSWORD=p
				IS_LOGGEDIN=1
				obj.innerHTML="logout"
				setTimeout("activateFIRST()", 1000)
				
			}	
		}
	}
	xmlHttp.open("GET","incl/verify.php?u="+u+"&p="+p,true);
	xmlHttp.send(null);
}

function activateFIRST() {
	// get first content type
	var temp=-1
	var pid=PIDS[SEC[SEC_ACTIVE][1]][PRO_ACTIVE] // get project ID
		
	for (a=0; a<WORDS.length; a++) {
		var b=WORDORDER[a]
		if (CON[pid][b]=="1" && temp==-1) {
			temp=b
		}		 
	}
	if (temp==-1) {
		temp=0
	}
	CON_ACTIVE_TITLE=WORDS[temp]
	
	if (temp==1 || temp==2 || temp==3 || temp==4) {
		var showPage="_/_1"
	} else {
		var showPage=""
	}
	
	UL_CON(temp) // undeline content type
	SHOW_CONTENT(pid) // show content types

	// update URL
	var linktitle='_'+SEC_ACTIVE_TITLE+'_/_'+PRO_ACTIVE_TITLE+'_/_'+CON_ACTIVE_TITLE+showPage
	StateManager.setState(linktitle)
}


function do_logout() {
	IS_LOGGEDIN=0
	obj=getObj("con5")
	obj.innerHTML=LOG_BAK
	THE_USERNAME=""
	THE_PASSWORD=""
	
	CON=CON_BAK
	PROP=PROP_BAK
			
	obj=getObj("thecontent")
	obj.innerHTML="YOU HAVE BEEN LOGGED OUT."
	setTimeout("activateFIRST()", 500)
}


function loadNewContent(u) {
	var xmlHttp;
	try {
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert("Please use a modern browser, such as the latest Firefox, Safari, Opera or Internet Explorer. Sorry for the inconvenience.");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			obj=getObj("thecontent")
			obj.innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",u,true);
	xmlHttp.send(null);
}

function logIT(what, detail) {
	
	
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			// logged!
		}
	}
	xmlHttp.open("GET","incl/log.php?what="+what+"&d="+detail, true);
	xmlHttp.send(null);
}
