//  Global XMLHTTP Request object array 
var _xmlHttpArray = [];

//  Array of functions to call on window.setTimeout 
var _loadFunctionArray = [];

//  Holds current loadFunctionArray count 
var _currentLoadFunction = 0;

//  Ajax ASP.NET Server Page URL 
var _ajaxServerPage = "";
//  var _ajaxServerPage = "http://localhost/apsa/AjaxControls/AjaxServer.aspx"; 
//  var _ajaxServerPage = "/NannyJob/AjaxControls/AjaxServer.aspx"; 



//  ================================================================== 
//  LocationAjaxUserControl 
//  ================================================================== 



function locationAjaxControl_Load( locationAjaxControlId )
{ 
	locationAjaxControl_Fill( locationAjaxControlId );
}

function locationAjaxControl_Fill( locationAjaxControlId )
{ 
	var suburbDropDownList = null;
	var stateHtmlInputHidden = null;
	var requestUrl = null;
	var xmlHttp = null;
	
	//  Check stateHtmlInputHidden.value != "" and stateHtmlInputHidden.value == suburbDropDownList.value 
	//    if true then return 
	//    else if stateHtmlInputHidden.value == "" 
	//      load with no default suburb 
	//      else load with default suburb 
	
	suburbDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__suburbDropDownList" 
		);
	
	stateHtmlInputHidden = document.getElementById( 
		locationAjaxControlId + 
		"__stateHtmlInputHidden" 
		);
	
	if( !suburbDropDownList || 
		!stateHtmlInputHidden )
	{ 
		return;
	}	
		
	if( -1 < suburbDropDownList.selectedIndex && 
		stateHtmlInputHidden.value == suburbDropDownList.options[ suburbDropDownList.selectedIndex ].value )
	{ 
		return;
	}
	else
	{ 
		//  URL to get areas for a given region 
		//  Will return suburbs of first area in region 
		requestUrl = 
			getAjaxServerPage() + 
			"?ajaxControlName=LocationAjaxControl";
		if( stateHtmlInputHidden.value != "" )
		{ 
			requestUrl += 
				"&selectedSuburb=" + 
				encodeURIComponent( stateHtmlInputHidden.value );
		}
	}
	
	xmlHttp = getXmlHttp( locationAjaxControlId );
	
	//  If browser supports XmlHttpRequest object 
	if( xmlHttp )
	{ 
		//  Initializes the request object with GET (METHOD of posting), 
		//  Request URL and sets the request as asynchronous 
		xmlHttp.open( 
			"GET" , 
			requestUrl , 
			true 
			);
	
		//  Setting the event handler for the response (region change) 
		//  _xmlHttp.onreadystatechange = handleResponse_WarmUpXmlHttp( locationAjaxUserControlId ); 
		xmlHttp.onreadystatechange = function() 
		{ 
			locationAjaxControl_HandleAjaxServerResponse( 
				locationAjaxControlId , 
				"suburb" 
				); 
		};
		
		//  Sends the request to server 
		xmlHttp.send( null );
	}
}

//  Called when response comes back from server 
function locationAjaxControl_HandleAjaxServerResponse( 
	locationAjaxControlId , 
	responseType )
{ 
	var xmlHttp = null;
	
	xmlHttp = getXmlHttp( locationAjaxControlId );

	//  To make sure receiving response data from server is completed 
	if( xmlHttp.readyState == 4 )
	{ 
		//  To make sure valid response is received from the server, 
		//  200 means response received is OK 
		if( xmlHttp.status == 200 )
		{ 
			switch( responseType )
			{ 
				case "suburb" : 
					locationAjaxControl_ClearAndSetProvinceDropDownListItems( 
						locationAjaxControlId , 
						xmlHttp.responseXML.documentElement 
						);
					break;
				
				case "province" : 
					locationAjaxControl_ClearAndSetRegionDropDownListItems( 
						locationAjaxControlId , 
						xmlHttp.responseXML.documentElement
							.childNodes[ 0 ].childNodes[ 1 ] 
						);
					break;
				
				case "region" : 
					locationAjaxControl_ClearAndSetAreaDropDownListItems( 
						locationAjaxControlId , 
						xmlHttp.responseXML.documentElement
							.childNodes[ 0 ].childNodes[ 1 ].childNodes[ 0 ].childNodes[ 1 ] 
						);
					break;
					
				case "area" : 
					locationAjaxControl_ClearAndSetSuburbDropDownListItems( 
						locationAjaxControlId , 
						xmlHttp.responseXML.documentElement
							.childNodes[ 0 ].childNodes[ 1 ].childNodes[ 0 ].childNodes[ 1 ].childNodes[ 0 ].childNodes[ 1 ] 
						);
					break;
			}
		}
		else
		{ 
			alert( "There was a problem retrieving data from the server" );
		}
		
		clearXmlHttp( locationAjaxControlId );
	}
}

function locationAjaxControl_ClearAndSetProvinceDropDownListItems( 
	locationAjaxControlId , 
	provincesNode )
{ 
	var provinceDropDownList = null;
    var provinceName = "";
	var optionItem = null;
	var selectedProvinceIndex = 0;
	
    provinceDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__provinceDropDownList" 
		);
	
	if( !provinceDropDownList )
	{ 
		return;
	}
	
	clearDropDownList( provinceDropDownList );
	
	for( var i = 0 ; i < provincesNode.childNodes.length ; i++ )
	{ 
		//  if( regionNodes[ i ] ) 
		provinceName = getInnerText( provincesNode.childNodes[ i ].childNodes[ 0 ] );
		optionItem = new Option( 
			provinceName , 
			provinceName , 
			false , 
			false 
			);
		provinceDropDownList.options[ provinceDropDownList.length ] = optionItem;
		if( provincesNode.childNodes[ i ].childNodes[ 1 ] )
		{ 
			selectedProvinceIndex = i;
		}
	}

	//  Set the selected province 
	provinceDropDownList.selectedIndex = selectedProvinceIndex;
	
	//  Fill for the regions for the selected province 
	locationAjaxControl_ClearAndSetRegionDropDownListItems( 
		locationAjaxControlId , 
		provincesNode.childNodes[ selectedProvinceIndex ].childNodes[ 1 ] 
		);
}

function locationAjaxControl_ClearAndSetRegionDropDownListItems( 
	locationAjaxControlId , 
	regionsNode )
{ 
	var provinceDropDownList = null;
	var regionDropDownList = null;
    var regionName = "";
	var optionItem = null;
	var selectedRegionName = "";
	var selectedRegionIndex = 0;
	var selectedProvinceName = "";
	var visibleBool = false;
	
    provinceDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__provinceDropDownList" 
		);
	
    regionDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__regionDropDownList" 
		);
	
	if( !provinceDropDownList || 
		!regionDropDownList )
	{ 
		return;
	}
	
	clearDropDownList( regionDropDownList );
	
	for( var i = 0 ; i < regionsNode.childNodes.length ; i++ )
	{ 
		//  if( regionNodes[ i ] ) 
		regionName = getInnerText( regionsNode.childNodes[ i ].childNodes[ 0 ] );
		optionItem = new Option( 
			regionName , 
			regionName , 
			false , 
			false 
			);
		regionDropDownList.options[ regionDropDownList.length ] = optionItem;
		if( regionsNode.childNodes[ i ].childNodes[ 1 ] )
		{ 
			selectedRegionName = regionName;
			selectedRegionIndex = i;
		}
	}

	//  Set the selected region 
	regionDropDownList.selectedIndex = selectedRegionIndex;

	//  Show / hide the drop down list based on single same value as parent 
	selectedProvinceName = provinceDropDownList.options[ provinceDropDownList.selectedIndex ].value;
	visibleBool = 
		( regionsNode.childNodes.length != 1 ) || 
		( selectedRegionName != selectedProvinceName );
	showHide( 
		regionDropDownList.id , 
		visibleBool 
		);
	
	//  Fill for the areas for the selected region 
	locationAjaxControl_ClearAndSetAreaDropDownListItems( 
		locationAjaxControlId , 
		regionsNode.childNodes[ selectedRegionIndex ].childNodes[ 1 ] 
		);
}

function locationAjaxControl_ClearAndSetAreaDropDownListItems( 
	locationAjaxControlId , 
	areasNode )
{ 
	var regionDropDownList = null;
	var areaDropDownList = null;
    var areaName = "";
	var optionItem = null;
	var selectedAreaName = "";
	var selectedAreaIndex = 0;
	var selectedRegionName = "";
	var visibleBool = false;
	
    regionDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__regionDropDownList" 
		);
	
    areaDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__areaDropDownList" 
		);
	
	if( !regionDropDownList || 
		!areaDropDownList )
	{ 
		return;
	}

	clearDropDownList( areaDropDownList );
	
	for( var i = 0 ; i < areasNode.childNodes.length ; i++ )
	{ 
		areaName = getInnerText( areasNode.childNodes[ i ].childNodes[ 0 ] );
		optionItem = new Option( 
			areaName , 
			areaName , 
			false , 
			false 
			);
		areaDropDownList.options[ areaDropDownList.length ] = optionItem;
		if( areasNode.childNodes[ i ].childNodes[ 1 ] )
		{ 
			selectedAreaName = "";
			selectedAreaIndex = i;
		}
	}

	//  Set the selected area 
	areaDropDownList.selectedIndex = selectedAreaIndex;
	
	//  Show / hide the drop down list based on single same value as parent 
	selectedRegionName = regionDropDownList.options[ regionDropDownList.selectedIndex ].value;
	visibleBool = 
		( areasNode.childNodes.length != 1 ) || 
		( selectedAreaName != selectedRegionName );
	showHide( 
		areaDropDownList.id , 
		visibleBool 
		);

	//  Fill for the areas for the selected region 
	locationAjaxControl_ClearAndSetSuburbDropDownListItems( 
		locationAjaxControlId , 
		areasNode.childNodes[ selectedAreaIndex ].childNodes[ 1 ] 
		);
}

function locationAjaxControl_ClearAndSetSuburbDropDownListItems( 
	locationAjaxControlId , 
	suburbsNode )
{ 
	var areaDropDownList = null;
	var suburbDropDownList = null;
	var stateHtmlInputHidden 
    var suburbName = "";
	var optionItem = null;
	var selectedSuburbName = "";
	var selectedSuburbIndex = 0;
	var visibleBool = false;
	
    areaDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__areaDropDownList" 
		);
	
    suburbDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__suburbDropDownList" 
		);
	
	stateHtmlInputHidden = document.getElementById( 
		locationAjaxControlId + 
		"__stateHtmlInputHidden" 
		);
	
	if( !areaDropDownList || 
		!suburbDropDownList || 
		!stateHtmlInputHidden )
	{ 
		return;
	}

	clearDropDownList( suburbDropDownList );
	
	for( var i = 0 ; i < suburbsNode.childNodes.length ; i++ )
	{ 
		suburbName = getInnerText( suburbsNode.childNodes[ i ].childNodes[ 0 ] );
		optionItem = new Option( 
			suburbName , 
			suburbName , 
			false , 
			false 
			);
		suburbDropDownList.options[ suburbDropDownList.length ] = optionItem;
		if( suburbName == stateHtmlInputHidden.value )
		{ 
			selectedSuburbIndex = i;
		}
	}

	//  Set the selected suburb 
	suburbDropDownList.selectedIndex = selectedSuburbIndex;
	selectedSuburbName = suburbDropDownList.options[ suburbDropDownList.selectedIndex ].value;
	
	//  Show / hide the drop down list based on single same value as parent 
	selectedAreaName = areaDropDownList.options[ areaDropDownList.selectedIndex ].value;
	visibleBool = 
		( suburbsNode.childNodes.length != 1 ) || 
		( selectedSuburbName != selectedAreaName );
	showHide( 
		suburbDropDownList.id , 
		visibleBool 
		);

	//  Save the current state 
	locationAjaxControl_SaveState( locationAjaxControlId );
}

//  Province changed - Load Regions, and first set of areas and suburbs and save state 
function locationAjaxControl_ProvinceDropDownList_OnChange( locationAjaxControlId )
{ 
	var provinceDropDownList = null;
	var requestUrl = null;
	var xmlHttp = null;
	
	provinceDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__provinceDropDownList" 
		);
	
	//  URL to get regions for a given province 
	//  Will return areas and suburbs of first region in province 
	requestUrl = 
		getAjaxServerPage() + 
		"?ajaxControlName=LocationAjaxControl&selectedProvince=" + 
		encodeURIComponent( provinceDropDownList.options[ provinceDropDownList.selectedIndex ].value );
	
	xmlHttp = getXmlHttp( locationAjaxControlId );
	
	//  If browser supports XmlHttpRequest object 
	if( xmlHttp )
	{ 
		//  Initializes the request object with GET (METHOD of posting), 
		//  Request URL and sets the request as asynchronous 
		xmlHttp.open( 
			"GET" , 
			requestUrl , 
			true 
			);
	
		//  Setting the event handler for the response (region change) 
		//  _xmlHttp.onreadystatechange = handleResponse_WarmUpXmlHttp( locationAjaxUserControlId ); 
		xmlHttp.onreadystatechange = function() 
		{ 
			locationAjaxControl_HandleAjaxServerResponse( 
				locationAjaxControlId , 
				"province" 
				); 
		};
		
		//  Sends the request to server 
		xmlHttp.send( null );
	}
}

//  Region changed - Load Areas and first set of suburbs and save state 
function locationAjaxControl_RegionDropDownList_OnChange( locationAjaxControlId )
{ 
	var regionDropDownList = null;
	var requestUrl = null;
	var xmlHttp = null;
	
	regionDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__regionDropDownList" 
		);
	
	//  URL to get areas for a given region 
	//  Will return suburbs of first area in region 
	requestUrl = 
		getAjaxServerPage() + 
		"?ajaxControlName=LocationAjaxControl&selectedRegion=" + 
		encodeURIComponent( regionDropDownList.options[ regionDropDownList.selectedIndex ].value );
	
	xmlHttp = getXmlHttp( locationAjaxControlId );
	
	//  If browser supports XmlHttpRequest object 
	if( xmlHttp )
	{ 
		//  Initializes the request object with GET (METHOD of posting), 
		//  Request URL and sets the request as asynchronous 
		xmlHttp.open( 
			"GET" , 
			requestUrl , 
			true 
			);
	
		//  Setting the event handler for the response (region change) 
		//  _xmlHttp.onreadystatechange = handleResponse_WarmUpXmlHttp( locationAjaxUserControlId ); 
		xmlHttp.onreadystatechange = function() 
		{ 
			locationAjaxControl_HandleAjaxServerResponse( 
				locationAjaxControlId , 
				"region" 
				); 
		};
		
		//  Sends the request to server 
		xmlHttp.send( null );
	}
}

//  Area changed - Load set of suburbs and save state 
function locationAjaxControl_AreaDropDownList_OnChange( locationAjaxControlId )
{ 
	var areaDropDownList = null;
	var requestUrl = null;
	var xmlHttp = null;
	
	areaDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__areaDropDownList" 
		);
	
	//  URL to get areas for a given region 
	//  Will return suburbs of first area in region 
	requestUrl = 
		getAjaxServerPage() + 
		"?ajaxControlName=LocationAjaxControl&selectedArea=" + 
		encodeURIComponent( areaDropDownList.options[ areaDropDownList.selectedIndex ].value );
	
	xmlHttp = getXmlHttp( locationAjaxControlId );
	
	//  If browser supports XmlHttpRequest object 
	if( xmlHttp )
	{ 
		//  Initializes the request object with GET (METHOD of posting), 
		//  Request URL and sets the request as asynchronous 
		xmlHttp.open( 
			"GET" , 
			requestUrl , 
			true 
			);
	
		//  Setting the event handler for the response (region change) 
		//  _xmlHttp.onreadystatechange = handleResponse_WarmUpXmlHttp( locationAjaxUserControlId ); 
		xmlHttp.onreadystatechange = function() 
		{ 
			locationAjaxControl_HandleAjaxServerResponse( 
				locationAjaxControlId , 
				"area" 
				); 
		};
		
		//  Sends the request to server 
		xmlHttp.send( null );
	}
}

//  Suburb changed - Save state 
function locationAjaxControl_SuburbDropDownList_OnChange( locationAjaxControlId )
{ 
	locationAjaxControl_SaveState( locationAjaxControlId );
}

function locationAjaxControl_SaveState( locationAjaxControlId )
{ 
	var stateHtmlInputHidden = null;
	var suburbDropDownList = null;
	
	stateHtmlInputHidden = document.getElementById( 
		locationAjaxControlId + 
		"__stateHtmlInputHidden" 
		);
	suburbDropDownList = document.getElementById( 
		locationAjaxControlId + 
		"__suburbDropDownList" 
		);
		
	stateHtmlInputHidden.value = suburbDropDownList.options[ suburbDropDownList.selectedIndex ].value;
}



//  ================================================================== 
//  DayTimeAjaxUserControl 
//  ================================================================== 



//Gets called on page initialization
function dayTimeAjaxControl_Load( dayTimeAjaxControlId )
{ 
	//  dayTimeAjaxControl_FromDropDownList1_OnChange( dayTimeAjaxControlId ); 
	showHideControlsAfterFromDropDownList1_OnChange( dayTimeAjaxControlId );
	//  alert( "dayTimeAjaxControl_Load()" ); 
}

//  From Time 1 changed 
function dayTimeAjaxControl_FromDropDownList1_OnChange( dayTimeAjaxControlId )
{ 
	var fromDropDownList1 = null;
	var toDropDownList1 = null;
	
	fromDropDownList1 = document.getElementById( 
		dayTimeAjaxControlId + 
		"__fromDropDownList1" 
		);
		
	if( !fromDropDownList1 )
	{ 
		return;
	}
		
	if( fromDropDownList1.selectedIndex != 0 )
	{ 
		if( 0 < fromDropDownList1.selectedIndex && 
			fromDropDownList1.selectedIndex < fromDropDownList1.options.length - 1 )
		{ 
			toDropDownList1 = document.getElementById( 
				dayTimeAjaxControlId + 
				"__toDropDownList1" 
				);
			
			if( !toDropDownList1 )
			{ 
				return;
			}
			
			if( toDropDownList1.selectedIndex <= fromDropDownList1.selectedIndex )
			{ 
				toDropDownList1.selectedIndex = fromDropDownList1.selectedIndex + 1;
			}
		}
	}
	
	showHideControlsAfterFromDropDownList1_OnChange( dayTimeAjaxControlId );
}

//  Splits the onChange event into 2 parts 
//  This second part shows/hides the controls  
function showHideControlsAfterFromDropDownList1_OnChange( dayTimeAjaxControlId )
{ 
	var fromDropDownList1 = null;
	var visibleBool = null;
	var showHideControlArray = null;
	
	fromDropDownList1 = document.getElementById( 
		dayTimeAjaxControlId + 
		"__fromDropDownList1" 
		);
		
	if( !fromDropDownList1 )
	{ 
		return;
	}
	
	visibleBool = ( 0 < fromDropDownList1.selectedIndex );

	showHideControlArray = 
	[ 
		dayTimeAjaxControlId + "__toLabel1" , 
		dayTimeAjaxControlId + "__toDropDownList1" , 
		dayTimeAjaxControlId + "__andLabel" , 
		dayTimeAjaxControlId + "__fromDropDownList2" , 
		dayTimeAjaxControlId + "__toLabel2" , 
		dayTimeAjaxControlId + "__toDropDownList2" 
	];
	
	for( var i = 0 ; i < showHideControlArray.length ; i ++ )
	{ 
		showHide( 
			showHideControlArray[ i ] , 
			visibleBool 
			);
	}
	
	if( visibleBool )
	{ 
		dayTimeAjaxControl_ToDropDownList1_OnChange( dayTimeAjaxControlId );
		showHideControlsAfterFromDropDownList2_OnChange( dayTimeAjaxControlId );
	}
}

//  To Time 1 changed 
function dayTimeAjaxControl_ToDropDownList1_OnChange( dayTimeAjaxControlId )
{ 
	var toDropDownList1 = null;
	var visibleBool = null;
	var showHideControlArray = null;
	
	toDropDownList1 = document.getElementById( 
		dayTimeAjaxControlId + 
		"__toDropDownList1" 
		);
		
	if( !toDropDownList1 )
	{ 
		return;
	}
	
	visibleBool = ( 
		toDropDownList1.selectedIndex != 
		( toDropDownList1.options.length - 1 ) 
		);
	
	showHideControlArray = 
	[ 
		dayTimeAjaxControlId + "__andLabel" , 
		dayTimeAjaxControlId + "__fromDropDownList2" 
	];
	
	for( var i = 0 ; i < showHideControlArray.length ; i ++ )
	{ 
		showHide( 
			showHideControlArray[ i ] , 
			visibleBool 
			);
	}
}

//  From Time 2 changed 
function dayTimeAjaxControl_FromDropDownList2_OnChange( dayTimeAjaxControlId )
{ 
	var fromDropDownList2 = null;
	var toDropDownList2 = null;
	var showHideControlArray = null;
	
	fromDropDownList2 = document.getElementById( 
		dayTimeAjaxControlId + 
		"__fromDropDownList2" 
		);
		
	if( !fromDropDownList2 )
	{ 
		return;
	}
	
	if( fromDropDownList2.selectedIndex != 0 )
	{ 
		if( 0 < fromDropDownList2.selectedIndex && 
			fromDropDownList2.selectedIndex < fromDropDownList2.options.length - 1 )
		{ 
			toDropDownList2 = document.getElementById( 
				dayTimeAjaxControlId + 
				"__toDropDownList2" 
				);
			
			if( !toDropDownList2 )
			{ 
				return;
			}
				
			if( toDropDownList2.selectedIndex <= fromDropDownList2.selectedIndex )
			{ 
				toDropDownList2.selectedIndex = fromDropDownList2.selectedIndex + 1;
			}
		}
	}
	
	showHideControlsAfterFromDropDownList2_OnChange( dayTimeAjaxControlId );
}

//  Splits the onChange event into 2 parts 
//  This second part shows/hides the controls  
function showHideControlsAfterFromDropDownList2_OnChange( dayTimeAjaxControlId )
{ 
	var fromDropDownList2 = null;
	var visibleBool = null;
	var showHideControlArray = null;
	
	fromDropDownList2 = document.getElementById( 
		dayTimeAjaxControlId + 
		"__fromDropDownList2" 
		);
		
	if( !fromDropDownList2 )
	{ 
		return;
	}
	
	visibleBool = ( 0 < fromDropDownList2.selectedIndex );

	showHideControlArray = 
	[ 
		dayTimeAjaxControlId + "__toLabel2" , 
		dayTimeAjaxControlId + "__toDropDownList2" 
	];
	
	for( var i = 0 ; i < showHideControlArray.length ; i ++ )
	{ 
		showHide( 
			showHideControlArray[ i ] , 
			visibleBool 
			);
	}
}



//  ================================================================== 
//  PositionTimeSheetAjaxControl 
//  ================================================================== 



//  Gets called on page initialization 
function positionTimeSheetAjaxControl_Load( positionTimeSheetAjaxControlId )
{ 
	positionTimeSheetAjaxControl_LiveInBooleanDropDownInput_OnChange( positionTimeSheetAjaxControlId );
	positionTimeSheetAjaxControl_LiveOutBooleanDropDownInput_OnChange( positionTimeSheetAjaxControlId );
}

//  Position changed 
function positionTimeSheetAjaxControl_LiveInBooleanDropDownInput_OnChange( positionTimeSheetAjaxControlId )
{ 
	var dropDownListId = "";
	var dropDownList = null;
	var liveInRelocateBooleanDropDownInputId = "";
	var liveInRelocateBooleanDropDownInput = null;
	var liveInSelectedString = "";
	var visibleBool = false;
	
	//  dropDownList 
	dropDownListId = 
		positionTimeSheetAjaxControlId + 
		"__liveInBooleanDropDownInput__dropDownList";
	dropDownList = document.getElementById( dropDownListId );
	
	if( !dropDownList )
	{ 
		return;
	}
	
	//  Get if liveIn is selected 
	liveInSelectedString = dropDownList.options[ dropDownList.selectedIndex ].value;
	
	//  Set visibleBool 
	visibleBool = ( liveInSelectedString == "1" );
	
	//  liveInRelocateBooleanDropDownInput 
	liveInRelocateBooleanDropDownInputId = 
		positionTimeSheetAjaxControlId + 
		"__liveInRelocateBooleanDropDownInput";
	liveInRelocateBooleanDropDownInput = document.getElementById( liveInRelocateBooleanDropDownInputId );
	
	if( !liveInRelocateBooleanDropDownInput )
	{ 
		return;
	}
	
	//  Show / hide liveInRelocateBooleanDropDownInput 
	showHide( 
		liveInRelocateBooleanDropDownInputId , 
		visibleBool 
		);
}

//  Position changed 
function positionTimeSheetAjaxControl_LiveOutBooleanDropDownInput_OnChange( positionTimeSheetAjaxControlId )
{ 
	var dropDownListId = "";
	var dropDownList = null;
	var validateTimeHtmlInputHidden = null;
	var liveOutSelectedString = "";
	var visibleBool = false;
	
	//  dropDownList 
	dropDownListId = 
		positionTimeSheetAjaxControlId + 
		"__liveOutBooleanDropDownInput__dropDownList";
	dropDownList = document.getElementById( dropDownListId );
	
	//  validateTimeHtmlInputHidden 
	validateTimeHtmlInputHidden = document.getElementById( 
		positionTimeSheetAjaxControlId + 
		"__timeSheetAjaxControl__validateTimeHtmlInputHidden" 
		);
	
	if( !dropDownList || 
		!validateTimeHtmlInputHidden )
	{ 
		return;
	}
	
	//  Get if liveOut is selected 
	liveOutSelectedString = dropDownList.options[ dropDownList.selectedIndex ].value;
	
	//  Set visibleBool 
	visibleBool = ( liveOutSelectedString == "1" );
	
	showHide( 
		positionTimeSheetAjaxControlId + 
		"__timeSheetAjaxControl" , 
		visibleBool 
		);
		
	if( visibleBool )
	{ 
		validateTimeHtmlInputHidden.value = "1";
	}
	else
	{ 
		validateTimeHtmlInputHidden.value = "0";
	}
}



//  ================================================================== 
//  OnlineInterviewIdentityAjaxControl 
//  ================================================================== 



//  Load method for OnlineInterviewIdentityAjaxUserControl 
function onlineInterviewIdentityAjaxControl_Load( onlineInterviewIdentityAjaxControlId )
{ 
	onlineInterviewIdentityAjaxControl_AvailableOnlineInterviewBooleanDropDownInput_OnChange( onlineInterviewIdentityAjaxControlId );
}

// Show or hide dayTimePanel basde on value of allTimeCheckBox
function onlineInterviewIdentityAjaxControl_AvailableOnlineInterviewBooleanDropDownInput_OnChange( 
	onlineInterviewIdentityAjaxControlId 
	)
{ 
	var idString = "";
	var visibleBool = false;
	var availableOnlineInterviewBooleanDropDownInput = null;
	var selectedValue = null;
	var imIdPanel = null;
	
	idString = 
		onlineInterviewIdentityAjaxControlId + 
		"__availableOnlineInterviewBooleanDropDownInput__dropDownList";
	availableOnlineInterviewBooleanDropDownInput = document.getElementById( idString );
	
	if( !availableOnlineInterviewBooleanDropDownInput )
	{ 
		return;
	}
	
	selectedValue = availableOnlineInterviewBooleanDropDownInput.value;
	visibleBool = ( selectedValue == "1" );
	
	idString = 
		onlineInterviewIdentityAjaxControlId + 
		"__imIdPanel";
	imIdDiv = document.getElementById( idString );
	
	if( !imIdDiv )
	{ 
		return;
	}
	
	showHide( 
		idString , 
		visibleBool 
		);
}



//  ================================================================== 
//  VacancyChildrenAjaxControl 
//  ================================================================== 



function vacancyChildrenAjaxControl_Load( vacancyChildrenAjaxControlId )
{ 
	vacancyChildrenAjaxControl_ChildCountDropDownList_OnChange( vacancyChildrenAjaxControlId );
}

function vacancyChildrenAjaxControl_ChildCountDropDownList_OnChange( vacancyChildrenAjaxControlId )
{ 
	var childCountDropDownListId = null;
	var childCountDropDownList = null;
	var childCount = 0;
	var currentVacancyChildControlPanelId = null;
	var visible = false;
	
	childCountDropDownListId = 
		vacancyChildrenAjaxControlId + 
		"__childCountDropDownList";
	childCountDropDownList = document.getElementById( childCountDropDownListId );
	
	if( !childCountDropDownList )
	{ 
		return;
	}
	
	childCount = parseInt( childCountDropDownList.options[ childCountDropDownList.selectedIndex ].value );
	
	for( i = 1 ; i < 7 ; i ++ )
	{ 
		currentVacancyChildControlPanelId = 
			vacancyChildrenAjaxControlId + 
			"__vacancyChildControlPanel" + 
			i;
			
		visible = ( parseInt( i ) <= childCount );
		
		showHide( 
			currentVacancyChildControlPanelId , 
			visible 
			);
	}
}



//  ================================================================== 
//  CandidateReferenceMemberAjaxControl 
//  ================================================================== 



function candidateReferenceMemberAjaxControl_Load( candidateReferenceMemberAjaxControlId )
{ 
	var action = "";
	var control = null;
	var headingText = "";
	var buttonText = "";
	var groupAdminPanelVisible = false;
	var adminPanelVisible = false;
	var idString = "";
	
	action = candidateReferenceMemberAjaxControl_GetAction( candidateReferenceMemberAjaxControlId );
	
	if( action == "" )
	{ 
		candidateReferenceMemberAjaxControl_SetFieldsDefaultValid( candidateReferenceMemberAjaxControlId );
		groupAdminPanelVisible = true;
		adminPanelVisible = false;
	}
	else
	{ 
		if( action == "add" )
		{ 
			headingText = "You are currently adding a reference. Please select \"Add Reference\" or \"Cancel\" when done.";
			buttonText = "Add Reference";
		}
		else if( action == "update" )
		{ 
			headingText = "You are currently updating a reference. Please select \"Update Reference\" or \"Cancel\" when done.";
			buttonText = "Update Reference";
		}
		else if( action == "delete" )
		{ 
			headingText = "Are you sure you wish to delete this reference?.";
			buttonText = "Confirm Delete";
		}
		
		groupAdminPanelVisible = false;
		adminPanelVisible = true;
	}
	
	//  headingLabel 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__candidateReferenceMemberControl__headingLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = 
			"<h3 class=\"fieldsetH3\">" + 
			headingText + 
			"</h3>";
	}
	
	//  okButton 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__okButton";
	control = document.getElementById( idString );
	if( control )
	{ 
		if( buttonText != "" )
		{ 
			control.value = buttonText;
		}
	}
	
	/*
	//  addLink 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__addLink";
	showHide( 
		idString , 
		groupAdminPanelVisible 
		);
	*/
	
	//  addButton 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__addHtmlInputButton";
	showHide( 
		idString , 
		groupAdminPanelVisible 
		);
	
	//  groupAdminPanel 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__groupAdminPanel";
	showHide( 
		idString , 
		groupAdminPanelVisible 
		);
	
	//  adminPanel 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__adminPanel";
	showHide( 
		idString , 
		adminPanelVisible 
		);
}

/*
function candidateReferenceMemberAjaxControl_AddLink_OnClick( candidateReferenceMemberAjaxControlId )
{ 
	candidateReferenceMemberAjaxControl_ClearFields( candidateReferenceMemberAjaxControlId );
	candidateReferenceMemberAjaxControl_SetActionAndActionIndex( 
		candidateReferenceMemberAjaxControlId , 
		"add" , 
		-1 
		);

	candidateReferenceMemberAjaxControl_Load( candidateReferenceMemberAjaxControlId );
}
*/

function candidateReferenceMemberAjaxControl_AddHtmlInputButton_OnClick( candidateReferenceMemberAjaxControlId )
{ 
	candidateReferenceMemberAjaxControl_ClearFields( candidateReferenceMemberAjaxControlId );
	candidateReferenceMemberAjaxControl_SetActionAndActionIndex( 
		candidateReferenceMemberAjaxControlId , 
		"add" , 
		-1 
		);

	candidateReferenceMemberAjaxControl_Load( candidateReferenceMemberAjaxControlId );
}

function candidateReferenceMemberAjaxControl_UpdateButton_OnClick( 
	candidateReferenceMemberAjaxControlId , 
	index )
{ 
	var candidateReference = null;

	candidateReferenceMemberAjaxControl_SetActionAndActionIndex( 
		candidateReferenceMemberAjaxControlId , 
		"update" , 
		index 
		);
	candidateReference = candidateReferenceMemberAjaxControl_GetActionIndexCandidateReference( 
		candidateReferenceMemberAjaxControlId 
		);
	candidateReferenceMemberAjaxControl_SetCandidateReference( 
		candidateReferenceMemberAjaxControlId , 
		candidateReference , 
		"add/update" 
		);
	
	candidateReferenceMemberAjaxControl_Load( candidateReferenceMemberAjaxControlId );
}

function candidateReferenceMemberAjaxControl_DeleteButton_OnClick( 
	candidateReferenceMemberAjaxControlId , 
	index )
{ 
	var candidateReference = null;
	
	candidateReferenceMemberAjaxControl_SetActionAndActionIndex( 
		candidateReferenceMemberAjaxControlId , 
		"delete" , 
		index 
		);
	candidateReference = candidateReferenceMemberAjaxControl_GetActionIndexCandidateReference( 
		candidateReferenceMemberAjaxControlId 
		);
	candidateReferenceMemberAjaxControl_SetCandidateReference( 
		candidateReferenceMemberAjaxControlId , 
		candidateReference , 
		"delete" 
		);

	candidateReferenceMemberAjaxControl_Load( candidateReferenceMemberAjaxControlId );
}

function candidateReferenceMemberAjaxControl_CancelHtmlInputButton_OnClick( candidateReferenceMemberAjaxControlId )
{ 
	var candidateReferenceMemberAjaxControlStateManager = null;
	
	candidateReferenceMemberAjaxControl_SetActionAndActionIndex( 
		candidateReferenceMemberAjaxControlId , 
		"" , 
		-1 
		);

	candidateReferenceMemberAjaxControl_Load( candidateReferenceMemberAjaxControlId );
}

function candidateReferenceMemberAjaxControl_ClearFields( candidateReferenceMemberAjaxControlId )
{ 
	var candidateReference = null;
	
	candidateReference = new CandidateReference( 
		0 , 
		"" , 
		"" , 
		"" , 
		"" , 
		"" , 
		"" , 
		"" , 
		false , 
		"" 
		);
	candidateReferenceMemberAjaxControl_SetCandidateReference( 
		candidateReferenceMemberAjaxControlId , 
		candidateReference , 
		"add/update" 
		);
}

function candidateReferenceMemberAjaxControl_SetFieldsDefaultValid( candidateReferenceMemberAjaxControlId )
{ 
	var candidateReference = null;
	
	candidateReference = new CandidateReference( 
		0 , 
		"enter a name..." , 
		"enter the contact number..." , 
		"input@email.com" , 
		"1900/01/02" , 
		"1900/01/03" , 
		"enter ages and genders of children..." , 
		"enter job description..." , 
		false , 
		"" 
		);
	candidateReferenceMemberAjaxControl_SetCandidateReference( 
		candidateReferenceMemberAjaxControlId , 
		candidateReference , 
		"add/update" 
		);
}

function candidateReferenceMemberAjaxControl_SetCandidateReference( 
	candidateReferenceAjaxControlId , 
	candidateReference , 
	action )
{ 
	var idString = "";
	var keyHtmlInputControl = null;
	var control = null;
	var fieldVisible = false;
	var labelVisible = false;
	
	fieldVisible = ( action != "delete" );
	labelVisible = ( action != "add/update" );
	
	//  keyHtmlInputControl 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__keyHtmlInputControl";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = candidateReference.getKey();
	}
	
	//  nameTextBox 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__nameTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = candidateReference.getName();
		showHide( 
			idString , 
			fieldVisible 
			);
	}

	//  nameLabel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__nameLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getName();
		showHide( 
			idString , 
			labelVisible 
			);
	}

	//  contactNumber1TextBox 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__contactNumber1TextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = candidateReference.getContactNumber1();
		showHide( 
			idString , 
			fieldVisible 
			);
	}

	//  contactNumber1Label 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__contactNumber1Label";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getContactNumber1();
		showHide( 
			idString , 
			labelVisible 
			);
	}

	//  emailTextBox 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__emailTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = candidateReference.getEmail();
		showHide( 
			idString , 
			fieldVisible 
			);
	}

	//  emailLabel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__emailLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getEmail();
		showHide( 
			idString , 
			labelVisible 
			);
	}

	//  fromDateControlPanel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__fromDateControlPanel";
	control = document.getElementById( idString );
	if( control )
	{ 
		showHide( 
			idString , 
			fieldVisible 
			);
	}
	
	//  fromDateControl 
	candidateReferenceMemberAjaxControl_SetDateControlValue( 
		candidateReferenceAjaxControlId , 
		"fromDateControl" , 
		candidateReference.getFromDate() 
		);
	
	//  fromDateLabel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__fromDateLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getFromDate();
		showHide( 
			idString , 
			labelVisible 
			);
	}

	//  toDateControlPanel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__toDateControlPanel";
	control = document.getElementById( idString );
	if( control )
	{ 
		showHide( 
			idString , 
			fieldVisible 
			);
	}

	//  toDateControl 
	candidateReferenceMemberAjaxControl_SetDateControlValue( 
		candidateReferenceAjaxControlId , 
		"toDateControl" , 
		candidateReference.getToDate() 
		);
	
	//  toDateLabel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__toDateLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getToDate();
		showHide( 
			idString , 
			labelVisible 
			);
	}
	
	//  childrenDescriptionTextBox 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__childrenDescriptionTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = candidateReference.getChildrenDescription();
		showHide( 
			idString , 
			fieldVisible 
			);
	}

	//  childrenDescriptionLabel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__childrenDescriptionLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getChildrenDescription();
		showHide( 
			idString , 
			labelVisible 
			);
	}
	
	//  employmentDescrptionTextBox 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__employmentDescriptionTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = candidateReference.getEmploymentDescription();
		showHide( 
			idString , 
			fieldVisible 
			);
	}

	//  employmentDescriptionLabel 
	idString = 
		candidateReferenceAjaxControlId + 
		"__candidateReferenceMemberControl__employmentDescriptionLabel";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.innerHTML = candidateReference.getEmploymentDescription();
		showHide( 
			idString , 
			labelVisible 
			);
	}
}

function candidateReferenceMemberAjaxControl_SetDateControlValue( 
	candidateReferenceMemberAjaxControlId , 
	dateControlId , 
	date )
{ 
	var split = null;
	var idString = "";
	var control = "";
	var year = "";
	var month = "";
	var day = "";
	
	if( date != "" )
	{ 
		split = date.split( "/" );
		
		//  Year 
		year = split[ 0 ];
		
		//  Month 
		if( split[ 1 ] )
		{ 
			month = split[ 1 ];
		}
		
		//  Day 
		if( split[ 2 ] )
		{ 
			day = split[ 2 ];
		}
	}
	
	//  _yearTextBox 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__candidateReferenceMemberControl__" + 
		dateControlId + 
		"__yearTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = year;
	}
	
	//  _monthTextBox 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__candidateReferenceMemberControl__" + 
		dateControlId + 
		"__monthTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = month;
	}
	
	//  _dayTextBox 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__candidateReferenceMemberControl__" + 
		dateControlId + 
		"__dayTextBox";
	control = document.getElementById( idString );
	if( control )
	{ 
		control.value = day;
	}
}

function candidateReferenceMemberAjaxControl_GetAction( candidateReferenceMemberAjaxControlId )
{ 
	var toRet = "";
	var idString = "";
	var actionHtmlInputControl = null;
	var split = null;
	
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__actionHtmlInputControl";
	actionHtmlInputControl = document.getElementById( idString );
	if( actionHtmlInputControl )
	{ 
		if( actionHtmlInputControl.value == "" )
		{ 
			toRet = "";
		}
		else if( actionHtmlInputControl.value.indexOf( "=" ) == -1 )
		{ 
			toRet = "add";
		}
		else
		{ 
			split = actionHtmlInputControl.value.split( "=" );
			toRet = split[ 0 ];
		}
	}
	
	return toRet;
}

function candidateReferenceMemberAjaxControl_GetActionIndex( candidateReferenceMemberAjaxControlId )
{ 
	var toRet = "";
	var idString = "";
	var actionHtmlInputControl = null;
	var split = null;
	
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__actionHtmlInputControl";
	actionHtmlInputControl = document.getElementById( idString );
	if( actionHtmlInputControl )
	{ 
		if( actionHtmlInputControl.value == "" || 
			actionHtmlInputControl.value.indexOf( "=" ) == -1 )
		{ 
			toRet = "-1";
		}
		else
		{ 
			split = actionHtmlInputControl.value.split( "=" );
			toRet = split[ 1 ];
		}
	}
	
	return toRet;
}

function candidateReferenceMemberAjaxControl_SetActionAndActionIndex( 
	candidateReferenceMemberAjaxControlId , 
	action , 
	actionIndex )
{ 
	var idString = "";
	var actionHtmlInputHidden = null;
	var valueString = "";
	
	//  actionHtmlInputControl 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__actionHtmlInputControl";
	actionHtmlInputControl = document.getElementById( idString );
	if( actionHtmlInputControl )
	{ 
		valueString = action;
		if( action == "update" || 
			action == "delete" )
		{ 
			valueString += 
				"=" + 
				actionIndex;
		}
		actionHtmlInputControl.value = valueString;
	}
}

function candidateReferenceMemberAjaxControl_GetActionIndexCandidateReference( candidateReferenceMemberAjaxControlId )
{ 
	var toRet = null;	
	var idString = "";
	var dataHtmlInputControl = null;
	var actionIndex = -1;
	var split = null;
	
	//  _candidateReferenceGroup 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__dataHtmlInputControl";
	dataHtmlInputControl = document.getElementById( idString );
	if( dataHtmlInputControl )
	{ 
		actionIndex = candidateReferenceMemberAjaxControl_GetActionIndex( candidateReferenceMemberAjaxControlId );
		if( dataHtmlInputControl.value != "" && 
			-1 < actionIndex )
		{ 
			split = dataHtmlInputControl.value.split( "|" );
			if( actionIndex < split.length )
			{ 
				//  toRet = new CandidateReference( 0 , "" , "" , "1900/01/01" , "1900/01/01" , false ); 
				toRet = new CandidateReference();
				toRet.fromClientSideString( split[ actionIndex ] );
			}
		}
	}
	
	return toRet;
}



//  =================================================================== 
//  CandidateReference Class 
//  =================================================================== 



function CandidateReference( 
	key , 
	name , 
	contactNumber1 , 
	email , 
	fromDate , 
	toDate , 
	childrenDescription , 
	employmentDescription , 
	verified , 
	userComments )
{ 

	//  Set member variables values 
	this._key = ( key ) ? key : 0;
	this._name = ( name ) ? name : "";
	this._contactNumber1 = ( contactNumber1 ) ? contactNumber1 : "";
	this._email = ( email ) ? email : "";
	this._fromDate = ( fromDate ) ? fromDate : "";
	this._toDate = ( toDate ) ? toDate : "";
	this._childrenDescription = ( childrenDescription ) ? childrenDescription : "";
	this._employmentDescription = ( employmentDescription ) ? employmentDescription : "";
	this._verified = ( verified ) ? verified : false;
	this._userComments = ( userComments ) ? userComments : "";
	
}

CandidateReference.prototype.getKey = function()
{ 
	return this._key;
}

CandidateReference.prototype.setKey = function( key )
{ 
	this._key = key;
}

CandidateReference.prototype.getName = function()
{ 
	return this._name;
}

CandidateReference.prototype.setName = function( name )
{ 
	this._name = name;
}

CandidateReference.prototype.getContactNumber1 = function()
{ 
	return this._contactNumber1;
}

CandidateReference.prototype.setContactNumber1 = function( contactNumber1 )
{ 
	this._contactNumber1 = contactNumber1;
}

CandidateReference.prototype.getEmail = function()
{ 
	return this._email;
}

CandidateReference.prototype.setEmail = function( email )
{ 
	this._email = email;
}

CandidateReference.prototype.getFromDate = function()
{ 
	var toRet = "";
	
	if( this._fromDate == "1900/01/01" )
	{ 
		toRet = "";
	}
	else
	{ 
		toRet = this._fromDate;
	}
	
	return toRet;
}

CandidateReference.prototype.setFromDate = function( fromDate )
{ 
	this._fromDate = fromDate;
}

CandidateReference.prototype.getToDate = function()
{ 
	var toRet = "";
	
	if( this._toDate == "1900/01/01" )
	{ 
		toRet = "";
	}
	else
	{ 
		toRet = this._toDate;
	}
	
	return toRet;
}

CandidateReference.prototype.setToDate = function( toDate )
{ 
	this._toDate = toDate;
}

CandidateReference.prototype.getChildrenDescription = function()
{ 
	return this._childrenDescription;
}

CandidateReference.prototype.setChildrenDescription = function( childrenDescription )
{ 
	this._childrenDescription = childrenDescription;
}

CandidateReference.prototype.getEmploymentDescription = function()
{ 
	return this._employmentDescription;
}

CandidateReference.prototype.setEmploymentDescription = function( employmentDescription )
{ 
	this._employmentDescription = employmentDescription;
}

CandidateReference.prototype.getVerified = function()
{ 
	return this._verified;
}

CandidateReference.prototype.setVerified = function( verified )
{ 
	this._verified = verified;
}

CandidateReference.prototype.getUserComments = function()
{ 
	return this._userComments;
}

CandidateReference.prototype.setUserComments = function( userComments )
{ 
	this._userComments = userComments;
}

CandidateReference.prototype.fromClientSideString = function( clientSideString )
{ 
	var split = null;
	
	split = clientSideString.split( ";" );
	if( split.length < 6 )
	{ 
		return;
	}
	this._key = split[ 0 ];
	this._name = this.decodeClientSideString( split[ 1 ] );
	this._contactNumber1 = this.decodeClientSideString( split[ 2 ] );
	this._email = this.decodeClientSideString( split[ 3 ] );
	this._fromDate = split[ 4 ];
	this._toDate = split[ 5 ];
	this._childrenDescription = this.decodeClientSideString( split[ 6 ] );
	this._employmentDescription = this.decodeClientSideString( split[ 7 ] );
	if( split[ 8 ] == "True" )
	{ 
		this._verified = true;
	}
	else
	{ 
		this._verified = false;
	}
	this._userComments = this.decodeClientSideString( split[ 9 ] );
}

CandidateReference.prototype.toClientSideString = function( clientSideString )
{ 
	var toRet = "";
	
	toRet = 
		this._key + 
		";" + 
		this.encodeClientSideString( this._name ) + 
		";" + 
		this.encodeClientSideString( this._contactNumber1 ) + 
		";" + 
		this.encodeClientSideString( this._email ) + 
		";" + 
		this._fromDate + 
		";" + 
		this._toDate + 
		";" + 
		this._childrenDescription + 
		";" + 
		this._employmentDescription + 
		";";
	if( this._verified )
	{ 
		toRet += "True";
	}
	else
	{ 
		toRet += "False";
	}
	toRet += 
		";" + 
		this.encodeClientSideString( this._userComments );
		
	return toRet;
}

CandidateReference.prototype.encodeClientSideString = function( text )
{ 
	var toRet = "";
	
	toRet = text.replace( /;/g , "[semicolon]" ).replace( /|/g , "[pipe]" );
	
	return toRet;
}

CandidateReference.prototype.decodeClientSideString = function( text )
{ 
	var toRet = "";
	
	toRet = text.replace( /\[semicolon\]/g , ";" ).replace( /\[pipe\]/g , "|" );
	
	return toRet;
}



//  ================================================================== 
//  AdvancedSearchMemberAjaxUserControl 
//   - CandidateVacancyGroupAdvancedSearchMemberAjaxUserControl 
//   - VacancyCandidateGroupAdvancedSearchMemberAjaxUserControl 
//  ================================================================== 



//  Load method for OnlineInterviewIdentityAjaxUserControl 
function advancedSearchMemberAjaxUserControl_Load( advancedSearchMemberAjaxUserControlId )
{ 
	advancedSearchMemberAjaxUserControl_RadioButtonList_OnClick( advancedSearchMemberAjaxUserControlId );
}

// Show or hide advancedSearchCriteriaMemberUserControlDiv based on selected value = criteria 
function advancedSearchMemberAjaxUserControl_RadioButtonList_OnClick( advancedSearchMemberAjaxUserControlId )
{ 
	var idString = "";
	var visibleBool = false;
	var radioButtonList = null;
	var inputArray = null;
	var selectedValue = "";
	var profileSearchPanel = null;
	var criteriaSearchPanel = null;
	var profileNumberSearchPanel = null;
	
	idString = 
		advancedSearchMemberAjaxUserControlId + 
		"_radioButtonList";
	radioButtonList = document.getElementById( idString );
	
	if( !radioButtonList )
	{ 
		return;
	}
	
	inputArray = radioButtonList.getElementsByTagName( "input" );
	for( var i = 0 ; i < inputArray.length ; i ++ )
	{ 
		if( inputArray[ i ].checked == true )
		{ 
			selectedValue = inputArray[ i ].value;
			break;
		}
	}
	
	//  Profile Search Panel 
	visibleBool = ( selectedValue == "profile" );
	
	idString = 
		advancedSearchMemberAjaxUserControlId + 
		"_profileSearchPanel";
	profileSearchPanel = document.getElementById( idString );
	if( profileSearchPanel )
	{ 
		showHide( 
			idString , 
			visibleBool 
			);
	}
	
	//  Criteria Search Panel 
	visibleBool = ( selectedValue == "criteria" );
	
	idString = 
		advancedSearchMemberAjaxUserControlId + 
		"_criteriaSearchPanel";
	criteriaSearchPanel = document.getElementById( idString );
	if( criteriaSearchPanel )
	{ 
		showHide( 
			idString , 
			visibleBool 
			);
	}
	
	//  Profile Number Search Panel 
	visibleBool = ( selectedValue == "profileNumber" );
	
	idString = 
		advancedSearchMemberAjaxUserControlId + 
		"_profileNumberSearchPanel";
	profileNumberSearchPanel = document.getElementById( idString );
	if( profileNumberSearchPanel )
	{ 
		showHide( 
			idString , 
			visibleBool 
			);
	}
}



//  ================================================================== 
//  VacancyMembershipPackageMemberAjaxUserControl 
//  ================================================================== 



//  Load method 
function vacancyMembershipPackageMemberAjaxUserControl_Load( vacancyMembershipPackageMemberAjaxUserControlId )
{ 
	vacancyMembershipPackageMemberAjaxUserControl_RadioButtonList_OnClick( vacancyMembershipPackageMemberAjaxUserControlId );
}

// Show or hide correct expiry date 30 / 90 days 
function vacancyMembershipPackageMemberAjaxUserControl_RadioButtonList_OnClick( vacancyMembershipPackageMemberAjaxUserControlId )
{ 
	var idString = "";
	var visibleBool = false;
	var radioButtonList = null;
	var inputArray = null;
	var selectedValue = "";
	var thirtyDayLabel = null;
	var ninetyDayLabel = null;
	
	//  Load radioButtonList 
	idString = 
		vacancyMembershipPackageMemberAjaxUserControlId + 
		"_radioButtonList";
	radioButtonList = document.getElementById( idString );
	
	//  Load thirtyDayPrice 
	idString = 
		vacancyMembershipPackageMemberAjaxUserControlId + 
		"_thirtyDayLabel";
	thirtyDayLabel = document.getElementById( idString );
	
	//  Load ninetyDayPrice 
	idString = 
		vacancyMembershipPackageMemberAjaxUserControlId + 
		"_ninetyDayLabel";
	ninetyDayLabel = document.getElementById( idString );
	
	if( !radioButtonList || 
		!thirtyDayLabel || 
		!ninetyDayLabel )
	{ 
		return;
	}
	
	inputArray = radioButtonList.getElementsByTagName( "input" );
	for( var i = 0 ; i < inputArray.length ; i ++ )
	{ 
		if( inputArray[ i ].checked == true )
		{ 
			selectedValue = inputArray[ i ].value;
			break;
		}
	}
	
	//  Thirty day label 
	visibleBool = ( selectedValue == "30" );
	showHide( 
		thirtyDayLabel.id , 
		visibleBool 
		);
	
	//  Ninety day label 
	visibleBool = !visibleBool;
	showHide( 
		ninetyDayLabel.id , 
		visibleBool 
		);
}



//  ================================================================== 
//  VacancyPaymentMemberAjaxUserControl 
//    - VacancyPricetagPaymentMemberAjaxUserControl 
//    - VacancyTwoCheckoutPaymentMemberAjaxUserControl 
//  ================================================================== 



//  Load method for VacancyPaymentMemberAjaxUserControl 
function vacancyPaymentMemberAjaxUserControl_Load( vacancyPaymentMemberAjaxUserControlId )
{ 
	vacancyPaymentMemberAjaxUserControl_PaymentTypeDropDownList_OnChange( vacancyPaymentMemberAjaxUserControlId );
}

// Show correct panel 
function vacancyPaymentMemberAjaxUserControl_PaymentTypeDropDownList_OnChange( vacancyPaymentMemberAjaxUserControlId )
{ 
	var idString = "";
	var paymentTypeDropDownList = null;
	var creditCardPanel = null;
	var directDepositPanel = null;
	var visibleBool = false;
	var inputArray = null;
	var selectedValue = "";
	
	//  Load paymentTypeDropDownList 
	idString = 
		vacancyPaymentMemberAjaxUserControlId + 
		"_paymentTypeDropDownList";
	paymentTypeDropDownList = document.getElementById( idString );
	
	//  Load creditCardPanel 
	idString = 
		vacancyPaymentMemberAjaxUserControlId + 
		"_creditCardPanel";
	creditCardPanel = document.getElementById( idString );
	
	//  Load directDepositPanel 
	idString = 
		vacancyPaymentMemberAjaxUserControlId + 
		"_directDepositPanel";
	directDepositPanel = document.getElementById( idString );
	
	if( !paymentTypeDropDownList || 
		!creditCardPanel || 
		!directDepositPanel )
	{ 
		return;
	}
	
	selectedValue = paymentTypeDropDownList.options[ paymentTypeDropDownList.selectedIndex ].value;
	visibleBool = ( selectedValue == "Credit Card" );
	
	//  Show / Hide Credit Card Panel 
	showHide( 
		creditCardPanel.id , 
		visibleBool 
		);
	
	//  Show / Hide Direct Deposit Panel 
	visibleBool = !visibleBool;
	showHide( 
		directDepositPanel.id , 
		visibleBool 
		);
}



//  ==================================================================== 
//  CandidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl 
//  ==================================================================== 



//  Load method 
function candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_Load( 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId )
{ 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_SwitchQuestionAnswerDisplayQuestionAnswerForm( 
		candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		true 
		);
}

// Show or hide question panel 
function candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_QuestionAnswerAnchor_OnClick( 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId )
{ 
	//  alert( "candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_QuestionAnswerAnchor_OnClick" ); 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_SwitchQuestionAnswerDisplayQuestionAnswerForm( 
		candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		false 
		);
}

// Show or hide question panel 
function candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_QuestionAnswerCancelSubmitInput_OnClick( 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId )
{ 
	//  alert( "candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_QuestionAnswerCencelSubmitInput_OnClick" ); 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_SwitchQuestionAnswerDisplayQuestionAnswerForm( 
		candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		true 
		);
}

function candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControl_SwitchQuestionAnswerDisplayQuestionAnswerForm( 
	candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
	showQuestionAnswerDisplay )
{
	var idString = "";
	var questionAnswerDisplayPanel = null;
	var questionAnswerFormPanel = null;
	var showQuestionAnswerForm = null;
	
	//  Load questionAnswerDisplayPanel 
	idString = 
		candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId + 
		"_questionAnswerDisplayPanel";
	questionAnswerDisplayPanel = document.getElementById( idString );
	
	//  Load questionAnswerFormPanel 
	idString = 
		candidateProfileViewApplicationQuestionAnswerMemberAjaxUserControlId + 
		"_questionAnswerFormPanel";
	questionAnswerFormPanel = document.getElementById( idString );
	
	if( !questionAnswerDisplayPanel || 
		!questionAnswerFormPanel )
	{ 
		return;
	}
	
	//  Show / Hide Question Answer Display Panel 
	showHide( 
		questionAnswerDisplayPanel.id , 
		showQuestionAnswerDisplay 
		);
		
	//  Show / Hide Question Answer Form Panel 
	if( showQuestionAnswerDisplay )
	{ 
		showQuestionAnswerForm = false;
	}
	else
	{ 
		showQuestionAnswerForm = true;
	}
	showHide( 
		questionAnswerFormPanel.id , 
		showQuestionAnswerForm 
		);
}



//  ==================================================================== 
//  VacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl 
//  ==================================================================== 



//  Load method 
function vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_Load( 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId )
{ 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerDisplayPanel( 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		true 
		);
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerFormPanel( 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		false 
		);
}

// Show or hide answer panel 
function vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_QuestionAnswerAnchor_OnClick( 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId )
{ 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerDisplayPanel( 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		false 
		);
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerFormPanel( 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		true 
		);
}

// Show or hide question panel 
function vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_QuestionAnswerCancelSubmitInput_OnClick( 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId )
{ 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerDisplayPanel( 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		true 
		);
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerFormPanel( 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
		false 
		);
}

function vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerDisplayPanel( 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
	show )
{
	var idString = "";
	var answerDisplayPanel = null;
	
	//  Load answerDisplayPanel 
	idString = 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId + 
		"_questionAnswerAnswerDisplayPanel";
	answerDisplayPanel = document.getElementById( idString );
	
	if( !answerDisplayPanel )
	{ 
		return;
	}
	
	//  Show / Hide Answer Display Panel 
	showHide( 
		answerDisplayPanel.id , 
		show 
		);
}

function vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControl_ShowHideAnswerFormPanel( 
	vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId , 
	show )
{
	var idString = "";
	var answerFormPanel = null;
	
	//  Load answerFormPanel 
	idString = 
		vacancyProfileViewApplicationQuestionAnswerMemberAjaxUserControlId + 
		"_questionAnswerFormPanel";
	answerFormPanel = document.getElementById( idString );
	
	if( !answerFormPanel )
	{ 
		return;
	}
	
	//  Show / Hide Answer Form Panel 
	showHide( 
		answerFormPanel.id , 
		show 
		);
}



//  ================================================================== 
//  DeactivateConfirmMemberAjaxUserControl 
//  ================================================================== 



//  Load method for DeactivateConfirmMemberAjaxUserControl 
function deactivateConfirmMemberAjaxUserControl_Load( deactivateConfirmMemberAjaxUserControlId )
{ 
	deactivateConfirmMemberAjaxUserControl_RadioButtonList_OnClick( deactivateConfirmMemberAjaxUserControlId );
}

// Show or hide deactivateConfirmMemberUserControlDiv based on selected value = criteria 
function deactivateConfirmMemberAjaxUserControl_RadioButtonList_OnClick( deactivateConfirmMemberAjaxUserControlId )
{ 
	var idString = "";
	var visibleBool = false;
	var radioButtonList = null;
	var inactiveDescriptionPanel = null;
	var inputArray = null;
	var selectedValue = "";
	
	//  Load radioButtonList 
	idString = 
		deactivateConfirmMemberAjaxUserControlId + 
		"_radioButtonList";
	radioButtonList = document.getElementById( idString );
	
	//  Load inactiveDescriptionPanel 
	idString = 
		deactivateConfirmMemberAjaxUserControlId + 
		"_inactiveDescriptionPanel";
	inactiveDescriptionPanel = document.getElementById( idString );
	
	//  Check control exists 
	if( !radioButtonList || 
		!inactiveDescriptionPanel )
	{ 
		return;
	}
	
	//  Get selected radio button 
	inputArray = radioButtonList.getElementsByTagName( "input" );
	for( var i = 0 ; i < inputArray.length ; i ++ )
	{ 
		if( inputArray[ i ].checked == true )
		{ 
			selectedValue = inputArray[ i ].value;
			break;
		}
	}
	
	//  Show / hide Inactive Description Panel 
	visibleBool = ( selectedValue == "1" );
	showHide( 
		inactiveDescriptionPanel.id , 
		visibleBool 
		);
}



//  =================================================================== 
//  General Methods 
//  =================================================================== 



function getXmlHttp( controlId )
{ 
	var xmlHttp = null;

	if( _xmlHttpArray[ controlId ] )
	{ 
		xmlHttp = _xmlHttpArray[ controlId ];
	}
	else
	{ 
		xmlHttp = createXmlHttp();
		_xmlHttpArray[ controlId ] = xmlHttp;
	}
	
	return xmlHttp;
}

function clearXmlHttp( controlId )
{ 
	_xmlHttpArray[ controlId ] = null;
}

function createXmlHttp()
{ 
	var xmlHttp = null;
	
	//  Creating object of XMLHTTP in IE 
	try
	{
		xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP" );
	}
	catch( e )
	{
		try
		{
			xmlHttp = new ActiveXObject( "Microsoft.XMLHTTP" );
		} 
		catch( oc )
		{
			xmlHttp = null;
		}
	}
	
	//  Creating object of XMLHTTP in Mozilla and Safari 
	if( !xmlHttp && 
		typeof XMLHttpRequest != "undefined" )
	{
		xmlHttp = new XMLHttpRequest();
	}
	
	return xmlHttp;
}

function warmUpXmlHttp( controlId )
{ 
	var requestUrl = null;
	var xmlHttp = null;
	
	//  URL to get areas for a given region 
	//  Will return suburbs of first area in region 
	requestUrl = getAjaxServerPage();
	
	xmlHttp = getXmlHttp( controlId );
	
	//  If browser supports XmlHttpRequest object 
	if( xmlHttp )
	{ 
		//  Initializes the request object with GET (METHOD of posting), 
		//  Request URL and sets the request as asynchronous 
		xmlHttp.open( 
			"GET" , 
			requestUrl , 
			true 
			);
		
		//  Setting the event handler for the response (region change) 
		xmlHttp.onreadystatechange = new function() 
		{ 
			handleResponse_WarmUpXmlHttp( controlId );
		};
		
		//  Sends the request to server 
		xmlHttp.send( null );
	}
}

//  Called when response comes back from server (region change) 
function handleResponse_WarmUpXmlHttp( controlId )
{ 
	var xmlHttp = null;
	
	xmlHttp = getXmlHttp( controlId );
	
	if( xmlHttp.readyState == 4 )
	{ 
		clearXmlHttp( controlId );
	}
}

function addLoadFunction( functionString )
{ 
	for( i = 0 ; i < _loadFunctionArray.length ; i ++ )
	{ 
		if( _loadFunctionArray[ i ] == functionString )
		{ 
			//  Already contains the load function 
			return;
		}
	}
	
	if( _currentLoadFunction == _loadFunctionArray.length )
	{ 
		window.setTimeout( loadLoadFunctionArray , 250 );
	}
	
	_loadFunctionArray.push( functionString );
}

function loadLoadFunctionArray()
{ 
	var loadFunctionString = "";
	
	if( _currentLoadFunction == _loadFunctionArray.length )
	{ 
		_currentLoadFunction = 0;
	}
	
	for( _currentLoadFunction ; _currentLoadFunction < _loadFunctionArray.length ; _currentLoadFunction ++ )
	{ 
		loadFunctionString = _loadFunctionArray[ _currentLoadFunction ];
		eval( loadFunctionString );
	}
}

// Show or hide element based on visibleBool value
function showHide( 
	elementIdString , 
	visibleBool )
{ 
	var element = null;
	
	element = document.getElementById( elementIdString );
	
	if( !element )
	{ 
		return;
	}
	
	if ( visibleBool )
	{ 
		element.style.display = "block";
	}
	else
	{ 
		element.style.display = "none";
	}
}

function clearDropDownList( dropDownList )
{ 
	//  Clears the dropDownList contents 
	for( var i = dropDownList.options.length - 1 ; -1 < i ; i-- )
	{ 
		dropDownList.options[ i ] = null;
	}
}

//  Returns the node text value 
function getInnerText( node )
{ 
	return( node.textContent || node.innerText || node.text );
}

function getAjaxServerPage( url )
{ 
	var indexOfApplicationFolder = 0;
	var indexOfRoot = 0;
	var indexOfFirstForwardSlash = 0;
	var applicationFolder = "";
	
	if( url == null )
	{ 
		url = document.location.href;
	}
	
	//  Test values 
	//  url = "http://www.nannyperfect.com/MemberCandidate/CandidateRegister.aspx"; 
	//  url = "http://localhost/NannyJob/MemberCandidate/CandidateRegister.aspx"; 
	//  url = "http://Ant2/NannyJob/MemberCandidate/CandidateRegister.aspx"; 
	//  url = "http://localhost/MemberCandidate/CandidateRegister.aspx"; 
	
	if( _ajaxServerPage == "" )
	{ 
		_ajaxServerPage = "AjaxControls/AjaxServer.aspx";
		indexOfApplicationFolder = url.toLowerCase().indexOf( "/nannyjob/" );
		
		if( indexOfApplicationFolder == -1 )
		{ 
			_ajaxServerPage = 
				"/" + 
				_ajaxServerPage;
		}
		else
		{ 
			indexOfRoot = url.indexOf( "/" ) + 2;
			
			indexOfFirstForwardSlash = url.indexOf( 
				"/" , 
				indexOfRoot 
				);
			applicationFolder = url.substr( 
				indexOfFirstForwardSlash + 1 , 
				url.indexOf( "/" , indexOfFirstForwardSlash + 1 ) - indexOfFirstForwardSlash - 1 
				);
			_ajaxServerPage = 
				"/" + 
				applicationFolder + 
				"/" + 
				_ajaxServerPage;
		}
	}
	
	return _ajaxServerPage;
}



//  =============================================================================== 
//  Old Code 
//  =============================================================================== 



/*
//  ================================================================== 
//  TimeSheetAjaxControl 
//  ================================================================== 



//  Load method for TimeSheetAjaxUserControl 
function timeSheetAjaxControl_Load( timeSheetAjaxControlId )
{ 
	//  alert( "timeSheetAjaxUserControl_OnLoad" ); 
	timeSheetAjaxControl_AllTimeBooleanDropDownInput_OnChange( timeSheetAjaxControlId );
}

// Show or hide dayTimePanel based on value of allTimeCheckBox
function timeSheetAjaxControl_AllTimeBooleanDropDownInput_OnChange( timeSheetAjaxControlId )
{ 
	var idString = "";
	var allTimeBooleanDropDownInput = null;
	var selectedValue = null;
	var visibleBool = false;
	var imIdPanel = null;
	
	idString = 
		timeSheetAjaxControlId + 
		"__allTimeBooleanDropDownInput__yesNoDropDownList";
	allTimeBooleanDropDownInput = document.getElementById( idString );
	
	if( !allTimeBooleanDropDownInput )
	{ 
		return;
	}
	
	selectedValue = allTimeBooleanDropDownInput.value;
	visibleBool = ( selectedValue == "1" );
	
	idString = 
		timeSheetAjaxControlId + 
		"__dayTimePanel";
	dayTimeDiv = document.getElementById( idString );
	
	if( !dayTimeDiv )
	{ 
		return;
	}
	
	showHide( 
		idString , 
		visibleBool 
		);
}
*/

/*
function getAjaxServerPage( url )
{ 
	var indexOfRoot = 0;
	var indexOfFirstForwardSlash = 0;
	var applicationFolder = "";
	
	if( url == null )
	{ 
		url = document.location.href;
	}
	
	//  Test values 
	//  url = "http://www.nannyperfect.com/MemberCandidate/CandidateRegister.aspx"; 
	//  url = "http://localhost/NannyJob/MemberCandidate/CandidateRegister.aspx"; 
	//  url = "http://Ant2/NannyJob/MemberCandidate/CandidateRegister.aspx"; 
	//  url = "http://localhost/MemberCandidate/CandidateRegister.aspx"; 
	
	if( _ajaxServerPage == "" )
	{ 
		_ajaxServerPage = "AjaxControls/AjaxServer.aspx";
		
		if( -1 < url.indexOf( "www." ) )
		{ 
			_ajaxServerPage = 
				"/" + 
				_ajaxServerPage;
		}
		else
		{ 
			indexOfRoot = url.indexOf( "/" ) + 2;
			
			indexOfFirstForwardSlash = url.indexOf( 
				"/" , 
				indexOfRoot 
				);
			applicationFolder = url.substr( 
				indexOfFirstForwardSlash + 1 , 
				url.indexOf( "/" , indexOfFirstForwardSlash + 1 ) - indexOfFirstForwardSlash - 1 
				);
			_ajaxServerPage = 
				"/" + 
				applicationFolder + 
				"/" + 
				_ajaxServerPage;
		}
	}
	
	return _ajaxServerPage;
}
*/

/*
function getAjaxServerPage( url )
{ 
	var indexOfLocalHost = 0;
	var indexOfFirstForwardSlash = 0;
	var applicationFolder = "";
	
	if( url == null )
	{ 
		url = document.location.href;
	}
	
	if( _ajaxServerPage == "" )
	{ 
		_ajaxServerPage = "AjaxControls/AjaxServer.aspx";
		
		indexOfLocalHost = url.indexOf( "localhost" );
		if( -1 < indexOfLocalHost )
		{ 
			indexOfFirstForwardSlash = url.indexOf( 
				"/" , 
				indexOfLocalHost 
				);
			
			applicationFolder = url.substr( 
				indexOfFirstForwardSlash + 1 , 
				url.indexOf( "/" , indexOfFirstForwardSlash + 1 ) - indexOfFirstForwardSlash - 1 
				);
			_ajaxServerPage = 
				"/" + 
				applicationFolder + 
				"/" + 
				_ajaxServerPage;
		}
		else
		{ 
			_ajaxServerPage = 
				"/" + 
				_ajaxServerPage;
		}
	}
	
	return _ajaxServerPage;
}
*/

/*
//  =================================================================== 
//  CandidateReference Class 
//  =================================================================== 



function CandidateReference( 
	key , 
	name , 
	email , 
	fromDate , 
	toDate , 
	verified )
{ 
	
	//  Set member variables values 
	this._key = key;
	this._name = name;
	this._email = email;
	this._fromDate = fromDate;
	this._toDate = toDate;
	this._verified = verified;
	
	//  Set functions 
	this.getKey = getKey;
	this.setKey = setKey;
	this.getName = getName;
	this.setName = setName;
	this.getEmail = getEmail;
	this.setEmail = setEmail;
	this.getFromDate = getFromDate;
	this.setFromDate = setFromDate;
	this.getToDate = getToDate;
	this.setToDate = setToDate;
	this.getVerified = getVerified;
	this.setVerified = setVerified;
	this.fromClientSideString = fromClientSideString;
	this.toClientSideString = toClientSideString;
	
	function getKey()
	{ 
		return _key;
	}
	
	function setKey( key )
	{ 
		_key = key;
	}
	
	function getName()
	{ 
		return _name;
	}
	
	function setName( name )
	{ 
		_name = name;
	}
	
	function getEmail()
	{ 
		return _email;
	}
	
	function setEmail( email )
	{ 
		_email = email;
	}
	
	function getFromDate()
	{ 
		return _fromDate;
	}
	
	function setFromDate( fromDate )
	{ 
		_fromDate = fromDate;
	}
	
	function getToDate()
	{ 
		return _toDate;
	}
	
	function setToDate( toDate )
	{ 
		_toDate = toDate;
	}
	
	function getVerified()
	{ 
		return _verified;
	}
	
	function setVerified( verified )
	{ 
		_verified = verified;
	}
	
	function fromClientSideString( clientSideString )
	{ 
		var split = null;
		
		split = clientSideString.split( ";" );
		if( split.length < 6 )
		{ 
			return;
		}
		_key = split[ 0 ];
		_name = split[ 1 ];
		_email = split[ 2 ];
		_fromDate = split[ 3 ];
		_toDate = split[ 4 ];
		_verified = split[ 5 ];
	}
	
	function toClientSideString()
	{ 
		var toRet = "";
		
		toRet = 
			_key + 
			";" + 
			_name + 
			";" + 
			_email + 
			";" + 
			_fromDate + 
			";" + 
			_toDate + 
			";" + 
			_verified;
			
		return toRet;
	}
	
}



//  =================================================================== 
//  CandidateReferenceMemberAjaxControlStateManager Class 
//  =================================================================== 



function CandidateReferenceMemberAjaxControlStateManager( candidateReferenceMemberAjaxControlId )
{ 
	
	this._candidateReferenceMemberAjaxControlId = candidateReferenceMemberAjaxControlId;
	this._action = "";
	this._actionIndex = 0;
	this._candidateReferenceGroup = new Array();
	this.getAction = getAction;
	this.setAction = setAction;
	this.getActionIndex = getActionIndex;
	this.setActionIndex = setActionIndex;
	this.getActionIndexCandidateReference = getActionIndexCandidateReference;
	this.load = load;
	this.save = save;
	load();
	
	function getAction()
	{ 
		return _action;
	}
	
	function setAction( action )
	{ 
		_action = action;
		if( _action != "update" && 
			_action != "delete" )
		{ 
			_actionIndex = -1;
		}
	}
	
	function getActionIndex()
	{ 
		return _actionIndex;
	}
	
	function setActionIndex( actionIndex )
	{ 
		_actionIndex = actionIndex;
	}
	
	function getActionIndexCandidateReference()
	{ 
		if( -1 < _actionIndex && 
			_actionIndex < _candidateReferenceGroup.length )
		{ 
			return _candidateReferenceGroup[ _actionIndex ];
		}
	}
	
	function load()
	{ 
		var idString = "";
		var actionHtmlInputControl = null;
		var split = null;
		var dataHtmlInputControl = null;
		var dataString = "";
		var candidateReferenceGroup = null;
		var candidateReference = null;
		
		//  _action 
		//  _actionIndex 
		idString = 
			candidateReferenceMemberAjaxControlId + 
			"__actionHtmlInputControl";
		actionHtmlInputControl = document.getElementById( idString );
		if( actionHtmlInputControl )
		{ 
			if( actionHtmlInputControl.value == "" )
			{ 
				_action = "";
				_actionIndex = -1;
			}
			else if( actionHtmlInputControl.value.indexOf( "=" ) == -1 )
			{ 
				_action = "add";
				_actionIndex = -1;
			}
			else
			{ 
				split = actionHtmlInputControl.value.split( "=" );
				_action = split[ 0 ];
				_actionIndex = split[ 1 ]*1;
			}
		}
		
		//  _candidateReferenceGroup 
		idString = 
			candidateReferenceMemberAjaxControlId + 
			"__dataHtmlInputControl";
		dataHtmlInputControl = document.getElementById( idString );
		candidateReferenceGroup = new Array();
		if( dataHtmlInputControl )
		{ 
			if( dataHtmlInputControl.value == "" )
			{ 
				
			}
			else
			{ 
				split = dataHtmlInputControl.value.split( "|" );
				for( i = 0 ; i < split.length ; i ++ )
				{ 
					candidateReference = new CandidateReference( 0 , "" , "" , "1900/01/01" , "1900/01/01" , false );
					candidateReference.fromClientSideString( split[ i ] );
					candidateReferenceGroup[ i ] = candidateReference;
				}
			}
		}
		this._candidateReferenceGroup = candidateReferenceGroup;
	}
	
	function save()
	{ 
		var idString = "";
		var actionHtmlInputHidden = null;
		var valueString = "";
		
		//  actionHtmlInputControl 
		idString = 
			candidateReferenceMemberAjaxControlId + 
			"__actionHtmlInputControl";
		actionHtmlInputControl = document.getElementById( idString );
		if( actionHtmlInputControl )
		{ 
			valueString = _action;
			if( _action == "update" || 
				_action == "delete" )
			{ 
				valueString += 
					"=" + 
					_actionIndex;
			}
			actionHtmlInputControl.value = valueString;
		}
		
		//  dataHtmlInputControl 
		idString = 
			candidateReferenceMemberAjaxControlId + 
			"__dataHtmlInputControl";
		dataHtmlInputControl = document.getElementById( idString );
		if( dataHtmlInputControl )
		{ 
			valueString = "";
			for( i = 0 ; i < _candidateReferenceGroup.length; i ++ )
			{ 
				valueString += _candidateReferenceGroup[ i ].toClientSideString();
				if( ( i + 1 ) < _candidateReferenceGroup.length )
				{ 
					valueString += "|";
				}
			}
			dataHtmlInputControl.value = valueString;
		}
	}
	
}
*/

/*
function candidateReferenceMemberAjaxControl_UpdateShowPanel( candidateReferenceMemberAjaxControlId )
{ 
	var candidateReferenceMemberAjaxControlStateManager = null;
	var idString = "";
	var groupAdminPanel = null;
	var adminPanel = null;
	var candidateReference = null;
	
	candidateReferenceMemberAjaxControlStateManager = new CandidateReferenceMemberAjaxControlStateManager( 
		candidateReferenceMemberAjaxControlId 
		);

	//  Load showGroupAdminPanel and showAdminPanel 
	//  Show/Hide groupAdminPanel 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__groupAdminPanel";
	groupAdminPanel = document.getElementById( idString );
	if( groupAdminPanel )
	{ 
		showHide( 
			idString , 
			!candidateReferenceMemberAjaxControlStateManager.getShowAdmin() 
			);
	}
	
	//  Show/Hide adminPanel 
	idString = 
		candidateReferenceMemberAjaxControlId + 
		"__adminPanel";
	adminPanel = document.getElementById( idString );
	if( adminPanel )
	{ 
		showHide( 
			idString , 
			candidateReferenceMemberAjaxControlStateManager.getShowAdmin() 
			);
	}
	
	//  Fill fields for validation 
	if( candidateReferenceMemberAjaxControlStateManager.getShowAdmin() )
	{ 
		candidateReference = new CandidateReference( 0 , "" , "" , "" , "" );
	}
	else
	{ 
		candidateReference = new CandidateReference( 0 , " " , "input@email.com" , "1900-01-01" , "" );
	}
	candidateReferenceMemberAjaxControl_SetCandidateReference( 
		candidateReferenceMemberAjaxControlId , 
		candidateReference 
		);
}
*/

/*
function loadLoadFunctionArray()
{ 
	var loadFunctionString = "";
	
	if( _currentLoadFunction == _loadFunctionArray.length )
	{ 
		_currentLoadFunction = 0;
	}
	
	for( _currentLoadFunction ; _currentLoadFunction < _loadFunctionArray.length ; _currentLoadFunction ++ )
	{ 
		loadFunctionString = _loadFunctionArray[ _currentLoadFunction ];
		eval( loadFunctionString );
	}
	
	//
	while( 0 < _loadFunctionArray.length )
	{ 
		loadFunctionString = _loadFunctionArray.pop();
		eval( loadFunctionString );
	}
	//
	
	//
	for( i = _loadFunctionArray.length - 1 ; -1 < i ; i -- )
	{ 
		eval( _loadFunctionArray[ i ] );
	}
	//
}
*/


/*
function Hashtable()
{ 
	this.values = new Array();
	this.keys = new Array();
	
	this.add = new function( key , value )
	{ 
		if( this.values[ key ] == null )
		{ 
			this.keys[ this.keys.length ] = key;
			this.values[ key ] = value;
		}
	}
	
	this.get = new function( key )
	{ 
		return this.values[ key ];
	}
	
	this.remove = new function( key )
	{ 
		
	}
}
*/
