/******* GLOBALS [BEGIN] *******/
var is_opera = /opera\/9/i.test(navigator.userAgent);
var is_gecko = /gecko/i.test(navigator.userAgent);
var is_ie    = /MSIE/.test(navigator.userAgent);
/******* GLOBALS [END] *******/

function Cursor () {
	
	var xCoordinate;
	var yCoordinate;
	
	var truebody = function (){
		if(!window.opera && document.compatMode && document.compatMode!="BackCompat"){
			return document.documentElement;
		}
		else{
			return document.body;
		}
	}
	
	this.updateCursorPosition = function (DOMEvent) {
		if (is_ie) {
			xCoordinate = event.clientX + truebody().scrollLeft;
			yCoordinate = event.clientY + truebody().scrollTop;
		} else {
			xCoordinate = DOMEvent.pageX > 0 ? DOMEvent.pageX : 0;
			yCoordinate = DOMEvent.pageY > 0 ? DOMEvent.pageY : 0;
		}
	}
	
	this.getX = function () {
	   return xCoordinate;
	}
	
	this.getY = function () {
	   return yCoordinate;
	}
}

function $(id){
	return document.getElementById(id);
}
function hideElement(object){
	object.style.display = 'none';
}
function showElement(object, display){
	if(!display){
		display = 'block';
	}
	object.style.display = display;
}
function getChildElementById(parentObject, childId){
	for(i=0; i<parentObject.childNodes.length; i++){
		if(parentObject.childNodes[i].id == childId){
			return parentObject.childNodes[i];
		}
	}
}
function showImagePopup(src, ev_obj){
	getChildElementById($('img_popup'), 'content_img').src = src;
	var ymin = document.all ? truebody().scrollTop : window.scrollY;
	var xmin = document.all ? truebody().scrollLeft : window.scrollX;
	$('img_popup').style.top = (ymin + 100) + "px";
	$('img_popup').style.left = (xmin + 100) + "px";
	showElement($('img_popup'));
}

function open(id){
	document.getElementById(id).className='show';
}
function close(id){
	document.getElementById(id).className='hide';
}