
function BuildDiv(id, oDataObj)
{
	var xsl="", output="", div;
	if (oDataObj)
	{
		if (oDataObj.nodeType==1)
			oDataObj.setAttribute('isContact', ((oDataObj.nodeName=='CONTACT')?'1':'0'));
		xTmp.loadXML(GetSectionXSL(id,1,oDataObj));
		CheckError(xTmp);
		output = oDataObj.transformNode(xTmp);
		if (oDataObj.nodeType==1)
			oDataObj.removeAttribute('isContact');
	}
	else
		output = GetSectionXSL(id);
	
	switch (id)
	{
		case 'POPUP':
		case 'LOGON':
		case 'LOGOFF':
		case 'PREF':
		case 'CallControl':
		case 'CSFM':
		case 'FooterButtons':
		case 'Float':
		case 'MSEX':
		case 'UB':
		case 'AC':
		case 'newCallAndSearch':
		case 'dv_feature_codes': div = getObj(id); break;
		
		case 'RRED':
		case 'NAPI': div = getObj('tabs'+id); break;
		
		case 'PP': 
			if (!b_MARGARITA_LICENSED)
				return;
			break;
		
		case 'EDNM':
		case 'EDWK':
		case 'EDHM':
		case 'EDAD': div = getObj('table'+id); break;
		
		case 'SYSO':
		case 'SYCS':
		case 'SYCF': div = getObj('ABSY'); break;
	}
	
	if (!div)
		div = getObj(id).children[oComponents.selectSingleNode('CONTENT[@abbr="'+id+'"]').getAttribute('type')+id];
	div.innerHTML = output;

	if (id!='CSFM' || id!='NA')
	{
		var xpath;
		if (oDataObj && oDataObj.nodeType==1 && oDataObj.getAttribute('readOnly'))
		{
			xpath = 'r="{0}"';
			xpath = Insert(oDataObj.getAttribute('readOnly'), xpath);
		}
		SetButtons(id, xpath);
	}
	
	switch (id)
	{
		case 'ED':
		case 'PI':
		case 'NAPI':
		case 'RRED':
			tab[id] = new TabObject(id, getObj('tabs'+id));
			tab[id].readOnly = eval(oDataObj.getAttribute('readOnly'));
			tab[id].refresh();
			break;

		case 'CT':
			tab[id] = new TabObject(id, getObj('tabs'+id));
			tab[id].refresh();
			BuildTable('GPLS');
			BuildTable('GPAB');
			break;

		case 'RL':
			tab[id] = new TabObject(id, getObj('tabs'+id));
			tab[id].refresh();
			break;
			
		case 'dv_feature_codes':
			tab['dv_feature_codes'] = new TabObject('dv_feature_codes', getObj('dv_feature_codes'));
			tab['dv_feature_codes'].refresh();
			// build in reverse order so buttons with be set for the user tab
			BuildTable('FCFAVS');
			BuildTable('FCADMN');
			BuildTable('FCUSER');
			break;
		
		case 'GP':
			BuildTable('GPLS');
			BuildTable('GPAB');
			break;
		
		case 'CSFM':
			getObjects('cs_availibility')[0].checked=true;
			SetButtons('CS');
			break;
		
		case 'PP':
			//SetPassportValues();
			break;
			
		case 'PREF':
			ConfigurePreferencesCheckboxes();
			break;
	}
}

function CreateHTML(id,bXSLFormat,oDataObj)
{
	xTmp.loadXML(GetSectionXSL(id,bXSLFormat,oDataObj));
	CheckError(xTmp);
	return oDataObj.transformNode(xTmp);
}

function GetSectionXSL(id, bXSLFormat, oDataObj, sAdditionalInfo)
{
	var LOGIN_STATUS  = new Number(0x00005);
	var x = "";
	if (bXSLFormat)
	{
		var match_name = (oDataObj && oDataObj.nodeName!='#document') ? oDataObj.nodeName : "/";
		x+= "<?xml version=\"1.0\"?>";
		x+= "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">";
		x+= "<xsl:template match=\""+ match_name +"\" xml:space=\"preserve\" >";
	}
	switch (id)
	{
		case "AC": 
			x+= "<div id=\"AC\" style=\"height:320px;\">";
			x+= 	"<div id=\"CC\" style=\"display:none;padding-right:0%;height:320px;\">";
//			x+= 	"<div id=\"CC\" style=\"padding-right:0%;height:320px;\">";
			x+= 		"<span>"+ CreateSingleDiv(oComponents.selectSingleNode("CONTENT[@abbr='TA']")) +"</span>";
			x+= 		"<span>"+ CreateSingleDiv(oComponents.selectSingleNode("CONTENT[@abbr='CL']")) +"</span>";
			x+= 	"</div>";
			x+= "</div>";
			break;
		case "newCallAndSearch":

			x+=	"<div style='margin:10% 0% 10% 5%'>";
			x+=		"<span>Search:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><input type=\"text\" id=\"cc_type_ahead_search\" onfocus=\"cur_search_type='TA'\" onkeyup=\"HandleKeypressInterval()\" class=\"call_control_input\" /></span>";	
			x+=	"</div>";
			
			x+=	"<div style='margin:10% 0% 2% 5%'>";
			x+=		"<span>Place Call:  <input type='text' id='cc_place_call_number' class='call_control_input' onkeydown='HandleKeydown(\"place_call\")'/>";
			x+=	"</div>";
			
			x+= 	"<div style='margin:10% 0% 10% 17%'>";
			x+=			MakeButton("", "Dial", "PlaceCall()", "", "", "button_cell_feature");
			x+= 	"</div>";
			
			x+=	"<hr style='width:80%' align=center >";
			x+= 	"<div id=\"WI\" style=\"margin:10% 0% 10% 17%;display:none\">"; 
//			x+=			MakeFeatureButton('', 'Web Invite', 'OnCollaborate(-1)');
			x+=			MakeFeatureButton('', 'Web Conference', 'OnCollaborate(-1)');
			x+= 	"</div>";
			x+= 	"<div style='margin:10% 0% 10% 17%'>";
			x+=			MakeFeatureButton('', 'Redial', 'RedialMenu()');
			x+= 	"</div>";
			x+= 	"<div style='margin:10% 0% 10% 17%'>";
//			x+=			MakeFeatureButton('', 'Favorites', 'HandleFeatureButtonClick()');
			x+=			MakeFeatureButton('', 'Feature Codes', 'HandleFeatureButtonClick()');
			x+= 	"</div>";
			x+= 	"<div style='margin:10% 0% 10% 7%'>";
			x+= 		"<span style=\"width:100%;padding:0px 10px;color:#000;\"><input type=\"checkbox\" id=\"rr_enabled_toggle\" onclick=\"SetAccountFlag('RoutingEnabled', this.checked)\" style=\"vertical-align:middle\"> "+text('RR/ENA_CKBX')+"</span>";
			x+= 	"</div>";
			
			x+= "<div id=\"ShowYWCRSIsNotDisplayed\" style=\"text-align:center;display:none;color:#000;margin-top:1%\">"+"<a href=\"javascript://\" onclick=\"logIntoWCRS('0');\">"+text('NCS/TEXT')+"</a>"+"</div>";

//					*** Powered By Logo ***
			x+= 	"<div style='margin:50% 0% 10% 18%'>";
			x+=			"<a href='http://www.inter-tel.com' target='_blank' style='text-decoration:none;'><img src='img/poweredby_intertel.gif' border='0'></a>";			
			x+= 	"</div>";
			break;
		
		case "CallControl":
			x+= "<div style=\"height:10px;width:100%;\">";
			x+= 	"<div style=\"color:#69c;height:20px;padding:4px 0px 3px 0px;background-color:#036;background-image:url(img/bgCallControlTop3.gif);background-repeat:repeat-x;background-position:top left\">";
			x+= 		"<div style=\"height:10px;width:375px;float:left;display:inline;margin-top:3px;\">";
			x+= 		"</div>";
//			x+= 		"<div style=\"height:10px;width:320px;float:right;display:inline;margin:3px 17px 0px 0px;padding-top:1px;text-align:right\">";
//							x+= MakeFeatureButton('', 'Web Invite', 'OnCollaborate(-1)');
//							x+= MakeFeatureButton('', 'Redial', 'RedialMenu()');
//							x+= MakeFeatureButton('', 'Favorites', 'HandleFeatureButtonClick()');
//							x+= MakeFeatureButton('', text('BUTN/LGOFF'), 'HandleFeatureButtonClick()');
//							x+= MakeFeatureButton('', text('BUTN/HELP'), 'HandleFeatureButtonClick()');
//			x+= 		"</div>";
			x+= 	"</div>";

			x+= "</div>";
			break;

		case "CB":
			x+= "<div id=\"CB\" style=\"height:400px; width:100%; overflow-y:hidden; border-left:1px solid #333; border-right:1px solid #333; border-bottom 1px solid #333; background-color:#EEE;\">";
			x+=		"<IFRAME name=\"Utility\" id=\"Utility\" frameborder=0 marginwidth=0 marginheight=0 height=0 width=100% src=\"../WCRS$/wapplink.asp?default\"></IFRAME>";
			x+=		"<iframe name=\"Display\" id=\"Display\" src=\"WCRS_Office.asp\" width=100% height=345px border=0 frameborder=0 ALLOWTRANSPARENCY=\"true\" style=\"background-color:#EEE;\"></iframe>";
			x+=		"<iframe name=\"Buttons\" src=\"WCRS_buttons.asp\" width=100% height=55px scrollbars=no frameborder=0 style=\"margin: 0px 0px 0px 0px; background-color:#EEE;\" ALLOWTRANSPARENCY=\"true\"></iframe>";
			x+= "</div>";
			break;
		
		case "CS":
			x+= "<div id=\"CSFM\" class=\"cs_form\" style=\"display:none;\" onkeydown=\"HandleKeydown('composite_status')\"></div>";
			x+= "<div id=\"tableCS\">temp</div>";
			break;
		
		case "CSFM":
			x+= "<xsl:script><![CDATA[";
			x+= GetEmbeddedInsertScript();
			x+=	"function IsDeviceInSIPMode(oDevice) {";
			x+= 	"var oCfgDevice	= oDevice.selectSingleNode(Insert(oDevice.selectSingleNode('StationType').text, '/R/FEATURE_CODE_SUPPORT/SIP_MODE/DEVICE[@station_type=\"{0}\"]'));";
			x+= 	"return (oCfgDevice) ? true : false;";
			x+=	"}";
			x+= "]]></xsl:script>";
			x+= 	"<div class=\"FormTitle\"></div>";
			x+= 	"<div class=\"cs_form_row\">";
			x+= 		"<span style=\"width:30%\">"+ text('CS/DES') +"<br/><input type=\"text\" id=\"cs_description\" onfocus=\"this.select()\" maxlength=\""+ INPUT_LIMIT_64 +"\" /></span>";
			x+= 		"<span style=\"width:30%\">"+ text('CS/LONA') +"<br/>";
			x+= 			"<select id=\"cs_location_name\" onclick=\"UpdateCompositeStatusSelect(this)\" onkeyup=\"UpdateCompositeStatusSelect(this)\">";
			x+=					"<option>--- "+text('CS/CHOOSE')+" ---</option>";
			x+=					"<xsl:for-each select=\"DEVICES/DEVICE[OwnerAccount = /R/ACCOUNT//UniqueID]\" order-by=\"+Name\"><option type=\"1\"><xsl:attribute name=\"node\"><xsl:value-of select=\"NodeID\" /></xsl:attribute><xsl:attribute name=\"extension\"><xsl:value-of select=\"Extension\" /></xsl:attribute><xsl:attribute name=\"node_colon_extension\"><xsl:value-of select=\"NodeID\" />:<xsl:value-of select=\"Extension\" /></xsl:attribute><xsl:value-of select=\"Name\"/></option></xsl:for-each>";
			x+=					"<xsl:for-each select=\"/R/CONTACT_FIELDS/FIELD[@locType and @type='TYPE_STRING_PHONE']\">";
			x+=						"<xsl:if test=\"/R/ACCOUNT//CONTACT/*[nodeName() = context(-1)/@name and value() != '']\">";
			x+=							"<option><xsl:attribute name=\"type\"><xsl:value-of select=\"@locType\" /></xsl:attribute><xsl:attribute name=\"property\"><xsl:value-of select=\"@name\" /></xsl:attribute><xsl:value-of select=\".\" /></option>";
			x+=						"</xsl:if>";
			x+=					"</xsl:for-each>";
			x+=					"<option type=\"0\">["+text('CS/CUST')+"]</option>";
			x+= 			"</select>";
			x+= 		"</span>";
			x+= 		"<span style=\"width:30%\">"+ text('CS/LONU') +"<br/><input type=\"text\" id=\"cs_location_number\" maxlength=\""+ INPUT_LIMIT_64 +"\" /></span>";
			x+= 	"</div>";
			x+= 	"<div class=\"cs_form_row\">";
			x+= 		"<span style=\"width:30%\">"+ text('CS/AVATY') +":</span>";
			x+= 		"<span style=\"width:32%;font-weight:normal\"><input type=\"radio\" id=\"cs_availibility0\" name=\"cs_availibility\" value=\"true\" style=\"width:25px\"/> <label for=\"cs_availibility0\" style=\"color:#666;\">"+text('CS/AVA')+"</label></span>";
			x+= 		"<span style=\"width:32%;font-weight:normal\"><input type=\"radio\" id=\"cs_availibility1\" name=\"cs_availibility\" value=\"false\" style=\"width:25px\"/> <label for=\"cs_availibility1\" style=\"color:#666;\">"+text('CS/UNAV')+"</label></span>";
			x+= 	"</div>";
			if (b_MARGARITA_LICENSED)
			{
				x+= "<div class=\"cs_form_row\" style=\"border-bottom:none\">";
				x+= 	"<span style=\"width:49%\">Microsoft &#174; .NET Passport Status:</span>";
				x+= 	"<span style=\"width:19%;\">";
				x+= 		"<select id=\"cs_messenger_status\">";
							var aIM_msgs = oText.selectNodes("LABELS/IM/STATUS"), k=0;
							while(aIM_msgs[k])
								x+=	"<option value=\""+ aIM_msgs[k].getAttribute('abbr') +"\">"+ aIM_msgs[k++].text +"</option>";
				x+= 		"</select>";
				x+= 	"</span>";
				x+= "</div>";
			}
			x+= 	"<div class=\"cs_form_row\" style=\"margin:15px;padding:3px;font-size:10px\"><input type=\"checkbox\" id=\"cs_dynamic_status\" onclick=\"ToggleSecondaryDNDMessages(this)\" style=\"width:25px;vertical-align:middle\"/><label for=\"cs_dynamic_status\">"+ text('CS/DYN_PRMT') +"</label></div>";
			x+= 	"<div class=\"FormSubtitle\" style=\"padding-left:20px;\"><span style=\"width:38%\">"+text('DV/DEV_NM')+"</span><span style=\"width:30%\">"+text('DV/PRI_DND_MSG')+"</span><span style=\"width:30%\">"+text('DV/SEC_DND_MSG')+"</span></div>";
			x+=		"<xsl:for-each select=\"DEVICES/DEVICE[OwnerAccount = /R/ACCOUNT//UniqueID]\" order-by=\"Extension\">";
			x+= 		"<div class=\"cs_form_row\">";
			x+= 			"<span style=\"width:38%;padding:0px\">";
			x+= 				"<span style=\"width:69%;\"><xsl:value-of select=\"Name\"/><xsl:if test=\".[Shared='true' or Shared='True' or Shared='TRUE']\">"+text('DV/SHARED')+"</xsl:if></span>";
			x+= 				"<span style=\"width:29%;font-weight:normal\">x<xsl:value-of select=\"Extension\"/></span>";
			x+= 			"</span>";
			x+= 			"<span style=\"width:30%\">";
			x+= 				"<select style=\"width:115px\"><xsl:attribute name=\"id\">cs_dnd_primary_<xsl:value-of select=\"Extension\" /></xsl:attribute>";
			x+=						"<option> "+ text('DV/DND_OFF') +" </option>";			
			x+=						"<xsl:choose>";
									// if device is in sip mode and supports just DND ON/OFF
			x+=						"<xsl:when expr=\"IsDeviceInSIPMode(this)\">";
			x+=							"<option value='"+ text('DV/DND_ON') +"'> "+ text('DV/DND_ON') +" </option>";
			x+=						"</xsl:when>";
									// if device is in proprietary mode
			x+=						"<xsl:otherwise>";
			x+= 						"<xsl:for-each select=\"/R/NODES/NODE[NodeNameElements//NodeID = context(-1)/NodeID]/DNDMessages/LIST//String\"><option><xsl:attribute name=\"value\"><xsl:value-of select=\".\"/></xsl:attribute><xsl:value-of select=\".\"/></option></xsl:for-each>";
			x+=						"</xsl:otherwise>";
			x+=						"</xsl:choose>";
			x+= 				"</select>";
			x+= 			"</span>";
			x+= 			"<span style=\"width:30%\"><input type=\"text\"><xsl:attribute name=\"id\">cs_dnd_secondary_<xsl:value-of select=\"Extension\" /></xsl:attribute></input></span>";
			x+= 		"</div>";
			x+=		"</xsl:for-each>";

			// shared device settings
			if (oDevNode.selectNodes('DEVICE[OwnerAccount=/R/ACCOUNT//UniqueID and (Shared="true" or Shared="True" or Shared="TRUE")]').length==0 && GetAccountFlag('UsingSharedDevice'))
			{
				x+= 	"<div class=\"cs_form_row\">";
				x+= 		"<span style=\"width:38%;\">"+ text('DV/SHARED_DEVS') +"</span>";
				x+= 		"<span style=\"width:30%\">";
				x+= 			"<select style=\"width:115px\" id=\"cs_dnd_primary_shared\">";
				x+=					"<option value=''> "+ text('DV/DND_OFF') +" </option>";
				x+=					"<option value='"+ text('DV/DND_ON') +"'> "+ text('DV/DND_ON') +" </option>";
				x+= 			"</select>";
				x+= 		"</span>";
				x+= 		"<span style=\"width:30%\"><input type=\"text\" id=\"cs_dnd_secondary_shared\"/></span>";
				x+= 	"</div>";
			}
			break;
		
		case "CT":
			// tab heads
			x+= "<div class=\"tab_control\">";
			x+= 	"<div class=\"tab_head_row\">";
			x+= 		"<span class='tab_head' index='1' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Personal Contacts</span>";
			x+= 		"<span class='tab_head' index='2' type='" + id + "' style='display:none' onclick='ViewTab();return false' >";
			x+= 			"ABEX</span>";
			x+= 		"<span class='tab_head' index='3' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Groups</span>";
			x+= 		"<span class='tab_head_spacer' style='width:502px;'> &nbsp; </span>";			
			x+= 	"</div>";
		
			// tab bodies
			x+= 	"<div class=\"tab_body\">";
			// Personal Contacts
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:310px\" id=\"CTAB\">";
			x+= 			"<div class=\"table\" id=\"tableAB\" style=\"border:0px\">";
			x+= 			"</div>";
			x+= 		"</div>";
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:310px\" id=\"ABEX\">";
			x+= 			"<div id='buttons' class='section_buttons'></div>";
			x+= 		"</div>";
			//Groups
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"CTGP\">";
			x+=			"<div id=\"GroupMenuContainer\" class=\"cssMenu\" onclick=\"HandleStackableGroupMenuClick()\" >";
			x+=				"<div class=\"\">";
			x+= 					"<span id=\"GroupList\" ondragenter=\"enterDragList()\" ondragover=\"overDrag()\" ondragleave=\"leaveDrag()\" ondrop=\"dropList()\"  style=\"width:50%;float:left;margin:0px;padding:0px\">";
			x+=	/*Current Groups*/			"<div class=\"cssMenuListHead\" style=\"background-color:#369;color:#fff;border-left:1px solid #c93;\">"+text('GP/TI_GP')+"</div>";	
			x+=						"<div id=\"tableGPLS\" style=\"border:0px;\">temp</div>";
			x+= 					"</span>";
			x+= 					"<span style=\"width:49.9%;margin:0px;padding:0px;float:left;border-left:1px solid #333;background-color:#EFEFF7\">";
			x+=						"<div class=\"cssMenuListHead\" style=\"background-color:#369;color:#fff;border-left:1px solid #9cf;\">"+text('GP/TI_AB')+"</div>";
			x+= 						"<div id=\"tableGPAB\" style=\"border:0px;\">temp</div>";
			x+= 					"</span>";
			x+=				"</div>";
			x+=				"<div class=\"cssMenuFoot\" style=\"background-color:#EFEFF7\">";
			x+=					"<div style=\"width:100%;color:#000\">";
			x+= 						text('GP/HLP_HOW');
//			x+=						"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/ADD_GP')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_ADD_GP')+"</a>";
//			x+=						"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/DEL_GP')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_DEL_GP')+"</a>";
			x+=						"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/REO_GP')\" onmouseout=\"HideHelp()\" onclick=\"PrioritizeGroup()\">"+text('GP/HLP_REO_GP')+"</a>";
//			x+=						"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/ADD_CO')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_ADD_CON')+"</a>";
//			x+=						"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/DEL_CO')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_DEL_CON')+"</a>";
			x+=					"</div>";
			x+=				"</div>";
			x+=			"</div>";	
			x+=		"</div>";	
			x+=	"</div>";	
			break;

		case "RL":
			// tab heads
			x+= "<div class=\"tab_control\">";
			x+= 	"<div class=\"tab_head_row\">";
			x+= 		"<span class='tab_head' index='1' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Rules</span>";
			x+= 		"<span class='tab_head' index='2' type='" + id + "' style='display:none' onclick='ViewTab();return false' >";
			x+= 			"RREX</span>";
			x+= 		"<span class='tab_head' index='3' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Greetings</span>";
			x+= 		"<span class='tab_head_spacer' style='width:502px;'> &nbsp; </span>";
			x+= 	"</div>";
		
			// tab bodies
			x+= 	"<div class=\"tab_body\">";
			// Personal Contacts
			x+= 		"<div class=\"tab_content\" id=\"RLRR\" style=\"display:none\">";
			x+= 			"<div class=\"table\" id=\"tableRR\" style=\"border:0px\">";
			x+= 			"</div>";
			x+= 		"</div>";
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"RREX\">";
			x+= 			"<div id='buttons' class='section_buttons'></div>";
			x+= 		"</div>";
			x+= 		"<div class=\"tab_content\" id=\"RLGT\" style=\"display:none\">";
			x+= 			"<div class=\"table\" id=\"tableGT\" style=\"border:0px\">";
			x+= 			"</div>";
			x+=			"<div class=\"cssMenuFoot\" id=\"RLGTHLP\" style=\"background-color:#EFEFF7;border:0px\">";
			x+=				"<div style=\"width:100%;color:#000\">";
			x+= 					text('GP/HLP_HOW');
			x+=					"<a href=\"javascript://\" onmouseover=\"this.title=text('GT/HELP/ADD_GT')\" onmouseout=\"HideHelp()\" onclick=\"HelpOnHowToAddGreeting()\">"+text('GT/HLP_ADD_GT')+"</a>";
			x+=				"</div>";
			x+=			"</div>";
			x+= 		"</div>";
			break;
		
		case "dv_add_form":
			x+= "<div id=\"dv_add_form\" class=\"footer_form\" style=\"display:none;\">";
			x+= 	"<div class=\"footer_form_title\">"+ text('DV/ADD') +" (+)</div>";
			x+= 	"<div>";
			x+= 		"<span style=\"width:30%\">"+ text('DV/NAME') +"<br/><input type=\"text\" id=\"add_device_name\" size=\"15\" maxlength=\""+ INPUT_LIMIT_64 +"\" onkeydown=\"HandleKeydown('device')\" /></span>";
			x+= 		"<span style=\"width:30%\">"+ text('DV/EXT') +"<br/><input type=\"text\" id=\"add_device_ext\" size=\"15\" maxlength=\""+ INPUT_LIMIT_64 +"\" onkeydown=\"HandleKeydown('device')\" /></span>";
			x+= 		"<span style=\"width:30%\">"+ text('DV/PASS') +"<br/><input type=\"password\" id=\"add_device_pass\" size=\"15\" maxlength=\""+ INPUT_LIMIT_64 +"\" onkeydown=\"HandleKeydown('device')\" /></span>";
			x+= 	"</div>";
			x+= 	"<div style=\"margin-top:10px\">";
			x+= 		MakeButton("iAdd", text('BUTN/ADD'), "SaveDevice(1)", "", "A");
			x+= 		MakeButton("iClose", text('BUTN/CLO'), "ToggleDeviceForm(0)", "", "C");
			x+= 	"</div>";
			x+= "</div>";
			break;
		
		case "dv_feature_codes":
//			x+= "<div class=\"tab_control\">";
			x+= "<div class=\"tab_control\" style=\"border:0\">";
					// tab heads
//			x+= 	"<div class=\"tab_head_row\">";
			x+= 	"<div class=\"tab_head_row\" style=\"background-color:#EFEFF7; margin-left: 0px; margin-right: 0px;\">";			
			x+= 		"<span class=\"tab_head\" type=\'"+id+"\' index=\"1\" onclick=\"ViewTab();return false\">"+ text('FC/USR') +"</span>";
			x+= 		"<span class=\"tab_head\" type=\'"+id+"\' index=\"2\" onclick=\"ViewTab();return false\">"+ text('FC/ADM') +"</span>";
			x+= 		"<span class=\"tab_head\" type=\'"+id+"\' index=\"3\" onclick=\"ViewTab();return false\">"+ text('FC/FAV') +"</span>";
			x+= 	"</div>";
					// tab bodies
			x+= 	"<div class=\"tab_body\" style=\"margin-left: 0px; margin-right: 0px;\">";
			x+= 		"<div class=\"tab_content\" id=\"FCUSER\" style=\"display:none;height:50px\">";
			x+= 			"<div class='table' id=\"tableFCUSER\">temp</div>";
			x+= 		"</div>";
			x+= 		"<div class=\"tab_content\" id=\"FCADMN\" style=\"display:none;height:50px\">";
			x+= 			"<div class='table' id=\"tableFCADMN\">temp</div>";
			x+= 		"</div>";
			x+= 		"<div class=\"tab_content\" id=\"FCFAVS\" style=\"display:none;height:50px\">";
			x+= 			"<div class='table' id=\"tableFCFAVS\">temp</div>";
			x+= 		"</div>";
			x+= 	"</div>";
			x+= "</div>";
			x+= "<div id='buttons' class='section_buttons'></div>";
			break;
		
		case "DS":
			// tab heads
			x+= "<div class=\"tab_control\">";
			x+= 	"<div class=\"tab_head_row\">";
			x+= 		"<span class='tab_head' index='1' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Search</span>";
			x+= 		"<span class='tab_head' index='2' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Results</span>";
			//blank tabs used for bottom-border.
			x+= 		"<span class='tab_head_spacer' style='width:502px;'> &nbsp; </span>";
			
			x+= 	"</div>";
			// tab bodies
			x+= 	"<div class=\"tab_body\" style=\"height:328px\">";
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"DSFM\"><div class=\"table\" id=\"tableDSFM\" style=\"border:0px\">temp</div></div>";
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"DSRS\"><div class=\"table\" id=\"tableDSRS\">temp</div></div>";
			x+= 	"</div>";
			x+= "</div>";
			break;
			
		case "EmailList":
			x+= "<div style=\"width:100%\">";
			x+= 	"<div class=\"menu_head\">"+text('MENU/TI_EMAIL')+"</div>";
			x+=		"<xsl:for-each select=\"Emails/LIST//String\">";
			x+= 	"<div class=\"menu_row\" onmouseover=\"this.style.backgroundColor='#ffc'\" onmouseout=\"this.style.backgroundColor=''\" onclick=\"this.firstChild.click()\">";
			x+= 		"<xsl:element name=\"a\">";
			x+= 		"<xsl:attribute name=\"style\">display:none</xsl:attribute>";
			x+= 		"<xsl:attribute name=\"href\">mailto:<xsl:value-of select=\".\"/></xsl:attribute>";
			x+= 			"<xsl:value-of select=\".\"/>";
			x+= 		"</xsl:element>";
			x+= 		"<xsl:value-of select=\".\"/>";
			x+= 	"</div>";
			x+=		"</xsl:for-each>";
			x+= "</div>";
			break;
			
		case "Float":
			x+= "<div class=\"FloatTitle\"><xsl:value-of select=\"R/@title\" /></div>";
			x+= "<div style=\"border:1px solid #000;border-top:none;\">";
			x+= 	"<xsl:if test=\".[@style]\"><xsl:attribute name=\"style\"><xsl:value-of select=\"@style\" /></xsl:attribute></xsl:if>";
			switch (oDataObj.selectSingleNode('R').getAttribute("title"))
			{
				// Feature code favorites - switching on floater title
				case text('FLOAT/FAVS'):
					// context 1
					x+= "<xsl:script><![CDATA[";
					x+= GetEmbeddedInsertScript();
					x+= GetEmbeddedFeatureSupportScript();
					x+= "]]></xsl:script>";
					x+= "<xsl:for-each select=\"R/DEVICES/DEVICE[OwnerAccount = /R/ACCOUNT//UniqueID]\" order-by=\"Extension\">";
					x+= "<div class=\"float_row\" style=\"background-color:#eec;color:#666;font-weight:bold;text-align:center\"><xsl:value-of select=\"Name\" /> (x<xsl:value-of select=\"Extension\" />)</div>";
					// context 2
					x+= "<xsl:choose>";
					x+= 	"<xsl:when test=\"FeatureCodeFavoritesList/LIST/*/FEATURE_CODE[0]\">";
					x+= 		"<xsl:for-each select=\"FeatureCodeFavoritesList/LIST/*/FEATURE_CODE\" order-by=\"Description\">";
					x+= 			"<xsl:if expr=\"FeatureCodeIsSupportedForThisStationType(this, 'UC_FAVORITE')\">";
					x+= 				"<div class=\"float_row\" onmouseover=\"this.style.backgroundColor='#ffc'\" onmouseout=\"this.style.backgroundColor=''\">";
					x+= 					"<xsl:attribute name=\"onclick\">ExecuteFeatureCode('<xsl:value-of select=\"Code\" />', '<xsl:value-of select=\"NodeID\" />', '<xsl:value-of select=\"ancestor(DEVICE)/Extension\" />')</xsl:attribute>";
					x+= 					"<span style=\"width:70%;margin-left:30px;\"><xsl:value-of select=\"Description\" /></span><span style=\"width:25%\"><xsl:value-of select=\"Code\" /></span>";
					x+= 				"</div>";
					x+= 			"</xsl:if>";
					x+= 		"</xsl:for-each>";
					x+= 	"</xsl:when>";
					x+= 	"<xsl:otherwise><div class=\"float_row\"><span style=\"width:100%;text-align:center;\">"+text('DV/NOFAVS')+"</span></div></xsl:otherwise>";
					x+= "</xsl:choose>";
					x+= "</xsl:for-each>";
					break;
				
				// Speed Dial
				case text('FLOAT/DIAL'):
					x+= "<xsl:for-each select=\"R/AB/CONTACT[Groups/LIST//String='"+config('SPEED_DIAL')+"']\">";
					x+= "<xsl:script><![CDATA[";
					x+= "]]></xsl:script>";
					
					x+= "<div class=\"float_row\" style=\"text-align:left;overflow:hidden\" onclick=\"HandleRowClick(this)\">";
					x+= 	"<xsl:attribute name=\"UniqueID\"><xsl:value-of select=\"UniqueID\" /></xsl:attribute>";
					x+= 	"<span style=\"width:10%;padding-top:3px;\">"+ GetXSLStatusLogic(id) +"</span>";
					x+= 	"<span style=\"width:50%;padding:0px 3px;\"><xsl:value-of select=\"FirstName\" /> <xsl:value-of select=\"LastName\" /></span>";
					x+= 	"<span style=\"width:25%;padding:0px 3px;\"><xsl:value-of select=\"AccountStatus//CurrentCompositeStatus\" /></span>";
					x+= 	"<span style=\"width:10%;padding:0px 3px;\">"+ GetXSLNoPhoneNumberLogic() +"</span>";
					x+= "</div>";
					x+= "</xsl:for-each>";
					break;
			}
			x+= "</div>";
			break;
			
		case "rr_what_greeting_select":
			x+=	"<xsl:choose>";
			x+=		"<xsl:when test=\"GREETINGS[GREETING]\">";
			x+= 		"<select id=\"rr_what_greeting\" class=\"rr_select\">";
			x+=				"<xsl:for-each select=\"GREETINGS/GREETING\" order-by=\"Description\"><option><xsl:attribute name=\"value\"><xsl:value-of select=\"UniqueID\"/></xsl:attribute><xsl:value-of select=\"Description\"/></option></xsl:for-each>";
			x+= 		"</select>";
			x+=		"</xsl:when>";
			x+=	"<xsl:otherwise>&#160;"+text('RR/WHAT_NOGREET')+"</xsl:otherwise>";
			x+=	"</xsl:choose>";
			break;
		
		case "GP":
/*			x+=	"<div id=\"GroupMenuContainer\" class=\"cssMenu\" onclick=\"HandleStackableGroupMenuClick()\" >";
			x+=	"<div class=\"cssMenuBody\">";
			x+= 	"<span id=\"GroupList\" ondragenter=\"enterDragList()\" ondragover=\"overDrag()\" ondragleave=\"leaveDrag()\" ondrop=\"dropList()\"  style=\"width:50%;float:left;height:250px;margin:0px;padding:0px;\">";
			x+=			"<div class=\"cssMenuListHead\" style=\"background-color:#960;color:#fff;border-left:1px solid #c93\">"+text('GP/TI_GP')+"</div>";	
			x+=			"<div id=\"tableGPLS\" style=\"border:0px\">temp</div>";
			x+= 	"</span>";
			x+= 	"<span style=\"width:49.9%;height:250px;margin:0px;padding:0px;float:left;border-left:1px solid #333;background-color:#69c\">";
			x+=			"<div class=\"cssMenuListHead\" style=\"background-color:#369;color:#fff;border-left:1px solid #9cf;\">"+text('GP/TI_AB')+"</div>";
			x+= 		"<div id=\"tableGPAB\" style=\"border:0px\">temp</div>";
			x+= 	"</span>";
			x+=	"</div>";
			x+=	"<div class=\"cssMenuFoot\" style=\"background-color:#B59554\">";
			x+=		"<div style=\"width:100%;color:#eec\">";
			x+= 		text('GP/HLP_HOW');
			x+=			"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/ADD_GP')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_ADD_GP')+"</a>";
			x+=			"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/DEL_GP')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_DEL_GP')+"</a>";
			x+=			"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/REO_GP')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_REO_GP')+"</a>";
			x+=			"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/ADD_CO')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_ADD_CON')+"</a>";
			x+=			"<a href=\"javascript://\" onmouseover=\"this.title=text('GP/HELP/DEL_CO')\" onmouseout=\"HideHelp()\">"+text('GP/HLP_DEL_CON')+"</a>";
			x+=		"</div>";
			x+=	"</div>";
		
			x+=	"</div>";*/
			break;
			
		case "Help":
			var sMouseEvents = "onmouseover=\"this.style.backgroundColor='#ffc'\" onmouseout=\"this.style.backgroundColor=''\"";
			x+= "<div class=\"menu_head\">Help</div>";
			x+= "<div style=\"width:100%\">";
			x+=		"<div class=\"menu_row\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">LaunchHelp('Start')</xsl:attribute>"+text('GBL/HELP_STR')+"</div>";
			x+=		"<div class=\"menu_row\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">LaunchHelp('Help')</xsl:attribute>"+text('GBL/HELP_CON')+"</div>";

			//this will set the display/hide properties of the Collborate help item.
			if(is_WCRSDisplayed != 1)
				x+=	"<div id=\"Coll_Help\" style=\"display:none\" class=\"menu_row\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">LaunchHelp('Collaborate')</xsl:attribute>"+text('GBL/HELP_COll')+"</div>";
			else
				x+=	"<div id=\"Coll_Help\" class=\"menu_row\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">LaunchHelp('Collaborate')</xsl:attribute>"+text('GBL/HELP_COll')+"</div>";	

			x+= "</div>";
			break;
		
		case "LOGON":
			var nameLabel 	= FormatAccessKey(text('LOGN/UID'));
			var passLabel 	= FormatAccessKey(text('LOGN/PAS'));
			x+= "<div><form id='logonForm' onkeydown=\"HandleKeydown('logon')\">";
			x+= "<div style=\"margin:15px 0px;\"><span class='logon_label' style=\"width:80px;margin-left:80px;\">"+ nameLabel +"</span>";
			var tag = BuildBasicInput("text", "logon_username", "12", "64", "");
			x+= 	"<span style=\"width:100px\">"+ ExtendHTMLTag(tag, "^=ACCESSKEY=S") +"</span></div>";
			x+= "<div style=\"margin:15px 0px\"><span class='logon_label' style=\"width:80px;margin-left:80px;\">"+ passLabel +"</span>";
			var tag  = BuildBasicInput("password", "logon_password", "12", "64", "");
			x+= 	"<span style=\"width:100px;\">"+ ExtendHTMLTag(tag, "^=onfocus=this.select()^=ACCESSKEY=A") +"</span></div>";
			x+= "<div style=\"margin:15px 0px\"><span class='logon_label' style='font-weight:normal;width:100%;margin-left:75px;'>"+ BuildCheckBox("logon_auto") +" <label for=\"logon_auto\">"+ text('LOGN/AUTO') +"</label></span></div>";
//			x+= "<div style=\"text-align:center;height:16px;\">";  //remove height so it doesn't cut off bottom of buttons
			x+= "<div style=\"text-align:center;\">";
			x+= 	MakeButton("iNext", text('BUTN/LGON'), "SubmitLogon()", "", "L", "button_cell_logon");
			x+= 	MakeButton("iSynch", text('BUTN/RESET'), "getObj(\"logonForm\").reset();SetFocus(\"logon_username\")", "", "R", "button_cell_logon");
			x+= "</div>";
			x+= "<div style=\"text-align:center;margin-top:5%\"><a href=\"javascript://\" onclick=\"ShowNewAccountForm();return false\">"+text('LOGN/NEW_ACCT')+"</a></div>";
			x+= "</form></div>";
			x+= "<div id='WCRS_Login'> </div>";
			break;

		case "LOGOFF":
			x+= "<div style=\"text-align:center;color:#000;margin-top:5%\">"+text('LOGN/LOGOF_ONE')+' '+"<a href=\"javascript://\" onclick=\"document.location.reload();\">"+text('LOGN/LOGOF_TWO')+"</a>"+' '+text('LOGN/LOGOF_THREE')+"</div>";
			x+= "<div style=\"text-align:center;color:#000;margin-top:1%\"><a href=\"javascript://\" onclick=\"ResetAutoLogon();document.location.reload();\">"+text('LOGN/LOGOF_TWO')+"</a>"+' '+text('LOGN/LOGON_DIFF')+' '+"</div>";
			break;
			
		case "MSEX":
			x+= "<div>";
			x+=	"<xsl:attribute name=\"UniqueID\"><xsl:value-of select=\"UniqueID\" /></xsl:attribute>";
			x+= 	"<div class=\"sub_title\">"+text('MS/SYS')+"</div>";
			x+= 	"<div style=\"margin:15px 10px;\" id=\"ms_translation\"><xsl:value-of select=\"Translation\" /></div>";
			x+= 	"<div style=\"margin:15px 10px;\"><xsl:value-of select=\"CreateTimestamp\" /></div>";
			x+= "</div>";
			break;
		
		case "NA":
			x+=	"<div id=\"NewAccountMenuContainer\" onkeydown=\"HandleKeydown('new_account')\">";
			x+= 	"<xsl:for-each select=\"section\">";
			x+=			"<div class=\"cssProcessSection\" style=\"display:none;height:200px;padding:15px;\">";
			x+=				"<xsl:attribute name=\"id\"><xsl:value-of select=\"@id\" /></xsl:attribute>";
			x+=				"<div class=\"cssProcessTitle\"><xsl:value-of select=\".\" /></div>";
			x+=				"<div class=\"cssProcessBody\" >";
			x+=					"<xsl:if test=\".[@id='NAUN']\">";
			x+=						"<div class=\"cssProcessRow\">";
			x+=							"<span style=\"width:40%;margin-left:10%\">";
			x+=								text('NA/FN')+"<br/><input id=\"na_first_name\" type=\"text\"/><br/>"+text('NA/MN')+"<br/><input id=\"na_middle_name\" type=\"text\"/><br/>"+text('NA/LN')+"<br/><input id=\"na_last_name\" type=\"text\"/>";
			x+=							"</span>";
			x+=							"<span style=\"width:40%;margin-left:10%\">";
			x+=								text('NA/UN')+"<br/><input id=\"na_username\" type=\"text\" onfocus=\"this.select()\" maxlength=\"32\"/><br/>"+text('NA/PA')+"<br/><input id=\"na_password1\" type=\"password\" onfocus=\"this.select()\" maxlength=\"32\"/><br/>"+text('NA/CP')+"<br/><input id=\"na_password2\" type=\"password\" onfocus=\"this.select()\" maxlength=\"32\"/>";
			x+=							"</span>";
			x+=						"</div>";
			x+=						"</xsl:if>";
			x+=					"<xsl:if test=\".[@id='NADV']\">";
			x+=						"<div id=\"tableNADL\" style=\"border:1px solid #333\"></div>";
									var link = "<a href=\"javascript://\" onclick=\"ToggleDeviceForm(1);return false\">{0}</a>";
			x+=						"<div class=\"na_device_row\" style=\"color:#333;margin-top:10px\">"+ Insert( Insert(text('GBL/CLK_HERE'),link), text('DV/ADD_MAN') )+"</div>";
			x+=						CreateHTML('dv_add_form', 1, oRoot);
			x+=						"</xsl:if>";
			x+=					"<xsl:if test=\".[@id='NALS']\">&#160;</xsl:if>";
			x+=					"<xsl:if test=\".[@id='NAPI']\">";
			x+=						"<div class=\"tabs\" id=\"tabsNAPI\"></div>";
			x+=						"</xsl:if>";
			x+=				"</div>";
			x+=			"</div>";
			x+=		"</xsl:for-each>";
			x+=	"</div>";
			break;
			
		case "PB":
			x+= "<div id=\"pb_title\" class=\"generic_title\"></div>";
			x+= "<div class=\"sub_title\" style=\"margin-bottom:5px;\">"+text('PB/PROG')+"</div>";
			x+= "<xsl:for-each select=\"BAR\">";
			x+= 	"<div>";
			x+= 	"<div style=\"margin:10px 0px 3px 25px\"><xsl:value-of select=\".\"/></div>";
			x+= 	"<div style=\"margin:0px 25px\">";
			x+= 		"<xsl:if test=\".[@style]\"><xsl:attribute name=\"style\"><xsl:value-of select=\"@style\"/></xsl:attribute></xsl:if>";
			x+= 		"<div>";
			x+= 			"<xsl:attribute name=\"id\">pb_<xsl:value-of select=\"@id\"/></xsl:attribute>";
			x+= 			"<xsl:attribute name=\"class\">progress_bar</xsl:attribute>";
			x+= 		"</div>";
			x+= 	"</div>";
			x+= 	"</div>";
			x+= "</xsl:for-each>";
			break;
		
		case "PhoneList":
		case "TransferSelect":
			var xpath = "(@locType {0}) and @type='TYPE_STRING_PHONE'";
			var xpath_insert = (id=='PhoneList') ? " or @name='HomePagerNumber' or @name='WorkPagerNumber'" : "";
			var aNumbers = oRoot.selectNodes("CONTACT_FIELDS/FIELD["+ Insert(xpath_insert, xpath) +"]"), i=0;
			var user_status = oRoot.selectNodes("AB/CONTACT/UniqueID");
			var sMouseEvents = "onmouseover=\"this.style.backgroundColor='#ffc'\" onmouseout=\"this.style.backgroundColor=''\"";
			var cur_title 	= (id=='PhoneList') ? text('MENU/TI_PHNUM') : text('MENU/TI_TRANS');
			var cur_method 	= (id=='PhoneList') ? 'PlaceCall' : 'TransferHighlightedCall';
		
			var request_account = GetTemplate('ACCOUNT');
			var user_status=0;
			//get the users current status
			if(oDataObj.selectSingleNode('LinkType').text != 'D') {
			if(oDataObj.selectSingleNode('LinkParameter').text)
			{
//				alert(oDataObj.selectSingleNode('LinkParameter').text);
				request_account.selectSingleNode('.//UniqueID').text = oDataObj.selectSingleNode('LinkParameter').text;
				var oInvite_Account = CallControlMethod('GetObjectSynch', request_account);
				user_status = parseInt(oInvite_Account.selectSingleNode('ACCOUNT/ContactElements/CONTACT/AccountStatus/ACC_STATUS/Status').text);
//				alert(user_status);
			}}

			x+= "<xsl:script><![CDATA[";
			x+= GetEmbeddedRemoveNodePrefixScript();
			x+= GetEmbeddedFormatPhoneNumberScript();
			x+= "]]></xsl:script>";
			x+= "<div style=\"width:100%\">";
			x+= 	"<div class=\"menu_head\">"+ cur_title +"</div>";
			if (id=='PhoneList')
			{
				if ((((user_status & LOGIN_STATUS)>0) || oDataObj.selectSingleNode('Emails/LIST//String[0]')) && IsWebInviteFlagSet() && IsWebInviteServiceAvailable() && is_WCRSDisplayed != 0)
				{
					x+="<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">OnCollaborate('<xsl:value-of select=\"UniqueID\"/>')</xsl:attribute>"+text('MENU/WM')+"</div>";
				}
				if(sAdditionalInfo=="SpeedDial")
				{
						x+="<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">DeleteHighlightedRows('CTGP','<xsl:value-of select=\"UniqueID\"/>')</xsl:attribute>"+text('MENU/DL')+"</div>";
				}		

				x+= "<xsl:if test=\".[LinkType='A' and Devices/LIST//String[0]]\">";
				x+= 	"<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">"+ cur_method +"('<xsl:value-of select=\"Devices/LIST//String[0]\"/>', '<xsl:value-of select=\"UniqueID\"/>')</xsl:attribute>"+text('MENU/FIND')+"</div>";
				x+=	"<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">CallVoicemail('<xsl:value-of select=\"LinkParameter\"/>')</xsl:attribute>"+text('MENU/VM')+"</div>";
				x+= 	"<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">AddStationMessage('PH', '<xsl:value-of select=\"UniqueID\"/>', '<xsl:value-of select=\"Devices/LIST//String[0]\"/>')</xsl:attribute>"+text('MENU/SM')+"</div>";
				x+= "</xsl:if>";
				x+= "<xsl:if test=\".[LinkType='D']\">";
				x+=		"<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">CallVoicemail('<xsl:value-of select=\"LinkParameter\"/>')</xsl:attribute>"+text('MENU/VM')+"</div>";
				x+=		"<div class=\"menu_row_location\" "+ sMouseEvents +"><xsl:attribute name=\"onclick\">AddStationMessage('PH', '<xsl:value-of select=\"UniqueID\"/>', '<xsl:value-of select=\"LinkParameter\"/>')</xsl:attribute>"+text('MENU/SM')+"</div>";
				x+= "</xsl:if>";
			}
			while (aNumbers[i])
			{
				// only display phone numbers that are not blank
				var node_name = aNumbers[i].getAttribute("name");
				x+=	"<xsl:if test=\""+ node_name +"[. != '']\">";
				x+= 	"<div class=\"menu_row\" "+ sMouseEvents +">";
				x+= 		"<xsl:attribute name=\"onclick\">"+ cur_method +"('<xsl:value-of select=\""+ node_name +"\"/>', '<xsl:value-of select=\"UniqueID\"/>')</xsl:attribute>";
				x+= 		"<span style=\"width:49%;\">"+aNumbers[i].text+"</span>";
				x+= 		"<span style=\"width:49%;\"><xsl:eval>removeNodePrefix(this, '"+ node_name +"')</xsl:eval></span>";//<xsl:value-of select=\""+ node_name +"\"/>
				x+= 	"</div>";
				x+=	"</xsl:if>";
				i++;
			}
			x+= "</div>";
			break;
			
		case "PP":
			x+= "<div class='tableBody' style=\"height:311px\">";
			x+= 	"<div style=\"width:100%;color:#fff;border-bottom:1px solid #960\">";//margin:30px;border:1px solid #630
			x+= 	"<div style=\"width:100%;background-color:#960;height:20px;padding-left:10px;line-height:18px;border-bottom:1px solid #630\">"+text('PP/TI')+"</div>";
			x+= 	"<div style=\"width:100%;background-color:#eec;color:#666;padding:30px 60px;\" onkeydown=\"HandlePassportKeydown()\">";
			x+= 		"<div class=\"pp_row\"><span style=\"width:50%;\">"+text('PP/EMA')+"</span><span><input type=\"text\" id=\"pp_passport_id\" ><xsl:attribute name=\"value\"><xsl:value-of select=\"PASSPORT[0]/ID\"/></xsl:attribute></input></span></div>";
			x+= 		"<div class=\"pp_row\"><span style=\"width:50%;\">"+text('PP/PASS')+"</span><span><input type=\"password\" id=\"pp_password\" style=\"width:150px; font-size:11px\" /><input type=\"hidden\" id=\"pp_old_password\"><xsl:attribute name=\"value\"><xsl:value-of select=\"PASSPORT[0]/Password\"/></xsl:attribute></input></span></div>";
			x+= 		"<div class=\"pp_row\"><span style=\"width:50%;\">"+text('PP/HAND')+"</span><span><input type=\"checkbox\" id=\"pp_auto_login\" style=\"width:auto;border:none\"/></span></div>";
			x+= 	"</div>";
			x+= 	"</div>";
			x+= "</div>";
			break;
			
		case "PREF":
			// Web Client prefs
			x+= "<div style='margin-top:10px'>"+ text('PREF/PRWC') +' '+ text('PREF/PRTI') +"</div>";
		 	x+= "<div><span>"+ BuildCheckBox("upWCDS") +"</span><span class='pref_label'>"+ text('PREF/WCDS') +"</span></div>";
			x+= "<div><span>"+ BuildCheckBox("upWCFS") +"</span><span class='pref_label'>"+ text('PREF/WCFS') +"</span></div>";
			x+= "<div><span>"+ BuildCheckBox("upWCLA") +"</span><span class='pref_label'>"+ text('PREF/WCLA') +"</span></div>";
			x+= "<div><span></span></div>";
			// Tray Client prefs
			x+= "<div style='margin-top:10px'>"+ text('PREF/PRTC') +' '+ text('PREF/PRTI') +"</div>";
			x+= "<div><span>"+ BuildCheckBox("upTCDS") +"</span><span class='pref_label'>"+ text('PREF/TCDS') +"</span></div>";
			x+= "<div><span>"+ BuildCheckBox("upTCLA") +"</span><span class='pref_label'>"+ text('PREF/TCLA') +"</span></div>";
			x+= "<div><span>"+ BuildCheckBox("upTCLN") +"</span><span class='pref_label'>"+ text('PREF/TCLN') +"</span></div>";
			x+= "<div style=\"text-align:center;margin-top:10px\">";
			x+= MakeButton("iNext", text('BUTN/NEXT'), "SetPreferences()", "", "", "button_cell_logon");
			x+= "</div>";
			break;
			
		case "Redial":
			var sMouseEvents = "onmouseover=\"this.style.backgroundColor='#ffc'\" onmouseout=\"this.style.backgroundColor=''\"";
			x+= "<xsl:script><![CDATA[";
			x+= GetEmbeddedRemoveNodePrefixScript();
			x+= GetEmbeddedFormatPhoneNumberScript();
			x+= GetEmbeddedCounterScript();
			x+= "]]></xsl:script>";
			x+= "<div class=\"menu_head\">"+ text('MENU/REDIAL') +"</div>";
			x+= "<div style=\"width:100%\">";
			x+=		"<xsl:choose>";
			x+=		"<xsl:when test=\"R/CALL_LOGS/CALLLOG[Incoming='false' or Incoming='False' or Incoming='FALSE'][0]\">";
			x+=			"<xsl:for-each select=\"R/CALL_LOGS/CALLLOG[Incoming='false' or Incoming='False' or Incoming='FALSE']\" order-by=\"-number(UniqueID)\">";
			x+=			"<xsl:if expr=\"CheckCount(5)\">";
			x+=			 	"<div class=\"menu_row\" "+ sMouseEvents +">";
			x+= 				"<xsl:attribute name=\"onclick\">PlaceCall('<xsl:value-of select=\"CallerIDNumber\"/>', '<xsl:value-of select=\"ContactUniqueID\"/>')</xsl:attribute>";
			x+= 				"<span style=\"width:33%;\">";
			x+= 					"<xsl:choose>";
			x+=						"<xsl:when test=\".[CallerIDFirstName != '' or CallerIDLastName != '']\"><xsl:value-of select=\"CallerIDFirstName\"/> <xsl:value-of select=\"CallerIDLastName\"/></xsl:when>";
			x+= 					"<xsl:otherwise><xsl:value-of select=\"CallerIDCompanyName\"/></xsl:otherwise>";
			x+= 					"</xsl:choose>";
			x+= 				"</span>";
			x+= 				"<span style=\"width:33%;\"><xsl:eval>removeNodePrefix(this, 'CallerIDNumber')</xsl:eval></span>";
			x+= 				"<span style=\"width:33%;\"><xsl:value-of select=\"CallActions//CALLLOG_ACTION[0]/TimeStamp\" /></span>";
			x+= 			"</div>";
			x+=			"</xsl:if>";
			x+=			"</xsl:for-each>";
			x+=		"</xsl:when>";
			x+=		"<xsl:otherwise><div class=\"menu_row\">"+text('MENU/NO_REDIAL')+"</div></xsl:otherwise>";
			x+=		"</xsl:choose>";
			x+= "</div>";
			break;

		case "PrioritizeGroup":
			x+= "<div style='background-color:#FFF;color:#000;'>"+ text('GP/HELP/REO_GP') +"</div>";
			break;

		case "AddGreeting":
			x+= "<div style='background-color:#FFF;color:#000;'>"+ text('GT/HELP/ADD_GT') +"</div>";
			break;

		case "RRED":
			x+= "<div class=\"tab_control\" style='border:0' onkeydown=\"HandleKeydown('routing_rule')\">";
			x+= 	"<div class=\"tab_head_row\" style='margin-left: 0px; margin-right: 0px;'>";
			x+= 		"<span class=\"tab_head\" index=\"1\" type=\'"+id+"\' onclick=\"ViewTab();return false\">";
			x+= 			"Who</span>";
			x+=	 		"<span class=\"tab_head\" index=\"2\" type=\'"+id+"\' onclick=\"ViewTab();return false\">";
			x+= 			"When</span>";
			x+= 		"<span class=\"tab_head\" index=\"3\" type=\'"+id+"\' onclick=\"ViewTab();return false\">";
			x+= 			"What</span>";
			x+= 		"<span class='tab_head_spacer' style='width:354px;'>   </span>";
			x+= 	"</div>";
			// tab bodies
			x+= 	"<div class=\"tab_body\" style='margin-left: 0px; margin-right: 0px;' >";			
			// Who
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"RREDWO\">";
			x+=				"<div class=\"rr_row\" style=\"font-weight:bold\">This rule applies to:</div>";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_who_type\" id=\"rr_who_type_0\" value=\""+ROUTINGRULE_WHOTYPE_ALLCALLERS+"\" onclick=\"ToggleWhoSearch(this)\" class=\"rr_radio\"/> <label for=\"rr_who_type_0\">"+text('RR/WHO_ALL')+"</label></div>";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_who_type\" id=\"rr_who_type_1\" value=\""+ROUTINGRULE_WHOTYPE_ALL_EXTERNAL_CALLERS+"\" onclick=\"ToggleWhoSearch(this)\" class=\"rr_radio\"/> <label for=\"rr_who_type_1\">"+text('RR/WHO_EXT')+"</label></div>";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_who_type\" id=\"rr_who_type_2\" value=\""+ROUTINGRULE_WHOTYPE_ALL_INTERNAL_CALLERS+"\" onclick=\"ToggleWhoSearch(this)\" class=\"rr_radio\"/> <label for=\"rr_who_type_2\">"+text('RR/WHO_INT')+"</label></div>";
			x+=				"<xsl:if test=\"GROUPS/*\">";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_who_type\" id=\"rr_who_type_3\" value=\""+ROUTINGRULE_WHOTYPE_GROUP+"\" onclick=\"ToggleWhoSearch(this)\" class=\"rr_radio\"/> <label for=\"rr_who_type_3\">"+text('RR/WHO_GP1')+"</label> ";
			x+=					"<select class=\"rr_select\" id=\"rr_who_group_name\" onclick=\"SetRadio('rr_who_type',3)\">";
			x+=						"<xsl:for-each select=\"GROUPS/GROUP\">";
			x+=							"<option><xsl:value-of select=\"Name\" /></option>";
			x+=						"</xsl:for-each>";
			x+=					"</select>&#160;&#160;"+text('RR/WHO_GP2');
			x+=				"</div>"
			x+=				"</xsl:if>";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_who_type\" id=\"rr_who_type_4\" value=\""+ROUTINGRULE_WHOTYPE_CONTACT+"\" onclick=\"ToggleWhoSearch(this)\" class=\"rr_radio\"/> <label for=\"rr_who_type_4\">"+text('RR/WHO_CON')+"</label>:</div>";
			x+=					"<span id=\"TARRWO\" style=\"display:none\">";
			x+=					"<div id=\"rr_target_TARRWO\" style=\"font-weight:bold;height:30px;margin:2px 5px;padding:0px 0px 5px 30px;vertical-align:top;\"></div> ";
			x+=					"<div onclick=\"SetRadio('rr_who_type',4)\" style=\"margin:0px 30px;background-color:#cc9;border:1px solid #996;padding:15px\">";
			x+= 					"<div>"+text('GBL/SRCH')+": <input type=\"text\" id=\"textEmbeddedTypeAheadSearchTARRWO\" onfocus=\"SetRadio('rr_who_type',4);cur_search_type='RREDWO';\" onkeyup=\"HandleKeypressInterval()\" class=\"rr_input\"/></div>";
			x+= 					"<div id=\"tableTARRWO\" style=\"border:1px solid #666;margin-top:10px\"></div>";
			x+=					"</div>";
			x+=					"</span>";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_who_type\" id=\"rr_who_type_5\" value=\""+ROUTINGRULE_WHOTYPE_CUSTOM+"\" onclick=\"ToggleWhoSearch(this)\" class=\"rr_radio\"/> <label for=\"rr_who_type_5\">"+text('RR/WHO_NUM')+"</label> <input type=\"text\" id=\"rr_who_custom_num\" onfocus=\"SetRadio('rr_who_type',5)\" class=\"rr_input\"/></div>";
			x+= 		"</div>";
			
			// When
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"RREDWE\">";
			x+=				"<div class=\"rr_row\" style=\"font-weight:bold\">"+text('RR/WHEN_TI')+":</div>";
			x+=				"<div class=\"rr_row\">";
			x+=					"<input type=\"radio\" name=\"rr_when_type\" id=\"rr_when_type_0\" value=\"availability\" class=\"rr_radio\"/><label for=\"rr_when_type_0\">"+text('RR/WHEN_AV')+"</label>: ";
			x+=					"<input type=\"radio\" name=\"rr_when_type_avail\" id=\"rr_when_type_0_av\" value=\"1\" onclick=\"SetRadio('rr_when_type',0)\" class=\"rr_radio\"/><label for=\"rr_when_type_0_av\">"+text('CS/AVA')+"</label>";
			x+=					"<input type=\"radio\" name=\"rr_when_type_avail\" id=\"rr_when_type_0_un\" value=\"0\" onclick=\"SetRadio('rr_when_type',0)\" class=\"rr_radio\"/><label for=\"rr_when_type_0_un\">"+text('CS/UNAV')+"</label>";
			x+=				"</div>";
			x+=				"<div class=\"rr_row\">";
			x+=					"<input type=\"radio\" name=\"rr_when_type\" id=\"rr_when_type_1\" value=\"status\" class=\"rr_radio\"/><label for=\"rr_when_type_1\">"+text('RR/WHEN_CS')+"</label>: ";
			x+=					"<select id=\"rr_when_status_select\" class=\"rr_select\" onclick=\"SetRadio('rr_when_type',1)\">";
			x+=						"<xsl:for-each select=\"COMPOSITES/COMPOSITE_STATUS\" order-by=\"+Description\"><option><xsl:value-of select=\"Description\" /></option></xsl:for-each>";
			x+=					"</select>";
			x+=				"</div>";
			x+=				"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_when_type\" id=\"rr_when_type_2\" value=\"anytime\" class=\"rr_radio\"/><label for=\"rr_when_type_2\">"+text('RR/WHEN_ANY')+"</label></div>";
				
			x+=				"<div class=\"rr_row\"><input type=\"checkbox\" id=\"rr_when_type_hours\" onclick=\"ToggleDiv('rr_when_hours', this);\" class=\"rr_radio\"/><label for=\"rr_when_type_hours\">"+text('RR/WHEN_APLY_HOURS')+"</label>: </div>";
			x+=				"<div id=\"rr_when_hours\" class=\"rr_sub_section\" style=\"display:none;\">";
			x+=					"<span style=\"margin:10px 10px 0px 0px;\">";
			x+=						BuildRuleSelect('hours', 'rr_when_time_start_hours', 'CheckForDayRollover()');
			x+=						"<span style=\"width:10px;text-align:right;font-weight:bold;\">:</span>";
			x+=						BuildRuleSelect('minutes', 'rr_when_time_start_min', 'CheckForDayRollover()');
			x+=						BuildRuleSelect('ampm', 'rr_when_time_start_ampm', 'CheckForDayRollover()');
			x+=					"</span>";
			x+=					"<span style=\"margin:10px 10px 0px 0px;vertical-align:middle\">"+text('RR/WHEN_TO')+"</span>";
			x+=					"<span style=\"margin:10px 10px 0px 0px;\">";
			x+=						BuildRuleSelect('hours', 'rr_when_time_stop_hours', 'CheckForDayRollover()');
			x+=						"<span style=\"width:10px;text-align:right;font-weight:bold;\">:</span>";
			x+=						BuildRuleSelect('minutes', 'rr_when_time_stop_min', 'CheckForDayRollover()');
			x+=						BuildRuleSelect('ampm', 'rr_when_time_stop_ampm', 'CheckForDayRollover()');
			x+=					"</span>";
			x+=					"<span style=\"margin:10px 0px 0px 0px;font-weight:bold;\" id=\"rr_time_clarification\"></span>";
			x+= 			"</div>";
			
			x+=				"<div class=\"rr_row\"><input type=\"checkbox\" id=\"rr_when_type_days\" onclick=\"ToggleDiv('rr_when_days', this);\" class=\"rr_radio\"/><label for=\"rr_when_type_days\">"+text('RR/WHEN_APLY_DAYS')+"</label>: </div>"; //style=\"padding-left:10px\"
			x+=				"<div id=\"rr_when_days\" class=\"rr_sub_section\" style=\"display:none;\">";
			x+=				"<div>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_mon\"/><label for=\"rr_when_day_mon\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="1"]').getAttribute('name') +"</label></span>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_tue\"/><label for=\"rr_when_day_tue\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="2"]').getAttribute('name') +"</label></span>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_wed\"/><label for=\"rr_when_day_wed\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="3"]').getAttribute('name') +"</label></span>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_thu\"/><label for=\"rr_when_day_thu\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="4"]').getAttribute('name') +"</label></span>";
			x+=				"</div>";
			x+=				"<div>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_fri\"/><label for=\"rr_when_day_fri\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="5"]').getAttribute('name') +"</label></span>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_sat\"/><label for=\"rr_when_day_sat\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="6"]').getAttribute('name') +"</label></span>";
			x+=					"<span style=\"width:24%;\"><input type=\"checkbox\" id=\"rr_when_day_sun\"/><label for=\"rr_when_day_sun\">"+ oText.selectSingleNode('LABELS/DAYS/DAY[@index="0"]').getAttribute('name') +"</label></span>";//x+=					"</span>";
			x+=					"<span style=\"width:100px;height:10px;text-align:left;margin:5px 0px 0px 4px\"><a href=\"javascript:ToggleDaysOfWeekCheckboxes()\" style=\"color:#903;\" id=\"rr_when_dow_toggle\">"+text('RR/CHK_ALL')+"</a></span>";
			x+=				"</div>";
			x+= 			"</div>";	
			x+=				"<div class=\"rr_row\"><input type=\"checkbox\" id=\"rr_when_type_date\" onclick=\"ToggleDiv('rr_when_date', this);\" class=\"rr_radio\"/><label for=\"rr_when_type_date\">"+text('RR/WHEN_APLY_DATES')+"</label>: </div>"; //style=\"padding-left:10px\"			
			x+=				"<div id=\"rr_when_date\" class=\"rr_sub_section\" style=\"display:none;\">";
			x+=					BuildRuleSelect('month', 'rr_when_date_start_month', 'SetDatesForThisMonth(this);CheckForYearRollover()');
			x+=					BuildRuleSelect('date', 'rr_when_date_start_day', 'CheckForYearRollover()', 'Jan');
			x+=					"<span style=\"padding:0px 5px 0px 10px;text-align:center;\">"+text('RR/WHEN_APLY_DATES_THR')+"</span>";
			x+=					BuildRuleSelect('month', 'rr_when_date_stop_month', 'SetDatesForThisMonth(this);CheckForYearRollover()');
			x+=					BuildRuleSelect('date', 'rr_when_date_stop_day', 'CheckForYearRollover()', 'Jan');
			x+=					"<span style=\"padding:5px 0px 0px 10px;\" id=\"rr_date_clarification\"></span>";
			x+= 			"</div>";
			x+= 		"</div>";
			
			
			// What
			x+= 		"<div class=\"tab_content\" style=\"display:none\" id=\"RREDWA\">";
			x+= 			"<div class=\"table\" id=\"tableRREDWA\"></div>";
			x+=				"<div id=\"formRREDWA\" style=\"display:none\">";
			x+=					"<div style=\"float:right;width:100px;font-size:30px;font-weight:bold;color:#666;padding-right:10px;line-height:28px;text-align:right;\"></div>";
			x+=					"<div class=\"rr_row\" style=\"font-weight:bold;\"></div>";//color:#c93;font-size:16px
			x+=					"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_what_type\" id=\"rr_what_type_0\" value=\""+ _STEPTYPE_PLAY_GREETING +"\" class=\"rr_radio\" onclick=\"ToggleWhatSearchAndDuration(this)\"/><label for=\"rr_what_type_0\">"+text('RR/WHAT_GREET') +"</label>";
			x+=					"<span id=\"rr_what_greeting_select\">";
			x+=					"<xsl:choose>";
			x+=						"<xsl:when test=\"GREETINGS/GREETING[Filename!='']\">";
			x+= 						"<select id=\"rr_what_greeting\" class=\"rr_select\">";
			x+=								"<xsl:for-each select=\"GREETINGS/GREETING[Filename!='']\" order-by=\"Description\"><option><xsl:attribute name=\"value\"><xsl:value-of select=\"UniqueID\"/></xsl:attribute><xsl:value-of select=\"Description\"/></option></xsl:for-each>";
			x+= 						"</select>";
			x+=						"</xsl:when>";
			x+=						"<xsl:otherwise> "+text('RR/WHAT_NOGREET')+"</xsl:otherwise>";
			x+=					"</xsl:choose>";
			x+=					"</span>";
			x+=					"</div>";
			
			// ***TO DO *** add check to see if primary device has a voicemail box associated with it
			x+=					"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_what_type\" id=\"rr_what_type_1\" value=\""+ _STEPTYPE_TRANSFER_TO_VOICEMAIL +"\" class=\"rr_radio\" onclick=\"ToggleWhatSearchAndDuration(this)\"/><label for=\"rr_what_type_1\">"+text('RR/WHAT_SEND_VM')+"</label></div>";
			x+=					"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_what_type\" id=\"rr_what_type_2\" value=\""+ _STEPTYPE_HANG_UP +"\" class=\"rr_radio\" onclick=\"ToggleWhatSearchAndDuration(this)\"/><label for=\"rr_what_type_2\">Hang up</label></div>";

			x+=					"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_what_type\" id=\"rr_what_type_3\" value=\""+ _STEPTYPE_SEND_TO_CURRENT_LOCATION +"\" class=\"rr_radio\" onclick=\"ToggleWhatSearchAndDuration(this)\"/><label for=\"rr_what_type_3\">"+text('RR/WHAT_SEND_CUR_LOC')+"</label></div>";
			x+=					"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_what_type\" id=\"rr_what_type_4\" value=\""+ _STEPTYPE_SEND_TO_LOCATION +"\" class=\"rr_radio\" onclick=\"ToggleWhatSearchAndDuration(this)\"/><label for=\"rr_what_type_4\">"+text('RR/WHAT_SEND_THIS_LOC')+"</label>: ";
			x+= 					"<select id=\"rr_what_location_type\" class=\"rr_select\" onclick=\"UpdateRoutingRuleWhatSelect(this);SetRadio('rr_what_type',4)\" onkeyup=\"UpdateRoutingRuleWhatSelect(this);\">";
			x+=							"<option type=\"-2\">--- "+text('CS/CHOOSE')+" ---</option>";
			x+=							"<xsl:for-each select=\"DEVICES/DEVICE[OwnerAccount = /R/ACCOUNT//UniqueID]\" order-by=\"+Name\"><option type=\"1\"><xsl:attribute name=\"extension\"><xsl:value-of select=\"Extension\" /></xsl:attribute><xsl:attribute name=\"node\"><xsl:value-of select=\"NodeID\" /></xsl:attribute><xsl:value-of select=\"Name\"/></option></xsl:for-each>";
			x+=								"<xsl:for-each select=\"/R/CONTACT_FIELDS/FIELD[@locType and @type='TYPE_STRING_PHONE']\">";
			x+=									"<xsl:if test=\"/R/ACCOUNT//CONTACT/*[nodeName() = context(-1)/@name and value() != '']\">";
			x+=										"<option><xsl:attribute name=\"type\"><xsl:value-of select=\"@locType\" /></xsl:attribute><xsl:attribute name=\"property\"><xsl:value-of select=\"@name\" /></xsl:attribute><xsl:value-of select=\".\" /></option>";
			x+=									"</xsl:if>";
			x+=								"</xsl:for-each>";
			x+=							"<option type=\"0\">["+text('CS/CUST')+"]</option>";
			x+= 					"</select>";
			x+=						"<input type=\"text\" id=\"rr_what_thisloc_number\" onfocus=\"SetRadio('rr_what_type',4)\" class=\"rr_input\" /></div>";
			x+=					"<div class=\"rr_row\"><input type=\"radio\" name=\"rr_what_type\" id=\"rr_what_type_5\" value=\""+ _STEPTYPE_SEND_TO_CONTACT +"\" class=\"rr_radio\" onclick=\"ToggleWhatSearchAndDuration(this)\"/><label for=\"rr_what_type_5\">"+text('RR/WHAT_SEND_CON')+"</label>:</div>";
			x+= 				"<span id=\"TARRWA\" style=\"display:none;\">";
			x+=						"<div id=\"rr_target_TARRWA\" style=\"font-weight:bold;margin:2px 5px;padding:0px 0px 0px 30px;vertical-align:top;height:45px\"></div> ";
			x+=						"<div onclick=\"SetRadio('rr_what_type',5)\" style=\"margin:0px 30px 20px 30px;background-color:#eee;border:1px solid #666;padding:15px\">";
			x+= 						"<div>"+text('GBL/SRCH')+": <input type=\"text\" id=\"textEmbeddedTypeAheadSearchTARRWA\" onfocus=\"SetRadio('rr_what_type',5);cur_search_type='RREDWA';\" onkeyup=\"HandleKeypressInterval()\" class=\"rr_input\"/></div>";
			x+= 						"<div id=\"tableTARRWA\" style=\"border:1px solid #666;margin-top:10px\"></div>";
			x+=						"</div>";
			x+=					"</span>";
			x+=					"<div class=\"rr_row\" id=\"rr_duration\" style=\"margin:0px;padding:10px;height:10px;border:1px solid #666;background-color:#eee;\">";
									var input = "<input type=\"text\" id=\"rr_send_duration\" class=\"rr_input\" onclick=\"SetRadio('rr_what_duration_type',0)\"/>";
			x+=						"<div><input type=\"radio\" name=\"rr_what_duration_type\" id=\"rr_what_duration_0\" value=\"duration\" class=\"rr_radio\"/><label for=\"rr_what_duration_0\">"+Insert(input, text('RR/WHAT_DUR_SPEC'))+"</label></div>";
			x+=						"<div><input type=\"radio\" name=\"rr_what_duration_type\" id=\"rr_what_duration_1\" class=\"rr_radio\"/><label for=\"rr_what_duration_1\">"+text('RR/WHAT_DUR_INDEF')+"</label></div>";
			x+=					"</div>";
			x+=				"</div>";
			x+= 		"</div>";
			x+= 	"</div></div>";
			break;
			
		case "Transfer":	
			var sMouseEvents = "onmouseover=\"this.style.backgroundColor='#ffc'\" onmouseout=\"this.style.backgroundColor=''\"";
			x+= "<div style=\"width:100%\">";
			x+= 	"<div class=\"menu_head\">"+text('MENU/TRAN_TYPE')+"</div>";
			x+= 	"<div class=\"menu_row\" "+ sMouseEvents +">";
			x+= 		"<xsl:attribute name=\"onclick\">HandleSpecifiedTransfer('manual', '<xsl:value-of select=\"CallID\"/>')</xsl:attribute>";
			x+= 		text('MENU/TRAN_SPEC');
			x+= 	"</div>";
			x+= 	"<div class=\"menu_row\" "+ sMouseEvents +">";
			x+= 		"<xsl:attribute name=\"onclick\">HandleSpecifiedTransfer('search', '<xsl:value-of select=\"CallID\"/>')</xsl:attribute>";
			x+= 		text('MENU/TRAN_SRCH');
			x+= 	"</div>";
			x+= "</div>";
			break;
		
		case "ED":
		case "PI":
		case "NAPI":
			if (oDataObj.nodeName=='ACCOUNT')
			x+= "<xsl:for-each select=\".//CONTACT\">";
			x+= "<xsl:script><![CDATA[";
			x+= "function countEmails(e) {";
			x+= 	"var nEmailNodes = e.selectNodes('Emails/LIST//String');";
			x+= 	"return nEmailNodes.length;";
			x+= "}";
			x+= "function formatOptionIndex(num, offset) {";
			x+= 	"return parseFloat(num) - parseFloat(offset);";
			x+= "}";
			x+= "function formatStringLength(node) {";
			x+= 	"var str = node.text;";
			x+= 	"if (str && str.length > 50)";
			x+= 		"str = str.substring(0,50) + '...';";
			x+= 	"return str;";
			x+= "}";
			x+= GetEmbeddedRemoveNodePrefixScript();
			x+= GetEmbeddedFormatPhoneNumberScript();
			x+= "function checkFlagsBit(e, n) {";
			x+= 	"var nFlags = parseFloat(e.selectSingleNode('/R/ACCOUNT/Flags').text);";
			x+= 	"var ACCOUNT_FLAGS_RoutingEnabled = "+ACCOUNT_FLAGS_RoutingEnabled+";";
			x+= 	"var ACCOUNT_FLAGS_PositiveCallerID = "+ACCOUNT_FLAGS_PositiveCallerID+";";
			x+= 	"var ACCOUNT_FLAGS_UsingSharedDevice = "+ACCOUNT_FLAGS_UsingSharedDevice+";";
			x+= 	"var ACCOUNT_FLAGS_IncludeAccountsInPhoneClientSearch = "+ACCOUNT_FLAGS_IncludeAccountsInPhoneClientSearch+";";
			x+= 	"var ACCOUNT_FLAGS_ASRConfirmationPrompts = "+ACCOUNT_FLAGS_ASRConfirmationPrompts+";";
			x+= 	"var ACCOUNT_FLAGS_PhoneClientAutoLogon = "+ACCOUNT_FLAGS_PhoneClientAutoLogon+";";
			x+= 	"var ACCOUNT_FLAGS_PromptToAddIdentifiedCaller = "+ACCOUNT_FLAGS_PromptToAddIdentifiedCaller+";";
			x+= 	"var ACCOUNT_FLAGS_AutoSave = "+ACCOUNT_FLAGS_AutoSave+";";
			x+=		"";
			x+= 	"if (ACCOUNT_FLAGS_RoutingEnabled == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_RoutingEnabled);";
			x+= 	"if (ACCOUNT_FLAGS_PositiveCallerID == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_PositiveCallerID);";
			x+= 	"if (ACCOUNT_FLAGS_UsingSharedDevice == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_UsingSharedDevice);";
			x+= 	"if (ACCOUNT_FLAGS_IncludeAccountsInPhoneClientSearch == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_IncludeAccountsInPhoneClientSearch);";
			x+= 	"if (ACCOUNT_FLAGS_ASRConfirmationPrompts == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_ASRConfirmationPrompts);";
			x+= 	"if (ACCOUNT_FLAGS_PhoneClientAutoLogon == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_PhoneClientAutoLogon);";
			x+= 	"if (ACCOUNT_FLAGS_PromptToAddIdentifiedCaller == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_PromptToAddIdentifiedCaller);";
			x+= 	"if (ACCOUNT_FLAGS_AutoSave == n)";
			x+= 	"	return (nFlags & ACCOUNT_FLAGS_AutoSave);";
			x+= "}";
			x+= GetEmbeddedFormatPhoneNumberScript();
			x+= "]]></xsl:script>";
			// tab heads
			x+= "<div class=\"tab_control\">";
			x+= 	"<div class=\"tab_head_row\">";
			x+= 		"<span class='tab_head' index='1' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Name</span>";
			x+= 		"<span class='tab_head' index='2' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Work</span>";
			x+= 		"<span class='tab_head' index='3' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Home</span>";
			x+= 		"<span class='tab_head' index='4' type='" + id + "' onclick='ViewTab();return false' >";
			x+= 			"Advanced</span>";
			if(id=='PI'){
			//if(oDataObj.getAttribute('isContact')!='1' && id=='ED'){
				x+= 		"<span class='tab_head' index='5' type='" + id + "' onclick='ViewTab();return false' >";
				x+= 			"Devices</span>";
				x+= 		"<span class='tab_head_spacer' style='width:127px;'> </span>";			
			}else {
				x+= 		"<span class='tab_head_spacer' style='width:252px;'> </span>";			
			}
			
			
			x+= 	"</div>";
		
			// tab bodies
			x+= 	"<div class=\"tab_body\">";
			// Name
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:328px\" id=\"EDNM\">";
			x+= 		"<div class=\"table\" id=\"tableEDNM\" style=\"border:0px\">";
			x+= 		GetFormXSL("NM",oDataObj);
			x+= 		"</div></div>";
			// Work
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:328px\" id=\"EDWK\">";
			x+= 		"<div class=\"table\" id=\"tableEDWK\" style=\"border:0px\">";
			x+= 		GetFormXSL("WK",oDataObj);
			x+= 		"</div></div>";
			// Home
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:328px\" id=\"EDHM\">";
			x+= 		"<div class=\"table\" id=\"tableEDHM\" style=\"border:0px\">";
			x+= 		GetFormXSL("HM",oDataObj);	
			x+= 		"</div></div>";
			// Advanced
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:328px\" id=\"EDAD\">";
			x+= 		"<div class=\"table\" id=\"tableEDAD\" style=\"border:0px\">";
			x+= 		GetFormXSL("AD",oDataObj);
			x+= 		"</div></div>";	
			// Devices 
			if(id=='PI'){
			//if(oDataObj.getAttribute('isContact')!='1' && id=='ED'){
			x+= 		"<div class=\"tab_content\" style=\"display:none;height:328px\" id=\"DV\">";
			x+= 		"<div class=\"table\" id=\"tableDV\">";
			x+=		"";
			x+= 		"</div></div>";	
			}
			x+= 	"</div></div>";
			if (oDataObj.nodeName=='ACCOUNT')
			x+= "</xsl:for-each>";
			break;
		
		case "SYSO":
			//x+= "<form class=\"edit_form\" style=\"overflow-y:auto\">";
			x+= "<div class='generic_title'><img src=\"img/iAddressBookSynch.gif\" class=\"icon\" style=\"margin:3px 5px;\"/>"+ text('SYNC/TI') +"</div>";
			x+= "<xsl:choose>";
			x+= "<xsl:when test=\".[SOURCE]\">";
			x+= 	"<div class=\"sub_title\">"+ text('SYNC/EXSO') +"</div>";
			x+= 	"<xsl:for-each select=\"SOURCE\">";
			x+= 		"<div class=\"sy_eval_row\" style=\"padding-left:20px;vertical-align:middle\"><span class=\"sy_eval_cb\"><input type=\"checkbox\"><xsl:attribute name=\"id\">SynchSourceCheckbox<xsl:value-of select=\".\" /></xsl:attribute></input></span><img src=\"img/iExtContactManager.gif\" class=\"icon\" style=\"margin:3px 5px;\" /> <xsl:value-of select=\".\" /></div>";
			x+= 	"</xsl:for-each>";
			x+= 	"<div class=\"sy_eval_row\" style=\"padding-left:25px\">("+ text('SYNC/INST') +")</div>";
			x+= "</xsl:when>";
			x+= "<xsl:otherwise>";
			x+= 	"<div>"+ text('SYNC/NONE') +"</div>";
			x+= "</xsl:otherwise>";
			x+= "</xsl:choose>";
			x+= "<div class=\"sub_title\"> "+ text('SYNC/IMPTTEXT') +"</div>";
			x+= "<div class=\"sy_eval_row\" style=\"padding-left:20px;vertical-align:middle\"><span class=\"sy_eval_cb\"><input type=\"checkbox\" id=\"FileImportCheckbox\" /></span><img src=\"img/iAdd.gif\" class=\"icon\" style=\"margin:3px 5px;\" /> " + text('SYNC/FILE')+" ";
			x+= 	"<form style=\"display:inline;font-size:10px;margin-top:10px\">"+ BuildBasicInput('file', 'FileImportPathInput', '', '', 'Button') +"</form>";
			x+= "</div>";
			break;
		
		case "SYCF":
			x+= "<xsl:script><![CDATA[";
			x+= GetEmbeddedInsertScript();
			x+= GetEmbeddedRemoveNodePrefixScript();
			x+= GetEmbeddedFormatPhoneNumberScript();
			x+= "function countEmails(e) {";
			x+= 	"var nEmailNodes = e.selectNodes('Emails/LIST//String');";
			x+= 	"return nEmailNodes.length;";
			x+= "}";
			x+= "function formatOptionIndex(num, offset){";
			x+= 	"return parseFloat(num) - parseFloat(offset);";
			x+= "}";
			x+= "function formatMergePhone(node, xpath) {";
			//x+= 	"return Insert(node.getAttribute('name'), xpath);";
			x+= 	"return removeNodePrefix(node, Insert(node.getAttribute('name'), xpath));";
			x+= "}";
			x+= "]]></xsl:script>";
			x+= "<div class=\"generic_title\">"+ oCurSynchNode.text +" Merge [Conflict "+ (conflict_num+1) +"]</div>";
			x+= "<div class=\"sub_title\" style=\"margin:5px 0px;\">Choose a method for resolving this conflict.</div>";
			x+= 	"<div class=\"sy_cf_row\">";
			x+= 		"<select id=\"sy_conflict_resolve_select\" style=\"border:1px solid #333;font-size:10px;\">";
			x+= 			"<option value=\"form\">"+text('SYNC/SCFM')+"</option>";
			x+= 			"<option value=\"ldap\">"+text('SYNC/SCAB')+"</option>";
			x+= 			"<option value=\"external\">"+ Insert(oCurSynchNode.text, text('SYNC/SCEX'))+"</option>";
			x+= 			"<option value=\"split\">"+text('SYNC/SCSE')+"</option>";
			x+= 			"<option value=\"skip\">"+text('SYNC/SCSK')+"</option>";
			x+= 		"</select>";
			x+= 	"</div>";
			x+= "<div class=\"sub_title\" style=\"margin:5px 0px;\">Choose a value for the highlighted fields.</div>";
			x+= "<xsl:for-each select=\"CONTACT_FIELDS/FIELD[@editable='2' and @conflict='1']\">";
			x+= 	"<div class=\"sy_cf_row\">";
			x+= 	"<xsl:if test=\".[@type='TYPE_STRING' or @type='TYPE_STRING_PHONE']\">";
			x+= 		"<span class=\"sy_cf_item\"><xsl:value-of select=\".\" /><br/>";
			x+= 			"<input type=\"text\" class=\"edit_form_text\">";
			x+= 				"<xsl:attribute name=\"id\">merge<xsl:value-of select=\"@name\" /></xsl:attribute>";
			x+= 				"<xsl:attribute name=\"maxlength\"><xsl:value-of select=\"@length\" /></xsl:attribute>";
			x+= 			"</input>";
			x+= 		"</span>";
			x+= 		"<span class=\"sy_cf_vals\">";
			x+=				"<div style=\"width:100%;margin-bottom:5px;\"><span style=\"width:18%;height:100%;margin-right:5px;vertical-align:top\"><img src=\"img/iArrowLeft.gif\" class=\"icon\" style=\"width:10px\"/><img src=\"img/iContact.gif\" class=\"icon\" /></span><span style=\"height:100%;width:80%;vertical-align:top\">";
			x+=					"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(1,'<xsl:value-of select=\"@name\" />')</xsl:attribute>";
			x+= 					"<xsl:if test=\".[@type='TYPE_STRING_PHONE']\"><xsl:eval>formatMergePhone(this, '/R/SYNCH/CONFLICT/LOCAL/CONTACT/*[nodeName() = \\'{0}\\']')</xsl:eval></xsl:if>";
			x+= 					"<xsl:if test=\".[@type='TYPE_STRING']\"><xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" /></xsl:if>";
			x+=					"</a></span></div>";
			x+=				"<div style=\"width:100%;margin-bottom:5px;\"><span style=\"width:18%;height:100%;margin-right:5px;vertical-align:top\"><img src=\"img/iArrowLeft.gif\" class=\"icon\" style=\"width:10px\"/><img src=\"img/iExtContactManager.gif\" class=\"icon\" /></span><span style=\"height:100%;width:80%;vertical-align:top\"><a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(0,'<xsl:value-of select=\"@name\" />')</xsl:attribute>";
			x+= 					"<xsl:if test=\".[@type='TYPE_STRING_PHONE']\"><xsl:eval>formatMergePhone(this, '/R/SYNCH/CONFLICT/REMOTE/CONTACT/*[nodeName() = \\'{0}\\']')</xsl:eval></xsl:if>";
			x+= 					"<xsl:if test=\".[@type='TYPE_STRING']\"><xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" /></xsl:if>";
			x+=					"</a></span></div>";
			//					<xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" />
			//  				<xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" />
			//  				<xsl:eval>removeNodePrefix(this, 'LocationNumber')</xsl:eval>
			//x+=				"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(1,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <img src=\"img/iContact.gif\" class=\"icon\" border=\"0\"/> <xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" /></a><br/>"; // (Personal Contacts)
			//x+=				"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(0,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <img src=\"img/iExtContactManager.gif\" class=\"icon\" border=\"0\"/> <xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" /></a>"; // ("+oCurS
			x+= 		"</span>";
			x+= 	"</xsl:if>";
			x+= 	"<xsl:if test=\".[@type='TYPE_STRING_MULTILINE']\">";
			x+= 		"<span class=\"sy_cf_item\"><xsl:value-of select=\".\" /><br/>";
			x+= 			BuildXSLTextarea("merge<xsl:value-of select=\"@name\" />", ".", 30, 3);
			x+= 		"</span>";
			x+= 		"<span class=\"sy_cf_vals\">";
			x+=				"<div style=\"width:100%;margin-bottom:5px;\"><span style=\"width:18%;height:100%;margin-right:5px;vertical-align:top\"><img src=\"img/iArrowLeft.gif\" class=\"icon\" style=\"width:10px\"/><img src=\"img/iContact.gif\" class=\"icon\" /></span><span style=\"height:100%;width:80%;vertical-align:top\"><a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(1,'<xsl:value-of select=\"@name\" />')</xsl:attribute><xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" /></a></span></div>";
			x+=				"<div style=\"width:100%;margin-bottom:5px;\"><span style=\"width:18%;height:100%;margin-right:5px;vertical-align:top\"><img src=\"img/iArrowLeft.gif\" class=\"icon\" style=\"width:10px\"/><img src=\"img/iExtContactManager.gif\" class=\"icon\" /></span><span style=\"height:100%;width:80%;vertical-align:top\"><a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(0,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" /></a></span></div>";
			//x+=				"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(1,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <img src=\"img/iContact.gif\" class=\"icon\" border=\"0\"/> <xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" /></a><br/>"; // (Personal Contacts)
			//x+=				"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(0,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <img src=\"img/iExtContactManager.gif\" class=\"icon\" border=\"0\"/> <xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" /></a>"; // ("+oCurSynchNode.text+")
			x+= 		"</span>";
			x+= 	"</xsl:if>";
			x+= 	"<xsl:if test=\".[@type='TYPE_CHECKBOX']\">";
			x+= 		"<span class=\"sy_cf_item\">";
			x+= 			"<input type=\"checkbox\"><xsl:attribute name=\"id\">merge<xsl:value-of select=\"@name\" /></xsl:attribute></input>";
			x+= 			"<xsl:value-of select=\".\" />";
			x+= 		"</span>";
			x+= 		"<span class=\"sy_cf_vals\">";
			x+=				"<div style=\"width:100%;margin-bottom:5px;\"><span style=\"width:18%;height:100%;margin-right:5px;vertical-align:top\"><img src=\"img/iArrowLeft.gif\" class=\"icon\" style=\"width:10px\"/><img src=\"img/iContact.gif\" class=\"icon\" /></span><span style=\"height:100%;width:80%;vertical-align:top\"><a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(1,'<xsl:value-of select=\"@name\" />')</xsl:attribute><xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" /></a></span></div>";
			x+=				"<div style=\"width:100%;margin-bottom:5px;\"><span style=\"width:18%;height:100%;margin-right:5px;vertical-align:top\"><img src=\"img/iArrowLeft.gif\" class=\"icon\" style=\"width:10px\"/><img src=\"img/iExtContactManager.gif\" class=\"icon\" /></span><span style=\"height:100%;width:80%;vertical-align:top\"><a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(0,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" /></a></span></div>";
			//x+=				"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(1,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <img src=\"img/iContact.gif\" class=\"icon\" border=\"0\"/> <xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName() = context(-1)/@name]\" /></a><br/>"; // (Personal Contacts)
			//x+=				"<a href=\"javascript://\"><xsl:attribute name=\"onclick\">SetMergeFormValue(0,'<xsl:value-of select=\"@name\" />')</xsl:attribute> <img src=\"img/iExtContactManager.gif\" class=\"icon\" border=\"0\"/> <xsl:value-of select=\"context(0)/REMOTE/CONTACT/*[nodeName() = context(-1)/@name]\" /></a>"; //("+oCurSynchNode.text+")
			x+= 		"</span>";
			x+= 	"</xsl:if>";
			x+= 	"<xsl:if test=\".[@type='TYPE_SELECTIONLIST' and @name='Emails']\">";
			x+= 		"<span class=\"sy_cf_item\"><xsl:value-of select=\".\" /><br/>";
			x+= 			BuildXSLEmailEdit('merge');
			x+= 		"</span>";
			x+= 		"<span class=\"sy_cf_vals\">";
			x+= 			"<select name=\"mergeEmailsChoice\" size=\"4\" style=\"width=200px;\" onclick=\"AddEmailToMergeResolution(this.selectedIndex)\" class=\"edit_form_text\">";
			x+= 				BuildMergeEmailOptions();
			x+= 			"</select><br/>";
			x+= 			text('SYNC/EMAIL_OPTS');
			x+= 		"</span>";
			x+= 	"</xsl:if>";
			//
			x+= 	"</div>";
			x+= "</xsl:for-each>";
			x+= "<xsl:for-each select=\"CONTACT_FIELDS/FIELD[@editable=2 and not(@conflict)]\">";
			x+= 	"<div class=\"sy_cf_row\">";
			x+= 	"<span class=\"sy_cf_vals\">";
			x+= 	"<xsl:if test=\".[@type='TYPE_STRING' or @type='TYPE_STRING_PHONE']\">";
			x+= 		"<xsl:value-of select=\".\" /><br/>";
			x+= 		"<input type=\"text\" class=\"edit_form_text\">";
			x+= 			"<xsl:attribute name=\"id\">merge<xsl:value-of select=\"@name\" /></xsl:attribute>";
			x+= 			"<xsl:attribute name=\"maxlength\"><xsl:value-of select=\"@length\" /></xsl:attribute>";
			x+= 			"<xsl:attribute name=\"value\">";
			x+= 				"<xsl:if test=\".[@type='TYPE_STRING_PHONE']\"><xsl:eval>formatMergePhone(this, '/R/SYNCH/CONFLICT/LOCAL/CONTACT/*[nodeName() = \\'{0}\\']')</xsl:eval></xsl:if>";
			x+= 				"<xsl:if test=\".[@type='TYPE_STRING']\"><xsl:value-of select=\"context(0)/LOCAL/CONTACT/*[nodeName()=context(-1)/@name]\" /></xsl:if>";
			x+= 			"</xsl:attribute>";
			x+= 		"</input>";
			x+= 	"</xsl:if>";
			x+= 	"<xsl:if test=\".[@type='TYPE_STRING_MULTILINE']\">";
			x+= 			"<xsl:value-of select=\".\" /><br/>";
			x+= 			BuildXSLTextarea("merge<xsl:value-of select=\"@name\" />", "context(0)/LOCAL/CONTACT/*[nodeName()=context(-1)/@name]", 30, 3);
			x+= 	"</xsl:if>";
			x+= 	"<xsl:if test=\".[@type='TYPE_CHECKBOX']\">";
			x+= 		"<span class=\"sy_cf_vals\">";
			x+= 			"<input type=\"checkbox\" class=\"rr_radio\"><xsl:attribute name=\"id\">merge<xsl:value-of select=\"@name\" /></xsl:attribute></input>";
			x+= 			"<xsl:value-of select=\".\" />";
			x+= 		"</span>";
			x+= 	"</xsl:if>";
			x+= 	"<xsl:if test=\".[@type='TYPE_SELECTIONLIST' and @name='Emails']\">";
			x+= 			"<xsl:value-of select=\".\" /><br/>";
			x+= 			BuildXSLEmailEdit('merge');
			x+= 	"</xsl:if>";
			x+= 	"</span>";
			x+= 	"</div>";
			x+= "</xsl:for-each>";
			x+= "<xsl:for-each select=\"CONTACT_FIELDS/FIELD[@editable=0]\">";
			x+= 	BuildXSLInput("hidden", "merge<xsl:value-of select=\"@name\" />", ".");
			x+= "</xsl:for-each>";
			break;
	
		case "UB":
			x+= "<xsl:for-each select=\"R/AB/CONTACT[Groups//String='"+config('SPEED_DIAL')+"']\" order-by=\"+FirstName;+LastName;+Company\">";
			x+= "<xsl:script><![CDATA[";
			x+= "]]></xsl:script>";
			x+= "<div class=\"user_button\" onmouseover=\"HandleUserButtonMouse(this)\" onmousedown=\"HandleUserButtonMouse(this)\" onmouseout=\"HandleUserButtonMouse(this)\">";
			x+= 	"<xsl:attribute name=\"type\">UB</xsl:attribute>";
			x+= 	"<xsl:attribute name=\"id\">ub<xsl:value-of select=\"UniqueID\" /></xsl:attribute>";
			x+= 	"<xsl:attribute name=\"onclick\">ViewListMenu('UB', '<xsl:value-of select=\"UniqueID\" />')</xsl:attribute>";
			x+= 		"<span style=\"height:16px;width:16px;float:left;\">";
			x+= 			GetXSLStatusLogic(id);
			x+= 		"</span>";
			x+= 		"<span style=\"height:12px;width:80px;margin:2px 2px;float:left;overflow:hidden\">";
			x+= 			"<xsl:if test=\".[FirstName!='' or LastName!='']\"><xsl:value-of select=\"FirstName\" /> <xsl:value-of select=\"LastName\" /></xsl:if>";
			x+= 			"<xsl:if test=\".[FirstName='' and LastName='' and Company!='']\"><xsl:value-of select=\"Company\" /></xsl:if>"; 
			x+= 		"&#160;</span>";
			x+= 		"<div class=\"user_button_status\">";
			x+= 			"<xsl:choose>";
			x+= 			"<xsl:when test=\".[LinkType='A']\"><xsl:value-of select=\"/R/STATUS_LIST/ACC_STATUS[OwnerUniqueID = context(-1)/LinkParameter]/CurrentCompositeStatus\" /><br/><xsl:value-of select=\"/R/STATUS_LIST/ACC_STATUS[OwnerUniqueID = context(-1)/LinkParameter]/CurrentDynamicStatus\" /></xsl:when>";
			x+= 			"<xsl:when test=\".[LinkType='D']\"><xsl:for-each select=\"/R/STATUS_LIST/DEVICE_STATUS[NodeColonExtension = context(-1)/LinkParameter][0]\"><xsl:value-of select=\"PrimaryMessage\" /><br/><xsl:value-of select=\"SecondaryMessage\" /></xsl:for-each></xsl:when>";
			x+= 			"</xsl:choose>";
			x+= 		"&#160;</div>";
			x+= "</div>";
			x+= "</xsl:for-each>";
			break;
			
		case "POPUP":
		
			//x+= "<div style=\"text-align:center;color:#000;margin-top:5%\">"+text('LOGN/LOGOF_ONE')+' '+"<a href=\"javascript://\" onclick=\"document.location.reload();\">"+text('LOGN/LOGOF_TWO')+"</a>"+' '+text('LOGN/LOGOF_THREE')+"</div>";
			//x+= "<div style=\"text-align:center;color:#000;margin-top:1%\"><a href=\"javascript://\" onclick=\"ResetAutoLogon();document.location.reload();\">"+text('LOGN/LOGOF_TWO')+"</a>"+' '+text('LOGN/LOGON_DIFF')+' '+"</div>";
			x+= "<div style=\"text-align:center;color:#000;font-size:15;margin-top:10%\">"+text('LOGN/POPUP')+"</div>";
			break;			
			
				
		default:
			x+= id + " content here...";
	}
	return x+= (bXSLFormat) ? "</xsl:template></xsl:stylesheet>":"";
}

function GetFormXSL(sId, oDataObj)
{
	var x = "<form name=\"editForm"+sId+"\" class=\"edit_form\" onkeydown=\"HandleKeydown('edit_form');\">";
	switch(sId)
	{
		case "NM":
		x+= "<div class=\"block\" style=\"margin:10px 10px;\">";
		x+= 	"<span style=\"width:32%\"><span class=\"ed_form_label\">"+ text('VCRD/FIR') +"</span><br/>"+ GetDisplayElement("FirstName",oDataObj) +"</span>";
		x+= 	"<span style=\"width:32%\"><span class=\"ed_form_label\">"+ text('VCRD/MID') +"</span><br/>"+ GetDisplayElement("MiddleName",oDataObj) +"</span>";
		x+= 	"<span style=\"width:32%\"><span class=\"ed_form_label\">"+ text('VCRD/LAS') +"</span><br/>"+ GetDisplayElement("LastName",oDataObj) +"</span>";
		x+= "</div>";
		x+= "<div class=\"block\" style=\"margin:10px 10px;\">";
		x+=		"<span class=\"ed_form_label\">"+ text('VCRD/EMA') +"</span><br/>"+ GetDisplayElement("Emails", oDataObj) +"</div>";
		x+= "<div class=\"block\" style=\"margin:10px 10px;\">";
		x+= 	"<span class=\"ed_form_label\">" + text('VCRD/NOT') +"</span><br/>"+ GetDisplayElement("Notes", oDataObj);
		x+= "</div>";
		break;
		
		case "WK":
		x+= "<div style=\"margin:10px 10px;\">";
		x+=		"<span style=\"width:45%\">";
		x+=			"<span style=\"width:40%\" class=\"ed_form_label\">"+ text('VCRD/COM') +"</span><span style=\"width:40%\">"+ GetDisplayElement("Company", oDataObj) +"</span>";
		x+=			"<span style=\"width:40%\" class=\"ed_form_label\">"+ text('VCRD/TIT') +"</span><span style=\"width:40%\">"+ GetDisplayElement("Title", oDataObj) + "</span>";
		x+=			"<span style=\"width:40%\" class=\"ed_form_label\">"+ text('VCRD/DEP') +"</span><span style=\"width:40%\">"+ GetDisplayElement("Department", oDataObj) +"</span>";
		x+=		"</span>";
		x+=		"<span style=\"width:45%\"><span class=\"ed_form_label\">"+ text('VCRD/STAD')+ "</span><br/>"+ GetDisplayElement("WorkAddress", oDataObj) +"</span>";
		x+=		"<fieldset>";
		x+=			"<legend> "+text('VCRD/PNUMS') +" </legend>";
		x+=				"<div>";
		x+=					"<span class=\"edit_form_phone\">"+ text('VCRD/PRI') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("WorkNumber1", oDataObj) +"</span>";
		x+=					"<span class=\"edit_form_phone\">"+ text('VCRD/SEC') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("WorkNumber2", oDataObj) +"</span>";
		x+=				"</div>";
		x+=				"<div>";
		x+=					"<span class=\"edit_form_phone\">"+ text('VCRD/MOB') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("WorkMobileNumber", oDataObj) +"</span>";
		x+=					"<span class=\"edit_form_phone\">"+ text('VCRD/FAX') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("WorkFaxNumber", oDataObj) +"</span>";
		x+=				"</div>";
		x+=				"<div>";
		x+=					"<span class=\"edit_form_phone\">"+ text('VCRD/PGR') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("WorkPagerNumber", oDataObj)  +"</span>";
		x+=					"<span class=\"edit_form_phone\">"+ text('VCRD/IPP') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("WorkIPPhone", oDataObj)  +"</span>";
		x+=				"</div>";
		x+=		"</fieldset>";
		x+=		"<span>"+ text('VCRD/WEB') +"</span><span>"+ GetDisplayElement("WorkWebPage", oDataObj)  +"</span>";
		x+= "</div>";
		break;
		
		case "HM":
		x+= "<div style=\"margin:10px 10px;\"><span class=\"ed_form_label\">"+ text('VCRD/STAD') +"</span><br/><span>"+ GetDisplayElement("HomeAddress", oDataObj) +"</span></div>";
		x+= "<div style=\"margin:10px 10px;\">";
		x+=		"<fieldset>";
		x+=			"<legend>"+ text('VCRD/PNUMS') +"</legend>";
		x+=			"<div>";
		x+=				"<span class=\"edit_form_phone\">"+ text('VCRD/PRI') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("HomeNumber1", oDataObj) +"</span>";
		x+=				"<span class=\"edit_form_phone\">"+ text('VCRD/SEC') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("HomeNumber2", oDataObj) +"</span>";
		x+=			"</div>";
		x+=			"<div>";
		x+=				"<span class=\"edit_form_phone\">"+ text('VCRD/MOB') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("HomeMobileNumber", oDataObj) +"</span>";
		x+=				"<span class=\"edit_form_phone\">"+ text('VCRD/FAX') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("HomeFaxNumber", oDataObj) +"</span>";
		x+=			"</div>";
		x+=			"<div>";
		x+=				"<span class=\"edit_form_phone\">"+ text('VCRD/PGR') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("HomePagerNumber", oDataObj) +"</span>";
		x+=				"<span class=\"edit_form_phone\">"+ text('VCRD/IPP') +"</span><span class=\"edit_form_phone\">"+ GetDisplayElement("HomeIPPhone", oDataObj) +"</span>";
		x+=			"</div>";
		x+=		"</fieldset>";
		x+=		"<span>"+ text('VCRD/WEB') +"</span><span>"+ GetDisplayElement("HomeWebPage", oDataObj) +"</span>";
		x+= "</div>";
		break;
		
		case "AD":
		if (oDataObj.getAttribute('isContact')=='1')
		{
			if (oDataObj.getAttribute('readOnly')=='1')
				x+= "<div style=\"margin-top:10px\">"+ text('EDIT/AD/MARK')+ "<span style=\"padding-left:15px;color:#666;font-weight:bold\">"+text('EDIT/AD/'+(boolVal(oDataObj.selectSingleNode("Private"))?"PRI":"PUB")) +"</span></div>";
			else
				x+= "<div><span><input type=\"checkbox\" id=\"editPrivate\" /><label for=\"editPrivate\">"+ text('EDIT/AD/MKPRI') +"</label></span></div>";
		}
		else
		{
			if (oDataObj.getAttribute('readOnly')=='1')
			{
				x+= "<span style=\"width:90%;\">";
				var choose_test_statement = "<xsl:choose><xsl:when test=\"{0}\"><img src=\"img/iSave.gif\" class=\"icon\" /></xsl:when><xsl:otherwise><img src=\"img/iClose.gif\" class=\"icon\" /></xsl:otherwise></xsl:choose>";
				var choose_expr_statement = "<xsl:choose><xsl:when expr=\"{0}\"><img src=\"img/iSave.gif\" class=\"icon\" /></xsl:when><xsl:otherwise><img src=\"img/iClose.gif\" class=\"icon\" /></xsl:otherwise></xsl:choose>";
				x+= "<div class=\"edit_form_row\">"
				x+=		"<span style=\"margin-right:10px\">" + Insert(("Unlisted[.='true' or .='True' or .='TRUE']"), choose_test_statement) +"</span>";
				x+=		text('EDIT/AD/DELIST') +"</div>";
				
//				x+= "<div class=\"edit_form_row\">";
//				x+=		"<span style=\"margin-right:10px\">" + Insert(("context(0)/XMLClientCookie/"+CLIENT_COOKIE_ToolbarOnTop+"[.='true' or .='True' or .='TRUE']"), choose_test_statement) +"</span>";
//				x+= 	text('EDIT/AD/TOOL') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("context(0)/XMLClientCookie/"+CLIENT_COOKIE_ExpandUserButtons+"[.='true' or .='True' or .='TRUE']"), choose_test_statement) +"</span>";
				x+= 	text('EDIT/AD/UB') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_PromptToAddIdentifiedCaller+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/CON_PRMPT') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("context(0)/XMLClientCookie/"+CLIENT_COOKIE_SynchReminder+"[.='true' or .='True' or .='TRUE']"), choose_test_statement) +"</span>";
				x+= 	text('EDIT/AD/REMIND') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_UsingSharedDevice+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/SHARED') +"</div>";
				
//				x+= "<div class=\"edit_form_row\">";
//				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_RoutingEnabled+")"), choose_expr_statement) +"</span>";
//				x+= 	text('EDIT/AD/ENARR') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_PositiveCallerID+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/POSID') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_IncludeAccountsInPhoneClientSearch+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/INC_ACT') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_ASRConfirmationPrompts+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/ASR') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_PhoneClientAutoLogon+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/PCA') +"</div>";
				
				x+= "<div class=\"edit_form_row\">";
				x+=		"<span style=\"margin-right:10px\">" + Insert(("checkFlagsBit(this, "+ACCOUNT_FLAGS_AutoSave+")"), choose_expr_statement) +"</span>";
				x+= 	text('EDIT/AD/AUTOSAVE') +"</div>";				
				
				x+= "<div class=\"edit_form_row\"><span class=\"edit_form_bold\">";
				x+= 	"<xsl:value-of select=\"context(0)/WAPBridgeCallDelay\" /></span> "+text('EDIT/AD/WAP')+"</div>";
				x+= "<div class=\"edit_form_row\"><span class=\"edit_form_bold\">";
				x+= 	"<xsl:value-of select=\"context(0)/TimeZone//Display\" /></span> "+text('EDIT/AD/TZ')+"</div>";
			}
			else
			{
				x+= "<span style=\"width:90%;padding-left:10px;\">";
				
				var ar_ID_TEXT_ELEMENTS = new Array(), i=0;
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editUnlisted', 							text('EDIT/AD/DELIST'));
//				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editToolbarOnTop', 						text('EDIT/AD/TOOL'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editExpandUserButtons', 					text('EDIT/AD/UB'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editPromptToAddIdentifiedCaller', 			text('EDIT/AD/CON_PRMPT'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editSynchReminder', 						text('EDIT/AD/REMIND'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editUsingSharedDevice', 					text('EDIT/AD/SHARED'));
//				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editRoutingEnabled', 						text('EDIT/AD/ENARR'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editPositiveCallerID', 					text('EDIT/AD/POSID'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editIncludeAccountsInPhoneClientSearch', 	text('EDIT/AD/INC_ACT'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editASRConfirmationPrompts', 				text('EDIT/AD/ASR'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editPhoneClientAutoLogon', 				text('EDIT/AD/PCA'));
				ar_ID_TEXT_ELEMENTS[ar_ID_TEXT_ELEMENTS.length] = new Array('editAutoSave', 				text('EDIT/AD/AUTOSAVE'));

				var ROW_TEMPLATE = "<div><input type=\"checkbox\" id=\"{0}\" /><label for=\"{0}\">{1}</label></div>";
				while (ar_ID_TEXT_ELEMENTS[i])
					x+=  InsertMultiple(ar_ID_TEXT_ELEMENTS[i++], ROW_TEMPLATE);

				x+= 	"<div> "+GetDisplayElement("WAPBridgeCallDelay", oDataObj)+""+text('EDIT/AD/WAP')+"</div>";
				x+= 	"<div><select id=\"editTimeZone\" style=\"font-size:10px\"><xsl:for-each select=\"/R/TIMEZONES/String\"><option><xsl:value-of select=\".\"/></option></xsl:for-each></select><br/>"+text('EDIT/AD/TZ')+"</div>";
			}
			x+= "</span>";
		}
	
		x+= 	BuildInput('hidden', 'editID');
		x+= 	BuildInput('hidden', 'editObject', 	((oDataObj.getAttribute('isContact')=='true')?'AB':'PI'));
		x+= 	BuildInput('hidden', 'editType', 	((oDataObj.getAttribute('readOnly')=='1')?'edit':'add'));
		x+= 	BuildInput('hidden', 'editMode');
		break;
	}
	return x+="</form>";
}

function GetDisplayElement(sPropName, oDataObj)
{
	var bIsContact 	= eval(oDataObj.getAttribute('isContact'));
	var bReadOnly 	= eval(oDataObj.getAttribute('readOnly'));
	if (bReadOnly)
	{
		switch (sPropName)
		{
			case 'Emails':
				return "<span style=\"font-weight:bold;color:#666\"><xsl:for-each select=\"Emails/LIST//String\"><xsl:eval>formatStringLength(this)</xsl:eval><br /></xsl:for-each></span>";
				
			case 'WorkNumber1':
			case 'WorkNumber2':
			case 'WorkMobileNumber':
			case 'WorkFaxNumber':
			case 'WorkPagerNumber':
			case 'WorkIPPhone':
			case 'HomeNumber1':
			case 'HomeNumber2':
			case 'HomeMobileNumber':
			case 'HomeFaxNumber':
			case 'HomePagerNumber':
			case 'HomeIPPhone':
				return "<span style=\"font-weight:bold;color:#666;\"><xsl:eval>removeNodePrefix(this, '"+ sPropName +"', this)</xsl:eval></span>";
				
			case 'WorkAddress':
			case 'HomeAddress':
			case 'WorkWebPage':
			case 'HomeWebPage':
			case 'Notes':
				return "<span style=\"font-weight:bold;color:#666;\"><xsl:for-each select=\""+ sPropName +"[0]\"><xsl:eval>formatStringLength(this)</xsl:eval></xsl:for-each></span>";
				
			default: 
				return "<span style=\"font-weight:bold;color:#666;\"><xsl:value-of select=\""+ sPropName +"\" /></span>";
		}
				
	}
	switch (sPropName)
	{
		case 'FirstName':
		case 'LastName':
		case 'Company':
		case 'Title':
		case 'Department':
			return BuildXSLInput('text', 'edit'+sPropName, sPropName, '15', INPUT_LIMIT_64);
		
		case 'MiddleName':
			return BuildXSLInput('text', 'edit'+sPropName, sPropName, '10', INPUT_LIMIT_64);
		
		case 'WAPBridgeCallDelay':
			return BuildXSLInput('text', 'edit'+sPropName, sPropName, '5', INPUT_LIMIT_64);
		
		case 'WorkNumber1':
		case 'WorkNumber2':
		case 'WorkMobileNumber':
		case 'WorkFaxNumber':
		case 'WorkPagerNumber':
		case 'WorkIPPhone':
		case 'HomeNumber1':
		case 'HomeNumber2':
		case 'HomeMobileNumber':
		case 'HomeFaxNumber':
		case 'HomePagerNumber':
		case 'HomeIPPhone':	
			return BuildPhoneInput('edit'+sPropName, sPropName);
		
		case 'WorkWebPage':
		case 'HomeWebPage':
			return BuildXSLInput('text', 'edit'+sPropName, sPropName, '40', INPUT_LIMIT_2048);
		
		case 'Emails':
			return BuildXSLEmailEdit('edit');
		
		case 'Notes':
		case 'WorkAddress':
		case 'HomeAddress':
			return BuildXSLTextarea('edit'+sPropName, sPropName, 40, 3, INPUT_LIMIT_4096);
	}
}

var TYPE_BOOL = 1;
var TYPE_STRING = 2;
var TYPE_STRING_PHONE = 4;
var TYPE_STRING_MULTILINE = 5;
var TYPE_SELECTIONLIST = 6;
var TYPE_DROPDOWNLIST = 7;

// Form element limits
var INPUT_LIMIT_32 = "32";
var INPUT_LIMIT_64 = "64";
var INPUT_LIMIT_256 = "256";
var INPUT_LIMIT_2048 = "2048";
var INPUT_LIMIT_4096 = "4096";

function GetNodeConversionStyle(sID, param1)
{
	var x="<?xml version=\"1.0\"?><xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">";
	switch(sID)
	{
		case "TIME_ZONE_INFO_SORT":
			x+= "<xsl:template match=\"/\">";
			x+= 	"<xsl:element name=\"TIMEZONES\">";
			x+=			"<xsl:apply-templates select=\"R/TIMEZONES/*\" order-by=\"+.\">";
			x+= 			"<xsl:template>";
			x+= 				"<xsl:copy><xsl:apply-templates select=\"node() | text()\"/></xsl:copy>";
			x+= 			"</xsl:template>";
			x+=			"</xsl:apply-templates>";
			x+= 	"</xsl:element>";
			x+= "</xsl:template>";
			break;
	}
	x+= "</xsl:stylesheet>";
	return x;
}

