function GetValue(obj)
{
	return ((document.getElementById(obj)!=null) ? document.getElementById(obj).value : "");
}

function SetValue(obj,value)
{
	if (document.getElementById(obj))
	{
		document.getElementById(obj).value = value;
	}
}

function GetValueCK(obj)
{
	return (document.getElementById(obj).checked == true) ? "1" : "0";
}

function GetHTML(obj)
{
	return ((document.getElementById(obj)!=null) ? document.getElementById(obj).innerHTML : "");
}

function SetHTML(obj,value)
{
	if (document.getElementById(obj))
	{
		document.getElementById(obj).innerHTML = value;
	}
}

/*function SetText(obj,value)
{
	if (document.getElementById(obj))
	{
		document.getElementById(obj).innerText = value;
	}
}*/

function GetObj(Id)
{
	var obj = document.getElementById(Id)
	if (obj)
	{
		return obj;
	}
	else
	{
		var parDoc = window.parent.document;
		if (parDoc)
		{
			return parDoc.getElementById(Id);
		}
	}
	return null;	
}

function Show(obj)
{		
	var myObj = document.getElementById(obj);
	if (myObj) {
		myObj.style.display = 'inline';
	}	
}

function Hide(obj)
{
	var myObj = document.getElementById(obj);
	if (myObj) {
		myObj.style.display = 'none';
	}	
}

function ShowV(obj)
{		
	var myObj = document.getElementById(obj);
	if (myObj) {
		myObj.style.visibility = 'visible';
	}	
}

function HideV(obj)
{
	var myObj = document.getElementById(obj);
	if (myObj) {
		myObj.style.visibility = 'hidden';
	}	
}

function Focus(obj)
{
	var myObj = document.getElementById(obj);
	if (myObj) {
		myObj.focus();
	}
}

function ucFirst(str) {
  if (str.length > 0) {
    return str[0].toUpperCase() + str.substring(1);
  } else {
    return str;
  }
}

function ParseJS(text){	
	var bLoop = true;
	var jscript;

	while(bLoop)
	{
		var i = text.indexOf("<script");
		if (i<0)
		{
			bLoop=false;
		}
		else
		{
			var l = text.length;
			text = text.substr(i,l-i);
			var i2 = text.indexOf(">")+1;
			var j = text.indexOf("</script");
			var jsAjax = text.substr(i2,j-i2);

			try { eval(jsAjax); } catch(err){  alert(String(err)); }
			jscript += jsAjax;
			//alert(jsAjax);

			l = text.length;
			text = text.substr(j,l-j);
		}
	}
	return jscript;
}

function addLoadListener(func) { 
  if (window.addEventListener) { 
    window.addEventListener("load", func, false); 
  } else if (document.addEventListener) { 
    document.addEventListener("load", func, false); 
  } else if (window.attachEvent) { 
    window.attachEvent("onload", func); 
  } 
}

/* MOUSE COORDS */
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

var mouseX = 0
var mouseY = 0

function getMouseXY(e) {
  if (IE) {
    mouseX = event.clientX + document.body.scrollLeft
    mouseY = event.clientY + document.body.scrollTop
  } else {  
    mouseX = e.pageX
    mouseY = e.pageY
  }  
  if (mouseX < 0){mouseX = 0}
  if (mouseY < 0){mouseY = 0}  
  return true
}

