// initialize event listener
document.onmousemove = getEvtTarget;
//

function getEvtTarget(evt) {
		evt = (evt) ? evt : ((window.event) ? event : null);
		var evtTargetClass = (evt.target) ? evt.target.className : ((evt.srcElement) ? evt.srcElement.className : null);
		//dropMenu(evtTargetClass);
}


function dropMenu(targetClass) {
	var studentsDrop = document.getElementById('studentsDrop');
	var aboutusDrop = document.getElementById('aboutusDrop');
	var employersDrop = document.getElementById('employersDrop');
	if (targetClass == 'studentsDrop') {
		studentsDrop.style.display = 'block';
	} else {
		studentsDrop.style.display = 'none';
	}
	if (targetClass == 'aboutusDrop') {
		aboutusDrop.style.display = 'block';
	} else {
		aboutusDrop.style.display = 'none';
	}
	if (targetClass == 'employersDrop') {
		employersDrop.style.display = 'block';
	} else {
		employersDrop.style.display = 'none';
	}
	//document.getElementById('js').innerHTML = targetClass+ "  " + targetID;
}

function highlight(object, link) {
	object.style.backgroundColor = '#FDFCA9';
	object.style.cursor = 'pointer';
	if (link == 'edit') {
		object.title = 'Edit internship';
	} else {
		object.title = 'View internship';
	}
	linkID = object.id;
	object.onclick = function() {
		if ((link == 'show') || (!(link))) {
			location.href = '/internships/show.php?id='+linkID;
		} else
		if (link == 'edit') {
			location.href = '/employers/internships/edit.php?id='+linkID;
		}
	}
}

function removehighlight(object) {
	object.style.background = 'none';
	object.title = '';
	return object.style.cursor = 'default';
}

function archiveInternship(object) {
	objectID = object.id;
	location.href='/includes/handle_editoptions.php?archiveID='+objectID;
}

function repostInternship(object) {
	objectID = object.id;
	location.href='/includes/handle_editoptions.php?repostID='+objectID;
}


function sortCompany(id) {
	location.href='/internships/index.php?comp='+id;
}

function sortCategory(id) {
	location.href='/internships/index.php?cat='+id;
}