
function ColorRow(objThis){
	objThis.initialCSS = objThis.className;
	objThis.className = 'SelectedRow';    
}


function ResetColorRow(objThis){
	
	objThis.className = objThis.initialCSS;    
	
}

function DoTopMenuOver(objThis){
	
	objThis.style.color = 'black'
	objThis.style.backgroundColor='#d2d2d2';
	
	var link = objThis.childNodes(0);
	link.style.color='#000000';
}


function DoTopMenuOut(objThis){

	objThis.style.color = '#d2d2d2'
	objThis.style.backgroundColor='black';

	objThis.style.backgroundColor=''
	var link = objThis.childNodes(0);
	link.style.color='';
	
}



function CreateDOM() {

	var dom = null;
	
	if (document.implementation && document.implementation.createDocument) {
	
		dom = document.implementation.createDocument("", "", null);
	
	} else if (window.ActiveXObject) {
	
		dom = new ActiveXObject("Microsoft.XMLDOM");	
 	}
 	
 	return dom;
}



//
// NetGetElementById, can find elements that have server side Ids...
////////////////////////////////////////////////////////////////////////////////////

	function NetGetElementById(document, id) {
	
		if (!id || !document) {
	
			return null;
		}
	
		var e = document.getElementById(id);
		
		if (e) {
		
			return e;
		}
		
		var elements = document.getElementsByTagName("*");
		
		for (var i = 0; i < elements.length; ++i) {
		
			var eid = elements[i].id;
			
			if (eid.length >= id.length) {
			
				if (eid.substring(eid.length - id.length, eid.length) == id) {
				
					return elements[i];
				}
			}
		}
	}
	 
	 
	 
//
// SREvent
// cross browser event
////////////////////////////////////////////////////////////////////////////////////

	function SREvent(e) {

		if (!e) { e = window.event; }
				
		if (e.keyCode) {
		
			this.keyCode = e.keyCode;
			
		} else if (e.which) {
		
			this.keyCode = e.which
		}
		
		this.event			= e;
		this.character		= String.fromCharCode(this.keyCode);
		this.ctrlKey		= e.ctrlKey;
		this.sourceElement	= (e.srcElement)? e.srcElement : e.target;
		this.mouse			= new Point();
		this.mouse.button	= e.button;
		
		if (e.pageX || e.pageY) {
				
			this.mouse.x = e.pageX;
			this.mouse.y = e.pageY;
		
		} else if (e.clientX || e.clientY) {
		
			if (document.documentElement && document.documentElement.scrollTop) {
			
				this.mouse.x = e.clientX + document.documentElement.scrollLeft;
				this.mouse.y = e.clientY + document.documentElement.scrollTop;
				
			} else {
		
				this.mouse.x = e.clientX + document.body.scrollLeft;
				this.mouse.y = e.clientY + document.body.scrollTop;
			}
		}

		this.CancelBubble = SREvent_CancelBubble;
	}

	function SREvent_CancelBubble() {

		this.event.cancelBubble = true;
	}			


//
// Point
////////////////////////////////////////////////////////////////////////////////////

	function Point(x, y) {
		
		this.x = (x)? x : 0;
		this.y = (y)? y : 0;
		
		this.toString	= Point_ToString;
	}

	function Point_ToString() {

		return 'Point(' + this.x + ', ' + this.y + ')';
	}



	function SearchGotFocus(o){
	
		
		if (o.value == o.getAttribute('initialText')){
		
			o.value = '';
			o.style.color = 'black'
		
		}
	
	}
	
	
	function SearchLostFocus(o){
	
	
		if (o.value == ''){
		
			o.value = o.getAttribute('initialText');
			o.style.color = 'gray'
		
		}
	
	}