function setfocus () {
var obj; var names = new Array('openparentsubsubmenurowcurrent','openparentsubmenurowcurrent','openparentmenurowcurrent','subsubmenurowcurrent','submenurowcurrent','menurowcurrent');
for (var i=0; i<names.length; i++) { obj=document.getElementById(names[i]); if (obj !=null) {obj.focus();}}} 
function setCursor() { 
	var ss=document.getElementById("ss"); 
	if (ss != null) {
		ss.focus(); 
	}
	if (createXMLHttpObject()) {
		var path = String(window.location);
		var str = "http://www.almavalestudio.co.uk/";
		var n= str.length;
		path = path.substr(n);
		if (path.length>0) {
			getData(path,'page','');
		} else {
			getData('index.php','page','');
		}
	}
}
function setText(obj) {
var subj = document.getElementById('subjectHeading');
var mid = document.getElementById('midColumn');
var w = obj.id;
var srcSubjObjName = w+'Heading';
var srcMidObjName = w+'Body';
subj.innerHTML=document.getElementById(srcSubjObjName).innerHTML;
mid.innerHTML=document.getElementById(srcMidObjName).innerHTML;
}
function loading(s,n) {
	//alert("S: "+s+", n: "+n);
	if (window.document.xhrStatusMonitor) {
		if (n) {
		window.document.xhrStatusMonitor.SetVariable("xhr_msg", n); 
		}
		if (s) {
		window.document.xhrStatusMonitor.SetVariable("xhr_loading", s);
		}
	} else {
		// alert("xhrStatusMonitor n'existe pas");
	}
}
var div='';
var pathForTheRecord='';
if( !window.XMLHttpRequest && window.ActiveXObject ) {
	window.XMLHttpRequest = function() {
	var a = [ 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.5.0' ],
	i = a.length; while(i--) {
	try {
		return new ActiveXObject( a[i] );
	} catch (e) { }
	}
	return null;
	};
}
var rsa = new Array("uninitialized","loading","loaded","interactive","");
var xmlhttp;
if( window.XMLHttpRequest ) {
 xmlhttp = new XMLHttpRequest();  
}

if( !xmlhttp ) {
var obj=document.getElementById('xhrReport');
obj.innerHTML='';
}

function createXMLHttpObject() {
	if( window.XMLHttpRequest ) {
		xmlhttp = new XMLHttpRequest();
		return true;
	} else {
		return false;
	}
}
function getInterface(path,d) {
	if (path) {
		//alert(path);
		loading('1',rsa[xmlhttp.readyState]);
		div=d;
		pathForTheRecord=path;
		xmlhttp = false;
		createXMLHttpObject();
		xmlhttp.open("GET", path,true);
		xmlhttp.onreadystatechange = setAnyInnerHtml;
		xmlhttp.initialise;
		xmlhttp.send(null);
	} else {
		alert("Cannot retrieve interface data. No path!");
	}
}

//getData('shows/index.php')
function getData(ariaFilePath,type,params) {
	if (ariaFilePath) {
		loading('1',rsa[xmlhttp.readyState]);
		div='evaluate';
		pathForTheRecord=ariaFilePath;
		xmlhttp = false;
		createXMLHttpObject();
		//alert("/conf/dataSource.php?path="+ariaFilePath+"&type="+type+params);
		xmlhttp.open("GET", "/conf/dataSource.php?path="+ariaFilePath+"&type="+type+params,true);
		xmlhttp.onreadystatechange = setAnyInnerHtml;
		xmlhttp.initialise;
		xmlhttp.send(null);
	} else {
		alert("Cannot retrieve interface data. No path!");
	}
}

function setAnyInnerHtml() {
		if (xmlhttp.readyState == 4) {
			if (xmlhttp.status == 200) {
				if (div != 'evaluate') { 
					populate(div,xmlhttp.responseText)
				} else {
					var str = xmlhttp.responseText;
					eval(str);
				}
				loading('0',rsa[xmlhttp.readyState]);
				var xhrObj=document.getElementById('xhrReport');
				if (xhrObj != null) {
					var lastPageRecord="index.php";
					var p = pathForTheRecord.substr(pathForTheRecord.indexOf('p=')+2);
					if (p) { lastPageRecord = p; }
					xhrObj.innerHTML="<a href='index.php'><img src='/images/xhrSpinner.png' border='0' title='Web 2.0 Mode Active' /></a>"
				}
			} else {
				message(xmlhttp.status);
				alert("Error!\n The server returned the following error code: "+xmlhttp.status+"\nRequested path: "+pathForTheRecord);
				pathForTheRecord = previousPath;
				//loading('2',rsa[xmlhttp.readyState]);
			} // end state 200
		} else {
			//message(load_seq+' : ' +rsa[xmlhttp.readyState]);
			//alert(xmlhttp.responseText);
			if (xmlhttp.readyState == 3) {
				//alert(xmlhttp.responseText);
				//loading('3',rsa[xmlhttp.readyState]);
			}
		} // end ready state 4
}
var inc1=0;
var theString1='';
var intv1;
var inc2=0;
var theString2='';
var intv2;
var inc3=0;
var theString3='';
var intv3;
/* var theArray=new Array('#000000','#1E1F21','#45484C','#6D7278','#949BA3','#B5BEC8','#949BA3','#6D7278','#45484C','#1E1F21','#000000'); */
var theArray=new Array('#000000','#3D3D51','#5A5A78','#6E6E93','#8888B5','#9999CC','#8888B5','#6E6E93','#5A5A78','#3D3D51','#000000');

function populate(d,t) {
	switch (d) {
	case 'content':
		div=d;
		theString1=t;
		if (theString1=='&nbsp;' || !theString1) {theString1='';}
		inc1=0;
		intv1=window.setInterval("writeContent1Out()",1);
		writeContent1Out();
	break;
	case 'heading01':
		div=d;
		theString2=t;
		if (theString2=='&nbsp;' || !theString2) {theString2='';}
		inc2=0;
		intv2=window.setInterval("writeContent2Out()",1);
		writeContent2Out();
	break;
	case 'searchResults':
		div=d;
		theString3=t;
		if (theString3=='&nbsp;' || !theString3) {theString3='';}
		inc3=0;
		intv3=window.setInterval("writeContent3Out()",1);
		writeContent3Out();
	break;
	default:
		var element = document.getElementById(d);
		if (element != null) {
			if (t) {
				if (t!="&nbsp;" && t) {
					element.innerHTML = t;
				} else {
					element.innerHTML = '';
				}
			} else {
				element.innerHTML = '';
			}
		}
	break;
	}
}
function writeContent1Out() {
	inc1++;
	if (!theArray[inc1]) { 
		window.clearInterval(intv1);
	} else {
		var obj=document.getElementById('content');
		if (obj !=null) {
			obj.style.color= theArray[inc1];
			if (inc1>=theArray.length-1 || inc1>200) {
				window.clearInterval(intv1);
			}
			if (inc1==5) {
			obj.innerHTML = theString1;
			}
		}
	}
}

function writeContent2Out() {
	inc2++;
	if (!theArray[inc2]) { 
		window.clearInterval(intv2);
	} else {
		var obj=document.getElementById('heading01');
		obj.style.color= theArray[inc2];
		if (inc2>=theArray.length-1 || inc2>200) {
			window.clearInterval(intv2);
		}
		if (inc2==5) {
		obj.innerHTML = theString2;
		}
	}
}

function writeContent3Out() {
	inc3++;
	if (!theArray[inc3]) { 
		window.clearInterval(intv3);
	} else {
		var obj=document.getElementById('searchResults');
		obj.style.color= theArray[inc3];
		if (inc3>=theArray.length-1 || inc3>200) {
			window.clearInterval(intv3);
		}
		if (inc3==5) {
		obj.innerHTML = theString3;
		}
	}
}