
function ttclient_createVerifier(id,width)
{
	var table = ttclient_createTable(width);
	var tablebody = document.createElement("TBODY");						
	var row=document.createElement("TR");	
	var cell=document.createElement("TD");					
		
	//drop list
	var cell=document.createElement("TD");	
	row.appendChild(cell);
	var ddl=document.createElement("select");	
	ddl.id=id;
	ddl.width="100%";
	
	//wire in events
	cell.appendChild(ddl);	
	
	tablebody.appendChild(row);
	table.appendChild(tablebody);
	
	var object = new ttclient_clientControl (table,ddl);
	return object;
}

function ttclient_createVerifierLov(id,width)
{
	var table = ttclient_createTable(width);
	var tablebody = document.createElement("TBODY");						
	var row=document.createElement("TR");	
	var cell=document.createElement("TD");					
	//create lov textbox
	var txtId =id +"Text";
	var listId =id +"Select";
	
	var txt = document.createElement("<INPUT type='text' id='"+ txtId+"'style='width:" + width + "'>");
	//wire in all events
	
	txt.onkeydown =function() { ttlov_formKeyPress(listId, this); };				
	txt.onkeyup =function() {ttlov_autoFill(txtId,listId,this,false,false); };	
	cell.appendChild(txt);	
	row.appendChild(cell);
	
	//spacer
	var cell=document.createElement("TD");
	cell.innerHTML="&nbsp";
	row.appendChild(cell);
	
	//drop list
	var cell=document.createElement("TD");	
	row.appendChild(cell);
	var ddl=document.createElement("select");
	
	ddl.onchange =function() { ttlov_vlChange(listId,txtId, event);};
	ddl.id=listId;
	//wire in events
	cell.appendChild(ddl);	
	
	tablebody.appendChild(row);
	table.appendChild(tablebody);
	
	var object = new ttclient_clientVerifierLov (table,txt,ddl);
	return object;
}

function ttclient_createInputNumeric(id, width)
{
	var table = ttclient_createTable(width);
	var tablebody = document.createElement("TBODY");						
	var row=document.createElement("TR");	
	var txt = document.createElement("<INPUT type='text' id='" + id +"' style='width:100%'>");
		
	txt.onkeyup =function() { ttdd_checkNumeric (this); };						
								
	var cell=document.createElement("TD");
	cell.appendChild(txt);
	row.appendChild(cell)
	tablebody.appendChild(row);
	table.appendChild(tablebody);							
	var object = new ttclient_clientControl(table,txt);
	return object;
}

function ttclient_createInputText(id,width)
{
	var table = ttclient_createTable(width);
	var tablebody = document.createElement("TBODY");						
	var row=document.createElement("TR");						
		
	var txt = document.createElement("<INPUT type='text' id='"+ id +"' style='width:100%'>");	
	var cell=document.createElement("TD");
	cell.appendChild(txt);
	row.appendChild(cell)
	tablebody.appendChild(row);
	table.appendChild(tablebody);						
	
	var object = new ttclient_clientControl(table,txt);
	return object;
}

function ttclient_createInputCurrency(id,width, currencySymbol)
{

	var table = ttclient_createTable(width);				
	var tablebody = document.createElement("TBODY");
	//create new row
	var row=document.createElement("TR");
	//currency Symbol*********************
	var cell=document.createElement("TD");
	cell.innerHTML = currencySymbol +"&nbsp;";
	row.appendChild(cell);
				
	var cell2=document.createElement("TD");			
	row.appendChild(cell2);
	var txt = document.createElement("<INPUT type='text' id='" + id +"' style='width:100%'>");			
	cell.appendChild(txt);

	tablebody.appendChild(row);
	table.appendChild(tablebody);												
	txt.onkeyup =function() { ttdd_checkNumeric (this); };	
	
	var object = new ttclient_clientControl(table,txt);
	return object;	
}

function ttclient_createInputBoolean(id,width)
{
	var chk = document.createElement("<INPUT align='center' type='checkbox' id='" + id+"' >");
						
	var table = ttclient_createTable(width);
	var tablebody = document.createElement("TBODY");
	//create new row
	var row=document.createElement("TR");
	//DAY*********************
	var cell=document.createElement("TD");
	row.appendChild(cell);
	cell.appendChild(chk);
	
	tablebody.appendChild(row);
	table.appendChild(tablebody);						
	var object = new ttclient_clientControl(table,chk);
	return object;	
}

function ttclient_createInputTime(stateId,id,width)
{	
	var table = ttclient_createTable(width);					
	var tablebody = document.createElement("TBODY");
	//create new row
	var row=document.createElement("TR");
	//HOUR**************************
	var cell=document.createElement("TD");
	row.appendChild(cell);
	//create hour						
	var hour = document.createElement("<INPUT type='text' style='width:20px' id='" + stateId +"Hour' value=\"hh\" maxlength=\"2\">");					//script wiring
	
	hour.onkeyup = function() { ttinputtime_keyUpHour (stateId); };							
	hour.onblur = function() { ttinputtime_blurHour(this);};
	hour.onfocus = function() { ttinputtime_focusHour(this);};
	
	
	cell.appendChild(hour);
	
	//*************************
	var cell=document.createElement("TD");
	cell.innerHTML=":";
	row.appendChild(cell);
						
	//minutes***********
	var cell=document.createElement("TD");
	row.appendChild(cell);
	//create minutes						
	var minutes = document.createElement("<INPUT type='text' style='width:25px' id='" + stateId +"Minute' value=\"mm\" maxlength=\"2\">");		
	//script wiring		
	minutes.onblur = function() { ttinputtime_blurMinute(this); };
	minutes.onfocus = function() { ttinputtime_focusMinute(this); };
	cell.appendChild(minutes);						
	
	
	//***********************
	var cell=document.createElement("TD");
	cell.className ="w100";
	row.appendChild(cell);
							
	tablebody.appendChild(row);
	table.appendChild(tablebody);
	
	//create javaScript element
	var inputDate = new ttinputtime_InputTime2(stateId,hour.id,minutes.id);		
	var dateControl = new ttclient_clientTimeControl(table,hour,minutes);
	return dateControl;
}


function ttclient_createInputDate(stateId,id,width)
{
	var date;																		
	var table = ttclient_createTable(width);					
	var tablebody = document.createElement("TBODY");
	//create new row
	var row=document.createElement("TR");
	//DAY*********************
	var cell=document.createElement("TD");
	row.appendChild(cell);
	//create day						
	var day = document.createElement("<INPUT type='text' style='width:20px' id='" + stateId +"Day' value=\"dd\" maxlength=\"2\">");					//script wiring
	
	day.onkeyup = function() { ttipd_keyUpDay (stateId); };						
	day.onfocus = function() { ttipd_focusDay(this);};						
	day.onblur = function() { ttipd_blurDay(this);};
	cell.appendChild(day);
	
	//*************************
	var cell=document.createElement("TD");
	cell.innerHTML="/";
	row.appendChild(cell);
						
	//Month***********
	var cell=document.createElement("TD");
	row.appendChild(cell);
	//create day						
	var month = document.createElement("<INPUT type='text' style='width:25px' id='" + stateId +"Month' value=\"mm\" maxlength=\"2\">");		
	//script wiring	
	month.onkeyup = function() {ttipd_keyUpMonth(stateId); };						
	month.onfocus = function() {ttipd_focusMonth(this); };						
	month.onblur = function() { ttipd_blurMonth(this); };
											
	cell.appendChild(month);						
	var cell=document.createElement("TD");
	cell.innerHTML="/";
	row.appendChild(cell);
	//*********************Year
	var cell=document.createElement("TD");
	row.appendChild(cell);
	//create day						
	var year = document.createElement("<INPUT type='text' style='width:30px' id='" + stateId +"Year' value=\"yyyy\" maxlength=\"4\">");			
	year.onkeyup = function() {ttipd_keyUpYear(stateId); };						
	year.onfocus = function() { ttipd_focusYear(this);};						
	year.onblur = function() { ttipd_blurYear(stateId,this); };						
						
	cell.appendChild(year);
	//***********************
	var cell=document.createElement("TD");
	cell.className ="100";
	row.appendChild(cell);
							
	tablebody.appendChild(row);
	table.appendChild(tablebody);
	
	//create javaScript elemetn
	var inputDate = new ttipd_InputDate2(stateId,day.id,month.id,year.id);		
	var dateControl = new ttclient_clientDateControl(table,day,month,year);
	return dateControl;
}

function ttclient_createTable(width)
{
	var table = document.createElement("TABLE");
	table.style.width = "100%";
	table.cellSpacing=0;
	table.cellPadding =0;		
	return table;
}

function ttclient_clientControl(table, innerControl)
{
	this.table= table;
	this.innerControl =innerControl ;	
}

function ttclient_clientVerifierLov(table, lovText, list)
{
	this.table= table;
	this.lovText =lovText ;	
	this.list =list;	
}

function ttclient_clientDateControl(table, day,month,year)
{
	this.table= table;
	this.day =day;	
	this.month =month;	
	this.year =year;	
}

function ttclient_clientTimeControl(table, hour,minute)
{
	this.table= table;
	this.hour =hour;	
	this.minute =minute;		
}
