// <!-- Add Services
function addEvent() {
	var ni = document.getElementById('servWrap');
	var numi = document.getElementById('servNr');
	var num = (document.getElementById('servNr').value -1)+ 2;
	numi.value = num;
	var divIdName = 'my'+num+'Div';
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id',divIdName);
	newdiv.innerHTML = "<ul class=\"services\"><li><label for=\"service\">Service Name</label><input type=\"text\" name=\"service_"+num+"\" value=\"\" id=\"service\" class=\"textInput\" maxlength=\"250\" /><div title=\"Remove this service\" class=\"rem-services\" onclick=\"removeElement(\'"+divIdName+"\')\"></div></li><li><label for=\"attributes\">Service Attributes</label><input type=\"text\" name=\"details_"+num+"\" value=\"\" id=\"attributes\" class=\"textInput\" maxlength=\"250\" /></li></ul>";
	ni.appendChild(newdiv);
}
// -->

// <!-- Remove Services
function removeElement(divNum) {
	var d = document.getElementById('servWrap');
	var olddiv = document.getElementById(divNum);
	var numi = document.getElementById('servNr');
	var num = (document.getElementById('servNr').value -1);
	
	numi.value = num;
	d.removeChild(olddiv);
}
// -->

// <!-- RSS Reader
var xmlHttp;

function showRSS(str) { 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="getrss.php";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
		document.getElementById("rssOutput").innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
// -->

// <!-- Close ERROR MESSAGES
function closeNotif() {
	document.getElementById("notifications").style.display = "none";
}
// -->

// <!-- Move Projects Up/Down
function moveUp(id, order) {
	var i = document.getElementById('listId');
	var o = document.getElementById('moveUp');
	
	i.value = id;
	o.value = order;
	
	document.edit_list.submit();
}

function moveDown(id, order) {
	var i = document.getElementById('listId');
	var o = document.getElementById('moveDown');
	
	i.value = id;
	o.value = order;
	
	document.edit_list.submit();
}
// -->

// <!-- Show banners
function showhideBanner() {
	if (document.getElementById) {
			obj = document.getElementById("banner-wrapper");
		if (obj.style.display == "none") {
			obj.style.display = "";
		} else {
			obj.style.display = "none";
		}
	}
}
// -->

// <!-- Selecting projects
function selectProject(thing) {
	var option = thing.options[thing.selectedIndex].value; // selected project
	var s = document.getElementById("s").value; // current session
	var t = document.getElementById("t").value; // current type page
	
	if (option > 0) { 
		//alert(option);
		window.location = "moduleinterface.php?_s_="+s+"&module=Administration&page=work&type="+t+"&item="+option;
	}
}
// -->