document.onmousemove = mouseMove;
function mouseMove(ev){
	ev = ev || window.event;
	mouse_position = mouse_coords(ev);
}

// Name the Window, so the remote can target it
self.name = "parent_window";

// This function is used to unsubscribe to an orb
function unsubscribe(id) {
	if(confirm('Are you sure you want to unsubscribe from this Orb?')){
		document.location.href="/orb/unsubscribe.php?id=" + id;
	}
}

// This function is used to confirm the deleting of comments
function delete_comment(comment_id, next_page) {
	if (confirm("Are you sure you want to delete this comment?")) {
		location.href="/orb/comment/delete_comment.php?comment_id=" + comment_id + "&next_page=" + next_page;
	}

}


// This function opens the comments of forms which are floating layers
function element_comments(element_id) {

	// Call the get_elements by class function to get all of the elements
	elements = get_elements_by_class('element-comments');

	// Set the correct element display style to block
	e = document.getElementById(element_id);

	// Loop through the elements and set there display style to none
	for(i=0; i<elements.length; i++) {

		// Check to see if the current element is equal to the element we want
		if(elements[i].id == e.id) {

			// Check to see what the display style is
			if (e.style.display == 'block') {

				// Set the display to none
				e.style.display = 'none';

			} else {

				// Set the display to block
				e.style.display = 'block';

			}

		} else {

			// Set the display style to none
			elements[i].style.display = 'none';

		}

	}

	e.style.top = mouse_position.y + 15;
	e.style.left = mouse_position.x + 5;
}