// Dependencies: RESX

var personaArr = [[g_MqRef.RESX['SOFTWARE_MANAGER'], 'jdavis.jpg',
						g_MqRef.RESX['SOFTWARE_MANAGER_TOOLTIP'], 
						'dambler', '',''], 
						
						[g_MqRef.RESX['EMPLOYEE'], 'employee.jpg', 
						g_MqRef.RESX['EMPLOYEE_TOOLTIP'], 
						'employee', '',''],
						
						[g_MqRef.RESX['IT_ASSET_MANAGER'], 'procurement.jpg', 
						g_MqRef.RESX['IT_ASSET_MANAGER_TOOLTIP'], 
						'dnathan', '',''],
						
						[g_MqRef.RESX['IT_MANAGER'], 'itmanager.jpg', 
						g_MqRef.RESX['IT_MANAGER_TOOLTIP2'], 
						'itmanager', '',''],
						
						[g_MqRef.RESX['HELPDESK_ANALYST'], 'analyst.jpg',
						g_MqRef.RESX['HELPDESK_ANALYST_TOOLTIP'], 
						'analyst', '',''], 
						
						[g_MqRef.RESX['HR_MANAGER'], 'mrosen.jpg',
						g_MqRef.RESX['HR_MANAGER_TOOLTIP'], 
						'mrosen', '',''], 
						
						/*[g_MqRef.RESX['RELEASE_MANAGER'], 'mrosen.jpg',
						g_MqRef.RESX['RELEASE_MANAGER_TOOLTIP'], 
						'chubbard', '',''], */
						
						[g_MqRef.RESX['VIZOR_ADMIN'], 'admintools.jpg', 
						g_MqRef.RESX['VIZOR_ADMIN_TOOLTIP'], 
						'admin', 'admin','']];

var blnCanChangeTheme=true;


function PersonaLogonsMgr(docHTML, personaArr, sInstanceName, callerRef)
{

	var _me=this;
		
	var PERSONA_NAME = 0;
	var PERSONA_IMAGE = 1;
	var PERSONA_TOOLTIP = 2;
	var PERSONA_USERNAME = 3;
	var PERSONA_PASS = 4;
	
	var m_docHTML=docHTML;
	var m_personaArr =personaArr ;
	var m_sInstanceName =sInstanceName;
	var m_callerRef=callerRef;
	
	function WriteMenu()
	{
		var loginScreen = m_docHTML.getElementById('loginScreen');
		var divEvalContent = m_docHTML.getElementById('EvalContent');
		
		var imgDir = "Theme/images/images/";
		var i;
		var x = 0;
		
		var evalHTML = "";
		
		if(loginScreen){
			loginScreen.style.top = '38%';
		}
			
		evalHTML += g_MqRef.RESX['EVAL_INSTRUCTION'];
		
								
		evalHTML += '<center><table id="personas" cellspacing="0" cellpadding="0"><tr>';
		
		for (i = 0; i<m_personaArr.length; i++)
		{
			x=i+1;
			if (m_personaArr[i][PERSONA_NAME] == g_MqRef.RESX['VIZOR_ADMIN'])
			{
				evalHTML += '<td><div class="personaLinks" id="' + x + 
						'" onclick="window.open(\'http://\'+window.location.host+\'/connectadmin/?al=1\', \'_blank\', \'height=750, width=1000, resizable=1\')"><span class="linkTooltips">'
						+ personaArr[i][PERSONA_TOOLTIP] + '</span><div class="imageDiv"><img src="' + imgDir + personaArr[i][PERSONA_IMAGE] + '" /></div><br />' 
						+ personaArr[i][PERSONA_NAME]+'</div></td>';
			}
			else
			{
				evalHTML += '<td><div class="personaLinks" id="' + x + '" onclick="document.location.href=\'javascript:void(' + m_sInstanceName + '.Login(' + x 
						+ '));\'"><span class="linkTooltips">' + personaArr[i][PERSONA_TOOLTIP] + '</span><div class="imageDiv"><img src="' + imgDir + personaArr[i][PERSONA_IMAGE] 
						+ '" /></div><br />' + personaArr[i][PERSONA_NAME]+'</div></td>';
			}
		}

		
		evalHTML += '</tr></table></center>';
		if(divEvalContent)
		{
			$('#EvalContent').html(evalHTML.toString());
		}	
	}
	
	function Login(objId)
	{
		
		var i;
		var varfrmLogon = m_docHTML.Logon;
		if (objId)
		{
			for (i=1; i<=personaArr.length; i++)
			{
				if (objId == i)
				{
					varfrmLogon.UserName.value = personaArr[i-1][PERSONA_USERNAME];
					varfrmLogon.Password.value = personaArr[i-1][PERSONA_PASS];
					if(m_callerRef){
						m_callerRef.logOn();
					}
				}
			}
		}
	}

	_me.WriteMenu=WriteMenu;
	_me.Login=Login;

}