/*****************************************************************************************/
function $(sId){ 
	return document.getElementById(sId); 
}

/*****************************************************************************************/
function reloadWindow(){
	window.location = window.location + '';
}


/*****************************************************************************************/
function addEvent(elNode, sEvent, fFunc){
	if(sEvent == 'keydown' || sEvent == 'keypress')
		sEvent = window.opera ? 'keypress' : 'keydown';

	if (isGecko){
		elNode.addEventListener (sEvent, fFunc, true);
	} else {
		elNode.attachEvent ('on' + sEvent, fFunc);
	} 
}	

/*****************************************************************************************/
function removeEvent(elNode, sEvent, fFunc){
	if(sEvent == 'keydown' || sEvent == 'keypress')
		sEvent = window.opera ? 'keypress' : 'keydown';

	if (isGecko){
		elNode.removeEventListener (sEvent, fFunc, true);
	} else {
		elNode.detachEvent ('on' + sEvent, fFunc);
	} 
}	

/*****************************************************************************************/
var oInfoWindow = new function(){
	
	this.close =  function(){
		$('InfoWindow').style.display = 'none';
		if(window.opera){
			document.onkeypress = null;
		} else {
			document.onkeydown = null;
		}
	}
	
	this.scrollTop =  function(){
		return window.pageYOffset
			|| document.documentElement.scrollTop
			|| document.body.scrollTop
			|| 0;
	}
	
	this.escapeButton = function(event){
		var evt = event || window.event;
		if(evt.keyCode == 27) oInfoWindow.close();
	}
	
	this.showRequestResult =  function(){
	
		$('InfoWindowContent').firstChild.className = '';
		$('InfoWindowImg').firstChild.className = '';
					
		$('InfoWindowContent').firstChild.style.height = '';
		$('InfoWindowImg').firstChild.style.height = '';

		if(window.opera){
			document.onkeypress = this.escapeButton;
		} else {
			document.onkeydown = this.escapeButton;
		}
	}
	
	this.open =  function(event){
		var elW = $('InfoWindow');
		
		$('InfoWindowContent').firstChild.className = 'overflow';
		$('InfoWindowImg').firstChild.className = 'overflow';
		
		elW.style.visibility = 'hidden';
		elW.style.overflow = 'hidden';
		elW.style.display = 'block';
		
		if (event){
			elW.style.top = event.clientY + this.scrollTop() - elW.parentNode.offsetTop + 10 + 'px';
		} else {
			elW.style.top = window.event.clientY + this.scrollTop() - elW.parentNode.offsetTop + 10 + 'px';
		}
		
		elW.style.visibility = 'visible';
		
		oInfoWindow.showRequestResult();
		
		
	}
	
}