var UIControlType_TreeNode=0;
var	UIControlType_InputText=1;
var UIControlType_DropDown=2;
var UIControlType_DropDownLov=3; 
var UIControlType_ListBox=4;
var UIControlType_InputDate=5;
var UIControlType_InputNumeric=6;
var UIControlType_InputDateRange=7;
var UIControlType_InputTime=8;
var UIControlType_InputTimeRange=9;
var UIControlType_BasketMiniText=10;
var UIControlType_BasketMiniItemsText=11;
var UIControlType_Blob=12;
var UIControlType_DateTime=13;
var UIControlType_InputBoolean=14;
var UIControlType_RowSelector=15;
var UIControlType_InputSearch=16;
var UIControlType_SayCheez=17;
var UIControlType_InputTextWithPostBack=18;
var UIControlType_SubPage=19;
var UIControlType_InputTextMultiLine=20;
var UIControlType_InputBooleanYN=21;
var UIControlType_Currency =22;
var UIControlType_Link=23;
var UIControlType_InputNumericWithPostBack=24;
var UIControlType_InputPassword =25;
var UIControlType_WeekPattern = 26;
var UIControlType_InputDateWithCalendar=27;
var UIControlType_spacer=28;
var	UIControlType_DropDownLovWithPostBack=29;
var UIControlType_InputSearchVerifier=30;
var UIControlType_PrinterSelection =31;
var UIControlType_Base=32;
var UIControlType_PrinterSelectionWithDocument =33;
var UIControlType_ContentInterworking=34;
var UIControlType_None=35;
var UIControlType_InputBooleanWithPostBack =36;
var UIControlType_InputBooleanYNWithPostBack =37;
var UIControlType_DynamicDropDownLov =38;
var UIControlType_InputSearchSuggest =39;
var UIControlType_ClientControl =40;
var UIControlType_InputRadio =41;
var UIControlType_BoundImage =42;
var UIControlType_FilePath =43;
var UIControlType_ContextLink =44;

var	OperatorType_equal=0;
var	OperatorType_lessThan=1;
var	OperatorType_greaterThan=2;
var	OperatorType_notEqualTo=4;
var OperatorType_greaterOrEqual=5;
var OperatorType_lessOrEqual=6;		
var OperatorType_unassigned=7;
var OperatorType_isNull=8;
var OperatorType_isNotNull=9;		
var OperatorType_ignoreCase=10;				
var OperatorType_startWith=11;		
var OperatorType_endWith=12;		
var OperatorType_contains=13;		
var OperatorType_any=14;		
var OperatorType_match=15;		
var OperatorType_soundex=16;
var OperatorType_fullTextSearch=17;
var OperatorType_customQuery=18;				
	
var ConditionCombine_and =0;
var ConditionCombine_or =1;

//do an escape on the data after no escaped chars have been dealt with 
function ttshared_SafeEscapeChars(strData)
{
	if (strData!=undefined)
	{
		//replace '+' with %2B first this should be dealt with on the server side i.e. in the respective handler
		strData = strData.replace(/\+/g,"%2B");
		//encode pound sign
		strData = strData.replace(String.fromCharCode(0x0A3), "[:POUNDSIGN]");
		//now escape the lot
		strData = escape(strData);
	}

	return strData;
}

function ttsh_CrSelFrame(uniqueId)
// Create an invisible IFrame that can be positioned below objects to overlay select boxes
{
	var iFrame=document.createElement("IFRAME");
	iFrame.id = uniqueId;
	iFrame.style.zIndex = 1000;
	iFrame.style.filter = "progid:DXImageTransform.Microsoft.Alpha(Opacity=0);";
	iFrame.style.visibility = 'hidden';
	iFrame.style.display = 'none';
	iFrame.style.position = "absolute";
	iFrame.frameBorder = "no";
	iFrame.scrolling = "no";
	iFrame.style.left = 0;
	iFrame.style.top = 0;

	return iFrame;
}

function ttsh_PosSelFrame(iFrame, top, left, width, height)
// Set position parameters of hidden iframe
{
	iFrame.style.top = top;
	iFrame.style.left = left;
	iFrame.style.width = width;
	iFrame.style.height = height;
}

function ttsh_DispSelFrame(iFrame, showHide)
// Show or hide the iframe
{
	if (showHide)
	{
		iFrame.style.visibility="visible";
		iFrame.style.display="";
	}
	else
	{
		iFrame.style.visibility="hidden";
		iFrame.style.display="none";
	}
}

function ttsh_AddEvent(element, type, handler)
// Attach an event
{
	var addEvent;
	if (document.addEventListener)
	{
		element.addEventListener(type, handler, true);	
	}
	else if (document.attachEvent)
	{
		element.attachEvent("on"+type, handler);	
	}
	else
	{
		addEvent = new Function;
	}
}

function ttsh_RemoveEvent(element, type, handler)
// Attach an event
{
	try
	{
		if (document && document.detachEvent)
		{
			element.detachEvent("on"+type, handler);	
		}
	}
	catch (e)
	{}
	
	try
	{
		if (document && document.removeEventListener)
		{
			element.removeEventListener(type, handler);	
		}
	}
	catch (e)
	{}
}
