// JavaScript Document
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

function ajaxHandler()
{
	var xmlHttp;
	try
	{  // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest(); 
	}
	catch (e)
	{  // Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
		catch (e)
	    {
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    	}
	    	catch (e)
    	  	{
				xmlHttp=null;
			}
		}
	} 
	return xmlHttp;
}
function setContent(id,content)
{
	document.getElementById(id).innerHTML=content;
}
function setValue(id,content)
{
	document.getElementById(id).value=content;
}
function getContent(id)
{
	return document.getElementById(id).innerHTML;
}
function getValue(id)
{
	return document.getElementById(id).value;
}
function getType(id)
{
	return document.getElementById(id).type;
}
function getContent_trim(id)
{
	return document.getElementById(id).innerHTML.replace(/&nbsp;/,"").trim();
}
function setWidth(id,wNum)
{
	document.getElementById(id).style.width=wNum;
}
function setClass(id,name)
{
	var element = document.getElementById(id);
	element.className = name;
}
function setBorder(id,color)
{
	var element = document.getElementById(id);
	element.style.border = color;
}
function setSelectedValue(id,val)
{
	var element = document.getElementById(id);
	for (i=0;i<element.length;i++)
    {
		if(element.options[i].text==val)
		{
			element.selectedIndex = i;
			break;
		}
	}
}
function show(id)
{
	document.getElementById(id).style.display='inline';
	//document.getElementById(id).style.visiblity='visible';
}
function hide(id)
{
	document.getElementById(id).style.display='none';
	//document.getElementById(id).style.visiblity='hidden';
}
function NumericOnly(e)
{
	var key;
	var keychar;
	if (window.event)
		key = window.event.keyCode;
	else if (e)
		key = e.which;
	else
		return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	
	if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
		return true;
	// alphas and numbers
	else if ((("0123456789").indexOf(keychar) > -1))
		return true;
	else
		return false;

}
function isEmpty(val)
{
	var value = val;
	var con = value.trim();
	if(con.length<1 || con == null || con == "")
	{
		return true;
	}
	else
	{
		return false;
	}
}
function element(id)
{
	return document.getElementById(id);
}