var ip = '5d9a0383633dbe508105b281dfa2ac3e';
var objArray = new Array();

function setClick(obj) {
	obj.style.border = '1px dotted #555';
	var spanArray = obj.getElementsByTagName('span');
	for (s=0; s < spanArray.length; s++) {
		spanArray[s].onmousedown = setremId;
	}
}
function remClick(obj) {
	obj.style.border = '0';
	var spanArray = obj.getElementsByTagName('span');
	for (s=0; s < spanArray.length; s++) {
		spanArray[s].onmousedown = null;
	}
}

function setremId() {
	document.getElementById('status').innerHTML = '';

	if (!this.id) {
	
		// SET ATTRIBUTES
		var uniqueID = ip + '-' + new Date().getTime();
		this.setAttribute('id', uniqueID);
		this.style.backgroundColor = '#CCD';
		this.onmouseover = showSpanId;
		this.onmouseout = hideSpanId;
		objArray[objArray.length] = this.id;
		
	} else {
	
		// REMOVE ATTRIBUTES
		
		for (i=0; i < objArray.length; i++) {
			if (objArray[i] == this.id) {
				objArray[i] = null;
				break;
			}
		}
		this.removeAttribute('id');
		this.style.borderBottom = '0';
		this.style.backgroundColor = 'transparent';
		this.style.color = '#000';
		this.onmouseover = null;
		this.onmouseout = null;
		document.getElementById('hover').innerHTML = '';
		
	}
	for (i=0; i < objArray.length; i++) {
		if (objArray[i]) {
			document.getElementById('status').innerHTML += objArray[i] + '<br />';
		}
	}
}

function showSpanId() {
	document.getElementById('hover').innerHTML = this.id;
	this.style.borderBottom = '1px dotted #522';
	this.style.backgroundColor = '#DCC';
	this.style.color = '#522';
}
function hideSpanId() {
	document.getElementById('hover').innerHTML = '';
	this.style.borderBottom = '0';
	this.style.backgroundColor = '#CCD';
	this.style.color = '#000';
}