var strFocus="";
var strBlur;
var a = new Array(3);
a[0]=""
a[1]=""
a[2]=""
var txtValue;
function TextBoxINC(txtid,DivID1,DivID2)
{
	var oThis = this;
	var oText = document.getElementById(txtid);
	this.TextBox = oText;
	oDiv1 = document.getElementById(DivID1);
	this.Div1 = oDiv1;
	oDiv2 = document.getElementById(DivID2);
	this.Div2 = oDiv2;
	
	oText.TextBoxINC = this
	oText.onfocus =  TextBoxINC.prototype.OnFocus;		
	oText.onblur = TextBoxINC.prototype.OnBlur;
	//oText.onkeyup = TextBoxINC.prototype.OnKeyUp;
	oText.onkeypress = TextBoxINC.prototype.OnKeyPress;
	oText.onclick = TextBoxINC.prototype.OnClick;
	
	//oDiv1.onclick = TextBoxINC.prototype.OnClick;
	
	oDiv1.style.display = 'none';
	oDiv2.style.display = 'none';
	

}

TextBoxINC.prototype.OnBlur = function()
{	
	this.TextBoxINC.TextBox_Blur();	
}

TextBoxINC.prototype.TextBox_Blur=function()
{
	strBlur = this.TextBox.name;
//	alert("strFocus-->"+strFocus + "," + strBlur);
	//alert("onblur-->" + strBlur + "," + strFocus)
	if(strBlur != strFocus){
		alert("IbnsideIF-->" + strFocus + "," + strBlur)
		this.Div1.style.display = 'none';
		this.Div2.style.display = 'none';
	}
}

TextBoxINC.prototype.OnClick = function()
{
	this.TextBoxINC.TextBox_Click();
}

TextBoxINC.prototype.TextBox_Click=function()
{
	//alert('hai');
	//alert(this.TextBox.name)
	//this.Div1.style.display = 'none';
	//this.Div2.style.display = 'none';	
}

TextBoxINC.prototype.OnFocus = function()
{	
	this.TextBoxINC.TextBox_Focus();	
}

TextBoxINC.prototype.TextBox_Focus=function()
{ 
	var preTXT=""
	preTXT=a[0];
	var preDIV1=a[1];
	var preDIV2=a[2];
	
	
	strFocus = this.TextBox.name;
	txtValue = this.TextBox.value;
	a[0]=strFocus;
	a[1]=this.Div1.id;
	a[2]=this.Div2.id;
	//alert(strFocus + "," + preTXT)
	
	if (strFocus != preTXT)
	{
		//alert(preTXT);
		if (preTXT != "")
		{
			//alert('in IF')
			document.getElementById(preDIV1).style.display = 'none';
			document.getElementById(preDIV2).style.display = 'none';
			this.Div1.style.display = 'block';
			this.Div2.style.display = 'block';
		}
		else
		{//alert('in FElse ');
		this.Div1.style.display = 'block';
		this.Div2.style.display = 'block';}
		
	}
	else{
		this.Div1.style.display = 'block';
		this.Div2.style.display = 'block';
	}
	if(isNaN(txtValue))
	{
		this.Div1.style.display = 'none';
		this.Div2.style.display = 'none';
	}
}

TextBoxINC.prototype.OnKeyPress = function(oEvent)
{
	if (!oEvent) 
	{
		oEvent = window.event;
	}
	if(!isNaN(txtValue))
	{
		var iKeyCode = oEvent.keyCode;	 
		if ((iKeyCode>=65 && iKeyCode<=90) || (iKeyCode >=97 && iKeyCode<=122) || (iKeyCode==32) ||(iKeyCode>=33 && iKeyCode <=45) || (iKeyCode==47) || (iKeyCode>=58 && iKeyCode<=64) || (iKeyCode>=91 && iKeyCode <=96) || (iKeyCode>=123 && iKeyCode<=126))
		{	return false;	}
	}

 }

 
function IncreseBy(i,txtID)
{
	//alert('button Click');
	strBlur=""
	var oText = document.getElementById(txtID);	
	oText.focus();
	
	if(oText.value == "" )
		oText.value = i
	else	
		oText.value = eval(oText.value) + eval(i)	
	
}

function DecreseBy(i,txtID)
{
	var oText = document.getElementById(txtID);
	if(oText.value == "" )
		oText.value = i
	else	
		oText.value = eval(oText.value) - eval(i)	
	
}
