

function C (ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size,streetNo,streetName,status,mlsNo2,enteredBy,showingInstructions){
	link = '<a href=javascript:e() onclick=detail("'+ counter + '") onmouseover=detail("' + counter  +'") TITLE="Click here to view the feature sheet.">'
	detailU = detailUrl+ mlsNo
	viewLink = '<a href=javascript:e() onclick=editApptLink('+counter+') >'
	bookAppt ='bookAppt?submitType=init&dbString=' + dbString +'&szWebCode=' + code + '&iListno=' +ilistNo; 
	editU = '../AddEditListing/AddEditListing.dll/EditFrame?dbString=' + dbString +'&szWebCode=' + code + '&iListno=' + ilistNo 
	detailLink = '<a href=javascript:e() onclick=openAWindowWS("'+ detailU + '","detail",800,600) onmouseover=detail("' + counter  +'") TITLE="Click here to view the feature sheet.">'
	editLink = '<a href=javascript:e() onclick=openAWindowNS("'+ editU + '","detail",790,530) onmouseover=detail("' + counter  +'") TITLE="Click here to edit listing.">'
	apptLink = '<a href=javascript:e() onclick=openAWindowWS("'+ bookAppt + '","",630,530) onmouseover=detail("' + counter  +'") TITLE="Click here to book an appointment.">'
	vApptLink = '<a href=javascript:e() onclick=viewApptLink("' +  counter  +'","'+ilistNo +'") TITLE="Click here to view appointments.">'
	checkBoxText = '<input id=checkbox name=cb type=checkbox value=' + ilistNo + ' tag='+counter +' >'
	//EditFrame?dbString=TEST:TEST2:TEST:TEST:TEST:TEST:TEST&szWebCode=FOLK05:WINLAW&iListno=270216
   //alert(apptLink)
   //alert(editLink)
	if (imagePresent == "i") {
		imageLine = '<IMG border=0 alt="" src="../images/camera.gif">' ;
	}else {
		imageLine=""
	}
	document.write("<TR id=" + idType + ">" +
		 "<TD> " + detailLink + imageLine + "</a></TD>" +
		 "<TD> " + checkBoxText + "</TD>" +
		"<TD> " + detailLink  + mlsNo +  "</a> </TD>" +	
		"<TD> " + editLink + currentPrice + "</a></TD>" +	
		"<TD> " + vApptLink + streetNo + "</a></TD> "+
		"<TD> " + apptLink + streetName + "</a></TD> "+	
		"<TD> "  + detailLink + listType + "</a></TD> "+	"<TD> "  +
		 bedrooms + ' & ' + bathrooms + "</a></TD> "+	"<TD> "  + status + "</a></TD>" +	
		"</TR>"	)
	
	if ( idType == "light" ){
		idType="dark"
	}else {
		idType="light"
	}
	dataList[counter++] = [ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size,streetNo,streetName,status,mlsNo2,enteredBy,showingInstructions]
	element = dataList[counter - 1]
}

function apptListingDetail (ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size,streetNo,streetName,status,mlsNo2,enteredBy,showingInstructions){
	
	dataList[0] = [ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size,streetNo,streetName,status,mlsNo2,enteredBy,showingInstructions]
	command = 'listMasks = { ' + opener.parent.frames['title'].document.forms[0].listMask.value + 'Delroy:"Builder" }'
	showingInstructionsText = showingInstructions
	listingAvailable = 'T'
	eval(command)
	detailTable(0)
}
function apptListingDetailE (ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size,streetNo,streetName,status,mlsNo2,enteredBy,showingInstructions){
	
	dataList[0] = [ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size,streetNo,streetName,status,mlsNo2,enteredBy,showingInstructions]
	command = 'listMasks = { ' + opener.parent.document.forms[0].listMask.value + 'Delroy:"Builder" }'
	showingInstructionsText = showingInstructions
	listingAvailable = 'T'
	eval(command)
	detailTable(0)
}

function detail (ilistNo){
	element = dataList[ilistNo]
	content = '<html><head><LINK REL=StyleSheet HREF="../detail.css" TYPE="text/css" MEDIA=screen >'
	content += '<BODY><Table >'
	content += "<TR> <TD class=column1>Sold Price </TD><TD>" +  element[soldPriceI] + 
		    '</TD><TD class=column2>MLS No.1</TD><TD>' + element[mlsNoI] + 
		    '</TD><TD  class=column3>'+listMasks["Rooms"] + '</TD><TD>' + element[roomsI] + 
		    '</TD><TD class=column3>'+listMasks["District"] + '</TD><TD class=D4 nowrap >' + element[DistrictI] +
		   
		     '</TD></TR>'

	content += "<TR> <TD class=column1 >AddCode </TD><TD>" +  element[adcodeI] + 
		    '</TD><TD class=column2>D.O.M</TD><TD>' + "" + 
		    '</TD><TD class=column3>'+listMasks["BedRooms"] + '</TD><TD>' + element[bedroomsI] + 
		    '</TD><TD class=column3>'+listMasks["VRM"] + '</TD><TD>' + element[vrmI]+
		     '</TD></TR>'

	content += "<TR> <TD class=column1 >"+listMasks["PendingDate"] + "</TD><TD>" +  element[conditionExpiryDateI] + 
		    '</TD><TD class=column2>Lock Box</TD><TD>' + element[lockboxI] + 
		    '</TD><TD class=column3>'+listMasks["BathRooms"] + '</TD><TD>' + element[bathroomsI] + 
		    '</TD><TD></TD><TD rowspan=>' + "" +
		     '</TD></TR>'

	content += "<TR> <TD class=column1>"+listMasks["ExpiryDate"] + "</TD><TD>" +  element[expirydateI] + 
		    '</TD><TD class=column2>Square ft</TD><TD>' + element[sizeI] + 
		    '</TD><TD class=column3>'+listMasks["Parking"] + '</TD><TD>' + element[parkingI] + 
		    //'</TD><TD>District</TD><TD>' + element[DistrictI] +
		     '</TD></TR>'

	content += "<TR> <TD class=column1 >Listing Date</TD><TD>" +  element[listdateI] + 
		    '</TD><TD class=column2>OpenHouse</TD><TD>' + element[openhouseFromTimeI] + 
		    '</TD><TD class=column3>Office</TD><TD>' + element[iofficeidI]  + 
		    
		     '</TD></TR>'
	content += '</table></BODY></html>'
	parent.frames["details"].document.close()
	parent.frames["details"].document.write(content)

}

function getData(locater){
	text = '["'+dataList[locater][ilistNo]+'","'+dataList[locater][mlsNo]+'","'+dataList[locater][imagePresent]+'","'+dataList[locater][currentPrice]+'","'+dataList[locater][address]+'","'+dataList[locater][listType]+'","'+dataList[locater][bedrooms]+'","'+dataList[locater][bathrooms]+'","'+dataList[locater][adcode]+'","'+dataList[locater][listdate]+'","'+dataList[locater][expirydate]+'","'+dataList[locater][openhouseFromTime]+'","'+dataList[locater][openhouseToTime]+'","'+dataList[locater][District]+'","'+dataList[locater][imageName]+'","'+dataList[locater][parking]+'","'+dataList[locater][soldPrice]+'","'+dataList[locater][rooms]+'","'+dataList[locater][vrm]+'","'+dataList[locater][iofficeid]+'","'+dataList[locater][lockbox]+'","'+dataList[locater][conditionExpiryDate]+'","'+dataList[locater][size]+'"]'
	alert(text)
//[ilistNo,mlsNo,imagePresent,currentPrice,address,listType,bedrooms,bathrooms,adcode,listdate,expirydate,openhouseFromTime,openhouseToTime,District,imageName,parking,soldPrice,rooms,vrm,iofficeid,lockbox,conditionExpiryDate,size]
//]+'","'+dataList[locater][
}


function detailTable (ilistNo){
	
	element = dataList[ilistNo]

	content = ''
	content += '<Table class=listingDetails >'
	content += '<TR> <TD class=column1>Status </TD><TD>' +  element[statusI] + 
		    '</TD><TD class=column2>List No</TD><TD>' + element[ilistNoI] + 
		    '</TD><TD  class=column3>Listing Date</TD><TD>' +  element[listdateI] + 
		    '</TD><TD class=column3>Entered By</TD><TD class=D4 nowrap > <script language=javascript>getEnteredBy()</script>' +
		   
		     '</TD></TR>'
	
	content += '<TR> <TD class=column1 >Lock Box</TD><TD>' + element[lockboxI] +  
		    '</TD><TD class=column2>MLS No1</TD><TD>' + element[mlsNoI] + 
		    '</TD><TD class=column3>'+listMasks["ExpiryDate"] + "</TD><TD>" +  element[expirydateI] + 
		    '</TD><TD class=column3>Confirmed By</TD><TD class=D4 nowrap > <script language=javascript>getConfirmedBy()</script>' +
		     '</TD></TR>'

	content += '<TR> <TD class=column1 >District</TD><TD>' + element[DistrictI] +
		    '</TD><TD class=column2>MLS No2</TD><TD>' + element[mlsNo2I] + 
		    '</TD><TD class=column3>'+listMasks["PendingDate"] + "</TD><TD>" +  element[conditionExpiryDateI] + 
		    '</TD><TD></TD><TD rowspan=>' + "" +
		     '</TD></TR>'

	
	content += '</table>';

	document.write(content)
}

function getEnteredBy(){
	document.write("Admin");
}
function getConfirmedBy(){
	document.write("Admin");
}

function showItem(ilistNo){

	element = dataList[ilistNo]
}

//Function that displays the search screen in the main window
function searchScreen(){
	
	parent.frames['mainwindow'].location.href = parent.frames['title'].document.forms[0].history.value
	//parent.frames["details"].history.back()
}

//Opens a window
function openAWindowNS(pageToLoad,awinName,wwidth,wheight)
{
    xposition=0; 
    yposition=0;
    
    if (parseInt(navigator.appVersion) >= 4 )
    {
    
	xposition = (screen.width - wwidth) / 2;
	yposition = (screen.height - wheight) / 2;
       
    }
    args = "width=" + wwidth + "," + "height=" + wheight + ",location=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + ","  + "top=" + yposition;   
    window.open(pageToLoad,awinName,args);

}

//Opens a window
function openAWindowWS(pageToLoad,awinName,wwidth,wheight)
{
    xposition=0; 
    yposition=0;
    
    if (parseInt(navigator.appVersion) >= 4 )
    {
    
	xposition = (screen.width - wwidth) / 2;
	yposition = (screen.height - wheight) / 2;
       
    }
    args = "width=" + wwidth + "," + "height=" + wheight + ",location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0,hotkeys=0,screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + ","  + "top=" + yposition;   
    window.open(pageToLoad,awinName,args);

}
listMasks = ""
//Performs loading operations
function loadActions(){
	command = 'listMasks = { ' + parent.frames['title'].document.forms[0].listMask.value + 'Delroy:"Builder" }'
	eval(command)
	parent.frames['title'].document.forms[0].apptBlankLink.value = '?submitType=init&dbString=' + dbString +'&szWebCode=' + code + '&iListno=' ;
}
function e () {
}

function A(agentName,agentID,agentCode,companyName,companyNumber,agentNumber){
	//alert(agentName);
	//document.write(agentName);
	agentList[agentCounter] = [decodeData(agentName),agentID,agentCode,decodeData(companyName),companyNumber,agentNumber]
	document.forms[0].agentName.options[agentCounter] = new Option(decodeData(agentName),agentCounter++)
}

//////////////////////////////////////////////////////////////////////////////
/*****************************************************************************
 *	Generate BuyerSeller data
 *
 *
 *
 *
 *
 *
 *****************************************************************************
 */
function BS(szName,bsID,cellPhone,busPhone,resPhone){
	//alert(agentName);
	//document.write(agentName);
	bsList[bsCounter] = [decodeData(szName),bsID,cellPhone,busPhone,resPhone]
	document.forms[0].buyerSeller.options[bsCounter] = new Option(decodeData(szName),bsCounter++)
}


//replace &db99 in data with '
function decodeData(input){
	reg = "/\&db99/g"
	return input.replace(reg,"'")

}
function listingAgent(agentName,agentCode,resTel,busTel,busFax,busExt,inOut){
	content = ''
	if (listingAgentCount++ == 0){
		content += '<tr><th>Agent Name </th><th>Extension</th><th>IN/OUT</th><th>Residence</th><th>Business</th><th>Fax</th></tr>'
	}

	//alert(formatPhone(busTel))

	cText = '</td><td>' 
	content += '<tr><td>' + decodeData(agentName) + cText + busExt + cText + inOut + cText + formatPhone(resTel) + cText+ formatPhone(busTel) + cText + formatPhone(busFax) +'</TD></tr>'
	document.write(content)
}

function buyerSeller(type,lastName,firstName,resTel,busTel,busFax,busExt){
	content = ''

	//alert(lastName)
	if (buyerSellerCounter == 0){
		content += '<tr><th>Type</th><th>Last Name</th><th>Frist Name</th><th>Residence</th><th>Business</th><th>Fax</th><th>Ext</th></tr>'
	}
	cText = '</td><td>' 
	content += '<tr><td>' + type + cText + lastName + cText + firstName + cText + formatPhone(resTel) + cText+ formatPhone(busTel) + cText + formatPhone(busFax)  + cText + busExt+'</TD></tr>'
	document.write(content)
	buyerSellerCounter++
}

/***********************************************************************
 *	Activity Log table generator.
 ***********************************************************************/
function al(comment,listno,dtDate,fromDate,activity,toDate){
	
	document.write("<TR id=" + idType + ">" +
	
		 "<TD> " + activity + "</TD>" +
		"<TD> " + fromDate+ " </TD>" +	
		"<TD> " + toDate + "</TD>" +	
		"<TD> " + comment + "</TD> "+	
		"</TR>"	)
	
	if ( idType == "light" ){
		idType="dark"
	}else {
		idType="light"
	}
}
/***********************************************************************
 *	View appointment data converter function.
 ***********************************************************************/
function V(apptNo,agentName,companyName,agentCode,companyTelephone,msgText,fromTime,toTime,fromDate,msgType,ilistNo,agentTel){
	detailLink = '<a href=javascript:e() onclick=editApptLink('+apptCount+') >'
	document.write("<TR id=" + idType + ">" +
		"<TD> " + "<input name=cb id=checkbox type=checkbox value= "+ apptNo+ " tag="+ apptCount + "></TD>" +
		"<TD> "+detailLink + agentName + "</a></TD>" +
		 "<TD> " + companyName + "</TD>" +
		"<TD> " + formatPhone(companyTelephone )+ " </TD>" +	
		"<TD> " + msgType + "</TD>" +	
		"<TD> " + fromDate + "</TD> "+	
		"<TD> "  + fromTime + "</TD> "+
		"<TD> "  + toTime + "</TD> "+	
		"<TD> "  + msgText + "</TD> "+	
		"</TR>"	)
	
	if ( idType == "light" ){
		idType="dark"
	}else {
		idType="light"
	}
	apptList[apptCount++] = [apptNo,agentName,ilistNo,companyName,agentCode,companyTelephone,msgText,fromTime,toTime,fromDate,msgType,agentTel]
}


/***********************************************************************
 *	View appointment data converter function for customer workstation.
 ***********************************************************************/
function V2(apptNo,agentName,companyName,agentCode,companyTelephone,msgText,fromTime,toTime,fromDate,msgType,ilistNo,szShowingComments,agentTel){
	detailLink = '<a href=javascript:e() onclick=editApptLink('+apptCount+') >'
	document.write("<TR id=" + idType + ">" +
		"<TD> "+  agentName + "</a></TD>" +
		 "<TD> " + companyName + "</TD>" +
		"<TD> " + formatPhone(companyTelephone )+ " </TD>" +	
		"<TD> " + msgType + "</TD>" +	
		"<TD> " + fromDate + "</TD> "+	
		"<TD> "  + fromTime + "</TD> "+
		"<TD> "  + toTime + "</TD> "+	
		"<TD> "  + msgText + "</TD> "+	
		"<TD> "  + szShowingComments + "</TD> "+
		"</TR>"	)
	
	if ( idType == "light" ){
		idType="dark"
	}else {
		idType="light"
	}
	
}

/***********************************************************************
 *	Caller log todo list
 ***********************************************************************/
function CL(callerName,code,dtdate,dtRemind,Source,callerLogID,agentCode,agentName){
	detailLink = '<a href=javascript:e() onclick=editCaller(' + clCount + ',' + code + ',' + callerLogID +') >'
	document.write("<TR id=" + idType + ">" +
		"<TD> " + "<input name=cb id=checkbox type=checkbox value= "+ callerLogID + " tag="+ clCount + "></TD>" +
		"<TD> "+detailLink+decodeData(agentName) + "</a></TD>" +
		 "<TD> " + decodeData(callerName) + "</TD>" +
		"<TD> " +detailLink+ dtdate + "</a> </TD>" +	
		"<TD> " + dtRemind + "</TD>" +	
		"<TD> " + Source + "</TD> "+	
		
		"</TR>"	)
	
	if ( idType == "light" ){
		idType="dark"
	}else {
		idType="light"
	}
	clList[clCount++] = [callerName,code,dtdate,dtRemind,Source,callerLogID,agentCode,agentName]
}

function apptData(apptNo,agentName,companyName,agentCode,companyTelephone,msgText,fromTime,toTime,fromDate,msgType,brokerRole,accessBy,msgWith,comments,feedback,szConfirmed,lastAttempt,agentTel){
		//index = document.forms[0].agentName.options[document.forms[0].agentName.selectedIndex].value
		document.forms[0].apptAgentCode.value = agentCode	
		document.forms[0].companyName.value = companyName
		document.forms[0].companyNumber.value = formatPhone(companyTelephone)
		document.forms[0].agentNumber.value = formatPhone(agentTel)
		document.forms[0].apptAgentName.value = agentName
		document.forms[0].saveButton.disabled = false
		fromTimeArray = split(fromTime," ")
		toTimeArray = split(toTime," ")
		document.forms[0].fromDate.value = fromDate
		document.forms[0].fromTime.value = fromTimeArray[0]
		document.forms[0].toTime.value = toTimeArray[0]	
		selectOption(msgType,document.forms[0].appointmentType) 
		selectOption(brokerRole,document.forms[0].brokerRole) 
		selectOption(msgText,document.forms[0].confirmedMessage) 
		selectOption(accessBy,document.forms[0].accessBy) 
		selectOption(fromTimeArray[1],document.forms[0].fromTimeTOD)	
		selectOption(toTimeArray[1],document.forms[0].toTimeTOD)
		document.forms[0].comments.value = comments
		document.forms[0].feedback.value = feedback
		document.forms[0].messageWith.value = msgWith
		document.forms[0].lastAttempt.value = lastAttempt
		if (szConfirmed  == 'True'){
			 document.forms[0].confirmedCheckBox.checked = true
		}else {
			document.forms[0].confirmedCheckBox.checked = false
		}
		document.forms[0].agentName.selectedIndex = 0;
}

function selectOption(valueText,selectObject){
	for ( i = 0; i < selectObject.length;i++){
		if (selectObject.options[i].value == valueText){
			selectObject.options[i].selected = true
			break;	
		}
	}
}

function updateAgentInfo(){
	if (document.forms[0].agentName.length > 0) {
		index = document.forms[0].agentName.options[document.forms[0].agentName.selectedIndex].value
		document.forms[0].apptAgentCode.value = agentList[index][agentCode]	
		document.forms[0].companyName.value = agentList[index][companyName]
		document.forms[0].companyNumber.value = formatPhone(agentList[index][companyNumber])
		document.forms[0].agentNumber.value = formatPhone(agentList[index][agentNumber])
		document.forms[0].szName.value = document.forms[0].agentName.options[document.forms[0].agentName.selectedIndex].text
		document.forms[0].apptAgentName.value = agentList[index][agentName]
		document.forms[0].saveButton.disabled = false
		//alert(document.forms[0].apptAgentName.value)
	}
}

function updateBuyerInfo(){
	if (document.forms[0].buyerSeller.length > 0) {
		index = document.forms[0].buyerSeller.options[document.forms[0].buyerSeller.selectedIndex].value
		document.forms[0].buyerSellerCode.value = bsList[index][szBSLIDI]	
		document.forms[0].resPhone.value = formatPhone(bsList[index][szResPhoneI])
		document.forms[0].cellPhone.value = formatPhone(bsList[index][szCellPhoneI])
		document.forms[0].busPhone.value = formatPhone(bsList[index][szBusPhoneI])
		document.forms[0].buyerSellerName.value = bsList[index][agentName]
		document.forms[0].szName.value = bsList[index][szNameI]	
		//alert(bsList[index][szBSLIDI])
		//alert(document.forms[0].szName.value)
		//alert(document.forms[0].apptAgentName.value)
	}
}

//Function that set call information during an edit.
function setCL(callerName,callerCode,dtDate,dtRemind,source,callerLogId,agentCode,listNo,todo,todoDate,completed,completedDate,completedBy,comment){
	//alert(callerName+':'+todo)
	options = document.forms[0].source.options
	for ( i = 0;i < document.forms[0].source.length;i++){
		if ( options[i].text == source ){
			options[i].selected = true;
			break;
		}
	}
	options = document.forms[0].agentCode.options
	for ( i = 0;i < document.forms[0].source.length;i++){
		if ( options[i].value == agentCode ){
			options[i].selected = true;
			break;
		}
	}
	if (listNo != '0' ){
		document.forms[0].listNo.value = listNo
	}
	document.forms[0].comment.value = comment
	if (todo == 'True' ){
		document.forms[0].todoCheck.checked = true
		document.forms[0].nextTime.selectedIndex = 2
	}else {
		document.forms[0].todoCheck.checked = false
	}
	
	if (completed == 'True' ){
		document.forms[0].completedCheck.checked = true
		document.forms[0].completedDate.value = completedDate
	}else {
		document.forms[0].completedCheck.checked = false
	}
	document.forms[0].callerLogId.value = callerLogId
}
//////////////////////////////////////////////////////////////////////////////////////////////
//	Function called when the street number is clicked on a listing search result.
//////////////////////////////////////////////////////////////////////////////////////////////
function viewApptLink(apptNo,listNo){
	address =  parent.frames['mainwindow'].dataList[apptNo][addressI]
	//alert(parent.frames['title'].document.forms[0].apptBlankLink.value + listNo)
	openAWindowNS( "viewAppt"+parent.frames['title'].document.forms[0].apptBlankLink.value + listNo,"",700,530) 
}


function getCalDate(cal){
	document.forms[0].fromDate.value = cal.value
	
}

function setSearchData(dtFrom,agentCode,toDo,completed,source){
	
	document.forms[0].fromDate.value = dtFrom
	options = document.forms[0].agentCode.options
	for ( i = 0;i < document.forms[0].agentCode.length;i++){
		if ( options[i].value == agentCode ){
			options[i].selected = true;
			break;
		}
	}
	options = document.forms[0].source.options
	for ( i = 0;i < document.forms[0].source.length;i++){
		if ( options[i].text == source ){
			options[i].selected = true;
			break;
		}
	}
	
	if (completed == 'T' ){
		document.forms[0].completedCheck.checked = true
	}else {
		document.forms[0].completedCheck.checked = false
	}
	
	if (toDo == 'T' ){
		document.forms[0].todoCheck.checked = true
	}else {
		document.forms[0].todoCheck.checked = false
	}
	
}


//Global Variables
idType="light"
listingAvailable = 'F'
showingInstructionsText = ''
dataList= new Array(50)
agentList = new Array(50)
apptList = new Array(50)
agentCounter = 0
apptCount = 0
buyerSellerCounter = 0
counter=0
ilistNoI=0
listingAgentCount=0
bookApptBlank = '' 
//Agent Data
agentName=0
agentID=1
agentCode=2
companyName=3
companyNumber=4
agentNumber=5

//Todo List
clList = new Array(50)
clCount = 0
clcallerNameI = 0 
clcodeI = 1
cldtdateI = 2
cldtRemindI = 3
clSourceI = 4
clcallerLogIDI = 5
clagentCodeI = 6
clagentNameI = 7


//BuyerSellerLawyer array elements
szNameI=0
szBSLIDI=1
szCellPhoneI=2
szBusPhoneI=3
szResPhoneI=4
bsCounter=0;
bsList = new Array(50)

//Listing Data elements
ilistNo=0
mlsNoI=1
imagePresentI=2
currentPriceI=3
addressI=4
listTypeI=5
bedroomsI=6
bathroomsI=7
adcodeI=8
listdateI=9
expirydateI=10
openhouseFromTimeI=11
openhouseToTimeI=12
DistrictI=13
imageNameI=14
parkingI=15
soldPriceI=16
roomsI=17
vrmI=18
iofficeidI=19
lockboxI=20
conditionExpiryDateI=21
sizeI=22
streetNoI=23
streetNameI=24
statusI=25
mlsNo2I=26
enteredByI=27
showingInstructionsI=28
