<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"/>
<!--meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=8,9,10" -->

<%@ taglib prefix = "egui" uri = "WEB-INF/eg-taglib.tld"%>
<%@ include file="admin/EgTrackerA.jsp" %>
<%@ page import = "com.egurkha.UserRegistry"%>
<%@ page import = "com.egurkha.EgUserRole"%>
<%@ page import = "com.egurkha.EgUserPermission"%>
<%@ page import = "com.eg.EgMemCheck"%>
<%@ page import = "com.eg.EgInstallInfo"%>
<%@ page import = "com.eg.EgCrypt"%>
<%@ page import = "com.eg.EgSpecsInfo"%>
<%@ page import = "com.egurkha.ini.*"%>
<%@ page import = "com.egurkha.User"%>
<%@ page import = "com.egurkha.EgConstants"%>
<%@ page import = "com.egurkha.util.StringUtils"%>
<%@ page import = "java.util.Vector"%>
<%@ page import = "com.eg.EgDateInfo" %>
<%@ page import = "com.eg.EgConfigConstants"%>
<%@ page import = "com.eg.EgServicesInfo"%>
<%@ page import="com.eg.IniFile"%>
<%@ page import = "java.util.Date"%>
<%@ page import = "com.eg.EgDateInfo"%>
<%@ page import = "java.util.Calendar"%>
<%@ page import = "java.util.TimeZone"%>
<%@ page import="com.eg.EgTopoInfo"%>
<%@ page import="com.eg.EgManagersIniForManager"%>
<%@ page import = "com.eg.EgURLEncoder"%>
<%@ page import = "com.eg.EgConfigInfo" %>
<%@ page import = "com.eg.EgDiscInfo" %>
<%@ page import = "com.eg.EgAggregateInfo" %>
<%@ page import = "com.egurkha.monitor.EgServiceMappingBean"%>
<%@ page import = "com.eg.EgDbAdapterTypeUI"%>
<%@ page import = "egurkha.EgDbAdapterUI"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import = "java.sql.*"%>
<%@ page import = "com.eg.EgUsersInfo"%>
<%@ page import = "com.eg.EgSms"%>
<%@ page import = "com.eg.EgManagersInfo"%>
<%@ page import = "com.egurkha.EgTimeZoneConverter"%>
<%@ page import = "com.egurkha.monitor.OneClickDashboardModel"%>
<%@ page import = "com.egurkha.monitor.MonitorUtility"%>
<%@ page import = "egurkha.reporter.ErUserData"%>
<%@ page import = "com.eg.EgUuidInfo"%>
<%@ page import = "java.io.*"%>
<%@ page import ="egurkha.config.EcUtils"%>
<%@ page import ="com.eg.EgConfigFilesSync"%>
<%@ page import ="com.eg.EgDbInfo"%>
<%@ page import = "com.egurkha.admin.mfa.GoogleAuthenticator"%>
<%@ page import = "com.egurkha.UserInfo"%>

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<jsp:useBean id = "configmsg" scope = "page" class = "egurkha.TransactionBean"/>

<%!
	boolean noManagersConfigured = false;
	EgSpecsInfo specsinfo=new EgSpecsInfo("manager");
	EgCrypt crypt=new EgCrypt();
	public boolean isValidDomainUser(String l_user)
	{
		l_user = StringUtils.replace(l_user,"\\","/");
		IniFile iniFile=new IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_authenticate.ini");
		if (iniFile != null && l_user != null && l_user.indexOf("/") != -1)
		{
			l_user = l_user.substring(0,l_user.indexOf("/")).trim();
			String subjs[]=iniFile.getSubjects();
			if (subjs!=null && subjs.length>0)
			{
				for (int i=0;i<subjs.length ; i++)
				{
					String domainDisName = subjs[i];
					if (domainDisName != null && domainDisName.equalsIgnoreCase(l_user))
					{
						return true;
					}
				}
			}
		}
		return false;
	}
	public boolean isCheckPermission(String url_l,EgUserRole userRole)
	{
	     String s_resUri=url_l; 
	     String s_resQryStr = "";
	     int idx = s_resUri.indexOf('?');
	     if(idx!=-1)
             {
	     	s_resQryStr = s_resUri.substring(idx + 1);
	     	s_resUri = s_resUri.substring(0,idx);
	     }
	     EgUserPermission userPerm = EgUserPermission.getInstance();
	     boolean accesscontrol=userPerm.checkPermission(s_resUri,s_resQryStr,userRole);
	     return accesscontrol;
	}
	
%>

<%
	response.setHeader("Cache-Control", "no-store");
	response.setHeader("Pragma", "no-cache");
	response.setDateHeader("Expires", -1); 
	String remoteurl="";
	String searchVals = "";

	String fwdTo = (String)session.getAttribute("fwdTo");
	if (!StringUtils.isNull(fwdTo))
	{
%>
		<jsp:forward page = "login.jsp"/>
<%
	}

    String globalSearchLastSessionURL = (String) session.getAttribute("globalSearchLastSessionURL");
 	String  selectedSkin="admin";
	String selectedTabTheme = "";
	EgServicesInfo serviceInfo = new EgServicesInfo("manager");
	UserRegistry ur = UserRegistry.getInstance();
	String hostip=_user.getUserIP(sessionID);
	User user = ur.getUser(sessionID);

	String queryString =  EcUtils.prepareQueryString(request.getParameterMap());
	if (StringUtils.isNull(queryString))
	{
		queryString = (String) session.getAttribute("loginQueryStr");
	}

	String mainEntryStr = (String) session.getAttribute("egEntryMain");
	String egEntryChild = (String) session.getAttribute("egEntryChild");

	String newWindow=request.getParameter("newwindow");
	if (StringUtils.isNull(newWindow))
	{
		newWindow = (String) session.getAttribute("newWindow");
	}
	String entry   = request.getParameter("entry");
	if (StringUtils.isNull(entry))
	{
		entry = (String) session.getAttribute("entry");
		session.removeAttribute("entry");
	}

	session.removeAttribute("threadSession");
	String quickLinksClicked = request.getParameter("quickLinksClicked");
	if (StringUtils.isNull(quickLinksClicked))
	{
		quickLinksClicked = (String) session.getAttribute("quickLinksClicked");
		session.removeAttribute("quickLinksClicked");
		if (StringUtils.isNull(quickLinksClicked))
		{
			quickLinksClicked = "false";
		}
	}

	String isConfigGlobalSearch = request.getParameter("isConfigGlobalSearch");
	isConfigGlobalSearch=(isConfigGlobalSearch!=null && isConfigGlobalSearch.equals("true"))?"true":"false";

	if (!StringUtils.isNull(mainEntryStr))
	{
		if (StringUtils.isNull(newWindow) && quickLinksClicked.equals("false") && isConfigGlobalSearch.equals("false"))
		{
			entry = mainEntryStr;

			int qsInd = queryString.indexOf("&");
			String subQueryString = queryString.substring(0, qsInd);
			if (subQueryString != null)
			{
				queryString = queryString.replace(subQueryString,"entry="+mainEntryStr);
			}
		}
	}

	configmsg.createFile("eg_services.ini");

	boolean isAdmin   = entry.equalsIgnoreCase("admin");
	boolean isMonitor = entry.equalsIgnoreCase("monitor");
	boolean isReport  = entry.equalsIgnoreCase("reporter");
	boolean isConfig  = entry.equalsIgnoreCase("config");
	boolean isSla	= entry.equalsIgnoreCase("sla");
	boolean login_as_egsm_in_sm = false;
	boolean hiddenUserProfile=false;
	boolean isPrefixConfigurable=true;
	String strFooterText="&copy;&nbsp;eG Innovations, Inc&#46; All Rights Reserved - v ";
	String strPrefix = configmsg.getStrValue("MISC_ARGS","ManagerPrefixTitle");
	if (strPrefix == null || strPrefix.equals(""))
	{
		isPrefixConfigurable = false;
		strPrefix = "eG ";
	}
	String themeIco="eg.ico";
	String showAdminHelpPageForSm="no";
	IniUI ui = IniUI.getInstance();	

	String thisLanguage =ui.getDefaultLanguage();
	if (user!=null)
	{
		String userLang = user.getLanguage();
		if (userLang!=null && !userLang.equalsIgnoreCase("NULL"))
		{
			thisLanguage=userLang;
		}
	}
	EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);
	boolean isEnableSLA = ui.isSLAEnabled();	
	if(EgInstallInfo.isSuperManager)
	{
		if(user.getLoginID().equals("egsm"))
		{
			login_as_egsm_in_sm = true;
		}
		else
		{
			hiddenUserProfile=true;
		}
	}
	if(EgInstallInfo.isSuperManager)
	{
		if(login_as_egsm_in_sm)
		{
			if(entry.equals("admin"))
			{
				selectedSkin="admin";
			}
			else if(entry.equals("monitor"))
			{
				selectedSkin="monitor";
			}
		}
		else if(isAdmin)
		{
			selectedSkin="monitor";
		}
		else if (isMonitor)
		{
			selectedSkin="monitor";
		}
		else if (isConfig)
		{
			selectedSkin="configindex";
		}
		else if(isReport)
		{
			selectedSkin="reporter";
		}	
		else if(isSla && isEnableSLA)
		{
			selectedSkin="sla";
		}		
	}
	else if(isAdmin)
	{
		selectedSkin="admin";
	}
	else if(isMonitor)
	{
		selectedSkin="monitor";
	}	
	else if(isReport)
	{
		selectedSkin="reporter";
	}	
	else if(isConfig)
	{
		selectedSkin="configindex";
	}	
	else if(isSla && isEnableSLA)
	{
		selectedSkin="slaindex";
	}
	if(entry.equalsIgnoreCase("admin"))
	{
		selectedTabTheme = user.getAdminSkin();
	}
	else if(entry.equalsIgnoreCase("monitor"))
	{
		selectedTabTheme = user.getMonitorSkin();
	}
	else if(entry.equalsIgnoreCase("reporter"))
	{
		selectedTabTheme = user.getReporterSkin();
	}
	else if(entry.equalsIgnoreCase("config"))
	{
		selectedTabTheme = user.getConfigSkin();
	}	
	else if(entry.equalsIgnoreCase("sla") && isEnableSLA)
	{
		selectedTabTheme = user.getConfigSkin();
	}	
	if(globalSearchLastSessionURL != null )
	 {
		remoteurl=globalSearchLastSessionURL;
	}
	long searchRefFrequency = 60 * 1000L;
	String refFreq = user.getRefreshFrequency();
	if(refFreq!=null && refFreq.length()>0)
	{
		searchRefFrequency =  Long.valueOf(refFreq).longValue() * 1000L;
	}
	boolean show_user_profile=true;
	if(EgInstallInfo.isSuperManager)
	{
		show_user_profile=false;
		if(login_as_egsm_in_sm)
		{
			show_user_profile=true;
		}
	}
	IniFile citrixDashCloudIni=new IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_XenUserDetails.ini");
	String strCitrixCloudDash = citrixDashCloudIni.getValue("XEN_USER_SETTINGS","EnableXenKPIThread");
	boolean isCitrixCloudDash=false;
	if(strCitrixCloudDash!=null && (strCitrixCloudDash.equalsIgnoreCase("true") || strCitrixCloudDash.equalsIgnoreCase("yes")))
		isCitrixCloudDash=true;

	String action = request.getParameter("action");
	IniFile searchDetailsIni=new IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_searchDetails.ini");
	String selectedSearchCombo = searchDetailsIni.getValue("Search_Default_Selection","default");
	String  globalSearchLastSessionval= (String) session.getAttribute("globalSearchLastSessionval");
	String searchType = "";
	String searchValue = "";
	if ( globalSearchLastSessionval != null && action == null )
	{
		searchVals=globalSearchLastSessionval;
		if(searchVals!=null && searchVals.indexOf(" ")>0)
		{
			searchType = searchVals.substring(0,searchVals.indexOf(" "));
			searchValue = searchVals.substring(searchVals.indexOf(" ")+1);
		}		
		searchValue=com.egurkha.util.StringUtils.replace(searchValue,"|hash|","#");
		searchValue=com.egurkha.util.StringUtils.replace(searchValue,"|quots|","'");
	 }  
	 	
	 String tabchanging="true";
	 String testing = (String) session.getAttribute("testing");	
	 if(testing != null && testing.equalsIgnoreCase("false"))
	 {
		 tabchanging="false";
	 }
	 String hasNotificationWindow = (String)session.getAttribute("hasNotificationWindow");
	 if (hasNotificationWindow == null || hasNotificationWindow.length() == 0)
	 {
		hasNotificationWindow = "yes";
	 }
	
	if(ui.isHKTThemeEnabled())
	{
		String hktThemeTitle = ui.getHKTThemeTitle();
		themeIco = ui.getHKTThemeICO();
		if(!StringUtils.isNull(hktThemeTitle))
		{
			strPrefix=hktThemeTitle;
		}
		if(StringUtils.isNull(strPrefix))
		{
			strPrefix="xMonPlus";
		}
		if(StringUtils.isNull(themeIco))
		{
			themeIco="eg.ico";
		}
	}

	String strInternetAvailable = (String) session.getAttribute("isInternetAvailable");

	EgMemCheck memCheck = new EgMemCheck();

	 if(entry.equals("config")||entry.equals("configindex"))
	{
		String tempconfigSkin=user.getConfigSkin();
%>
	<link rel="stylesheet" href="/final/resources/css/ext-eg.css"/>
	<link rel="stylesheet" href="/final/styles/eG<%=tempconfigSkin%>ThemeIcons.css"/>
	<link rel="stylesheet" href="/final/styles/eG<%=tempconfigSkin%>Theme.css"/>	
<%
	}
%>

<link rel="stylesheet" href="/final/styles/index<%=selectedTabTheme%>.css"/>
<jsp:useBean id="esmb" scope="page" class="com.egurkha.monitor.EgServiceMappingBean" />
<link rel="shortcut icon" href="/final/<%=themeIco%>">
<style type="text/css">
	/*
	.notificationsIndex {
		background : url('/final/images/notifications.png') no-repeat top left;
		width: 16px; 
		height: 16px;
	}
	*/
	.custom-mb-info {
		background-image: url('/final/resources/themes/images/default/shared/icon-info.gif');
		width: 50px;
		height: 35px;
		background-repeat : no-repeat;
	}
	.normal {text-transform: none; !important;}
</style>

<egui:skin ui = "<%=selectedSkin%>"/>

<base target = "main">
<script>
	var topoGroupSaveSeg = "";
	var topoGroupSaveSer = "";
	var onlyVm = <%=user.isOnlyVMAssigned()%>;
	var isPrefixConfigurable = <%=isPrefixConfigurable%>;
	var csrfToken = '<%=strCsrfToken%>';
	var mainPage = 'mainPage';
    var searchRes = '';
	var searchvalues='';
	var isConfigGlobalSearch = '<%=isConfigGlobalSearch%>';
	var serviceSearchval='<%=searchVals%>';
	var segmentSearchval='<%=searchVals%>';
	var zoneSearchval='<%=searchVals%>';
	var serverSearchval= '<%=searchVals%>';
   	var segmenttreeOpenval=false;
	var zonetreeOpenval=false;
	var serverstreeOpenval=false;
	var servicetreeOpenval=false;
	var globalsearch=false;
	var servertypeval='';
	var remoteurl= '<%=remoteurl%>';
	var searchType= '<%=searchType%>';
	var searchValue= "<%=searchValue%>";
	var selectedSearchCombo= '<%=selectedSearchCombo%>';
	var userSearchCombo=new Array();
	var testing= '<%=tabchanging%>';
	var egindex = null;
	var validSearchPrefix='<egui:intnl text="monitor.search.Please enter search criteria or use" />';
	var searchLbl='<egui:intnl text="monitor.services.Search" />';
	var alertlbl='<egui:intnl text="monitor.search.Alert" />';
	var searchLbl='<egui:intnl text="monitor.common.Search" />';

	var subjectLbl='<egui:intnl text="admin.settings.Subject" />';
	var requesterLbl='<egui:intnl text="monitor.common.Requester" />';
	var searchUserLbl='<egui:intnl text="monitor.common.Search User" />';
	var switchLbl='<egui:intnl text="monitor.common.SWITCH" />';
	var CCLbl='<egui:intnl text="reporter.common.CC" />';
	var regionLbl='<egui:intnl text="monitor.common.Region" />';
	var descriptionLbl='<egui:intnl text="monitor.common.Description" />';
	var browseLbl='<egui:intnl text="admin.common.Browse" />';
	var attachmentLbl='<egui:intnl text="monitor.common.Attachment" />';
	var loadingMsg='<egui:intnl text="admin.utility.Loading, please wait"/>';
	var ticketTypeLbl='<egui:intnl text="monitor.common.Ticket Type" />';
	var schReportLbl='<egui:intnl text="monitor.common.Schedule this Report" />';

	var noMeasure='<egui:intnl text="monitor.common.No Measures Available" />';
	var toolMinimize='<egui:intnl text="monitor.dashboard.Minimize" />';
	var bccNotAllowed='<egui:intnl text="admin.user.Bcc mail id is not allowed in DBL(Chinese,Korean,Japanese)" />';
	var toNotAllowed='<egui:intnl text="admin.user.To mail id is not allowed in DBL(Chinese,Korean,Japanese)" />';
	var validMobileNumber='<egui:intnl text="admin.user.Please enter valid Cc mail id and/or mobile number" />';
	var validEmailId='<egui:intnl text="admin.profile.Please enter valid Bcc mail id and/or mobile number" />';
	var ccNotAllowed='<egui:intnl text="admin.profile.Please enter valid Bcc mail id and/or mobile number" />';
	var validMailandMobileNo='<egui:intnl text="admin.user.Please enter valid To mail id and/or mobile number" />';
	var jsonDataArchive = '';
	var isAutoDiscRunning = false;
	var integrityCheckMsg1 = '<egui:intnl text="admin.user.An administrator has already logged in" />.';
	var integrityCheckMsg2 = '<egui:intnl text="admin.user.Do you wish to continue" />?';
	var integrityTitle = '<egui:intnl text="admin.user.NOTIFICATION" />';
	var percentage='<%= mappingInfo.getTextDescription("monitor.common.Percentage")%>';
	var errmsg='<%= mappingInfo.getTextDescription("monitor.endUserDashboard.No Records Found")%>';
	var checkforUpdateTitle = '<egui:intnl text="admin.utility.Check for Updates" />';
	var reportIncidentTitle = '<egui:intnl text="admin.utility.Report an Incident" />';
	var suggestaFeatureTitle = '<egui:intnl text="admin.utility.Suggest a Feature" />';
	var helpCenterTitle = '<egui:intnl text="admin.utility.Help Center" />';
	var utilitiesTitle = '<egui:intnl text="admin.utility.Technical Support" />';
	var userProfTitle = '<egui:intnl text="admin.common.USER PROFILE" />';
	var userIDTitle = '<egui:intnl text="admin.common.User ID" />';
	var selectedTabTheme='<%=selectedTabTheme%>';
	var searchRefFrequency=<%=searchRefFrequency%>;

	var scriptNameSetImage = null;
	var strInternetAvailable='<%=strInternetAvailable%>';
</script>
<%
try
{
	EgConfigInfo configInfo = new EgConfigInfo("manager");
	EgDiscInfo discInfo = new EgDiscInfo("manager");
	String servicesFileName = configInfo.getServicesFile ("manager");
	IniFile servicesFilePtr = new IniFile (servicesFileName);
	String s_showMonitorProfile = servicesFilePtr.getValue("MISC_ARGS","ShowMonitorProfile");	
	s_showMonitorProfile=(s_showMonitorProfile==null || s_showMonitorProfile.trim().length()==0)?"":s_showMonitorProfile;
	//String sessionID = session.getId();
	String integrity = request.getParameter("integritycheckviolated");
	if (StringUtils.isNull(integrity))
	{
		integrity = (String)session.getAttribute("integritycheckviolated");
	}
	String integrityMessage = "";
	
	boolean hideTrendTab = false;
	String trendFlag = servicesFilePtr.getValue("MISC_ARGS","DisableTrendComputation");
	if(trendFlag != null && trendFlag.trim().length() > 0 && (trendFlag.equalsIgnoreCase("true") || trendFlag.equalsIgnoreCase("yes")))
		hideTrendTab = true;

	user.setUserLanguageAndSkins();
	List serverTypeList = user.getServerTypes();
	List vmTypeList = user.getOnlyVMTypes();
	List vmServersList = user.getOnlyVMServers(false);
	String smartAlertValue=request.getParameter("smartAlertValue");
		//-------Print Current year : Vijay 8.1.2008-----------------
		int currYear = 0;

		Calendar cal = Calendar.getInstance();
		currYear = cal.get(cal.YEAR);
		//-------------------------Print Current year------------------
	//String managerIp=specsinfo.getEGServer();

	if(ui.isHKTThemeEnabled())
	{
		strFooterText = "&copy;&nbsp;"+ui.getHKTPDFFooterText()+"&nbsp;"+currYear+". All Rights Reserved - v ";
	}

	boolean isIE = true;
	String configHomePage = "/final/servlet/com.eg.EcConfigurationServletNew?cmd=Home";
	String userAgent = request.getHeader("USER-AGENT");
	if (userAgent==null) userAgent="";
	if (userAgent.indexOf("MSIE")==-1)
		isIE=false;
	boolean isChrome=true;
	if(userAgent.indexOf("Chrome")==-1)
	isChrome=false;
	//EgHelpParser egHelp = new EgHelpParser();
	String helpURL = "";
	String url="";
	boolean fromReportTemplate = false;
	String smartParam = request.getParameter("smartParam");
	String fromSm = request.getParameter("fromsuper");
	if(fromSm == null)
		fromSm = (String) session.getAttribute("fromSm");
	if(fromSm!=null && (fromSm.equals("yes") || fromSm.equals("home"))){
		newWindow="no";
	}
	String fromQuickLaunch = request.getParameter("fromQuickLaunchPage");
	if (StringUtils.isNull(fromQuickLaunch))
	{
		fromQuickLaunch = (String) session.getAttribute("fromQuickLaunchPage");
		session.removeAttribute("fromQuickLaunchPage");
	}
	if (fromQuickLaunch!=null && fromQuickLaunch.length()>0 && fromQuickLaunch.equals("yes"))
		newWindow="no";
	String access=request.getParameter("access");
	if (StringUtils.isNull(access))
	{
		access = (String) session.getAttribute("access");
		session.removeAttribute("access");
	}
	String accessPageName=request.getParameter("accessPageName");
	if (StringUtils.isNull(accessPageName))
	{
		accessPageName = (String) session.getAttribute("accessPageName");
		session.removeAttribute("accessPageName");
	}
	String analysisBy=request.getParameter("analysisBy");
	if (StringUtils.isNull(analysisBy))
	{
		analysisBy = (String) session.getAttribute("analysisBy");
		session.removeAttribute("analysisBy");
	}
	String analysis=request.getParameter("analysis");
	if (StringUtils.isNull(analysis))
	{
		analysis = (String) session.getAttribute("analysis");
		session.removeAttribute("analysis");
	}
	String compstate=request.getParameter("compstate");
	if (StringUtils.isNull(compstate))
	{
		compstate = (String) session.getAttribute("compstate");
		session.removeAttribute("compstate");
	}
	String startTimeUrl=request.getParameter("startTimeUrl");
	if (StringUtils.isNull(startTimeUrl))
	{
		startTimeUrl = (String) session.getAttribute("startTimeUrl");
		session.removeAttribute("startTimeUrl");
	}
	String endTimeUrl=request.getParameter("endTimeUrl");
	if (StringUtils.isNull(endTimeUrl))
	{
		endTimeUrl = (String) session.getAttribute("endTimeUrl");
		session.removeAttribute("endTimeUrl");
	}
	String showEventHistory=request.getParameter("showEventHistory");
	if (StringUtils.isNull(showEventHistory))
	{
		showEventHistory = (String) session.getAttribute("showEventHistory");
		session.removeAttribute("showEventHistory");
	}
	String alertTest=request.getParameter("alertTest");
	if (StringUtils.isNull(alertTest))
	{
		alertTest = (String) session.getAttribute("alertTest");
		session.removeAttribute("alertTest");
	}
	String compTypeList=request.getParameter("compTypeList");
	if (StringUtils.isNull(compTypeList))
	{
		compTypeList = (String) session.getAttribute("compTypeList");
		session.removeAttribute("compTypeList");
	}
	String layer=request.getParameter("layer");
	if (StringUtils.isNull(layer))
	{
		layer = (String) session.getAttribute("layer");
		session.removeAttribute("layer");
	}
	String pressed = request.getParameter("pressed");
	String fromPage = request.getParameter("fromPage");//modifed on 24/10/07 stalin to not allow to display the popup of alarm page when go through egNewWindowAlert
	String isDisableMydashboardPopout="false";
	String s_iniFile = EgInstallInfo.getInstallDir()+ "/manager/config/eg_customdashboard.ini";
	IniFile customDashboard = new IniFile(s_iniFile);
	String DisableMydashboardPopout=customDashboard.getValue("DASHBOARD_SETTINGS","DisableMydashboardPopout");
	if(DisableMydashboardPopout!=null && DisableMydashboardPopout.equalsIgnoreCase("no"))
		isDisableMydashboardPopout="true";

	if(layer==null)
	{
		layer="";
	}
	String test=request.getParameter("test");
	if (StringUtils.isNull(test))
	{
		test = (String) session.getAttribute("test");
		session.removeAttribute("test");
	}
	if(test==null)
	{
		test="";
	}
	String descriptor=request.getParameter("descriptor");
	if (StringUtils.isNull(descriptor))
	{
		descriptor = (String) session.getAttribute("descriptor");
		session.removeAttribute("descriptor");
	}
	if(descriptor==null)
	{
		descriptor="";
	}
	else if(descriptor!=null)
	{
		descriptor=descriptor.trim();
	}
	boolean isFromQuickLaunch= (fromQuickLaunch != null && fromQuickLaunch.equalsIgnoreCase("yes"));
	String displayTab = request.getParameter("displayTab");
	if (StringUtils.isNull(displayTab))
	{
		displayTab = (String) session.getAttribute("displayTab");
		session.removeAttribute("displayTab");
	}
	if (entry == null)
		throw new IllegalArgumentException("EgError: User access control specification not received");
	if(isFromQuickLaunch)
	{
		if(entry != null && entry.equalsIgnoreCase("reporter"))
		{
			ErUserData erdata = new ErUserData(user.getLoginID(),false);
			session.setAttribute("UBean",erdata);
		}
	}
	boolean javaVersion=crypt.checkJavaVersion();
	/** For zone map changes */
	boolean mapEnabled = false;
	IniFile uiIni = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_ui.ini");
	String currentDateFormat = uiIni.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");
	String showAlarmsInLightBox=uiIni.getValue("ALARMS","showAlarmsInLightBox");
	String showSlaAlertsPopup=uiIni.getValue("ALARMS","showSlaAlertsPopup");
	String mapLicense = uiIni.getValue("ZONE_MAP","mapEnabled");
	String isListView = uiIni.getValue("MONITOR_DASHBOARD","ListView");
	isListView=(isListView==null || isListView.trim().length()==0)?"Yes":isListView;

	String no_curr_alarms = uiIni.getValue("HIDE_ALARM_POPUP","no_curr_alarms");
	no_curr_alarms=(no_curr_alarms==null || no_curr_alarms.trim().length()==0)?"no":no_curr_alarms;

	
	mapEnabled = (mapLicense != null && mapLicense.equalsIgnoreCase("yes"));

	String strSapMenuEnable = uiIni.getValue("SAP","Enable_SAP_Menu");
	strSapMenuEnable=(strSapMenuEnable==null || strSapMenuEnable.trim().length()==0)?"False":strSapMenuEnable;

	boolean isSapMenuEnable = false;
	if(strSapMenuEnable!=null && strSapMenuEnable.trim().length()>0 && (strSapMenuEnable.equalsIgnoreCase("true") || strSapMenuEnable.equalsIgnoreCase("yes")))
	{
		isSapMenuEnable = true;
	}

	boolean isShowAlarmsInLightBox = false;
	boolean isShowSlaAlertsPopup = false;
	if(EgInstallInfo.isSuperManager)
	{
		Object firstTimeLogin = session.getAttribute("firstTimeLogin");
		if(firstTimeLogin == null)
		{
			session.setAttribute("firstTimeLogin","no");
		}
		noManagersConfigured = EgManagersInfo.getInstance().getConfiguredManagers().isEmpty();
		if(firstTimeLogin == null && entry.equalsIgnoreCase("monitor") && user.getLoginID().equals("egsm") && noManagersConfigured)
		{
			entry = "admin";
			showAdminHelpPageForSm="yes";
		}
		else if (entry .equalsIgnoreCase("admin") && !user.getLoginID().equals("egsm"))
			entry = "monitor";
	}
	boolean hasMeasuregraphEnabled  =isCheckPermission("/monitor/EgGraphGenerator.jsp",user.getUserRole());
	boolean hasSummarygraphEnabled=isCheckPermission("/monitor/EgBarGraphGenerator.jsp",user.getUserRole());
	boolean hasTrendgraphEnabled  =isCheckPermission("/monitor/EgTrendGraphGenerator.jsp",user.getUserRole());
	boolean hasLivegraphEnabled  =isCheckPermission("/monitor/livegraph/EgLiveGraphHome.jsp",user.getUserRole());
	boolean hasTransactionConfigEnabled=isCheckPermission("/monitor/EgAddMonTrans.jsp",user.getUserRole());
	boolean hasAlarmHistoryEnabled=isCheckPermission("/monitor/EgSiteInfraView.jsp?disphist=yes",user.getUserRole());
	boolean hasFeedbackEntryEnabled=isCheckPermission("/monitor/dispComponentFeedback.jsp",user.getUserRole());
	boolean hasFixHistoryEnabled=isCheckPermission("/monitor/dispComponentHistory.jsp",user.getUserRole());
	boolean hasDetailedDiagnosisEnabled=isCheckPermission("/monitor/EgDiagnosis.jsp",user.getUserRole());
	boolean hasQuickInsightEnabled=isCheckPermission("/monitor/qinsight/EgQInsightHome.jsp",user.getUserRole());
	boolean hasMyDashboardEnabled=isCheckPermission("/monitor/MyDashboard.jsp",user.getUserRole());
	
	String indexMegalink = uiIni.getValue("NAVIGATION_MENU_OPTIONS","EnableMegaMenu");
	String indexMenuLink = uiIni.getValue("NAVIGATION_MENU_OPTIONS","EnableMenuBar");
	boolean isIndexMegaLinkEnabled=true;
	boolean isIndexMenuLinkEnabled=true;
	if(indexMegalink!=null && indexMegalink.equalsIgnoreCase("yes"))
		isIndexMegaLinkEnabled = false;

	if(indexMenuLink!=null && indexMenuLink.equalsIgnoreCase("yes"))
		isIndexMenuLinkEnabled = false;

	String stateIcons = uiIni.getValue("STATE_ICONS","Default");
	
	if(isMonitor && (showAlarmsInLightBox!=null && showAlarmsInLightBox.equalsIgnoreCase("yes") ||  showAlarmsInLightBox.equalsIgnoreCase("true")))
	{
		isShowAlarmsInLightBox = true;
	}
	if(isSla  && isEnableSLA && (showSlaAlertsPopup!=null && showSlaAlertsPopup.equalsIgnoreCase("yes") ||  showSlaAlertsPopup.equalsIgnoreCase("true")))
	{
		isShowSlaAlertsPopup = true;
	}

	boolean isCustomDashboardEnabled=false;
	//if(!EgInstallInfo.isSuperManager)
	{
		String customDashboardFlag=uiIni.getValue("MULTISERVER_CUSTOM_DASHBOARD","ShowCustomDashboard");
		if(customDashboardFlag!=null && customDashboardFlag.equalsIgnoreCase("yes"))
			isCustomDashboardEnabled=true;
	}

	//********TvMode******
		String eGTVModeSelectedscreens = uiIni.getValue("eG_TVMode_selected_screens",user.getLoginID().toLowerCase());
		
		boolean isTVModeSelectedscreens=true;
	/*	if (!StringUtils.isNull(eGTVModeSelectedscreens) || user.getLoginID().equalsIgnoreCase("admin")|| user.getLoginID().equalsIgnoreCase("egsm"))
		{
			isTVModeSelectedscreens = false;
			if (StringUtils.isNull(eGTVModeSelectedscreens))
			{
				
				isTVModeSelectedscreens = true;
			}
		}*/
	//*******TvMode End****

	//User License changes
	EgUsersInfo usersInfo = new EgUsersInfo();
	boolean isUserBasedLicense = usersInfo.isUserBasedLicense();
	boolean isUsersLimitCrossed = false;
	boolean alertUserAbtUserCert = false;
	int currCrossing = 0;
	int windowInt = 7;
	String message = "";
	String message2 = "";
	if (isUserBasedLicense)
	{
		isUsersLimitCrossed = usersInfo.isUserViolationOccured();
		windowInt = usersInfo.getWindowValue();
		currCrossing = usersInfo.getNumberOfViolationForLast(windowInt);
		if (!isUsersLimitCrossed && currCrossing > 0)
		{
			alertUserAbtUserCert = true;
		}
		int noOfTotalAvail = usersInfo.getTotalNumberOfDays();
		if (noOfTotalAvail < windowInt)
			windowInt = noOfTotalAvail;
		message = usersInfo.getAlertMessage(windowInt,currCrossing);
		message2 = usersInfo.getAlertMessage2();
	}

	// For find Service Health enabled or disabled
	// By Saravanan.A on 28-2-2012
	String enableServiceHealth = uiIni.getValue("SERVICE_HEALTH","enable_services_health");
	enableServiceHealth=(enableServiceHealth==null || enableServiceHealth.trim().length()==0)?"false":enableServiceHealth.toLowerCase();

	boolean isEnableServiceHealth=false;
	if(enableServiceHealth!=null && (enableServiceHealth.equalsIgnoreCase("yes") || enableServiceHealth.equalsIgnoreCase("true")))
		isEnableServiceHealth=true;
	//---end--
	String installdir = EgInstallInfo.getInstallDir();

	IniFile seumINI = new IniFile(installdir+"/manager/config/eg_extmondash.ini");
	String enableSEUMDashboard = seumINI.getValue("USER_SETTINGS","EnableSEUMDashboard");
	enableSEUMDashboard=(enableSEUMDashboard==null || enableSEUMDashboard.trim().length()==0)?"false":enableSEUMDashboard.toLowerCase();

	boolean isEnableSEUMDashboard=false;
	if(enableSEUMDashboard!=null && (enableSEUMDashboard.equalsIgnoreCase("yes") || enableSEUMDashboard.equalsIgnoreCase("true")))
		isEnableSEUMDashboard=true;

	IniFile dashboardConfigINI = new IniFile(installdir+"/manager/config/eg_dashboardConfig.ini");
	String menuSupportStr="";
	Object [] menuSupports = dashboardConfigINI.getVariables("MENU_SUPPORT_TYPES");
	ArrayList menuList=new ArrayList();
	ArrayList citrixMenuList=new ArrayList();
	ArrayList vdiMenuList=new ArrayList();
	ArrayList citrixVdiMenuList=new ArrayList();

	if (menuSupports!=null)
	{
		if(serverTypeList!=null && serverTypeList.contains("Host_system"))
			serverTypeList.remove("Host_system");
		for (int i=0;i<menuSupports.length ;i++ )
		{
			String thisVar = (String)menuSupports[i];
			String comptypesIni = dashboardConfigINI.getValue("MENU_SUPPORT_TYPES",thisVar);
			StringTokenizer st = new StringTokenizer(comptypesIni,",");
			if(thisVar.trim().equalsIgnoreCase("Simulations"))
			{
				int count = 0;
				while(st.hasMoreTokens())
				{
					String type = st.nextToken();
					if(type!=null)
					{
						type = type.trim();
						if(serverTypeList!=null && serverTypeList.contains(type))
						{
							count++;
							break;
						}

					}
				}

				if(serverTypeList.size()>count && count>0 && isEnableSEUMDashboard)
				{
					menuSupportStr=menuSupportStr+",Synthetic Monitoring";
				}
				else 
				{
					if(count>0 && (isEnableSEUMDashboard || !isEnableSEUMDashboard))
						menuSupportStr=menuSupportStr+","+thisVar;
				}
			}
			else
			{
				while(st.hasMoreTokens())
				{
					String type = st.nextToken();
					if(type!=null)
					{
						type = type.trim();
						if(serverTypeList!=null && serverTypeList.contains(type))
						{
							if(thisVar.trim().startsWith("VDI->"))
							{
								vdiMenuList.add(thisVar);
							}
							if(thisVar.trim().startsWith("Citrix/VDI->"))
							{
								citrixVdiMenuList.add(thisVar);
							}
							if(thisVar.trim().startsWith("Citrix->"))
							{
								citrixMenuList.add(thisVar);
							}
							if(thisVar.indexOf("->")>-1)
							{
								String tMenu=thisVar.substring(0,thisVar.indexOf("->"));
								String sMenu=thisVar.substring(thisVar.indexOf("->")+2);
								if((menuList.size()==0)||(menuList.size()>0 && !menuList.contains(sMenu)))
								{
									menuList.add(sMenu);
									menuSupportStr=menuSupportStr+","+sMenu;
								}
								if(!tMenu.trim().equalsIgnoreCase("Citrix/VDI") && !tMenu.trim().equalsIgnoreCase("Citrix") 
									&& !tMenu.trim().equalsIgnoreCase("VDI"))
								{
									if((menuList.size()==0)||(menuList.size()>0 && !menuList.contains(tMenu)))
									{
										menuList.add(tMenu);
										menuSupportStr=menuSupportStr+","+tMenu;
									}
								}
							}
							else
							{
								menuSupportStr=menuSupportStr+","+thisVar;
							}
							break;
						}
						else if((user.isOnlyVMAssigned()  || user.isVMAssigned()) && user.getOnlyVMs().size()>0 && vmTypeList!=null && vmTypeList.contains(type))
						{
							if(thisVar.trim().startsWith("VDI->"))
							{
								vdiMenuList.add(thisVar);
							}
							if(thisVar.trim().startsWith("Citrix/VDI->"))
							{
								citrixVdiMenuList.add(thisVar);
							}
							if(thisVar.trim().startsWith("Citrix->"))
							{
								citrixMenuList.add(thisVar);
							}
							if(thisVar.indexOf("->")>-1)
							{
								String tMenu=thisVar.substring(0,thisVar.indexOf("->"));
								String sMenu=thisVar.substring(thisVar.indexOf("->")+2);
								if((menuList.size()==0 && !sMenu.equals("Virtual Desktops")) || (menuList.size()>0 && !menuList.contains(sMenu) && !sMenu.equals("Virtual Desktops")))
								{
									menuList.add(sMenu);
									menuSupportStr=menuSupportStr+","+sMenu;
								}
								if(!tMenu.trim().equalsIgnoreCase("Citrix/VDI") && !tMenu.trim().equalsIgnoreCase("Citrix") 
									&& !tMenu.trim().equalsIgnoreCase("VDI"))
								{
									if((menuList.size()==0)||(menuList.size()>0 && !menuList.contains(tMenu)))
									{
										menuList.add(tMenu);
										menuSupportStr=menuSupportStr+","+tMenu;
									}
								}
							}
							else
							{
								menuSupportStr=menuSupportStr+","+thisVar;
							}
							break;
						}
					}
				}
			}
		}
		
		if((citrixMenuList.size()>0 && vdiMenuList.size()>0) || (citrixMenuList.size()==0 && vdiMenuList.size()==0 && citrixVdiMenuList.size()>0))
			menuSupportStr=menuSupportStr+",Citrix/VDI";
		else if(citrixMenuList.size()==0 && vdiMenuList.size()>0)
			menuSupportStr=menuSupportStr+",VDI";
		else if(citrixMenuList.size()>0 && vdiMenuList.size()==0)
			menuSupportStr=menuSupportStr+",Citrix";
		if(user != null)
		{
			List services = user.getServices();
			List sites = user.getSites();
			List serGroups = user.getServiceGroups();
			List zonemap = user.getZones();
			
			if((services!=null && services.size()>0) || (sites!=null && sites.size()>0))
			{
				menuSupportStr=menuSupportStr+",Business";
			}
			if(serGroups!=null && serGroups.size()>0)
			{
				menuSupportStr=menuSupportStr+",Service Groups";
			}
			if(zonemap!=null && zonemap.size()>0)
			{
				menuSupportStr=menuSupportStr+",Zones Map";
			}
		}
		int c=0;
		for(int j=0;j<serverTypeList.size() ;j++)
		{
			String type = (String)serverTypeList.get(j);
			if(type!=null)
			{
				type = type.trim();
				if(type.startsWith("Agg_") && c<1)
				{
					menuSupportStr=menuSupportStr+",Aggregates";
					c++;
					break;
				}
			}
		}
	}
	if(menuSupportStr!=null && menuSupportStr.startsWith(","))
	{
		menuSupportStr=menuSupportStr.substring(1);
	}

	IniFile citrixIni = new IniFile(installdir+"/manager/config/eg_citrixdashboard.ini");
	String vdiDashTypes = citrixIni.getValue("Dashboard_Types","VirtualDesktopsDashboard");
	String defaultVDIDashType = "";
	if(vdiDashTypes!= null && vdiDashTypes.trim().length()>0)
	{
		ArrayList type_dash_list = (ArrayList)com.egurkha.util.StringUtils.egTokenizer(vdiDashTypes, ",",false,true,true);		//param 3-->includeEmpty,4-->unique,5-->trim
		if(type_dash_list!=null && type_dash_list.size()>0)
		{
			for(int hh=0;hh<type_dash_list.size();hh++)
			{
				String type_dash_str_final=(String)type_dash_list.get(hh);

				if(type_dash_str_final!=null && type_dash_str_final.length()>0)
				{
					ArrayList f_typedashboard_list = (ArrayList)com.egurkha.util.StringUtils.egTokenizer(type_dash_str_final, ":",false,false,true);		//param 3-->includeEmpty,4-->unique,5-->trim

					String dash_name=(String)f_typedashboard_list.get(0);
					String d_comp_type=(String)f_typedashboard_list.get(1);

					if(serverTypeList!=null && serverTypeList.contains(d_comp_type))
					{
						defaultVDIDashType = dash_name;
						break;
					}
				}
			}
		}
	}


	IniFile endUserINI = new IniFile(installdir+"/manager/config/eg_endUserDetails.ini");
	String defaultUType = endUserINI.getValue("END_USER_DASHBOARD_SETTINGS","DefaultUserType");
	String defaultUserType="";
	if(defaultUType!= null && !defaultUType.equalsIgnoreCase("null") && !defaultUType.trim().equals("") && defaultUType.trim().length()>0)
	{
		defaultUserType = defaultUType;
	}

	String enableEndUserDashboard = endUserINI.getValue("END_USER_DASHBOARD_SETTINGS","EnableEndUserDashboard");
	enableEndUserDashboard=(enableEndUserDashboard==null || enableEndUserDashboard.trim().length()==0)?"false":enableEndUserDashboard.toLowerCase();
	String enableHighUserProfile = endUserINI.getValue("END_USER_DASHBOARD_SETTINGS","HighUserProfileExpDashboard");
	enableHighUserProfile=(enableHighUserProfile==null || enableHighUserProfile.trim().length()==0)?"false":enableHighUserProfile.toLowerCase();
	String usersByLocation = endUserINI.getValue("END_USER_DASHBOARD_SETTINGS","UsersByLocation");
	usersByLocation = (usersByLocation==null || usersByLocation.trim().length()==0)?"false":usersByLocation.toLowerCase();
	Object [] group_ued_vars = endUserINI.getVariables("LOC_USER_DESKTOP_METRICS");
	String grpByUsrTypes = "";
	if(group_ued_vars!=null)
	{
		for(int u=0;u<group_ued_vars.length ;u++)
		{
			String tmpStr = (String)group_ued_vars[u];
			if(tmpStr!=null && tmpStr.trim().length()>0 && tmpStr.toLowerCase().indexOf("groupby")>-1)
			{
				String tmp_usr_type = tmpStr.substring(0,tmpStr.indexOf(":"));
				if(tmp_usr_type!=null && tmp_usr_type.trim().length()>0 && !tmp_usr_type.equalsIgnoreCase("null"))
				{
					String showUserLocations = endUserINI.getValue("GEO_LOCATION_SETTINGS",tmp_usr_type+":ShowUserLocations");
					String showSeparateFilters = endUserINI.getValue("LOC_USER_DESKTOP_METRICS",tmp_usr_type+":showSeparateFilters");
					if(showUserLocations!=null && showUserLocations.trim().length()>0 && (showUserLocations.equalsIgnoreCase("true")||showUserLocations.equalsIgnoreCase("yes")) && showSeparateFilters!=null && showSeparateFilters.trim().length()>0 && (showSeparateFilters.equalsIgnoreCase("true")||showSeparateFilters.equalsIgnoreCase("yes")))
						grpByUsrTypes = grpByUsrTypes +","+tmp_usr_type;
				}
			}
		}
		if(grpByUsrTypes!=null && grpByUsrTypes.startsWith(","))
		{
			grpByUsrTypes = grpByUsrTypes.substring(1);
		}
	}
	boolean isEnableEndUserDashboard=false;
	if(enableEndUserDashboard!=null && (enableEndUserDashboard.equalsIgnoreCase("yes") || enableEndUserDashboard.equalsIgnoreCase("true")))
		isEnableEndUserDashboard=true;

	ArrayList uedMenuList=new ArrayList();
	ArrayList sepMenuList=new ArrayList();
	ArrayList virtualMenuList=new ArrayList();
	ArrayList uedHighMenuList=new ArrayList();
	String menuStr="";
	String sepMenuStr="";
	String menuVMStr="";
	String highMenuStr="";
	if(isEnableEndUserDashboard)
	{
		Object [] ued_vars = endUserINI.getVariables("USER_TYPE_COMPONENTS");
		if (ued_vars!=null)
		{
			for (int i=0;i<ued_vars.length ;i++ )
			{
				String thisVar = (String)ued_vars[i];
				String comptypesIni = endUserINI.getValue("USER_TYPE_COMPONENTS",thisVar);
				String ut_to_skip = endUserINI.getValue("SKIP_USERTYPE_UED_MENU",thisVar);
				if(ut_to_skip==null || ut_to_skip.trim().length()==0)
				{
					StringTokenizer st = new StringTokenizer(comptypesIni,",");
					while(st.hasMoreTokens())
					{
						String type = st.nextToken();
						if(type!=null)
						{
							type = type.trim();
							if(serverTypeList!=null && serverTypeList.contains(type))
							{
								if(enableHighUserProfile!=null && (enableHighUserProfile.equalsIgnoreCase("true") || enableHighUserProfile.equalsIgnoreCase("yes")))
								{
									String userTypeHighUserProfile = endUserINI.getValue("END_USER_DASHBOARD_SETTINGS",thisVar+":HighUserProfile");
									if(userTypeHighUserProfile!=null && (userTypeHighUserProfile.equalsIgnoreCase("true") || userTypeHighUserProfile.equalsIgnoreCase("yes")))
									{
										uedHighMenuList.add(thisVar);
										highMenuStr=highMenuStr+","+thisVar;
									}
								}
								if(thisVar!=null && thisVar.equals("ESX"))
								{
									virtualMenuList.add(thisVar);
									menuVMStr=menuVMStr+","+thisVar;
									break;
								}
								else
								{
									uedMenuList.add(thisVar);
									menuStr=menuStr+","+thisVar;
									break;
								}
							}
							else if((user.isOnlyVMAssigned()  || user.isVMAssigned() ) && user.getOnlyVMs().size()>0 && vmTypeList!=null && vmTypeList.contains(type) )
							{
								if(thisVar!=null && thisVar.equals("ESX"))
								{
									virtualMenuList.add(thisVar);
									menuVMStr=menuVMStr+","+thisVar;
									break;
								}
								else
								{
									uedMenuList.add(thisVar);
									menuStr=menuStr+","+thisVar;
									break;
								}
							}
						}
					}
				}
				else if(ut_to_skip!=null && ut_to_skip.trim().length()>0)
				{
					StringTokenizer st = new StringTokenizer(comptypesIni,",");
					while(st.hasMoreTokens())
					{
						String type = st.nextToken();
						if(type!=null)
						{
							type = type.trim();
							if(serverTypeList!=null && serverTypeList.contains(type))
							{
								sepMenuList.add(thisVar);
								sepMenuStr=sepMenuStr+","+thisVar;
								break;
							}
						}
					}
				}
			}
		}
	}

	if(menuStr!=null && menuStr.startsWith(","))
	{
		menuStr=menuStr.substring(1);
	}

	if(sepMenuStr!=null && sepMenuStr.startsWith(","))
	{
		sepMenuStr=sepMenuStr.substring(1);
	}
	if(menuVMStr!=null && menuVMStr.startsWith(","))
	{
		menuVMStr=menuVMStr.substring(1);
	}
	if(highMenuStr!=null && highMenuStr.startsWith(","))
	{
		highMenuStr=highMenuStr.substring(1);
	}

	String uedSubMenu="false";
	if(uedMenuList!=null && uedMenuList.size()>1)
	{
		uedSubMenu="true";
	}

	String vmUEDSubMenu="false";
	if(virtualMenuList!=null && virtualMenuList.size()>0)
	{
		vmUEDSubMenu="true";
	}
	String highUedSubMenu="false";
	if(uedHighMenuList!=null && uedHighMenuList.size()>1)
	{
		highUedSubMenu="true";
	}
	String sepSubMenu="false";
	if(sepMenuList!=null && sepMenuList.size()>0)
	{
		sepSubMenu="true";
	}

	ArrayList logonMenuList=new ArrayList();
	String logStr="";
	
	IniFile egFormatIni = new IniFile(installdir+"/manager/config/eg_format.ini");
	
	String sim_type = egFormatIni.getValue("SIMULATION","Types");
	ArrayList simTypeList = new ArrayList();
	if(sim_type != null && sim_type.trim().length() > 0)
		simTypeList =  com.egurkha.util.StringUtils.egTokenizer(sim_type.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
	if(simTypeList != null && simTypeList.size() > 0)
	{
		for(int l=0;l<simTypeList.size();l++)
		{
			String sim_comp_type = (String)simTypeList.get(l);
			if(serverTypeList!=null && serverTypeList.size()>0 && serverTypeList.contains(sim_comp_type))
			{
				logonMenuList.add(sim_comp_type);
				logStr=logStr+","+sim_comp_type;
			}
		}
	}
	
	if(logStr!=null && logStr.startsWith(","))
	{
		logStr=logStr.substring(1);
	}
	
	String enableLogonSimulator="false";
	if(logonMenuList!=null && logonMenuList.size()>0)
	{
		enableLogonSimulator="true";
	}
	String logonSubMenu="false";
	if(logonMenuList!=null && logonMenuList.size()>1)
	{
		logonSubMenu="true";
	}

	IniFile serverDashBoardINI = new IniFile(installdir+"/manager/config/eg_serverdashboard.ini");
	String enableSapAbapDashboard = serverDashBoardINI.getValue("SAP_ABAP_DASHBOARD_SETTINGS","EnableSapABAPDashboard");

	String enableSapAbapInMenu="false";
	if(enableSapAbapDashboard!=null && (enableSapAbapDashboard.equalsIgnoreCase("yes") || enableSapAbapDashboard.equalsIgnoreCase("true")))
	{
		if(serverTypeList!=null && serverTypeList.contains("SAP_R3_server"))
		{
			enableSapAbapInMenu="true";
		}
	}

	String enableSapPlatformDashboard = serverDashBoardINI.getValue("SAP_PLATFORM_DASHBOARD_SETTINGS","EnableSapPlatformDashboard");

	String enableSapPlatformInMenu="false";
	if(enableSapPlatformDashboard!=null && (enableSapPlatformDashboard.equalsIgnoreCase("yes") || enableSapPlatformDashboard.equalsIgnoreCase("true")))
	{
		String sapPlatformDBServerType = serverDashBoardINI.getValue("SAP_PLATFORM_COMP_TYPES","SapPlatformServerType");

		ArrayList sapCompTypeList = new ArrayList();
		if(sapPlatformDBServerType != null && sapPlatformDBServerType.trim().length() > 0)
		{
			sapCompTypeList =  com.egurkha.util.StringUtils.egTokenizer(sapPlatformDBServerType.trim(),",",true,false,true);
		}

		if(sapCompTypeList != null && sapCompTypeList.size() > 0)
		{
			for(int l=0;l<sapCompTypeList.size();l++)
			{
				String sap_comp_type = (String)sapCompTypeList.get(l);
				if(serverTypeList!=null && serverTypeList.size()>0 && serverTypeList.contains(sap_comp_type))
				{	
					enableSapPlatformInMenu="true";
					break;
				}
			}
		}
	}

	String enableSapDashboards = serverDashBoardINI.getValue("SAP_DASHBOARD_SETTINGS","EnableSapDashboards");

	String enableSapDashboardsInMenu="false";
	if(enableSapDashboards!=null && (enableSapDashboards.equalsIgnoreCase("yes") || enableSapDashboards.equalsIgnoreCase("true")))
	{
		String sapDashboardsServerType = serverDashBoardINI.getValue("SAP_DASHBOARD_SETTINGS","SapDashboardsServerType");

		ArrayList sapCompTypeList = new ArrayList();
		if(sapDashboardsServerType != null && sapDashboardsServerType.trim().length() > 0)
		{
			sapCompTypeList =  com.egurkha.util.StringUtils.egTokenizer(sapDashboardsServerType.trim(),",",true,false,true);
		}

		if(sapCompTypeList != null && sapCompTypeList.size() > 0)
		{
			for(int l=0;l<sapCompTypeList.size();l++)
			{
				String sap_comp_type = (String)sapCompTypeList.get(l);
				if(serverTypeList!=null && serverTypeList.size()>0 && serverTypeList.contains(sap_comp_type))
				{	
					enableSapDashboardsInMenu="true";
					break;
				}
			}
		}
	}
	
	boolean isSessionSimulationEnabled = false;	
	boolean isSimulationEnabled = false;
	boolean isDefaultSimulationEnabled = false;
	
	String monitorBy = "NETWORK";
	
	String default_em = dashboardConfigINI.getValue("TREE_PAGE_SETTINGS","default");
	default_em=(default_em==null || default_em.trim().length()==0)?"ExtTestDashboard~$~"+monitorBy:default_em;
	String stringToken[] = StringUtils.getTokens(default_em,"~$~");

	String defaultCompType = stringToken[1];

	ArrayList simulationTypesList =  new ArrayList();
	String simulationTypes = dashboardConfigINI.getValue("Support_Simulation_Types","ComponentTypes");
	if(simulationTypes != null && simulationTypes.trim().length() > 0)
		simulationTypesList =  com.egurkha.util.StringUtils.egTokenizer(simulationTypes.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
	if(simulationTypesList != null && simulationTypesList.size() > 0)
	{
		if(serverTypeList!=null && serverTypeList.size()>0 )
		{
			if(serverTypeList.contains(defaultCompType))
			{
				isDefaultSimulationEnabled = true;
				isSimulationEnabled = true;
			}
			else
			{
				for(int l=0;l<simulationTypesList.size();l++)
				{
					String sim_comp_type = (String)simulationTypesList.get(l);			
					
					if(serverTypeList.contains(sim_comp_type))
					{
						isSimulationEnabled = true;				
						monitorBy = dashboardConfigINI.getValue("SIMULATION_SUPPORT",sim_comp_type);
						if(monitorBy != null && monitorBy.trim().length() > 0)
							break;
						else
						{
							monitorBy = "NETWORK";
						}
					}
									
				}
			}
			
		}
	}

	if(!isSimulationEnabled)
	{
		ArrayList emulationTypesList =  new ArrayList();
		String emulationTypes = dashboardConfigINI.getValue("Support_Emulation_Types","ComponentTypes");
		if(emulationTypes != null && emulationTypes.trim().length() > 0)
			emulationTypesList =  com.egurkha.util.StringUtils.egTokenizer(emulationTypes.trim(),",",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
		if(emulationTypesList != null && emulationTypesList.size() > 0)
		{
			for(int l=0;l<emulationTypesList.size();l++)
			{
				String sim_comp_type = (String)emulationTypesList.get(l);
				if(serverTypeList!=null && serverTypeList.size()>0 && serverTypeList.contains(sim_comp_type))
				{
					isSessionSimulationEnabled = true;
					monitorBy = dashboardConfigINI.getValue("Supported_Emulation_Monitor",sim_comp_type);
					if(monitorBy != null && monitorBy.trim().length() > 0)
						break;
					else
					{
						monitorBy = "NETWORK";
					}
								
				}
			}
		}
	}
	
	if(isSimulationEnabled && !isDefaultSimulationEnabled)	
		default_em = "SIMULATION_SUPPORT~$~"+monitorBy;	
	else if(!isSimulationEnabled && isSessionSimulationEnabled)
		default_em = "ExtTestDashboard~$~"+monitorBy;
	String Stoken[] = StringUtils.getTokens(default_em,"~$~");
	String em_default_url="/final/monitor/comparisonDashboard.jsp?treeTitle=ExtTestDashboard&isFromMenu=true&isLogonType=false";
	if(Stoken!=null)
	{
		String subject = Stoken[0];
		String key = Stoken[1];
		if(subject != null && subject.equalsIgnoreCase("ExtTestDashboard"))
		{
			String default_test = dashboardConfigINI.getValue(subject,key);
			if(default_test != null && default_test.trim().length() > 0)
				em_default_url += "&monitorsBy="+key+"&ltest="+default_test;
		}
		else if(subject != null && serverTypeList != null)
		{
			if(serverTypeList.contains(key))
			{
				String default_title = dashboardConfigINI.getValue(subject,key);
				if(default_title != null && default_title.trim().length() > 0)
					em_default_url="/final/monitor/comparisonDashboard.jsp?treeTitle="+default_title+"&isFromMenu=true&isLogonType=true";
			}
			else
			{
				Object [] ued_vars = dashboardConfigINI.getVariables(subject);
				if (ued_vars!=null)
				{
					for (int i=0;i<ued_vars.length ;i++ )
					{
						String thisVar = (String)ued_vars[i];
						if(serverTypeList!=null && serverTypeList.contains(thisVar))
						{
							String default_title = dashboardConfigINI.getValue(subject,thisVar);
							if(default_title != null && default_title.trim().length() > 0)
								em_default_url="/final/monitor/comparisonDashboard.jsp?treeTitle="+default_title+"&isFromMenu=true&isLogonType=true";
							break;
						}
					}
				}
			}
		}

	}

	String enableRUM = uiIni.getValue("RUM_APPLICATIONS","enable_RUM");
	enableRUM=(enableRUM==null || enableRUM.trim().length()==0)?"false":enableRUM.toLowerCase();

	boolean isEnableRUM=false;
	if(enableRUM!=null && (enableRUM.equalsIgnoreCase("yes") || enableRUM.equalsIgnoreCase("true")))
		isEnableRUM=true;

	EgUserRole userRole = user.getUserRole();
	String roleName     = userRole.getRoleName();
	IniFile specsIni = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_specs.ini");
	boolean hasAdminTab = userRole.hasAnyAdminRole(EgUserPermission.ADMIN);
	boolean hasReporterTab = userRole.hasAnyReporterRole(EgUserPermission.REPORTER);
	boolean hasConfigTab = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);
	boolean hasMonitorTab = userRole.hasAnyMonitorRole(EgUserPermission.MONITOR);
	boolean hasSlaTab = false;
	if(isEnableSLA)
	{
		hasSlaTab = true;//userRole.hasAnySlaRole(EgUserPermission.SLA);
	}
	com.eg.EgCertUsage userCert = new com.eg.EgCertUsage();
	com.eg.EgUuidInfo uuidInfo = new com.eg.EgUuidInfo();
	ArrayList usersList = userCert.getAllLimitedCompAccessUsers(true);
	boolean isLimitedAdmin = (usersList.contains(user.getLoginID()));//!userRole.hasAllComponentAccess();
	boolean isUser = uuidInfo.isUser(user.getLoginID());
	boolean isOrg = uuidInfo.isOrg(user.getLoginID());
	boolean isShareRoleUser = (uuidInfo.isUser(user.getLoginID()) && uuidInfo.hasOURole(user.getLoginID()));
	boolean showLicensePolicy = (isOrg || (isUser && !isLimitedAdmin) || (isShareRoleUser)) ? true : false;
	boolean isNonSharedUser = false;
	if (isLimitedAdmin && !isOrg && !isShareRoleUser)
	{
		isNonSharedUser = true;
	}

	if(EgInstallInfo.isSuperManager)
	{
		hasAdminTab = false;//dont show admin tab in supermanager unless user login is egsm
		if(user.getLoginID().equals("egsm"))
		{
			login_as_egsm_in_sm = true;
			hasAdminTab = true;
		}
		hasReporterTab = false;
		hasConfigTab = false;
		hasSlaTab = false;
	}
	boolean hasRemoteControlEnabled=false;
	boolean rcEnabled = user.getLoginRCEnabled();

	//Role based admin menu - Start
	long perValue = userRole.getAdminPerm();
	EgUserPermission sas = EgUserPermission.getInstance();
	ArrayList adminPermCheckList = sas.getPrivilegeList(roleName,perValue,0);//admin role privilege list.
	HashMap panelNames = sas.getPanelInfo();//panel details.
	ArrayList adminPanelNames = sas.getPanelList(adminPermCheckList,panelNames);//Eligible panel list.
	String[][] allGroupNames = sas.getAdminDesc();//all admin groups.
	
	boolean hasComponentMangamentEnabled = false;
	boolean hasComponentGrpEnabled = false;
	boolean hasSegmentConfigEnabled = false;
	boolean hasServiceConfigEnabled = false;
	boolean hasZonesEnabled = false;
	boolean hasAgentTestEnabled = false;
	boolean hasGlobalTestEnabled = false;
	boolean hasRedundantMgrEnabled = false;
	boolean hasAgentSettingsEnabled = false;
	boolean hasExtRemAgentsEnabled = false;
	boolean hasAgentStatusEnabled= false;
	boolean hasGlobalThreshEnabled= false;
	boolean hasAgentThreshEnabled= false;
	boolean hasMaintenancePolicyEnabled= false;
	boolean hasManagerConfigEnabled= false;
	boolean hasICEnabled = false;
	boolean hasUserManagementEnabled = false;
	boolean hasReportsConfigEnabled = false;
	boolean hasAuditsEnabled = false;
	boolean hasDiscoveryEnabled = false;
	boolean hasAssetManagementEnabled = false;

	boolean infraPanel = false;
	boolean agentPanel = false;
	boolean alertPanel = false;
	boolean icPanel = false;
	boolean umPanel = false;
	boolean setPanel = false;
	boolean misPanel = false;
	boolean auditPanel = false;
	int total = adminPanelNames.size();
	int nofPanel = 2;

	if(EgInstallInfo.isSuperManager)
	{
		nofPanel++;
		auditPanel = true;
		hasAuditsEnabled = true;
	}
	else
	{
		for (int z = 0;z<total;z++)
		{
			String temp = (String) adminPanelNames.get(z);
			if (temp.equalsIgnoreCase("Infrastructure"))
			{
				infraPanel = true;//default panel.
			}
			else if (temp.equalsIgnoreCase("Agents"))
			{
				agentPanel = true;
				nofPanel++;
			}
			else if (temp.equalsIgnoreCase("Alerts"))
			{
				alertPanel = true;
				nofPanel++;
			}
			else if (temp.equalsIgnoreCase("Intergration Console") && memCheck.isExtensible())
			{
				icPanel = true;
				nofPanel++;
			}
			else if (temp.equalsIgnoreCase("User Management"))
			{
				umPanel = true;
				nofPanel++;
			}
			else if (temp.equalsIgnoreCase("Settings"))
			{
				setPanel = true;
				nofPanel++;
			}
			else if (temp.equalsIgnoreCase("Miscellaneous"))
			{
				misPanel = true;//default panel.
				//nofPanel++;
			}
			else if ((temp.equalsIgnoreCase("Audits")) && (serviceInfo.isAuditlogEnabled()))
			{
				auditPanel = true;
				nofPanel++;
			}
		}

		for (int i=0;i<allGroupNames.length;i++)
		{
			String temp = allGroupNames[i][0];
			if (!adminPermCheckList.contains(temp))
			{
				continue;
			}
			if (temp.equalsIgnoreCase("User Management"))
			{
				hasUserManagementEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Manager Configuration"))
			{
				hasManagerConfigEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Maintenance Policy Configuration"))
			{
				hasMaintenancePolicyEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Reports Configuration"))
			{
				hasReportsConfigEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Integration Console"))
			{
				hasICEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Component Management"))
			{
				hasComponentMangamentEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Segment Configuration"))
			{
				hasSegmentConfigEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Service Configuration"))
			{
				hasServiceConfigEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Agent Test Configuration"))
			{
				hasAgentTestEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Agent Threshold Configuration"))
			{
				hasAgentThreshEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Agent Settings"))
			{
				hasAgentSettingsEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Redundant Manager Configuration"))
			{
				if (!EgInstallInfo.isClusterSupported && EgInstallInfo.iclusterType != 1)
				{
					hasRedundantMgrEnabled = false;
				}
				else
				{
					hasRedundantMgrEnabled = true;
				}
			}
			else if (temp.equalsIgnoreCase("Zone Configuration"))
			{
				hasZonesEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Group Configuration"))
			{
				hasComponentGrpEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Audits"))
			{
				hasAuditsEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Global Threshold Configuration"))
			{
				hasGlobalThreshEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Agent Status"))
			{
				hasAgentStatusEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Global Agent Test Configuration"))
			{
				hasGlobalTestEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Discovery Management"))
			{
				hasDiscoveryEnabled = true;
			}
			else if (temp.equalsIgnoreCase("External/Remote Agent Configuration"))
			{
				hasExtRemAgentsEnabled = true;
			}
			else if (temp.equalsIgnoreCase("Asset Management"))
			{
				hasAssetManagementEnabled = true;
			}
		}
	}
	//if (agentPanel && !hasRedundantMgrEnabled && !hasAgentStatusEnabled &&
		//!hasAgentSettingsEnabled && !hasAgentTestEnabled &&
		//!hasGlobalTestEnabled)
	//{
		//agentPanel = false;
		//nofPanel--;
	//}
	//Role based admin menu - End
	
	//Role based config menu - Start
	boolean hasInventoryEnabled = false;
	boolean hasCurrentConfigEnabled = false;
	boolean hasChangesEnabled = false;
	boolean hasConsolidatedViewEnabled = false;
	boolean hasThinClientEnabled = false;
	boolean hasSettingsEnabled = false;
	boolean hasComparisonEnabled = false;
	boolean hasComplianceCheckEnabled = false;

	boolean inventoryPanel = false;
	boolean changePanel = false;
	boolean settingsPanel = false;
	boolean thinClientPanel = false;

	long l_configValue = userRole.getConfigPerm();
	ArrayList configPermCheckList = sas.getPrivilegeList(roleName,l_configValue,3);//config role privilege list.
	HashMap configPanelList = sas.getCPanelInfo();
	ArrayList configPanelNames = sas.getPanelList(configPermCheckList,configPanelList);
	String[][] allConfigNames = sas.getConfigDesc();
	int size = configPanelNames.size();
	int nofConfigPanel = 2;//Miscellenous and Configuration panels are mandatory.
	for (int con = 0;con<size;con++)
	{
		String temp = (String) configPanelNames.get(con);
		if (temp.equalsIgnoreCase("Changes"))
		{
			changePanel = true;
			nofConfigPanel++;
		}
		else if (temp.equalsIgnoreCase("Inventory"))
		{
			inventoryPanel = true;
			nofConfigPanel++;
		}
		//else if (temp.equalsIgnoreCase("Thin Client")) // Thin client is not in use
		//{
			//thinClientPanel = true;
			//nofConfigPanel++;
		//}
		else if (temp.equalsIgnoreCase("Settings"))
		{
			settingsPanel = true;
			nofConfigPanel++;
		}
	}

	for (int i=0;i<allConfigNames.length;i++)
	{
		String temp = allConfigNames[i][0];
		if (!configPermCheckList.contains(temp))
		{
			continue;
		}
		if (temp.equalsIgnoreCase("Inventory"))
		{
			hasInventoryEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Current Configuration"))
		{
			hasCurrentConfigEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Changes"))
		{
			hasChangesEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Consolidated View"))
		{
			hasConsolidatedViewEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Thin Client"))
		{
			hasThinClientEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Settings"))
		{
			hasSettingsEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Comparison"))
		{
			hasComparisonEnabled = true;
		}
		else if (temp.equalsIgnoreCase("Compliance Check"))
		{
			hasComplianceCheckEnabled = true;
		}
	}
	//Role based config menu - End.

	String hasVMs = "false";
	String menuForVM = "false";
	String menuForVMAlso = "false";
	if(userRole.hasAllComponentAccess())
	{
		menuForVM = "false";
		hasVMs="false";
	}
	else
	{
		List u_servers = user.getServers(false);
		if(user.isOnlyVMAssigned() && !user.isVMAssigned() && (u_servers == null || u_servers.size() == 0))
		{
			menuForVM = "true";
			//Limited access admin - admin and config tabs will not be shown
			//when monitor or reporter tab is available and only vms assigned.
			if(isAdmin && hasMonitorTab)
			{
				isAdmin = false;
				isMonitor = true;
				entry = "monitor";
				if(adminPermCheckList != null && !adminPermCheckList.contains("Component Management") && !adminPermCheckList.contains("User Management") && !adminPermCheckList.contains("External/Remote Agent Configuration"))
					hasAdminTab = false;
			}
			if(isAdmin && hasReporterTab)
			{
				isAdmin = false;
				isReport = true;
				entry = "reporter";
				hasAdminTab = false;
			}
		}
		if(user.getOnlyVMs()!=null && user.getOnlyVMs().size()>0)
		{
			menuForVMAlso = "true";
			hasVMs="true";
		}
	}
		
	//Added on April 10, To take out the admin tab for admin users logging into secondary managers
	boolean isSecondaryManager = false;
	EgManagersIniForManager mi = null;
	if(EgInstallInfo.isClusterSupported)
	{
		mi = EgManagersIniForManager.getInstance();
		if(!mi.isPrimaryManager())
		{
			isSecondaryManager = true;
			if(isAdmin && hasAdminTab && hasMonitorTab)
			{
				isAdmin=false;
				isMonitor=true;
				entry="monitor";
			}
			if(isAdmin && hasAdminTab && hasConfigTab)
			{
				isAdmin=false;
				isConfig=true;
				entry="config";
			}
			if(isAdmin && hasAdminTab && hasReporterTab)
			{
				isAdmin=false;
				isReport=true;
				entry="reporter";
			}
			if(isAdmin && hasAdminTab && hasSlaTab)
			{
				isAdmin=false;
				isSla=true;
				entry="sla";
			}
		}
	}

	if((!isShowAlarmsInLightBox) && isSecondaryManager && isMonitor){
		if(showAlarmsInLightBox!=null && (showAlarmsInLightBox.equalsIgnoreCase("yes") ||  showAlarmsInLightBox.equalsIgnoreCase("true"))){
			isShowAlarmsInLightBox = true;
		}
	}
	
	if(newWindow!=null && newWindow.trim().length()>0 && newWindow.equals("yes"))
	{
		session.setAttribute("entryChild", entry);
	}
	else session.setAttribute("entryMain", entry);
	session.setAttribute("entry", entry);
	String menuItemJSLink="/final/"+entry+"/eg_scripts/menu_item_"+_user.getLanguage()+".js";
	String menuAdminItemJSLink = "/final/admin/eg_scripts/menu_item_"+_user.getLanguage()+".js";
	String menuMonitorItemJSLink = "/final/monitor/eg_scripts/menu_item_"+_user.getLanguage()+".js";
	String menuReporterItemJSLink = "/final/reporter/scripts/menu_item_"+_user.getLanguage()+".js";
	String menuConfigItemJSLink = "/final/config/scripts/menu_item_"+_user.getLanguage()+".js";
	String menuSlaItemJSLink = "/final/SLA/scripts/menu_item_"+_user.getLanguage()+".js";
	//String menuJSLink = "/final/"+entry+"/eg_scripts/navlinks.js";
	String menuJsMegaLink = "/final/"+entry+"/eg_scripts/navlinksAdminMega.js";
	// This was used for grouping mega navlink in admin module 
	//String menuItemJsMegaLink = "/final/"+entry+"/eg_scripts/menu_item_mega_"+_user.getLanguage()+".js";
	boolean fromSmart = smartParam != null && !entry.equals("");
	String tabIMG=null;/*-----------Vijay 6/9/2007 -------------------*/
	String hideAlarmPopup=uiIni.getValue("HIDE_ALARM_POPUP","alarm_popup");
	if(EgInstallInfo.isSuperManager)
	{
		hideAlarmPopup="no";
	}

	IniFile clsIni = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_ls_portal.ini");
	String browserTitle = clsIni.getValue("LS_TRIAL_SETTINGS","browserTitle");
	String cloudModel = clsIni.getValue("LS_TRIAL_SETTINGS","cloudModel");
	String reqFrom = request.getParameter("reqFrom");
	if (StringUtils.isNull(reqFrom))
	{
		reqFrom = (String)session.getAttribute("reqFrom");
	}
	String tab = request.getParameter("tab");
	if (StringUtils.isNull(tab))
	{
		tab = (String)session.getAttribute("tab");
	}
	String help = request.getParameter("help");
	if (StringUtils.isNull(help))
	{
		help = (String)session.getAttribute("help");
	}
	boolean hideQuickLink = false;
	
	String alarmsTitle = mappingInfo.getTextDescription("admin.common.Alarms by Mail");
	String mailIdTitle = mappingInfo.getTextDescription("admin.common.Mail ID");
	if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
	{
		hasNotificationWindow = "no";
		boolean isSMSAlertEnabled =  memCheck.isSMSAlertEnabled();
		//EgSms sms = new EgSms();
		//boolean smsSettings = sms.checkSmsSettings();
		
		if (isSMSAlertEnabled)
		{
			boolean smsSettings = EgSms.checkSmsSettings();
			if (smsSettings)
			{
				alarmsTitle = mappingInfo.getTextDescription("admin.common.Alarms by Mail/SMS");
				mailIdTitle = mappingInfo.getTextDescription("admin.common.Mail ID/Mobile No");
			}
		}
	}
	else
	{
		alarmsTitle = mappingInfo.getTextDescription("admin.common.Alarms by Mail/SMS");
		mailIdTitle = mappingInfo.getTextDescription("admin.common.Mail ID/Mobile No");
	}

	if(entry.equalsIgnoreCase("config"))
	{
		Map configSetting=(Hashtable)user.getUserConfigSetting();
		if(configSetting!=null && configSetting.size()>0)
			configHomePage=(String)configSetting.get(EgConfigConstants.HOME_PAGE);
	}
	boolean noValidUserRolesForSM = false;
	if(EgInstallInfo.isSuperManager)
	{
		if(login_as_egsm_in_sm)
		{
			if(entry.equals("admin"))
			{
					selectedSkin="admin";
%>
<%
				url= "/final/admin/EgDispManagers.jsp";
				helpURL = "/final/eghelp/EgHelp.jsp";
				session.setAttribute("moduleName","admin");
				tabIMG = _user.getAdminSkin();
				String adminLastAccessedURL  =(String)session.getAttribute("adminLastAccessedURL");
				session.removeAttribute("adminLastAccessedURL");
			}
			else if(entry.equals("monitor"))
			{
				selectedSkin="monitor";
%>
<%
				url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
				helpURL = "/final/eghelp/EgMHelp.jsp";
				//menuJSLink = "/final/monitor/eg_scripts/navlinks.js";
				menuJsMegaLink = "/final/monitor/eg_scripts/navlinksMonitorMega.js";
				menuItemJSLink="/final/monitor/eg_scripts/menu_item_"+_user.getLanguage()+".js";
				session.setAttribute("moduleName","monitor");
				tabIMG = _user.getMonitorSkin();
			}
		}
		else if(isAdmin)
		{
			selectedSkin="monitor";
%>
<%
			url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			helpURL = "/final/eghelp/EgMHelp.jsp";
			//menuJSLink = "/final/monitor/eg_scripts/navlinks.js";
			menuJsMegaLink = "/final/monitor/eg_scripts/navlinksAdminMega.js";
			menuItemJSLink="/final/monitor/eg_scripts/menu_item_"+_user.getLanguage()+".js";
			session.setAttribute("moduleName","monitor");
			tabIMG = _user.getMonitorSkin();
		}
		else if (isMonitor)
		{
			selectedSkin="monitor";
%>
<%
			url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			helpURL = "/final/eghelp/EgMHelp.jsp";
			//menuJSLink = "/final/monitor/eg_scripts/navlinks.js";
			menuJsMegaLink = "/final/monitor/eg_scripts/navlinksMonitorMega.js";
			menuItemJSLink="/final/monitor/eg_scripts/menu_item_"+_user.getLanguage()+".js";
			session.setAttribute("moduleName","monitor");
			tabIMG = _user.getMonitorSkin();
		}
		else if (isConfig)
		{
			selectedSkin="configindex";
%>
<%
			isConfig = false;
			noValidUserRolesForSM = true;
			entry = "monitor";
			url = "/final/monitor/forbidden.jsp";
			session.setAttribute("moduleName","monitor");
			tabIMG = _user.getMonitorSkin();
		}
		else if (isReport)
		{
			selectedSkin="reporter";
%>
<%
			isReport = false;
			noValidUserRolesForSM = true;
			entry = "monitor";
			url = "/final/monitor/forbidden.jsp";
			session.setAttribute("moduleName","monitor");
			tabIMG = _user.getMonitorSkin();
		}
		else if (isSla && isEnableSLA)
		{
			selectedSkin="sla";
%>
<%
			isSla = false;
			noValidUserRolesForSM = true;
			entry = "monitor";
			url = "/final/monitor/forbidden.jsp";
			session.setAttribute("moduleName","monitor");
			tabIMG = _user.getMonitorSkin();
		}
	}
	else if(isAdmin)
	{
		selectedSkin="admin";
%>
<%
		if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
		{
			hideQuickLink = true;
			session.setAttribute("clsTrial","Yes");
			String compType = request.getParameter("compType");
			if (StringUtils.isNull(compType))
			{
				compType = (String)session.getAttribute("compType");
			}
			String lsurl = request.getParameter("url");
			if (StringUtils.isNull(lsurl))
			{
				lsurl = (String)session.getAttribute("url");
			}
			String refurl = request.getParameter("refurl");
			url = "/final/portal/LogonSimulator.jsp?from=login&tab="+tab+"&compType="+compType+"&help="+help+"&url="+lsurl+"&refurl="+refurl;
		}
		else
		{
			if (reqFrom != null && reqFrom.equalsIgnoreCase("citrix"))
			{
				session.setAttribute("citrix","Yes");
			}
			url= "/final/admin/EgAdminOperations.jsp?integritycheckviolated="+integrity+"&"+ queryString;
			String adminLastAccessedURL  =(String)session.getAttribute("adminLastAccessedURL");
			session.removeAttribute("adminLastAccessedURL");
			if(adminLastAccessedURL!=null)
			{
				url= adminLastAccessedURL;
			}
		}
		helpURL = "/final/eghelp/EgHelp.jsp";
		session.setAttribute("moduleName","admin");
		tabIMG = _user.getAdminSkin();
	}
	else if (isMonitor)
	{
		selectedSkin="monitor";
%>
<%
		if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
		{
			hideQuickLink = true;
			session.setAttribute("clsTrial","Yes");
			String compType = request.getParameter("compType");
			if (StringUtils.isNull(compType))
			{
				compType = (String)session.getAttribute("compType");
			}
			String lsurl = request.getParameter("url");
			if (StringUtils.isNull(lsurl))
			{
				lsurl = (String)session.getAttribute("url");
			}
			String refurl = request.getParameter("refurl");
			url = "/final/portal/LogonSimulator.jsp?from=login&tab="+tab+"&compType="+compType+"&help="+help+"&url="+lsurl+"&refurl="+refurl;
			menuJsMegaLink = "/final/monitor/eg_scripts/navlinksMonitorMegaLS.js";
		}
		else
		{
			if (reqFrom != null && reqFrom.equalsIgnoreCase("citrix"))
			{
				session.setAttribute("citrix","Yes");
			}
			url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			menuJsMegaLink = "/final/monitor/eg_scripts/navlinksMonitorMega.js";
		}
		helpURL = "/final/eghelp/EgMHelp.jsp";
		//menuJSLink = "/final/monitor/eg_scripts/navlinks.js";
		menuItemJSLink="/final/monitor/eg_scripts/menu_item_"+_user.getLanguage()+".js";
		session.setAttribute("moduleName","monitor");
		tabIMG = _user.getMonitorSkin();
	}
	else if (isConfig)
	{
		selectedSkin="configindex";
%>
<%
		if (configHomePage != null && configHomePage.indexOf("EcConfigurationServlet?") != -1)
		{
			configHomePage = configHomePage.replace("EcConfigurationServlet?","EcConfigurationServletNew?");
		}

		if (configHomePage != null && 
			!configHomePage.startsWith("/final/servlet/") && 
			!configHomePage.startsWith("/final/config/"))
		{
			IniFile configSettingIni =  new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_configtests.ini");
			configHomePage = (String)configSettingIni.getValue("HOME_PAGE",configHomePage);
		}
		url = configHomePage;
		helpURL="/final/eghelp/EgCHelp.jsp?from=Config";
		//menuJSLink = "/final/config/scripts/navlinks.js";
		menuJsMegaLink = "/final/config/scripts/navlinksConfigMega.js";
		menuItemJSLink="/final/config/scripts/menu_item_"+_user.getLanguage()+".js";
		session.setAttribute("moduleName","config");
		tabIMG = _user.getConfigSkin();
		String configLastAccessedURL = (String)session.getAttribute("configLastAccessedURL");
		session.removeAttribute("configLastAccessedURL");
		if (configLastAccessedURL != null)
		{
			if (configLastAccessedURL.indexOf("###") != -1)
			{
				configLastAccessedURL = StringUtils.replace(configLastAccessedURL,"###","$$$");
			}
			
			if (configLastAccessedURL.indexOf("#") != -1)
			{
				configLastAccessedURL = StringUtils.replace(configLastAccessedURL,"#","$");
			}

			url = configLastAccessedURL;
		}
	}
	else if (isReport)
	{
		selectedSkin="reporter";
%>
<%
		if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
		{
			session.setAttribute("clsTrial","Yes");
		}
		//menuJSLink = "/final/reporter/scripts/navlinks.js";
		menuJsMegaLink = "/final/reporter/scripts/navlinksReporterMega.js";
		menuItemJSLink="/final/reporter/scripts/menu_item_"+_user.getLanguage()+".js";
		///final/reporter/ReporterTemplate.jsp?
		String reportLastAccessedURL  =(String)session.getAttribute("reportLastAccessedURL");
		if(isFromQuickLaunch){
			String toReporterPage=request.getParameter("toReporterPage");
			if (StringUtils.isNull(toReporterPage))
			{
				toReporterPage = (String) session.getAttribute("toReporterPage");
				session.removeAttribute("toReporterPage");
			}

			if(access != null && access.equalsIgnoreCase("RUMReport"))
			{
				MonitorUtility mu=new MonitorUtility();
				String rum_rep_url = mu.getRUMReportUrl(user.getLoginID(),analysisBy,analysis,startTimeUrl,endTimeUrl);
				if(rum_rep_url != null && rum_rep_url.trim().length() > 0)
					session.setAttribute("reportLastAccessedURL",rum_rep_url);
				url = "/final/monitor/EgReporter.jsp";
			}
			else
			{
				if(toReporterPage != null && toReporterPage.equalsIgnoreCase("true"))
					url =uiIni.getValue("DAILY_EMAILER_LINKS",access);
				else
					url =uiIni.getValue("MONITOR_QUICK_MENU",access);
				if(url == null || url.trim().length() == 0)
					url = "/final/monitor/EgReporter.jsp?";
				else if(url.indexOf(" ") > 0){
					String params = url.substring(url.indexOf("?")+1);
					url = url.substring(0,url.indexOf("?")+1);
					if(params != null && params.trim().length() > 0){
						StringTokenizer strtok = new StringTokenizer(params,"&");
						while(strtok.hasMoreTokens())
						{
							String param = strtok.nextToken();
							String reqparam =param.substring(0,param.indexOf("="));
							String value = param.substring(param.indexOf("=")+1,param.length());
							if(value.indexOf(" ") > 0)
							{
								value = EgURLEncoder.encode(value,"UTF-8");
							}
							url += reqparam+"="+value+"&";
						}
					}
				}

				if(analysisBy != null && analysisBy.trim().length() > 0)
					url+="&analysisBy="+analysisBy;
				if(analysis != null && analysis.trim().length() > 0)
					url+="&analysis="+analysis;
				if(compstate != null && compstate.trim().length() > 0)
					url+="&compstate="+compstate;
				if(startTimeUrl != null && startTimeUrl.trim().length() > 0){
					url+="&er_timeline=Any&startdate="+startTimeUrl.substring(0,startTimeUrl.lastIndexOf(" "));
					StringTokenizer st = new StringTokenizer(startTimeUrl.substring(startTimeUrl.lastIndexOf(" ")+1),":");
					url+="&starthr="+st.nextToken()+"&startmin="+st.nextToken();
				}
				if(endTimeUrl != null && endTimeUrl.trim().length() > 0){
					url+="&enddate="+endTimeUrl.substring(0,endTimeUrl.lastIndexOf(" "));
					StringTokenizer st = new StringTokenizer(endTimeUrl.substring(endTimeUrl.lastIndexOf(" ")+1),":");
					url+="&endhr="+st.nextToken()+"&endmin="+st.nextToken();
				}
				if(alertTest != null && alertTest.trim().length() > 0)
					url+="&alertTest="+alertTest;
				if(compTypeList != null && compTypeList.trim().length() > 0)
					url+="&compTypeList="+compTypeList;
			}
			
		}
		else{
			url = "/final/monitor/EgReporter.jsp";
			if(menuForVM.equalsIgnoreCase("true"))
				url = "/final/monitor/EgReporter.jsp?menuForVM=true";
			if(reportLastAccessedURL!=null && reportLastAccessedURL.equalsIgnoreCase("/final/reporter/ReporterTemplate.jsp?"))
			{
				url = "/final/reporter/ReporterTemplate.jsp?";
				fromReportTemplate = true;
			}
		}
		helpURL = "/final/eghelp/EgMHelp.jsp";
		session.setAttribute("moduleName","reporter");
		tabIMG = _user.getReporterSkin();
		/*String reportLastAccessedURL  =(String)session.getAttribute("reportLastAccessedURL");
		session.removeAttribute("reportLastAccessedURL");

		if(reportLastAccessedURL!=null)
		{
			if(reportLastAccessedURL.indexOf("##")>-1)
			{
				reportLastAccessedURL=StringUtils.replace(reportLastAccessedURL,"##","$$");
			}
			else if(reportLastAccessedURL.indexOf("#")>-1)
			{
				reportLastAccessedURL=StringUtils.replace(reportLastAccessedURL,"#","$");
			}
			
			url= reportLastAccessedURL;
			
		} */
	}
	else if (isSla && isEnableSLA)
	{
		selectedSkin="sla";
%>
<%
		menuJsMegaLink = "/final/SLA/scripts/navlinksSLAMega.js";
		menuItemJSLink="/final/SLA/scripts/menu_item_"+_user.getLanguage()+".js";
		url="/final/servlet/com.egurkha.SLA.controller.EgSLAController?slaCmd=home";
		helpURL = "/final/eghelp/EgMHelp.jsp";
		session.setAttribute("moduleName","sla");
		tabIMG = _user.getSlaSkin();
	}
	if (user == null)
	{
		Vector errorVector = new Vector();
		errorVector.add("User session expired. please login again.");
		session.setAttribute("vec_Errors", errorVector); 
%>
		<jsp:forward page = "egLogin.jsp"/>
<%
	}
	session.setAttribute("skin", selectedSkin); 
	String id = user.getLoginID();
	String uname = request.getParameter("uname");
	if (StringUtils.isNull(uname))
	{
		uname = (String) session.getAttribute("uname");
		session.removeAttribute("uname");
	}

	String temp_id = id;
	if (uname != null && uname.length() > 0)
	{
		id = uname;
	}

	boolean changepwd=true;
	if (id.indexOf("/")>-1 && isValidDomainUser(id))
		changepwd=false;
	
	long myPer = userRole.getMonitorPerm();
	boolean isAlarmViewer = (roleName.equals("AlarmViewer") || roleName.equals("SuperAlarmViewer"));

	

	if(!EgInstallInfo.isSuperManager)
	{
		hasConfigTab=memCheck.isCMEnabled();
		hasReporterTab=memCheck.isReportEnabled();
		if(isEnableSLA)
		{
			hasSlaTab=memCheck.isSLAEnabled();
		}
	}
	hasRemoteControlEnabled = memCheck.isRemoteControlEnabled();
	
	
	//Added on April 10, To take out the admin tab for admin users logging into secondary managers
	if(EgInstallInfo.isClusterSupported)
	{
		mi = EgManagersIniForManager.getInstance();
		if(mi!=null&&!mi.isPrimaryManager())
		{
			if((!isAdmin) && hasAdminTab)
			{
				hasAdminTab=false;
			}
		}
	}
	 hasMonitorTab = userRole.hasAnyMonitorRole(EgUserPermission.MONITOR);
	boolean showMonHome = false;
	if (hasMonitorTab)
	{
		showMonHome = true;
	}
	if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
	{
		showMonHome = false;
	}
	List zones = user.getZones();
	List segments = user.getSegments();
	List services = user.getServices();
	List servers = user.getServers(false);
	List serGroups = user.getServiceGroups();
	List dataSearchObj = new ArrayList(); 
	if(segments.size() > 0)
		dataSearchObj.add("segment~Segment");
	if(servers.size() > 0)
		dataSearchObj.add("server~Components");
	if(services.size() > 0)
		dataSearchObj.add("service~Service");
	//if(userRole.hasAllComponentAccess())
	if(true)
	{
		dataSearchObj.add("user~User");
		//dataSearchObj.add("vm~VM/Desktop");
		if (userRole.hasAllComponentAccess() || user.isOnlyVMAssigned() || user.isVMAssigned() || (user.getOnlyVMs()!=null && user.getOnlyVMs().size()>0))
			dataSearchObj.add("vm~VM/Desktop");
	}
	if(zones.size() > 0)
		dataSearchObj.add("zone~Zone");
	
	if(dataSearchObj != null && dataSearchObj.size() > 0)
	{
		boolean  isDefaultAvail = false;
		String lastoption = "";
		for(int i=0;i<dataSearchObj.size();i++)
		{
			String nameValuePair = (String)dataSearchObj.get(i);
			String valuePair = nameValuePair.substring(0,nameValuePair.indexOf("~"));
			String namePair = nameValuePair.substring(nameValuePair.indexOf("~")+1);
			lastoption = valuePair;
			if(selectedSearchCombo.equalsIgnoreCase(valuePair))
				isDefaultAvail = true;
%>
	<script>
		userSearchCombo.push({
			"name": "<%=namePair%>",
			"value": "<%=valuePair%>",
		});
	</script>	
<%
		}
		if(!isDefaultAvail)
			selectedSearchCombo = lastoption;
%>
	<script>
		selectedSearchCombo = '<%=selectedSearchCombo%>';
	</script>	
<%
	}
	if (hasReporterTab)
	{
		hasReporterTab = userRole.hasAnyReporterRole(EgUserPermission.REPORTER);
		if(zones.size() == 0 && segments.size() == 0 && services.size() == 0 && serGroups.size() == 0)
		{
			if(user.isOnlyVMAssigned() && !user.isVMAssigned())
			{
				if(hasReporterTab || hasMonitorTab)
				{
					//Fix to show admin tab for orgAdmin when this user is assigned only with VMs.
					if(adminPermCheckList != null && !adminPermCheckList.contains("Component Management") && !adminPermCheckList.contains("User Management") && !adminPermCheckList.contains("External/Remote Agent Configuration")){
						hasAdminTab = false;
					}
					hasConfigTab = false;
				}
				else
				{
					if(hasConfigTab)
						hasConfigTab = true;
				}
			}
		}
	}
	if (hasConfigTab)
	{
		if(!userRole.hasAllComponentAccess())
		{
			if(isMonitor && !isAlarmViewer)
			{
				
				if(zones.size() == 0 && segments.size() == 0 && services.size() == 0 && serGroups.size() == 0)
				{
					if(user.isOnlyVMAssigned() && !user.isVMAssigned())
					{
						hasConfigTab = false;
					}
					else
					{
						hasConfigTab = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);
					}
				}
				else
				{
					hasConfigTab = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);
				}
			}
			else
			{
				hasConfigTab = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);
			}
		}
		else
		{
			hasConfigTab = userRole.hasAnyConfigRole(EgUserPermission.CONFIG);
		}
	}

	if (isMonitor && !isAlarmViewer)
	{
		url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
	}
	if (isMonitor && isAlarmViewer)
	{
		url = "/final/monitor/EgAlarms.jsp";
	}
	if (isMonitor && isAlarmViewer && request.getParameter("from") != null && request.getParameter("from").equals("userProfile"))
	{
		if(login_as_egsm_in_sm)
		{
			url = "/final/admin/EgSmUserProfile.jsp?entry="+entry;
		}
		else
		{
		url = "/final/admin/userProfile.jsp?entry=" + entry+"&uname="+EgURLEncoder.encode(id,"UTF-8");
		}
	}

	if (isAdmin)
	{
%>
		<base target = "main">
		
<%
		if (request.getParameter("from") != null)
		{
			if(login_as_egsm_in_sm)
			{
				url = "/final/admin/EgSmUserProfile.jsp?entry="+entry;
			}
			else
			{
			url = "/final/admin/userProfile.jsp?entry=" + entry+"&uname="+EgURLEncoder.encode(id,"UTF-8");
			}
		}
	}
	boolean isAlarmQView = false; 
	String currentMonitorHomePageURL="";
	String HidForHomePageUrl=(String)user.getMonitorHomePage();
	if(!isAlarmViewer)
	{
		if(HidForHomePageUrl!=null && HidForHomePageUrl.trim().length()>0)
		{
			String monitor_home_page_value=uiIni.getValue("MONITOR_HOME_PAGE",HidForHomePageUrl);
			if(monitor_home_page_value!=null && monitor_home_page_value.trim().length()>0)
			{
				if((!user.isOnlyVMAssigned()) || (user.isOnlyVMAssigned() && (HidForHomePageUrl.equals("Current Alarms") || HidForHomePageUrl.equals("History of Alarms") || HidForHomePageUrl.equals("History of Acknowledgements") || HidForHomePageUrl.equals("History of Deletions") || HidForHomePageUrl.equals("My Dashboard"))))
					HidForHomePageUrl=monitor_home_page_value;
				else
					HidForHomePageUrl ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			}
			else if(HidForHomePageUrl.trim().equalsIgnoreCase("AlarmViewer"))
			{
				HidForHomePageUrl="/final/monitor/EgAlarms.jsp";
			}
			else
			{
				HidForHomePageUrl ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			}
		}
		else
		{
			HidForHomePageUrl ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
		}
	}
	else
	{
		HidForHomePageUrl="/final/monitor/EgAlarms.jsp";
	}
	if (isMonitor && !isAlarmViewer)
	{
		String monitor_home_page_variable=(String)user.getMonitorHomePage();
		if(fromPage != null && fromPage.equals("alarmQView")) 
		{
			String qViewParam = request.getParameter("qViewParam");
			if(qViewParam!=null)
			{
				qViewParam = StringUtils.replace(qViewParam,"^","&");
				qViewParam = StringUtils.replace(qViewParam,"|eq|","=");
				qViewParam = StringUtils.replace(qViewParam,"\\","\\\\");
				qViewParam = StringUtils.decodeSecurityChar(qViewParam);
				if (qViewParam!=null && qViewParam.trim().length()>0)
				{
					StringTokenizer qParamTok = new StringTokenizer(qViewParam,"&");
					String tmpQViewParam = "";
					while (qParamTok.hasMoreTokens())
					{
						String param = qParamTok.nextToken();
						if (param!=null && param.trim().length()>0 && param.indexOf("=")!=-1)
						{
							String reqparam =param.substring(0,param.indexOf("="));
							String value = param.substring(param.indexOf("=")+1,param.length());
							if (reqparam.equals("test"))
							{
								if(value!=null && value.trim().length()>0)
								{
									value = com.egurkha.util.StringUtils.encodeSecurityChar(value);
									value = EgURLEncoder.encode(value,"UTF-8");
								}
								else
								{
									value = value;
								}
							}
							tmpQViewParam = tmpQViewParam+reqparam+"="+value+"&";
						}
						else if (param!=null && param.trim().length()>0)
						{
							tmpQViewParam = tmpQViewParam+"&"+param+"&";
						}
					}
					qViewParam = tmpQViewParam;
				}
			}
			url= "/final/monitor/EgSiteInfraView.jsp?monCmd=componentDashboard&"+qViewParam+"&toDashBoardLayer=true&gotoLayerModel=true";
			isAlarmQView = true;
		} 
		else if (fromSmart)
		{
			if (smartParam.equals("alarm"))
			{
				url = "/final/monitor/EgAlarms.jsp";
			}
			else
			{
				String [] thisArr = StringUtils.getTokens(smartParam, "^");
				url= "/final/monitor/EgSiteInfraView.jsp?monCmd=componentDashboard&qctr=2&fromalarm=1&host=" + thisArr[0] + "&layer=" + thisArr[1] + "&site=" + thisArr[2] + "&test=" + thisArr[3] + "-"+thisArr[4] + "&comptype="+thisArr[5]+"&tstate=" + thisArr[6]+"&msmt_host=" +thisArr[7]+ "&componentName=" + thisArr[0] + ":" + thisArr[5]+"&toDashBoardLayer=true&gotoLayerModel=true";
			}
		}
		else if(fromSm!=null)
		{
			if((fromSm.equals("yes") || fromSm.equals("home")) && request.getParameter("fromsuperHome")!=null && request.getParameter("fromsuperHome").equals("home"))
			{
				/*if (user.getMonitorHomePage().equalsIgnoreCase("Dashboard"))
				{
					url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
				}
				else if (user.getMonitorHomePage().equalsIgnoreCase("Current Alarms"))
				{
					url = "/final/monitor/EgAlarms.jsp";
				}*/
				if(monitor_home_page_variable!=null && monitor_home_page_variable.trim().length()>0)
				{
					String monitor_home_page_value=uiIni.getValue("MONITOR_HOME_PAGE",monitor_home_page_variable);
					if(monitor_home_page_value!=null && monitor_home_page_value.trim().length()>0)
					{
						if((!user.isOnlyVMAssigned()) || (user.isOnlyVMAssigned() && (monitor_home_page_variable.equals("Current Alarms") || monitor_home_page_variable.equals("History of Alarms") || monitor_home_page_variable.equals("History of Acknowledgements") || monitor_home_page_variable.equals("History of Deletions") || monitor_home_page_variable.equals("My Dashboard"))))
							url=monitor_home_page_value;
						else
							url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
					}
					else if(monitor_home_page_variable.trim().equalsIgnoreCase("AlarmViewer"))
					{
						url="/final/monitor/EgAlarms.jsp";
					}
					else
					{
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
					}
				}
				else
				{
					url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
				}
			}
			else if(fromSm.equals("yes") && request.getParameter("fromsuperHome")==null)
			{
				url = "/final/monitor/EgSiteInfraView.jsp?monCmd=componentDashboard&qctr=2&fromalarm=1&host="+request.getParameter("host")+"&layer=" +request.getParameter("layer")+ "&site=" +request.getParameter("site")+ "&test=" +request.getParameter("test")+ "&comptype=" +request.getParameter("comptype")+"&tstate=" +request.getParameter("tstate")+ "&msmt_host=&componentName=" + request.getParameter("comptype") + ":" +request.getParameter("host")+"&newWindow=true&toDashBoardLayer=true&gotoLayerModel=true";
			}
		}
		else
		{
			if(monitor_home_page_variable!=null && monitor_home_page_variable.trim().length()>0)
			{
				String monitor_home_page_value=uiIni.getValue("MONITOR_HOME_PAGE",monitor_home_page_variable);
				if(monitor_home_page_value!=null && monitor_home_page_value.trim().length()>0)
				{
					if((!user.isOnlyVMAssigned()) || (user.isOnlyVMAssigned() && (monitor_home_page_variable.equals("Current Alarms") || monitor_home_page_variable.equals("History of Alarms") || monitor_home_page_variable.equals("History of Acknowledgements") || monitor_home_page_variable.equals("History of Deletions") || monitor_home_page_variable.equals("My Dashboard"))))
						url=monitor_home_page_value;
					else
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
				}
				else if(monitor_home_page_variable.trim().equalsIgnoreCase("AlarmViewer"))
				{
					url="/final/monitor/EgAlarms.jsp";
				}
				else
				{
					url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
				}
			}
			else
			{
				url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			}
		}
		/*else if (user.getMonitorHomePage().equalsIgnoreCase("Dashboard"))
		{
			url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
		}
		else if (user.getMonitorHomePage().equalsIgnoreCase("Current Alarms"))
		{
			url = "/final/monitor/EgAlarms.jsp";
		}
		else if (user.getMonitorHomePage().equalsIgnoreCase("Live Graph"))
		{
			url = "/final/monitor/livegraph/EgLiveGraphHome.jsp";
		}
		else if (user.getMonitorHomePage().equalsIgnoreCase("Quick Insight"))
		{
			url = "/final/monitor/qinsight/EgQInsightHome.jsp";
		}
		else if (user.getMonitorHomePage().equalsIgnoreCase("Virtual"))
		{
			url = "/final/monitor/vmwareDashboard.jsp";
		}
		else //if(user.getMonitorHomePage().equalsIgnoreCase("Blank"))
		{
			//url = "/final/monitor/blank.jsp";
			url = "/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
		}*/

		if (request.getParameter("from") != null)
		{
			if(login_as_egsm_in_sm)
			{
				url = "/final/admin/EgSmUserProfile.jsp?entry="+entry;
			}
			else
			{
			url = "/final/admin/userProfile.jsp?entry=" + entry+"&uname="+EgURLEncoder.encode(id,"UTF-8");
			}
		}
		currentMonitorHomePageURL=url;

		if(isFromQuickLaunch)
		{
			try
			{
				if (entry != null && entry.equalsIgnoreCase("reporter"))
				{
					ErUserData erdata = new ErUserData(user.getLoginID(),false);
					session.setAttribute("UBean",erdata);
				}
			}
			catch(Exception ee)
			{
				ee.printStackTrace();
			}

			if(access!=null && access.trim().length()>0)
			{
				if(access.equalsIgnoreCase("segmentList"))
				{
					url ="/final/servlet/com.eg.EgMonitorController?monCmd=segmentList&from=MainDashboard";
					if(accessPageName!=null && accessPageName.trim().length()>0 && !accessPageName.equalsIgnoreCase("all"))
					{
						url=url+"&action=search&searchString="+EgURLEncoder.encode(accessPageName,"UTF-8");
					}
					else
					{
						url=url+"&action=segment";
					}
				}
				else if(access.equalsIgnoreCase("serviceList"))
				{
					url="/final/servlet/com.eg.EgMonitorController?monCmd=serviceList&from=MainDashboard&fromQuicklaunch=yes";
					if(accessPageName!=null && accessPageName.trim().length()>0 &&!accessPageName.equalsIgnoreCase("all"))
					{
						url=url+"&action=search&searchString="+EgURLEncoder.encode(accessPageName,"UTF-8");
					}
					else
					{
						url=url+"&action=service";
					}
				}
				else if(access.equalsIgnoreCase("componentList"))
				{
					url="/final/servlet/com.eg.EgMonitorController?monCmd=componentList";

					if(accessPageName!=null && accessPageName.trim().length()>0 && !accessPageName.equals("All"))
					{
						url=url+"&action=search&from=componentList&searchIndComps=checked&searchTypeString="+EgURLEncoder.encode(accessPageName,"UTF-8");
					}
					else
					{
						url=url+"&from=TreeMenu&action=component&searchIndComps=checked";
					}
				}
				else if(access.equalsIgnoreCase("systemList"))
				{
					url="/final/servlet/com.eg.EgMonitorController?monCmd=boxList";
					if(accessPageName!=null && accessPageName.trim().length()>0 && !accessPageName.equals("All"))
					{
						url=url+"&action=search&from=boxList&searchNameString="+EgURLEncoder.encode(accessPageName,"UTF-8");
					}
					else
					{
						url=url+"&from=MainDashboard&action=box";
					}
				}
				else if(access.equalsIgnoreCase("zoneList"))
				{
					url="/final/servlet/com.eg.EgMonitorController?monCmd=zoneList&from=MainDashboard";
					if(accessPageName!=null && accessPageName.trim().length()>0 && !accessPageName.equalsIgnoreCase("all"))
					{
						url=url+"&action=search&searchString="+EgURLEncoder.encode(accessPageName,"UTF-8");
					}
					else
					{
						url=url+"&action=zone";
					}
				}
				else if(access.equalsIgnoreCase("segment"))
				{
					if(accessPageName!=null && accessPageName.trim().length()>0)
					{
						List usr_seg=user.getSegments();
						if(usr_seg!=null && usr_seg.contains(accessPageName))
						{
							EgAggregateInfo aggregateInfo = new EgAggregateInfo("manager");
							ArrayList aggregateArray = aggregateInfo.getAggregateComponentsOfElement("segment",accessPageName);

							boolean aggregateTab =false;
							if(aggregateArray != null && aggregateArray.size() > 0)
								aggregateTab = true;

							//url="/final/monitor/EgDispMonSegments.jsp?segment="+EgURLEncoder.encode(accessPageName,"UTF-8");

							url="/final/monitor/segmentDashboard.jsp?selectNode="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&selectedParam="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&currentTab=topology&segment="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&aggregateTab="+aggregateTab+"&fromHomepage=true";
						}
						else
						{
							url="/final/servlet/com.eg.EgMonitorController?monCmd=segmentList&from=MainDashboard";
							if(accessPageName!=null && accessPageName.trim().length()>0 && !accessPageName.equalsIgnoreCase("all"))
							{
								url=url+"&action=search&searchString="+EgURLEncoder.encode(accessPageName,"UTF-8");
							}
							else
							{
								url=url+"&action=segment";
							}
						}
					}
					else
					{
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
					}
				}
				else if(access.equalsIgnoreCase("service"))
				{
					if(accessPageName!=null && accessPageName.trim().length()>0)
					{
						List usr_ser=user.getServices();
						List usr_ser_sites=user.getSites();
						if((usr_ser!=null && usr_ser.contains(accessPageName)) || (usr_ser_sites!=null && usr_ser_sites.contains(accessPageName)))
						{
							EgTopoInfo topoInfo=new EgTopoInfo("manager");
							EgAggregateInfo aggregateInfo = new EgAggregateInfo("manager");
							String value = topoInfo.getValue("SERVICE",accessPageName);
							boolean isSite=false;
							if(value!=null && value.trim().equalsIgnoreCase("site"))
							{
								isSite=true;
							}

							ArrayList aggregateArray = aggregateInfo.getAggregateComponentsOfElement("service",accessPageName);

							boolean aggregateTab =false;
							if(aggregateArray != null && aggregateArray.size() > 0)
								aggregateTab = true;

							String currentTab = "topology";
							boolean hasTransactions = false;
							String[] strVarArr = topoInfo.getVariables("TRANSACTIONS");
							if(strVarArr!=null && strVarArr.length > 0)
							{
								for(int i=0; i<strVarArr.length; i++)
								{
									String site = strVarArr[i];
									site = site.substring(0,site.lastIndexOf(":"));
									if(site.equals(accessPageName))
									{
										currentTab = "transactions";
										hasTransactions = true;
										break;
									}
								}
							}
							else
							{
								hasTransactions = false;
							}

							boolean hasEmulatedTransactions = false;

							Vector compVec = topoInfo.getAssociatesForSite(accessPageName);

							for(int k=0; k<compVec.size(); k++)
							{
								String comp =(String) compVec.get(k);
								if(comp!=null && comp.indexOf("Emulated")>-1)
								{
									currentTab = "transactions";
									hasEmulatedTransactions = true;
								}
							}

							if(isSite && (hasTransactions || hasEmulatedTransactions))
							{
								url ="/final/monitor/serviceDashboard.jsp?action=service&treeFlag=treeFlag&treeTitle=services&outsideService=true&selectNode=Service^&selectedParam="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&topoSegment="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&currentTab="+currentTab+"&isSite="+isSite+"&aggregateTab="+aggregateTab+"&hasTransactions="+hasTransactions+"&hasEmulatedTransactions="+hasEmulatedTransactions+"&treeOpen=false&openNode=Services&fromPage=serviceTree&fromHomepage=true";
							}
							else
							{
								String segment_names = topoInfo.getValue("WEB_SITE_SEGMENTS","Web_site:" + accessPageName);
								if(segment_names!=null && segment_names.indexOf(",") > -1)
								{
									url="/final/monitor/EgSiteInfraView.jsp?site="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&isSite="+isSite+"&service="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&serviceName="+EgURLEncoder.encode(accessPageName,"UTF-8");
								}
								else
								{
									url ="/final/monitor/serviceDashboard.jsp?action=service&treeFlag=treeFlag&treeTitle=services&outsideService=true&selectNode=Service^&selectedParam="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&topoSegment="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&currentTab="+currentTab+"&isSite="+isSite+"&aggregateTab="+aggregateTab+"&hasTransactions="+hasTransactions+"&hasEmulatedTransactions="+hasEmulatedTransactions+"&treeOpen=false&openNode=Services&fromPage=serviceTree&fromHomepage=true";
								}
							}
						}
						else
						{
							url="/final/servlet/com.eg.EgMonitorController?monCmd=serviceList&from=MainDashboard&fromQuicklaunch=yes";
							if(accessPageName!=null && accessPageName.trim().length()>0 && !accessPageName.equalsIgnoreCase("all"))
							{
								url=url+"&action=search&searchString="+EgURLEncoder.encode(accessPageName,"UTF-8");
							}
							else
							{
								url=url+"&action=service";
							}
						}
					}
					else
					{
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
					}
				}
				else if(access.equalsIgnoreCase("zoneMap"))
				{
					url ="/final/monitor/zoneMap.jsp?isFromMenu=true";
				}
				else if(access.equalsIgnoreCase("zone"))
				{
					if(accessPageName!=null && accessPageName.trim().length()>0)
					{
						List usr_zones=user.getZones();
						if(usr_zones!=null && usr_zones.contains(accessPageName))
						{
							EgAggregateInfo aggregateInfo = new EgAggregateInfo("manager");
							ArrayList aggregateArray = aggregateInfo.getAggregateComponentsOfElement("zone",accessPageName);

							boolean aggregateTab =false;
							if(aggregateArray != null && aggregateArray.size() > 0)
								aggregateTab = true;

							//url="/final/servlet/com.eg.EgMonitorController?monCmd=zoneDashboard&zoneName="+EgURLEncoder.encode(accessPageName,"UTF-8");

							url = "/final/monitor/zoneDash.jsp?&selectNode=Zone^"+EgURLEncoder.encode(accessPageName,"UTF-8")+"&selectedParam="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&currentTab=details&zoneName="+EgURLEncoder.encode(accessPageName,"UTF-8")+"&aggregateTab="+aggregateTab+"&openNode=null&treeFlag=false&fromHomepage=true";
						}
						else
						{
							url="/final/servlet/com.eg.EgMonitorController?monCmd=zoneList&from=MainDashboard";
							if(accessPageName!=null && accessPageName.trim().length()>0 &&!accessPageName.equalsIgnoreCase("all"))
							{
								url=url+"&action=search&searchString="+EgURLEncoder.encode(accessPageName,"UTF-8");
							}
							else
							{
								url=url+"&action=zone";
							}
						}
					}
					else
					{
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
					}
				}
				else if(access.equalsIgnoreCase("component") || access.equalsIgnoreCase("system"))
				{
					if(accessPageName!=null && accessPageName.trim().length()>0)
					{
						List usr_server=user.getServers(false);
						List component_types_list=new LinkedList();
						component_types_list.addAll(user.getServerTypes());
						//saravanan.s, add the host system
						List hostSystem = Server.getHostSystems(usr_server, true);
						if(hostSystem!=null && hostSystem.size()>0)
						{
							for (int r=0; r<hostSystem.size(); r++)
							{
								String s = (String) hostSystem.get(r);
								s =Server.HOST_SYSTEM+":"+s;
								if (!usr_server.contains(s))
								{
									usr_server.add(s);
								}
							}
						}

						String TempAccessPageName=accessPageName;
						StringTokenizer tmp_st=new StringTokenizer(accessPageName,":");
						if(tmp_st.countTokens()==2)
						{
							TempAccessPageName=TempAccessPageName+":NULL";
						}

						if(usr_server!=null && (usr_server.contains(accessPageName) || usr_server.contains(TempAccessPageName)))
						{
							StringTokenizer st=new StringTokenizer(accessPageName,":");
							String comp_type="";
							String comp_name="";
							String comp_port="";
							String comp_sid="";
							String fakeType="";
							// find the real component type and port then form the url.
							// by Saravanan.A on 18-7-2012
							if(st.countTokens()==2)
							{
								comp_type=st.nextToken();
								comp_name=st.nextToken();
								comp_port="NULL";

								if (comp_type!=null && comp_type.equalsIgnoreCase("host_system"))
								{
									if(test!=null && test.trim().length()>0)
									{
										fakeType = discInfo.getTypeForHostTest(comp_name,test);
									}
									else
									{
										List temp_type_list=(List)discInfo.getServerTypesForNick(comp_name);
										if(temp_type_list!=null && temp_type_list.size()>0)
										{
											for(int i=0; i<temp_type_list.size(); i++)
											{
												String	temp_type=(String)temp_type_list.get(i);
												if(component_types_list!=null && temp_type!=null && component_types_list.contains(temp_type))
												{
													fakeType = temp_type;
													break;
												}
											}
										}
									}

									fakeType=(fakeType==null || fakeType.trim().length()==0)?"Host_system":fakeType;

									if (fakeType != null)
									{
										fakeType = fakeType.trim();
									}

									String comp_port_2=(String)discInfo.getPortForHost(comp_name,fakeType);
									if(comp_port_2!=null && comp_port_2.trim().length()>0 && (!comp_port_2.equals(comp_port)))
										comp_port=comp_port_2;
								}
								else
								{
									fakeType=comp_type;
								}

								comp_name=comp_name+":"+comp_port;
							}
							else if(st.countTokens()==3)
							{
								comp_type=st.nextToken();
								comp_name=st.nextToken();
								comp_port=st.nextToken();
								
								if (comp_type!=null && comp_type.equalsIgnoreCase("host_system"))
								{
									if(test!=null && test.trim().length()>0)
									{
										fakeType = discInfo.getTypeForHostTest(comp_name,test);
									}
									else
									{
										List temp_type_list=(List)discInfo.getServerTypesForNick(comp_name);
										if(temp_type_list!=null && temp_type_list.size()>0)
										{
											for(int i=0; i<temp_type_list.size(); i++)
											{
												String	temp_type=(String)temp_type_list.get(i);
												if(component_types_list!=null && temp_type!=null && component_types_list.contains(temp_type))
												{
													fakeType = temp_type;
													break;
												}
											}
										}
									}

									fakeType=(fakeType==null || fakeType.trim().length()==0)?"Host_system":fakeType;

									if (fakeType != null)
									{
										fakeType = fakeType.trim();
									}

									String comp_port_2=(String)discInfo.getPortForHost(comp_name,fakeType);
									if(comp_port_2!=null && comp_port_2.trim().length()>0 && (!comp_port_2.equals(comp_port)))
										comp_port=comp_port_2;
								}
								else
								{
									fakeType=comp_type;
								}

								comp_name=comp_name+":"+comp_port;
							}
							else if(st.countTokens()==4)
							{
								comp_type=st.nextToken();
								comp_name=st.nextToken();
								comp_port=st.nextToken();
								comp_sid=st.nextToken();

								if (comp_type!=null && comp_type.equalsIgnoreCase("host_system"))
								{
									if(test!=null && test.trim().length()>0)
									{
										fakeType = discInfo.getTypeForHostTest(comp_name,test);
									}
									else
									{
										List temp_type_list=(List)discInfo.getServerTypesForNick(comp_name);
										if(temp_type_list!=null && temp_type_list.size()>0)
										{
											for(int i=0; i<temp_type_list.size(); i++)
											{
												String	temp_type=(String)temp_type_list.get(i);
												if(component_types_list!=null && temp_type!=null && component_types_list.contains(temp_type))
												{
													fakeType = temp_type;
													break;
												}
											}
										}
									}

									fakeType=(fakeType==null || fakeType.trim().length()==0)?"Host_system":fakeType;

									if (fakeType != null)
									{
										fakeType = fakeType.trim();
									}

									String comp_port_2=(String)discInfo.getPortForHost(comp_name,fakeType);
									if(comp_port_2!=null && comp_port_2.trim().length()>0 && (!comp_port_2.equals(comp_port)))
										comp_port=comp_port_2;
								}
								else
								{
									fakeType=comp_type;
								}

								comp_name=comp_name+":"+comp_port+":"+comp_sid;
							}//sarav url formed here
							//--end--
							
							String site_name_value="NULL";
							if(layer!=null && (layer.trim().equals("WEB_SITE") || layer.trim().equals("WEB_TRANSACTIONS")))
							{
								Vector site_vect=(Vector)esmb.getServiceNamesForComponent(accessPageName);
								
								if(site_vect!=null && site_vect.size()>0)
								{
									EgTopoInfo topoInfo=new EgTopoInfo("manager");
									for (int r=0; r<site_vect.size(); r++)
									{
										String s = (String) site_vect.get(r);
										String value = topoInfo.getValue("SERVICE",s);
										if(value!=null && value.trim().equalsIgnoreCase("site"))
										{
											site_name_value=s;
											break;
										}
									}
								}
							}

							url="/final/servlet/com.eg.EgDashboardController?site="+EgURLEncoder.encode(site_name_value,"UTF-8")+"&from=list&tab=layers&comptype="+EgURLEncoder.encode(fakeType,"UTF-8")+"&host="+EgURLEncoder.encode(comp_name,"UTF-8")+"&faketype="+EgURLEncoder.encode(fakeType,"UTF-8");

							if(layer!=null && layer.trim().length()>0)
							{
								url=url+"&layer="+EgURLEncoder.encode(layer,"UTF-8");
							}

							if(test!=null && test.trim().length()>0 && (descriptor==null || descriptor.trim().length()==0))
							{
								url=url+"&test="+EgURLEncoder.encode(test,"UTF-8")+"-"+"&qctr=2&tstate=UNKNOWN&msmt_host=&toDashBoardLayer=true&fromalarmWindow=true&findInfo=true";
							}
							else if(test!=null && test.trim().length()>0 && descriptor!=null && descriptor.trim().length()>0)
							{
								// split the msmt_host and descriptor and form the url.
								// by Saravanan.A on 18-7-2012
								ArrayList des_and_msmt =  com.egurkha.util.StringUtils.egTokenizer(descriptor, "~$~",true,false,true);//param 3-->includeEmpty,4-->unique,5-->trim
								if(des_and_msmt.size()==2)
								{
									String des_info=(String)des_and_msmt.get(0);
									des_info=(des_info==null || des_info.trim().length()==0|| des_info.equals("+"))?"":des_info;

									String m_host=(String)des_and_msmt.get(1);
									m_host=(m_host==null || m_host.trim().length()==0)?"":m_host;

									url=url+"&test="+EgURLEncoder.encode(test,"UTF-8")+"-"+EgURLEncoder.encode(des_info,"UTF-8")+"&qctr=2&tstate=UNKNOWN&msmt_host="+EgURLEncoder.encode(m_host,"UTF-8")+"&toDashBoardLayer=true&fromalarmWindow=true";
								}
								else if(des_and_msmt.size()==1)
								{
									String des_info=(String)des_and_msmt.get(0);
									des_info=(des_info==null || des_info.trim().length()==0 || des_info.equals("+"))?"":des_info;

									url=url+"&test="+EgURLEncoder.encode(test,"UTF-8")+"-"+EgURLEncoder.encode(des_info,"UTF-8")+"&qctr=2&tstate=UNKNOWN&msmt_host=&toDashBoardLayer=true&fromalarmWindow=true";
								}
								//---end--
							}
							else if(layer!=null && layer.trim().length()>0)
							{
								url=url+"&qctr=2&tstate=&msmt_host=&toDashBoardLayer=true&fromalarmWindow=true&QuickLaunchLayerOnly=true";
							}
						}
						else
						{
							url="/final/servlet/com.eg.EgMonitorController?monCmd=componentList&from=TreeMenu&action=component&searchIndComps=checked";
						}
					}
					else
					{
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
					}
				}
				else if(access.equalsIgnoreCase("virtualdashboard")){
					url="/final/monitor/vmwareDashboard.jsp?monCmdComeFrom=vmdashboard";
				}
				else if(access!=null && access.equalsIgnoreCase("LiveGraph")){
					url = "/final/monitor/livegraph/EgLiveGraphHome.jsp?";
					if(accessPageName != null && accessPageName.trim().length() > 0 && !accessPageName.equalsIgnoreCase("NULL") )
						url = url+"accessPageName=" + accessPageName;
				}
				else if(access!=null && access.equalsIgnoreCase("QuickInsight")){
					
					url = "/final/monitor/qinsight/EgQInsightHome.jsp?fromQuickLaunch=true";
					if(accessPageName != null && accessPageName.trim().length() > 0 && !accessPageName.equalsIgnoreCase("NULL"))
						url = url+"&accessPageName=" + accessPageName;
				}
				else if(access.equalsIgnoreCase("RumDashboard")){
					url="/final/monitor/realUserMonitorsDashboard.jsp?1=1";
					if(accessPageName != null && accessPageName.trim().length() > 0)
						url=url+"&layersTitle="+accessPageName;
				}
				else if(access.equalsIgnoreCase("UEDashboard") && accessPageName != null && accessPageName.trim().length() > 0){
					url="/final/monitor/endUserDashboard.jsp?access=allusers&userType="+accessPageName;
				}
				else if(access.equalsIgnoreCase("CitrixDashboard"))
				{
					accessPageName=(accessPageName==null || accessPageName.trim().length()==0 || accessPageName.equalsIgnoreCase("null"))?"Citrix_Dashboard":accessPageName;
					url="/final/monitor/citrixDashboard.jsp?iniName=eg_citrixdashboard&userBased=true&fromMenu=true&showConfig=true&dashboard_name="+accessPageName;
				}
				else if(access.equalsIgnoreCase("XenServerDashboard"))
				{
					accessPageName=(accessPageName==null || accessPageName.trim().length()==0 || accessPageName.equalsIgnoreCase("null"))?"Citrix_Xenserver_Dashboard":accessPageName;
					url="/final/monitor/citrixDashboard.jsp?iniName=eg_citrixdashboard&userBased=true&fromMenu=true&showConfig=true&dashboard_name="+accessPageName;
				}
				else if(access.equalsIgnoreCase("KeyUsers") && accessPageName != null && accessPageName.trim().length() > 0){
					url="/final/monitor/endUserDashboard.jsp?access=allusers&showKeyUser=true&userType="+accessPageName;
				}
				else if(access.equalsIgnoreCase("HistoryOfAlarms")){
					url="/final/monitor/EgSiteInfraView.jsp?disphist=yes";
					
					if(analysisBy != null && analysisBy.trim().length() > 0)
						url+="&analysisBy="+analysisBy;
					if(analysis != null && analysis.trim().length() > 0)
						url+="&analysis="+analysis;
					if(compstate != null && compstate.trim().length() > 0)
						url+="&compstate="+compstate;
					if(startTimeUrl != null && startTimeUrl.trim().length() > 0)
						url+="&startTimeUrl="+startTimeUrl;
					if(endTimeUrl != null && endTimeUrl.trim().length() > 0)
						url+="&endTimeUrl="+endTimeUrl;
					if(showEventHistory != null && showEventHistory.trim().length() > 0)
						url+="&showEventHistory="+showEventHistory;
					if(alertTest != null && alertTest.trim().length() > 0)
						url+="&alertTest="+alertTest;
					if(compTypeList != null && compTypeList.trim().length() > 0)
						url+="&compTypeList="+compTypeList;

				}
				else if(access.equalsIgnoreCase("BusinessDashboard")){
					url="/final/servlet/com.eg.EgMonitorController?monCmd=serviceList&from=MainDashboard&action=service&isServiceBusiDash=true&isFromMenu=true";
					if(strCsrfToken!=null && strCsrfToken.trim().length()>0 && !strCsrfToken.equalsIgnoreCase("null"))
						url = url + "&com.eg.CSRF_NONCE="+ strCsrfToken;
				}
				else if(access.equalsIgnoreCase("CurrentAlarms"))
				{
					accessPageName=(accessPageName==null || accessPageName.trim().length()==0 || accessPageName.equalsIgnoreCase("null"))?"":accessPageName;

					if(accessPageName!=null && accessPageName.trim().length()>0)
						url="/final/monitor/EgAlarms.jsp?showAlarms="+accessPageName+"&selectedSubFilterOption="+accessPageName;
					else
						url="/final/monitor/EgAlarms.jsp?";
				}
				else
				{
					String toReporterPage=request.getParameter("toReporterPage");
					if (StringUtils.isNull(toReporterPage))
					{
						toReporterPage = (String) session.getAttribute("toReporterPage");
						session.removeAttribute("toReporterPage");
					}
					if(toReporterPage != null && toReporterPage.equalsIgnoreCase("true"))
						url =uiIni.getValue("DAILY_EMAILER_LINKS",access);
					else
						url = uiIni.getValue("MONITOR_QUICK_MENU",access);
					if(url == null || url.trim().length() == 0)
						url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";

					if(analysisBy != null && analysisBy.trim().length() > 0)
						url+="&analysisBy="+analysisBy;
					if(analysis != null && analysis.trim().length() > 0)
						url+="&analysis="+analysis;
					if(compstate != null && compstate.trim().length() > 0)
						url+="&compstate="+compstate;
					if(startTimeUrl != null && startTimeUrl.trim().length() > 0)
						url+="&startTimeUrl="+startTimeUrl;
					if(endTimeUrl != null && endTimeUrl.trim().length() > 0)
						url+="&endTimeUrl="+endTimeUrl;
					if(showEventHistory != null && showEventHistory.trim().length() > 0)
						url+="&showEventHistory="+showEventHistory;
					if(alertTest != null && alertTest.trim().length() > 0)
						url+="&alertTest="+alertTest;
					if(compTypeList != null && compTypeList.trim().length() > 0)
						url+="&compTypeList="+compTypeList;
				}
			}
			else
			{
				url ="/final/servlet/com.eg.EgMonitorController?monCmd=dashboard";
			}
			url=url+"&egQuickLaunch=true";
		}
		if(EgInstallInfo.isSuperManager && login_as_egsm_in_sm && noManagersConfigured)
		{
			url= "/final/admin/EgDispManagers.jsp";
		}
	}
	if (isMonitor && isAlarmViewer)
	{
		if(fromSm!=null)
		{
			//fromSm.equals("hist")
			/*String component=request.getParameter("component");
			component = (component != null)?component:"";
			StringTokenizer st=new StringTokenizer(component,":");
			String  ctype="";
			String cname="";
			String port="";
			while(st.hasMoreTokens())
			{
				cname=st.nextToken();
				port=st.nextToken();
				ctype=st.nextToken();
			}
			url= "/final/monitor/componentMeasureTabSet.jsp?type="+ctype+"&site="+request.getParameter("site")+"&host="+cname+"&port="+port+"&info="+cname+"&state="+request.getParameter("tstate")+"&messy="+request.getParameter("measure");
			*/
			if(fromSm!=null && fromSm.trim().length()>0 && fromSm.equalsIgnoreCase("hist"))
			{
				url= "/final/monitor/EgFixHistory.jsp?component="+request.getParameter("component")+"&site="+request.getParameter("site")+"&test="+request.getParameter("test")+"&measure="+request.getParameter("measure");
			}
			else if(fromSm!=null && fromSm.trim().length()>0 && fromSm.equalsIgnoreCase("feedback"))
			{
				url= "/final/monitor/EgFixFeedBack.jsp?site="+request.getParameter("site")+"&trgthost="+request.getParameter("trgthost")+"&port="+request.getParameter("port")+"&test="+request.getParameter("test")+"&info="+request.getParameter("info")+"&comptype="+request.getParameter("comptype")+"&measure="+request.getParameter("measure")+"&msmttime="+request.getParameter("msmttime");
			}
			else
			{
				url = "/final/monitor/EgAlarms.jsp";
			}
		}
		currentMonitorHomePageURL=url;
%>
<%
	}
	boolean isOpenMyDashboard=false;
	String monitorLastSession=null;
	if(isMonitor && !fromSmart && !isAlarmQView && !isFromQuickLaunch)
	{
		String comeFromValue=request.getParameter("comeFrom");
		monitorLastSession=(String)session.getAttribute("monitorLastSession");
		session.removeAttribute("monitorLastSession");
		if(monitorLastSession!=null && comeFromValue==null)
		{
			// Based on Service Health enabled or disabled
			// By Saravanan.A on 28-2-2012
			if(isEnableServiceHealth || isEnableEndUserDashboard || isEnableSEUMDashboard || isEnableRUM)
			{
				url=monitorLastSession;
			}
			else if((!isEnableServiceHealth && !isEnableEndUserDashboard && !isEnableSEUMDashboard && !isEnableRUM) && (monitorLastSession.indexOf("serviceHealthMain.jsp")<0 && monitorLastSession.indexOf("endUserDashboard")<0 && monitorLastSession.indexOf("externalMonitorsDashboard") < 0 && monitorLastSession.indexOf("realUserMonitorDashboard") < 0))
			{
				if(monitorLastSession!=null && monitorLastSession.equals("/final/monitor/MyDashboard.jsp?newWindow=true"))
				{
					isOpenMyDashboard=true;
				}
				else
				{
					url=monitorLastSession;
				}
			}
			if(strCsrfToken!=null && strCsrfToken.trim().length()>0 && !strCsrfToken.equalsIgnoreCase("null"))
				url = url +"&com.eg.CSRF_NONCE="+strCsrfToken;
		}
	}
	if (isReport)
	{
		
%>
		<base target ="main">
		
<%
	}

	if (isConfig)
	{
%>
		<base target ="main">
		
<%
	}
	if (isSla && isEnableSLA)
	{
%>
		<base target ="main">
<%
		if(isSla && isEnableSLA )
		{
			String slaLastSession=(String)session.getAttribute("slaLastSession");
			if(slaLastSession!=null )
			{
				if(slaLastSession.indexOf("currentTab=")>11)
				{
					String lastViewedTab=(String)session.getAttribute("lastTabViewed");
					String afterViewTab=slaLastSession.substring(slaLastSession.indexOf("currentTab=")+11);
					String beforeViewTab=slaLastSession.substring(0,slaLastSession.indexOf("currentTab=")+11);
					afterViewTab=afterViewTab.substring(afterViewTab.indexOf("&"),afterViewTab.length());
					slaLastSession=beforeViewTab+lastViewedTab+afterViewTab;
				}
				session.removeAttribute("slaLastSession");
				url=slaLastSession;
			}	
		}
	}
	if (noValidUserRolesForSM)//if logged in user is of role either REPORTER or CONFIG , use monitor skin
	{
%>
		<base target = "main">
<%
	}
	
	boolean isAdminNewWindow = false;
	boolean isMonitorNewWindow = false;
	boolean isReporterNewWindow = false;
	boolean isConfigNewWindow=false;
	boolean isSlaNewWindow=false;	
	
	boolean isAdminSeperator=false;
	boolean isMonitorSeperator = false;
	boolean isReporterSeperator=false;
	boolean isConfigSeperator=false;
	boolean isSlaSeperator=false;	
	
	
	boolean adminPressed=false;
	boolean monitorPressed=false;
	boolean reporterPressed=false;
	boolean configPressed=false;
	boolean slaPressed=false;
	
	if(pressed!=null )
	{
		if(pressed.equals("admin"))
		{
			adminPressed = true;
		}
		if(pressed.equals("monitor"))
		{
			monitorPressed = true;
		}
		if(pressed.equals("reporter"))
		{
			reporterPressed = true;
		}
		if(pressed.equals("config"))
		{
			configPressed = true;
		}
		if(pressed.equals("sla") && isEnableSLA)
		{
			slaPressed = true;
		}
	}
	else
	{
		if(entry.equals("admin"))
		{
			adminPressed=true;
			if(EgInstallInfo.isSuperManager)
			{
				if(!login_as_egsm_in_sm)
				{
					adminPressed=false;
					monitorPressed = true;
				}
			}
		}
		if(entry.equals("monitor"))
		{
			monitorPressed = true;
		}
		if(entry.equals("reporter"))
		{
			reporterPressed = true;
		}
		if(entry.equals("config"))
		{
			configPressed = true;
		}
		if(entry.equals("sla") && isEnableSLA)
		{
			slaPressed = true;
		}				
	}
	
	if(entry!=null &&  newWindow!=null)
	{
		if(entry.equals("admin") && newWindow.equalsIgnoreCase("yes"))
		{
			isMonitorNewWindow = true;
			isReporterNewWindow = true;
			isConfigNewWindow=true;
			isSlaNewWindow=true;
			
			isAdminSeperator=true;
			isMonitorSeperator = true;
			isReporterSeperator=true;
			isConfigSeperator=true;
			isSlaSeperator=true;
			
			adminPressed=true;
			
			
			
		}
		if(entry.equals("monitor") && newWindow.equalsIgnoreCase("yes"))
		{
			isAdminNewWindow = true;
			isReporterNewWindow = true;
			isConfigNewWindow=true;
			
			
			isAdminSeperator=true;
			isMonitorSeperator = true;
			isReporterSeperator=true;
			isConfigSeperator=true;
			isSlaSeperator=true;
			
			monitorPressed=true;
			
		}
		if(entry.equals("reporter") && newWindow.equalsIgnoreCase("yes"))
		{
			isMonitorNewWindow = true;
			isAdminNewWindow = true;
			isConfigNewWindow=true;
			isSlaNewWindow=true;
			
			isAdminSeperator=true;
			isMonitorSeperator = true;
			isReporterSeperator=true;
			isConfigSeperator=true;
			isSlaSeperator=true;
			
			reporterPressed=true;
		}
		if(entry.equals("config") && newWindow.equalsIgnoreCase("yes"))
		{
			isMonitorNewWindow = true;
			isReporterNewWindow = true;
			isAdminNewWindow=true;
			isSlaNewWindow=true;
			
			isAdminSeperator=true;
			isMonitorSeperator = true;
			isReporterSeperator=true;
			isConfigSeperator=true;
			isSlaSeperator=true;
			
			configPressed=true;
		}
		if(entry.equals("sla")  && isEnableSLA && newWindow.equalsIgnoreCase("yes"))
		{
			isMonitorNewWindow = true;
			isReporterNewWindow = true;
			isAdminNewWindow=true;
			isConfigNewWindow=true;
		
			isAdminSeperator=true;
			isMonitorSeperator = true;
			isReporterSeperator=true;
			isConfigSeperator=true;
			isSlaSeperator=true;
			slaPressed=true;
		}		
	}
	
	if(hasAdminTab)
	{
		if(!hasMonitorTab && !hasReporterTab && !hasConfigTab && !hasSlaTab)
			isAdminSeperator=true;
	}
	if(hasMonitorTab)
	{

		if(!hasReporterTab && !hasConfigTab && !hasSlaTab)
			isMonitorSeperator=true;
	}
	if(hasReporterTab)
	{
		
		if(!hasConfigTab && !hasSlaTab)
			isReporterSeperator=true;
	}
	if(hasConfigTab)
	{
		if(!hasSlaTab)
			isConfigSeperator=true;
	}
	if(hasSlaTab && isEnableSLA)
	{
		isSlaSeperator=true;
	}
	
	boolean isAdminNewWindowIcon = false;
	boolean isMonitorNewWindowIcon = false;
	boolean isReporterNewWindowIcon = false;
	boolean isConfigNewWindowIcon=false;
	boolean isSlaNewWindowIcon=false;

	
	if(!hasAdminTab)
	{
		isAdminNewWindow = true;
		isAdminNewWindowIcon=true;
		isAdminSeperator=true;
		
	}
	if(!hasMonitorTab)
	{
		isMonitorNewWindow = true;
		isMonitorNewWindowIcon=true;
		isMonitorSeperator=true;
		
	}
	if(!hasReporterTab)
	{
		isReporterNewWindow = true;
		isReporterNewWindowIcon=true;
		isReporterSeperator=true;
	
	}
	
	if(!hasConfigTab)
	{
		isConfigNewWindow=true;
		isConfigNewWindowIcon=true;
		isConfigSeperator=true;
	}
	if(!hasSlaTab)
	{
		isSlaNewWindow=true;
		isSlaNewWindowIcon=true;
		isSlaSeperator=true;
	}


	if(newWindow!=null && newWindow.equalsIgnoreCase("yes"))
	{
		isAdminNewWindowIcon = true;
		isMonitorNewWindowIcon = true;
		isReporterNewWindowIcon = true;
		isConfigNewWindowIcon=true;
		isSlaNewWindowIcon=true;
	}

	String smartHome=request.getParameter("SmartHomePage");
	smartHome=(smartHome==null)?"":smartHome;
    EgDateInfo egDate = new EgDateInfo();
    Date local_date = new Date(egDate.egetUTCDate());
    cal.setTime(local_date);
    cal.setTimeZone(egDate.getRealTimeZone());
    String temp1 = (cal.get(cal.MONTH)+1) + "/" + cal.get(cal.DAY_OF_MONTH) + "/" +cal.get(cal.YEAR);
    String mgr_time = cal.get(cal.HOUR_OF_DAY)+":"+cal.get(cal.MINUTE)+":"+cal.get(cal.SECOND);
    String dispDate = DateUtil.changeDateFormat(temp1,"MM/dd/yyyy",currentDateFormat);
    TimeZone tz = egDate.getRealTimeZone();
    String tzName = tz.getDisplayName(tz.inDaylightTime(local_date), TimeZone.SHORT);
    EgTimeZoneConverter timeZoneConverter = new EgTimeZoneConverter(dispDate+" "+mgr_time,user);
    String loginUserDateTime = (String)timeZoneConverter.getDate(false);
    Date loginUserDate = (Date)timeZoneConverter.getDate(true);
    TimeZone user_tz = (TimeZone)timeZoneConverter.getTimeZone();
    if( loginUserDateTime != null && !loginUserDateTime.trim().equals(""))
    {
    	dispDate = loginUserDateTime;
		tzName = user_tz.getDisplayName(user_tz.inDaylightTime(loginUserDate), TimeZone.SHORT);
    }
	IniFile idxControl =  new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_ui.ini");
	boolean isDynamicDashboard=false;
	boolean showMonitoringDomainPopup=false;
	String showMonDomainPopup=customDashboard.getValue("DASHBOARD_SETTINGS","showMonitoringDomainPopup");
	if(showMonDomainPopup!=null && showMonDomainPopup.equalsIgnoreCase("yes"))
	{
		showMonitoringDomainPopup=true;
	}
	String monHomeDashURL=user.getMonitorHomePage();
	String dynamicHome=user.getMonitorHomePageOption();//idxControl.getValue("MONITOR_DASHBOARD","DynamicHome");
	if(StringUtils.isNull(dynamicHome))
		dynamicHome="default";

	String dynamicHomePageSelection="";
	String dynamicDashboardURL="";
	if(hasMyDashboardEnabled && (!isAlarmViewer && !fromSmart && !isAlarmQView) && (dynamicHome!=null && dynamicHome.equalsIgnoreCase("dynamic")))
	{
		isDynamicDashboard=true;
		OneClickDashboardModel oneClickModel=new OneClickDashboardModel(_user);
		dynamicDashboardURL=oneClickModel.getDynamicDashboardURL();
		if(!StringUtils.isNull(dynamicDashboardURL))
		{
			HidForHomePageUrl=dynamicDashboardURL;
			boolean setDynamicDashUrl=true;
			if(url!=null && url.indexOf("/final/monitor/MyDashboard.jsp?")>-1)
			{
				if(url.indexOf("setMonitorHome=true")==-1)
				{
					setDynamicDashUrl=false;
				}
			}
			if(setDynamicDashUrl)
			{
				monHomeDashURL=dynamicDashboardURL;
				currentMonitorHomePageURL=dynamicDashboardURL;
				HidForHomePageUrl=dynamicDashboardURL;
			}
		}
	}

	if(isMonitor && !fromSmart && !isAlarmQView)
	{
		if(isDynamicDashboard)
		{
			if(!StringUtils.isNull(dynamicDashboardURL))
			{
				boolean setDynamicDashUrl=true;
				if(url!=null && url.indexOf("/final/monitor/MyDashboard.jsp?")>-1)
				{
					if(url.indexOf("setMonitorHome=true")==-1)
					{
						setDynamicDashUrl=false;
					}
				}
				if(setDynamicDashUrl)
				{
					monHomeDashURL=dynamicDashboardURL;
					currentMonitorHomePageURL=dynamicDashboardURL;
					HidForHomePageUrl=dynamicDashboardURL;
					url=dynamicDashboardURL;
				}
			}
		}
	}
	String loggedInUserId=user.getLoginID();

	IniFile ServicesIni = new IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_services.ini");
	String eGMgrModel = ServicesIni.getValue("MISC_ARGS","eGMgrModel");
	String hasServiceAssignmentReportEnabled = "true";
	if (!userRole.hasAllComponentAccess())
	{
		hasServiceAssignmentReportEnabled = "false";
	}
	String hasDomainRights = "true";
	String hasSAMLRights = "true";

	if (eGMgrModel != null && eGMgrModel.equalsIgnoreCase("msp"))
	{
		hasDomainRights = "false";
		hasSAMLRights = "false";
	}
%>
	<script type="text/javascript" src="/final/admin/eg_scripts/ie5.js"></script>
	
	<script type="text/javascript" src ="/final/monitor/eg_scripts/homepage.js"></script>

<!-- fancy Scroll -->
	<!-- <script src="/final/jquery/jquery.min.js"></script> -->
	<script src="/final/jquery/jquery.js"></script>
	<script src="/final/scripts/tinymce/tinymce.min.js"></script>
	<meta http-equiv = "Content-Type" content = "text/html; charset=utf-8">

	<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">

	<script language = "javascript">
	
	function filterEncode(text)
	{
		//['%;()=]
		var filterEncodeChar = ['[',']','(',')','=','&','%','\'',';','\\','"'];
		var filterDecodeText = ['|lsbr|','|rsbr|','|lbr|','|rbr|','|eq|','|ampsnd|','|per|','|squot|','|scol|','|slash|','|dqt|'];
		try
		{
			if(text != null && text != undefined && !Ext.isEmpty(text))
			{
				for(var a in filterEncodeChar)
				{
					var encode_char = filterEncodeChar[a];
					var decode_char = filterDecodeText[a];
					do
					{
						text=text.replace(encode_char,decode_char);
					}
					while (text.indexOf(encode_char)>-1);
				}
			}
		}
		catch (e)
		{
		}
		return text;
	}

	function filterDecode(text)
	{
		//['%;()=]
		var filterEncodeChar = ['[',']','(',')','=','&','%','\'',';','\\','"'];
		var filterDecodeText = ['|lsbr|','|rsbr|','|lbr|','|rbr|','|eq|','|ampsnd|','|per|','|squot|','|scol|','|slash|','|dqt|'];
		try
		{
			if(text != null && text != undefined && !Ext.isEmpty(text))
			{
				for(var a in filterEncodeChar)
				{
					var encode_char = filterEncodeChar[a];
					var decode_char = filterDecodeText[a];
					do
					{
						text=text.replace(decode_char,encode_char);
					}
					while (text.indexOf(decode_char)>-1);
				}
			}
		}
		catch (e)
		{
		}
		return text;
	}

	</script>
	<script language = "javascript">
	var alarmsTitle = '<%=alarmsTitle%>';
	var mailIdTitle = '<%=mailIdTitle%>';
	var tabPopUp;
	var isShowAlarmsInLightBox='<%=isShowAlarmsInLightBox%>';
	var isShowSlaAlertsPopup='<%=isShowSlaAlertsPopup%>';
	var hktThemeTitle='<%=strPrefix%>';
	var isListView='<%=isListView%>';
	var isSapMenuEnable=<%=isSapMenuEnable%>;
	var alarmWindowRef;
	var win = null;
	var windowsList = new Array();
	var hKT_ThemeEnabled='<%=ui.isHKTThemeEnabled()%>';
	var isHKT_ThemeEnabled=(hKT_ThemeEnabled=='true'?true:false);
	//var homepage="<%//=user.getMonitorHomePage()%>"
	var homepage="<%=currentMonitorHomePageURL%>";
	var smartHomePage="<%=smartHome%>";
	var isDynamicDashboard="eval('<%=isDynamicDashboard%>')";
	var loggedInUserId='<%=loggedInUserId%>';
	var newwin="<%=newWindow%>";
	var helpURL='<%=helpURL%>';
	var isAlarmViewerUser='<%=isAlarmViewer%>';
	var HomePageURL = '<%=currentMonitorHomePageURL%>';
	var isDisableMydashboardPopout='<%=isDisableMydashboardPopout%>';
	var moduleName = '<%=entry%>';
	var egTheme = '<%=tabIMG%>';
	var uname_time='<%=EgURLEncoder.encode(id,"UTF-8")%>'
	var hideAlarmPopup="<%=hideAlarmPopup%>";
	var showMonitoringDomainPopup="<%=showMonitoringDomainPopup%>";

	// Role based admin menu - Start.
	var isNonSharedUser = '<%=isNonSharedUser%>';
	var hasServiceAssignmentReportEnabled = '<%=hasServiceAssignmentReportEnabled%>';
	var hasDomainRights = '<%=hasDomainRights%>';
	var hasSAMLRights = '<%=hasSAMLRights%>';
	var hasComponentMangamentEnabled = '<%=hasComponentMangamentEnabled%>';
	var hasComponentGrpEnabled = '<%=hasComponentGrpEnabled%>';
	var hasSegmentConfigEnabled = '<%=hasSegmentConfigEnabled%>';
	var hasServiceConfigEnabled = '<%=hasServiceConfigEnabled%>';
	var hasZonesEnabled = '<%=hasZonesEnabled%>';
	var hasAgentTestEnabled = '<%=hasAgentTestEnabled%>';
	var hasGlobalTestEnabled = '<%=hasGlobalTestEnabled%>';
	var hasRedundantMgrEnabled = '<%=hasRedundantMgrEnabled%>';
	var hasAgentSettingsEnabled = '<%=hasAgentSettingsEnabled%>';
	var hasAgentStatusEnabled= '<%=hasAgentStatusEnabled%>';
	var hasGlobalThreshEnabled= '<%=hasGlobalThreshEnabled%>';
	var hasAgentThreshEnabled= '<%=hasAgentThreshEnabled%>';
	var hasMaintenancePolicyEnabled= '<%=hasMaintenancePolicyEnabled%>';
	var hasManagerConfigEnabled= '<%=hasManagerConfigEnabled%>';
	var hasICEnabled = '<%=hasICEnabled%>';
	var hasUserManagementEnabled = '<%=hasUserManagementEnabled%>';
	var hasReportsConfigEnabled = '<%=hasReportsConfigEnabled%>';
	var hasAuditsEnabled = '<%=hasAuditsEnabled%>';
	var hasDiscoveryEnabled = '<%=hasDiscoveryEnabled%>';
	var hasExtRemAgentsEnabled = '<%=hasExtRemAgentsEnabled%>';
	var hasAssetManagementEnabled = '<%=hasAssetManagementEnabled%>';
	var infraPanel = '<%=infraPanel%>';
	var agentPanel = '<%=agentPanel%>';
	var alertPanel = '<%=alertPanel%>';
	var icPanel = '<%=icPanel%>';
	var umPanel = '<%=umPanel%>';
	var setPanel = '<%=setPanel%>';
	var misPanel = '<%=misPanel%>';
	var auditPanel = '<%=auditPanel%>';
	var nofPanel = '<%=nofPanel%>';
	var isLimitedAdmin = '<%=isLimitedAdmin%>';
	var showLicensePolicy = '<%=showLicensePolicy%>';
	// Role based admin menu - End.

	// Role based Config menu - Start.
	var hasInventoryEnabled = '<%=hasInventoryEnabled%>';
	var hasCurrentConfigEnabled = '<%=hasCurrentConfigEnabled%>';
	var hasChangesEnabled = '<%=hasChangesEnabled%>';
	var hasConsolidatedViewEnabled = '<%=hasConsolidatedViewEnabled%>';
	var hasThinClientEnabled = '<%=hasThinClientEnabled%>';
	var hasSettingsEnabled = '<%=hasSettingsEnabled%>';
	var hasComparisonEnabled = '<%=hasComparisonEnabled%>';
	var hasComplianceCheckEnabled = '<%=hasComplianceCheckEnabled%>';

	var inventoryPanel = '<%=inventoryPanel%>';
	var changePanel = '<%=changePanel%>';
	var settingsPanel = '<%=settingsPanel%>';
	var thinClientPanel = '<%=thinClientPanel%>';
	var nofConfigPanel = '<%=nofConfigPanel%>';

	var no_curr_alarms = '<%=no_curr_alarms%>';

	// Role based Config menu - End.
	var hasTVModeSelectedscreens='<%=isTVModeSelectedscreens%>'=='true';
	var hasGraphmenuEnabled = "true";
	var hideTrend = '<%=hideTrendTab%>';
	var unauthuserpage=new Object();	
	unauthuserpage.hasMeasuregraphEnabled= '<%=hasMeasuregraphEnabled%>';
	unauthuserpage.hasSummarygraphEnabled= '<%=hasSummarygraphEnabled%>';
	unauthuserpage.hasTrendgraphEnabled= '<%=hasTrendgraphEnabled%>';
	unauthuserpage.hasLivegraphEnabled= '<%=hasLivegraphEnabled%>';
	unauthuserpage.hasTransactionConfigEnabled= '<%=hasTransactionConfigEnabled%>';
	unauthuserpage.hasAlarmHistoryEnabled= '<%=hasAlarmHistoryEnabled%>';
	unauthuserpage.hasFeedbackEntryEnabled= '<%=hasFeedbackEntryEnabled%>';
	unauthuserpage.hasFixHistoryEnabled= '<%=hasFixHistoryEnabled%>';
	unauthuserpage.hasDetailedDiagnosisEnabled= '<%=hasDetailedDiagnosisEnabled%>';
	unauthuserpage.hasQuickInsightEnabled= '<%=hasQuickInsightEnabled%>';
	unauthuserpage.hasMyDashboardEnabled= '<%=hasMyDashboardEnabled%>';
	var hasGraphmenuEnabled="true";
	if(unauthuserpage.hasMeasuregraphEnabled=="false" && unauthuserpage.hasSummarygraphEnabled=="false" && unauthuserpage.hasTrendgraphEnabled=="false" && unauthuserpage.hasLivegraphEnabled=="false")
	{
		hasGraphmenuEnabled="false";
	}
<%
	boolean showAlertAdmin=(uiIni.getValue("SMART_ALERT","admin")).trim().equalsIgnoreCase("true");
	boolean showAlertMonitor=(uiIni.getValue("SMART_ALERT","monitor")).trim().equalsIgnoreCase("true");
	boolean showAlertReporter=(uiIni.getValue("SMART_ALERT","reporter")).trim().equalsIgnoreCase("true");
	boolean showAlertConfig=(uiIni.getValue("SMART_ALERT","config")).trim().equalsIgnoreCase("true");
	boolean showAlertPopup=(uiIni.getValue("SMART_ALERT","popup")).trim().equalsIgnoreCase("true");
	boolean showAlertSla=(uiIni.getValue("SMART_ALERT","sla")).trim().equalsIgnoreCase("true");
%>
	var showAlertAdmin ='<%=showAlertAdmin%>';
	var showAlertMonitor ='<%=showAlertMonitor%>';
	var showAlertReporter ='<%=showAlertReporter%>';
	var showAlertConfig ='<%=showAlertConfig%>';
	var showAlertSla ='<%=showAlertSla%>';
	var alarmsPopupTitle='<egui:intnl text="monitor.common.Current Alarms" />/<egui:intnl text="monitor.common.Unknowns" />';
	var newWindow = '<%= mappingInfo.getTextDescription("monitor.common.New Window")%>';
	var alarmHelp = '<%= mappingInfo.getTextDescription("monitor.common.Help")%>';
	var monHomeLbl = '<%= mappingInfo.getTextDescription("admin.common.Set Monitor Home")%>';
	var defaultLbl = '<%= mappingInfo.getTextDescription("admin.common.Default")%>';
	var dashTempLbl = '<%= mappingInfo.getTextDescription("admin.common.Dashboard Templates")%>';
	var submitLbl = '<%= mappingInfo.getTextDescription("admin.common.Submit")%>';
	var editProfLbl = '<%= mappingInfo.getTextDescription("admin.common.Edit Profile")%>';

	if(smartHomePage==null || smartHomePage=='null')
	{
		smartHomePage='';
	}
	function test()
	{
		var helpwin = window.open(helpURL,"helpwindow","toolbar=no,menubar=no,location=no,status=no,width=600,height=400,left=206,top=155,screenx=0,screeny=0,resizable=yes,scrollbars=1,scrollbars=yes");
		helpwin.focus();
		openWindow(helpURL,"helpwindow","toolbar=no,menubar=no,location=no,status=no,width=600,height=400,left=206,top=155,screenx=0,screeny=0,resizable=yes,scrollbars=1,scrollbars=yes");
	}

	function loadConfigWindow(QString)
	{
		var url = '';
		var params = '';
		var len = QString.indexOf('?');
		if (len > -1)
		{
			url = QString.substring(0,len);
			params = QString.substring(len+1);
		}

		var strArr = params.split('&');

		var form = document.createElement('form');
		form.setAttribute('target', '_parent');
		form.setAttribute('method', 'post');
		form.setAttribute('action', url);

		for (var i=0; i<strArr.length; i++) 
		{
			var name = '';
			var value = '';
			var paramValue = strArr[i];
			var paramLen = paramValue.indexOf('=');
			if (paramLen > -1)
			{
				name = paramValue.substring(0,paramLen);
				value = paramValue.substring(paramLen+1);
			}
			if (strArr.hasOwnProperty(i)) 
			{
				var hiddenField = document.createElement('input');
				hiddenField.setAttribute('type', 'hidden');
				hiddenField.setAttribute('name', name);
				hiddenField.setAttribute('value', value);

				form.appendChild(hiddenField);
			}
		}

		document.body.appendChild(form);
		form.submit();
	}

	function postCustomFormSubmit(QString)
	{
		var url = '';
		var params = '';
		var len = QString.indexOf('?');
		if (len > -1)
		{
			url = QString.substring(0,len);
			params = QString.substring(len+1);
		}

		var strArr = params.split('&');

		var form = document.createElement('form');
		form.setAttribute('target', 'newindow');
		form.setAttribute('method', 'post');
		form.setAttribute('action', url);

		for (var i=0; i<strArr.length; i++) 
		{
			var name = '';
			var value = '';
			var paramValue = strArr[i];
			var paramLen = paramValue.indexOf('=');
			if (paramLen > -1)
			{
				name = paramValue.substring(0,paramLen);
				value = paramValue.substring(paramLen+1);
			}
			if (strArr.hasOwnProperty(i)) 
			{
				var hiddenField = document.createElement('input');
				hiddenField.setAttribute('type', 'hidden');
				hiddenField.setAttribute('name', name);
				hiddenField.setAttribute('value', value);

				form.appendChild(hiddenField);
			}
		}
		tabPopUp = window.open("", "newindow", "toolbar=no,location=no,status=no,menubar=no,width=1024,height=720,left=0,top=0,screenx=0,screeny=0,resizable=yes");

		document.body.appendChild(form);
		form.submit();
	}

	function new_window(val)
	{
		if (val == "admin")
		{
			if(newwin!=null&&!newwin!=""&&newwin=="yes")
			{
				tabPopUp= window.open("/final/egIndex.jsp?entry=admin&newwindow=no",
						"newindow",
						"toolbar=no,location=no,status=no,menubar=no,width=1024,height=720,left=0,top=0,screenx=0,screeny=0;resizable=yes");
				//tabPopUp.addEventListener("beforeunload", newWindowCloseEvent, false);
				// For IE Support changes
				tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
				  (tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false
				);
			}
			else
			{
				tabPopUp= window.open("/final/egIndex.jsp?entry=admin&newwindow=yes",
						"newindow",
						"toolbar=no,location=no,status=no,menubar=no,width=1024,height=720,left=0,top=0,screenx=0,screeny=0;resizable=yes");
				//tabPopUp.addEventListener("beforeunload", newWindowCloseEvent, false);
				// For IE Support changes
				tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
				  (tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false
				);

			}
		}
		else if (val == "monitor")
		{
			if (reqFrom != null && reqFrom == "clsTrial")
			{
				postCustomFormSubmit("/final/egm?entry=monitor&newwindow=yes&displayTab=monitor&reqFrom=clsTrial");
			}
			else
			{
				postCustomFormSubmit("/final/egm?entry=monitor&newwindow=yes&displayTab=monitor");
			}
			
			var timer = setInterval(function() {
				if(tabPopUp) 
				{  
					clearInterval(timer); 
					tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
					(tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);
				}
			}, 1000);

			// For IE Support changes
			//tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
			//  (tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);

		}
		else if (val == "reporter")
		{
			// For IE Support changes
			postCustomFormSubmit("/final/egm?entry=reporter&newwindow=yes&displayTab=reporter");

			var timer = setInterval(function() {
				if(tabPopUp) 
				{  
					clearInterval(timer); 
					tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
					(tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);
				}
			}, 1000);
			//tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
			//  (tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);

		}
		else if (val == "config")
		{
			postCustomFormSubmit("/final/egm?entry=config&newwindow=yes&displayTab=config");

			var timer = setInterval(function() {
				if(tabPopUp) 
				{  
					clearInterval(timer); 
					tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
					(tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);
				}
			}, 1000);

			// For IE Support changes
			//tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
			//  (tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);
		}
		else if (val == "sla")
		{
			tabPopUp = window.open("/final/egIndex.jsp?entry=sla&newwindow=yes&displayTab=sla",
						"newindow",
						"toolbar=no,location=no,status=no,menubar=no,width=1024,height=720,left=0,top=0,screenx=0,screeny=0,resizable=yes");
			//tabPopUp.addEventListener("beforeunload", newWindowCloseEvent, false);
			// For IE Support changes
			//tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
			//  (tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);

			var timer = setInterval(function() {
				if(tabPopUp) 
				{  
					clearInterval(timer); 
					tabPopUp[tabPopUp.addEventListener ? 'addEventListener' : 'attachEvent'](
					(tabPopUp.attachEvent ? 'on' : '') + 'beforeunload', newWindowCloseEvent, false);
				}
			}, 1000);
		}
	}

	function newWindowCloseEvent() {
		Ext.onReady(function(){
			Ext.Ajax.request({
					url : '/final/admin/setSessionAttribute.jsp',
					method : 'POST',
					params : {
						action: 'childwindowclosed'
					},
					success : function(response)
					{
					}
			});
		});
	}

	function openMonitoringDomainSelectionPopup()
	{
		if(monitorPressed)
		{
			var monitoringDomainSelectionPopup=Ext.getCmp('monitoringDomainSelectionPopup');
			if(!Ext.isEmpty(monitoringDomainSelectionPopup))
			{
				Ext.destroy(monitoringDomainSelectionPopup);
				Ext.EventManager.removeAll('monitoringDomainSelectionPopup');
			}
			
			var mainIFrameObj = document.getElementById('main');
			var mainIfrmSrc=mainIFrameObj.src;
			if(mainIfrmSrc!=null && mainIfrmSrc.indexOf("MyDashboard.jsp")>-1)
			{
				return;
			}
			var leftPosition =25;
			var cwidth1=0;
			var left=0;
			if (Ext.getBody().getViewSize().width < 1100)
			{
				cwidth1=Ext.getBody().getViewSize().width-714;
				leftPosition = 25;
				left = (Ext.getBody().getViewSize().width/2)-(cwidth1/2);
			}
			else
			{
				cwidth1=Ext.getBody().getViewSize().width-804;
				leftPosition = 78;
				left = (Ext.getBody().getViewSize().width/2)-(cwidth1/2);
			}
			var cwidth2=(cwidth1/2);
			var cheight=Ext.getBody().getViewSize().height-240;
			var top = (Ext.getBody().getViewSize().height/2)-(cheight/2);

			Ext.onReady(function(){
				Ext.Ajax.request({
					url : '/final/servlet/com.eg.EgMonitorRequestDispatcher',
						method : 'POST',
						params : "comesFrom=myDashboard&action=getMonitoringDomains",
						async : false,
						success : function(response)
						{
							var jsonText=response.responseText;
							var jsonData=Ext.decode(jsonText);
							if(jsonData!=null && jsonData.hasOwnProperty('monitoringDomains'))
							{
								var radioBtnArr=[];
								for(var mDomainCntr in jsonData.monitoringDomains)
								{
									var mDomainObj=jsonData.monitoringDomains[mDomainCntr];
									var dispField=mDomainObj.displayField;
									var valField=mDomainObj.valueField;

									radioBtnArr.push({
										boxLabel: dispField,
										name: 'domainName',
										inputValue: valField,
										cls: 'radiobt'
									});
								}
								var radioGrpObj={
									xtype: 'radiogroup',
									width: 450,
									columns: 2,
									vertical: true,
									labelAlign: 'right',
									labelWidth:120,
									fieldLabel: '',
									id: 'monitoringDomainOpt',
									name: 'monitoringDomainOpt',
									items : radioBtnArr
								};
								 Ext.widget("window", {
									id : 'monitoringDomainSelectionPopup',
									name : 'monitoringDomainSelectionPopup',
									title : 'Pick a Dashboard as Home Page',
									modal : true,
									resizable: false,
									width:cwidth1 ,
									frame: false,
									constrain: true,
									ghost:false,
									style:{'left':''+leftPosition+' !important'},
									scroll: false,
									autoScroll: false,
									border: false,
									bodyPadding : '10',
									padding: "10",
									closeAction:'destroy',
									layout : {
										type : 'vbox',
										align : 'stretch'
									},
									dockedItems: [{
										xtype: 'toolbar',
										dock: 'bottom',
										cls:'egFooter',
										items: [
											'->',
										{
											xtype : 'button',
											buttonAlign:'center',
											text : " UPDATE",
											margin:6,
											padding:'0 10 0 10',
											cls : 'buttonNewBig',
											buttonAlign : 'center',
											handler : function(btn)
											{
												var selectedDomainOpt = Ext.getCmp('monitoringDomainOpt').getChecked();
												var selectedDomain =null;
												if(!Ext.isEmpty(selectedDomainOpt))
												{
													selectedDomain = selectedDomainOpt[0].inputValue;
												}
												if(selectedDomain==null || selectedDomain=='' || selectedDomain=='undefined' || selectedDomain=='none')
												{
													Ext.Msg.show({
														title:'Alert',
														 msg: 'Please choose a monitoring domain',
														buttons: Ext.Msg.OK,
														icon: Ext.Msg.WARNING
													 });
												}
												Ext.Ajax.request({
												url : '/final/servlet/com.eg.egMyDashboardController',
													method : 'POST',
													params : "action=setDynamicDashboard&selectedMonitoringDomain="+encodeURIComponent(selectedDomain),
													async : false,
													success : function(response)
													{
														btn.up('panel').close();
														var jsonText=response.responseText;
														var jsonData=Ext.decode(jsonText);
														//window.location.href='/final/egIndex.jsp?entry=monitor&displayTab=all&uname=&integritycheckviolated=false&hideMonitoringDomainPopup=true';
														var tabeSetObj=Ext.getCmp('tabset');
														tabeSetObj.changeModuleTab('/final/egIndexJson.jsp?entry=monitor&displayTab=all&uname=&integritycheckviolated=false&hideMonitoringDomainPopup=true');
														//tabeSetObj=null;
														//delete tabeSetObj;
													}
												});
											}
										},'->'
										]
									}],
									items : radioGrpObj,
									listeners: {
										'afterrender' : function(w)
										{
										},
										show: function(win) {
										if (this.modal) {
											var dom = Ext.dom.Query.select('.x-mask');
											var el = Ext.get(dom[0]);
											el.addCls('windowModal');
										}
										},
										hide:  function(win) {
										if (this.modal) {
											var dom = Ext.dom.Query.select('.x-mask');
											var el = Ext.get(dom[0]);
											el.removeCls('windowModal');
										}
										},
										close:  function(win) {
										if (this.modal) {
											var dom = Ext.dom.Query.select('.x-mask');
											var el = Ext.get(dom[0]);
											el.removeCls('windowModal');
										}
										}},
										tools : [
												{
													xtype : 'button',
													iconCls : 'iconHelp',
													listeners: {
													afterrender: function () {
													Ext.create('Ext.tip.ToolTip', {
													target: this.id,
													anchor: 'top',
													cls: 'yellowTip',
													trackMouse: true,
													html: alarmHelp
													});
													}
													},
													style : {
														'background' : 'none',
														'border' : '0px',
														'margin':'0 10 0 0',
													},
													handler : function()
													{
													}
												}
											]
									}).show();
									Ext.state.Manager.set(loggedInUserId+"_isMonDomainPopupLoaded", "yes");
								}
							}
				});
			});
		}
	}
	function openAlarmPopupWindow()
	{
		openAlarmPopupWindow(null);
	}
	function openAlarmPopupWindow(alarmsLink)
	{
		openAlarmPopupWindow(alarmsLink,null);
	}
	var alarmPop;
	function openAlarmPopupWindow(alarmsLink,compType)
	{
		if((monitorPressed!=null && monitorPressed==true || monitorPressed=="true") && (isAlarmViewerUser!=null && isAlarmViewerUser!="true"))
		{
			//var cwidth1=Ext.getBody().getViewSize().width-240;
			if (Ext.getBody().getViewSize().width < 1100)
			{
				var cwidth1=Ext.getBody().getViewSize().width-64;
				var leftPosition = 25;
				var left = (Ext.getBody().getViewSize().width/2)-(cwidth1/2);
			}
			else
			{
				var cwidth1=Ext.getBody().getViewSize().width-154;
				var leftPosition = 78;
				var left = (Ext.getBody().getViewSize().width/2)-(cwidth1/2);
			}
			var cwidth2=(cwidth1/2);			
			//var cheight=Ext.getBody().getViewSize().height-120;
			var cheight=Ext.getBody().getViewSize().height-240;
			var top = (Ext.getBody().getViewSize().height/2)-(cheight/2);
			
			var winTitle = '';
			var zoneNam = '';
			if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined)
			{
				var vars = alarmsLink.split('&');
				for(var i = 0; i < vars.length; i++){
				var pair = vars[i].split('=');
				if (decodeURIComponent(pair[0]) == 'zoneName')
					zoneNam = decodeURIComponent(pair[1]);
				}
			}
			if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined && alarmsLink.indexOf('maxDurationAlarmIds')!=-1)
			{
				if(!Ext.isEmpty(zoneNam) && zoneNam!=null && zoneNam!='null' && zoneNam!=undefined)
					winTitle = "<%= mappingInfo.getTextDescription("monitor.common.Longest Alarms")%> - "+zoneNam;//"Longest Alarms - "+zoneNam;
				else
					winTitle = "<%= mappingInfo.getTextDescription("monitor.common.Longest Alarms")%>"//"Longest Alarms"
				btnMaxHide = true;
				btnHelpHide = true;
			}
			else if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!='null' && alarmsLink!=undefined)
			{
				if(alarmsLink.indexOf("&state=UNKNOWN") > 0)
					winTitle  = '<%= mappingInfo.getTextDescription("monitor.common.Unknowns")%>';
				else if(!Ext.isEmpty(zoneNam) && zoneNam!=null && zoneNam!='null' && zoneNam!=undefined)
					winTitle = '<%= mappingInfo.getTextDescription("monitor.common.Open Problems")%> - '+zoneNam;
				else if(compType != null && compType.length > 0)
					winTitle = '<%= mappingInfo.getTextDescription("monitor.common.Open Problems for")%> '+compType+' <%= mappingInfo.getTextDescription("monitor.common.Components")%>';
				else
					winTitle = '<%= mappingInfo.getTextDescription("monitor.common.Open Problems")%>';
				var doSubString = true;
				if(alarmsLink.indexOf("&doSubString=") > 0)
					doSubString = false;
				var vars = alarmsLink.split('&');
				for(var i = 0; i < vars.length; i++){
					var pair = vars[i].split('=');
					if(decodeURIComponent(pair[0]) == 'title')
					{
						var titleName = decodeURIComponent(pair[1]);
						if(titleName.indexOf("$quote$") > 0)
							titleName = titleName.replace("$quote$","'");
						if(doSubString)
							titleName = titleName.substring(titleName.indexOf(" "));
						winTitle = titleName;
					}
				}
				btnMaxHide = true;
				btnHelpHide = true;
			}
			else
			{
				winTitle = "<%= mappingInfo.getTextDescription("monitor.common.Current Alarms / Unknowns")%>";
				if(onlyVm)
					winTitle = "<%= mappingInfo.getTextDescription("monitor.common.Current Alarms")%>";//"Current Alarms";
				btnMaxHide = false;
				btnHelpHide = false;
			}
			if(isShowAlarmsInLightBox!=null && isShowAlarmsInLightBox=="true")
			{
				try
				{
					if(!Ext.isEmpty(no_curr_alarms) && (no_curr_alarms=='no'))
					{
						Ext.Ajax.request({
							url : '/final/servlet/com.eg.EgCurrentAlarmsC',
							scope:this,
							timeout:280000,
							success: function(response)
							{
								var jsonText=response.responseText;
								var jsonData=Ext.decode(jsonText);
								var dataAvailable=jsonData.dataAvailable;
								if(!Ext.isEmpty(dataAvailable) && (dataAvailable=='true' || dataAvailable === 'true' || dataAvailable == true))
								{
									Ext.onReady(function(){
										alarmPop = Ext.widget("window", {
											title: winTitle,
											id : 'alarmLightBoxPopup',
											name : 'alarmLightBoxPopup',
											modal : true,
											resizable: false,
											width:cwidth1 ,
											frame: false,
											constrain: true,
											ghost:false,
											cls:'lightbox',
											style:{'left':''+leftPosition+' !important'},
											scroll: false,
											autoScroll: false,
											closable:false,
											border: false,
											padding: "0 0 0 0",
											margin: "30 20 0 0",
											closeAction:'destroy',
											listeners: {
												show: function(win){
													if (this.modal){
														var dom = Ext.dom.Query.select('.x-mask');
														var el = Ext.get(dom[0]);
														el.addCls('windowModal');
													}
												},
												hide: function(win){
													if (this.modal){
														var dom = Ext.dom.Query.select('.x-mask');
														var el = Ext.get(dom[0]);
														el.removeCls('windowModal');
													}
												},
												boxready: function (c) {
													try
													{
														Ext.create('Ext.util.KeyNav', c.getEl(), {
														  "esc" : function(e){
															c.hide();
															Ext.getCmp('alarmLightBoxPopup').close();
														  },
														  scope: c
														});
													}
													catch (e)
													{
													}
												},
												afterrender: function(){
													try
													{
														var browser = get_browser_info();
														var browserName = browser.name;
														if((Ext.isEmpty(alarmsLink) || alarmsLink==null || alarmsLink=='undefined' || alarmsLink==undefined) && (!Ext.isEmpty(browserName) && browserName!=null && browserName!=undefined && browserName.indexOf("IE")!=-1))
														{
														
															setTimeout('loadAlarmFrame()',3000);
														}
														else
														{
															
															var alarmIfrmID = document.getElementById("alarmIframeId");
															if(!Ext.isEmpty(alarmIfrmID) && alarmIfrmID!=null && alarmIfrmID!=undefined)
															{	
															
																if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined)
																	alarmIfrmID.src = alarmsLink+"&isPopupWindow=true";
																else
																	alarmIfrmID.src="/final/monitor/EgAlarms.jsp?isPopupWindow=true";
															}
														}
													}
													catch(er)
													{
														
													}
												}
											},
											tools:[
													{
														xtype:'button',
														iconCls:'iconHelp',
														id:'btnHelpId',
														hidden:btnHelpHide,
														listeners:{
															afterrender: function(){
																Ext.create('Ext.tip.ToolTip',{
																	target: this.id,
																	anchor: 'top',
																	cls: 'yellowTip',
																	trackMouse: true,
																	html: alarmHelp
																});
															}
														},
														style:{
															'background' : 'none',
															'border' : '0px',
															'margin':'0 10 0 0',
														},
														handler : function()
														{
															//openAlarmHelpWin();
															var helpwin = window.open("/final/eghelp/EgHelpApp.jsp?forwardPage=EgMHelp.jsp&params="+encodeURIComponent('|amp|from|equal|Alarms'),
															"HelpWindow",
															"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+left+",top="+top+",screenx="+left+",screeny="+top+",resizable=yes");
															helpwin.focus();
														}
													},
													{
														xtype : 'button',
														iconCls : 'iconMaximizeGray',
														action:'maximize',
														id:'btnMaxId',
														hidden:btnMaxHide,
														listeners: {
															afterrender: function (){
																Ext.create('Ext.tip.ToolTip',{
																	target: this.id,
																	anchor: 'top',
																	cls: 'yellowTip',
																	trackMouse: true,
																	html: newWindow
																});
															}
														},
														style : {
															'background' : 'none',
															'border' : '0px',
															'margin':'0 10 0 0',
														},
														handler : function()
														{
															alarmWindowRef = window.open("/final/monitor/EgAlarms.jsp",
															"alarmWindow",
															"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+left+",top="+top+",screenx="+left+",screeny="+top+",resizable=yes");
															this.up('window').close();
														}
													},
													{
														xtype : 'button',
														iconCls : 'iconClose3',
														id:'btnCloseId',
														//hidden:true,
														//disabled:true,
														action:'destroy',
														style : {
															'background' : 'none',
															'border' : '0px',
															'margin':'0 10 0 0',
														},
														handler : function()
														{
															this.up('window').close();
														}
													}
											],
											html: '<iframe id="alarmIframeId" width="'+cwidth1+'" height="'+cheight+'" scrolling="no" frameborder="0" ></iframe>',
										}).show();
										Ext.EventManager.onWindowResize(function (){
											if(Ext.getCmp('alarmLightBoxPopup') != null && Ext.getCmp('alarmLightBoxPopup') != undefined && Ext.getCmp('alarmLightBoxPopup').hidden == false){
												Ext.getCmp('alarmLightBoxPopup').center()
											}
										})
							
									});

								}
							}
						});
					}
					else
					{
						Ext.onReady(function(){
							Ext.widget("window", {
								title: winTitle,
								id : 'alarmLightBoxPopup',
								name : 'alarmLightBoxPopup',
								modal : true,
								resizable: false,
								width:cwidth1 ,
								frame: false,
								constrain: true,
								ghost:false,
								cls:'lightbox',
								style:{'left':''+leftPosition+' !important'},
								scroll: false,
								autoScroll: false,
								closable:false,
								border: false,
								padding: "0 0 0 0",
								margin: "30 20 0 0",
								closeAction:'destroy',
								listeners: {
									show: function(win){
										if (this.modal){
											var dom = Ext.dom.Query.select('.x-mask');
											var el = Ext.get(dom[0]);
											el.addCls('windowModal');
										}
									},
									hide: function(win){
										if (this.modal){
											var dom = Ext.dom.Query.select('.x-mask');
											var el = Ext.get(dom[0]);
											el.removeCls('windowModal');
										}
									},
									boxready: function (c) {
										try
										{
											Ext.create('Ext.util.KeyNav', c.getEl(), {
											  "esc" : function(e){
												c.hide();
												Ext.getCmp('alarmLightBoxPopup').close();
											  },
											  scope: c
											});
										}
										catch (e)
										{
										}
									},
									afterrender: function(){
										try
										{
											var browser = get_browser_info();
											var browserName = browser.name;
											if((Ext.isEmpty(alarmsLink) || alarmsLink==null || alarmsLink=='undefined' || alarmsLink==undefined) && (!Ext.isEmpty(browserName) && browserName!=null && browserName!=undefined && browserName.indexOf("IE")!=-1))
											{
											
												setTimeout('loadAlarmFrame()',3000);
											}
											else
											{
												
												var alarmIfrmID = document.getElementById("alarmIframeId");
												if(!Ext.isEmpty(alarmIfrmID) && alarmIfrmID!=null && alarmIfrmID!=undefined)
												{	
												
													if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined)
														alarmIfrmID.src = alarmsLink+"&isPopupWindow=true";
													else
														alarmIfrmID.src="/final/monitor/EgAlarms.jsp?isPopupWindow=true";
												}
											}
										}
										catch(er)
										{
											
										}
									}
								},
								tools:[
										{
											xtype:'button',
											iconCls:'iconHelp',
											id:'btnHelpId',
											hidden:btnHelpHide,
											listeners:{
												afterrender: function(){
													Ext.create('Ext.tip.ToolTip',{
														target: this.id,
														anchor: 'top',
														cls: 'yellowTip',
														trackMouse: true,
														html: alarmHelp
													});
												}
											},
											style:{
												'background' : 'none',
												'border' : '0px',
												'margin':'0 10 0 0',
											},
											handler : function()
											{
												//openAlarmHelpWin();
												var helpwin = window.open("/final/eghelp/EgHelpApp.jsp?forwardPage=EgMHelp.jsp&params="+encodeURIComponent('|amp|from|equal|Alarms'),
												"HelpWindow",
												"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+left+",top="+top+",screenx="+left+",screeny="+top+",resizable=yes");
												helpwin.focus();
											}
										},
										{
											xtype : 'button',
											iconCls : 'iconMaximizeGray',
											action:'maximize',
											id:'btnMaxId',
											hidden:btnMaxHide,
											listeners: {
												afterrender: function (){
													Ext.create('Ext.tip.ToolTip',{
														target: this.id,
														anchor: 'top',
														cls: 'yellowTip',
														trackMouse: true,
														html: newWindow
													});
												}
											},
											style : {
												'background' : 'none',
												'border' : '0px',
												'margin':'0 10 0 0',
											},
											handler : function()
											{
												alarmWindowRef = window.open("/final/monitor/EgAlarms.jsp",
												"alarmWindow",
												"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+left+",top="+top+",screenx="+left+",screeny="+top+",resizable=yes");
												this.up('window').close();
											}
										},
										{
											xtype : 'button',
											iconCls : 'iconClose3',
											id:'btnCloseId',
											//hidden:true,
											//disabled:true,
											action:'destroy',
											style : {
												'background' : 'none',
												'border' : '0px',
												'margin':'0 10 0 0',
											},
											handler : function()
											{
												this.up('window').close();
											}
										}
								],
								html: '<iframe id="alarmIframeId" width="'+cwidth1+'" height="'+cheight+'" scrolling="no" frameborder="0" ></iframe>',
							}).show();
							Ext.EventManager.onWindowResize(function (){
								if(Ext.getCmp('alarmLightBoxPopup') != null && Ext.getCmp('alarmLightBoxPopup') != undefined && Ext.getCmp('alarmLightBoxPopup').hidden == false){
									Ext.getCmp('alarmLightBoxPopup').center()
								}
							})
				
						});
					}
					
				}
				catch (e)
				{
					console.log(e)
				}
			}
			else
			{
				alarmWindowRef = window.open("/final/monitor/EgAlarms.jsp",
						"alarmWindow",
						"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+cwidth2+",top="+cheight+",screenx=0,screeny=0,resizable=yes");
			}
		}
		else if(isAlarmViewerUser!=null && isAlarmViewerUser!="true")
		{
			if((showAlertAdmin!=null && showAlertAdmin=="true") && adminPressed)
			{
				if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
				{
					if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
					{
						if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
			{
				if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
			{
				if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
			{
				getSmartAlert();
				alarmWindowRef = null;
			}
		}
		return;
	}
	function openAlarmPopupWindowUED(CompTypeandCompName,sInfo)
	{
		openAlarmPopupWindowUED(CompTypeandCompName,sInfo,null);
	}
	function openSlaAlertsPopup(){
			Ext.onReady(function(){
					Ext.widget('window',{
									title: "SLA Alerts",
									autoScroll:true,
									closeAction: 'destory',
									width:800,
									height:498,
									modal:true,
									listeners: {
									show: function(win) {
									if (this.modal) {
										var dom = Ext.dom.Query.select('.x-mask');
										var el = Ext.get(dom[0]);
										el.addCls('windowModal');
									}
									},
									 hide:  function(win) {
									if (this.modal) {
										var dom = Ext.dom.Query.select('.x-mask');
										var el = Ext.get(dom[0]);
										el.removeCls('windowModal');
									}
									}},
									html: '<iframe width="792" height="458" frameborder="0" scrolling="no" src="/final/monitor/eGSlaNotification.jsp?isPopupWindow=true"></iframe>'
									}).show();
				});
	}
	function openAlarmPopupWindowUED(CompTypeandCompName,sInfo,alarmsLink)
	{
		var isHistory='';
		var time_period='';
		if(alarmsLink !=null && (alarmsLink.startsWith("true") || alarmsLink.startsWith("yes")))
		{
			isHistory = alarmsLink.substr(0,alarmsLink.indexOf('EG'));
			time_period = alarmsLink.substr(alarmsLink.indexOf('EG')+2);
			alarmsLink = null;
		}
		if((monitorPressed!=null && monitorPressed==true || monitorPressed=="true") && (isAlarmViewerUser!=null && isAlarmViewerUser!="true"))
		{
			//var cwidth1=Ext.getBody().getViewSize().width-240;
			if (Ext.getBody().getViewSize().width < 1100)
			{
				var cwidth1=Ext.getBody().getViewSize().width-64;
				var leftPosition = 25;
				var left = (Ext.getBody().getViewSize().width/2)-(cwidth1/2);
			}
			else
			{
				var cwidth1=Ext.getBody().getViewSize().width-154;
				var leftPosition = 78;
				var left = (Ext.getBody().getViewSize().width/2)-(cwidth1/2);
			}
			var cwidth2=(cwidth1/2);			
			//var cheight=Ext.getBody().getViewSize().height-120;
			var cheight=Ext.getBody().getViewSize().height-240;
			var top = (Ext.getBody().getViewSize().height/2)-(cheight/2);
			
			var winTitle = '';
			var zoneNam = '';
			if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined)
			{
				var vars = alarmsLink.split('&');
				for(var i = 0; i < vars.length; i++){
				var pair = vars[i].split('=');
				if (decodeURIComponent(pair[0]) == 'zoneName')
					zoneNam = decodeURIComponent(pair[1]);
				}
			}
			if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined && alarmsLink.indexOf('maxDurationAlarmIds')!=-1)
			{
				if(!Ext.isEmpty(zoneNam) && zoneNam!=null && zoneNam!='null' && zoneNam!=undefined)
					winTitle = "Longest Alarms - "+zoneNam;
				else
					winTitle = "Longest Alarms"
				btnMaxHide = true;
				btnHelpHide = true;
			}
			else if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!='null' && alarmsLink!=undefined)
			{
				if(!Ext.isEmpty(zoneNam) && zoneNam!=null && zoneNam!='null' && zoneNam!=undefined)
					winTitle = "Open Problems - "+zoneNam;
				else
					winTitle = "Open Problems";
				btnMaxHide = true;
				btnHelpHide = true;
			}
			else
			{
				//winTitle = "Current Alarms / Unknowns";
				if(isHistory == "true" || isHistory == "yes")
				{
					if(time_period!="null" && time_period!="")
					{
						//winTitle = "History of Alarms for Components in User Session : "+sInfo;
						winTitle = "Alarms for components supporting user : "+sInfo;
						btnMaxHide = true;
						btnHelpHide = true;
					}
					else
					{
						//winTitle = "Current Alarms for Components in User Session : "+sInfo;
						winTitle = "Current Alarms for components supporting user : "+sInfo;
						btnMaxHide = true;
						btnHelpHide = true;
					}
				}
				else
				{
					//winTitle = "Current Alarms for Components in User Session : "+sInfo;
					winTitle = "Current Alarms for components supporting user : "+sInfo;
					btnMaxHide = false;
					btnHelpHide = false;
				}
			}
			if(isShowAlarmsInLightBox!=null && isShowAlarmsInLightBox=="true")
			{
				Ext.onReady(function(){
					Ext.widget("window", {
						title: winTitle,
						id : 'alarmLightBoxPopup',
						name : 'alarmLightBoxPopup',
						modal : true,
						resizable: false,
						width:cwidth1 ,
						frame: false,
						constrain: true,
						ghost:false,
						cls:'lightbox',
						style:{'left':''+leftPosition+' !important'},
						scroll: false,
						autoScroll: false,
						closable:false,
						border: false,
						padding: "0 0 0 0",
						margin: "30 20 0 0",
						closeAction:'destroy',
						listeners: {
							show: function(win){
								if (this.modal){
									var dom = Ext.dom.Query.select('.x-mask');
									var el = Ext.get(dom[0]);
									el.addCls('windowModal');
								}
							},
							hide: function(win){
								if (this.modal){
									var dom = Ext.dom.Query.select('.x-mask');
									var el = Ext.get(dom[0]);
									el.removeCls('windowModal');
								}
							},
							boxready: function (c) {
								try
								{
									Ext.create('Ext.util.KeyNav', c.getEl(), {
									  "esc" : function(e){
										c.hide();
										Ext.getCmp('alarmLightBoxPopup').close();
									  },
									  scope: c
									});
								}
								catch (e)
								{
								}
							},
							afterrender: function(){
								try
								{
									var browser = get_browser_info();
									var browserName = browser.name;
									if((Ext.isEmpty(alarmsLink) || alarmsLink==null || alarmsLink=='undefined' || alarmsLink==undefined) && (!Ext.isEmpty(browserName) && browserName!=null && browserName!=undefined && browserName.indexOf("IE")!=-1))
									{
									
										setTimeout('loadAlarmFrame()',3000);
									}
									else
									{
										
										var alarmIfrmID = document.getElementById("alarmIframeId");
										sInfo= filterEncode(sInfo);
										if(!Ext.isEmpty(alarmIfrmID) && alarmIfrmID!=null && alarmIfrmID!=undefined)
										{	
											if(!Ext.isEmpty(alarmsLink) && alarmsLink!=null && alarmsLink!=undefined)
												alarmIfrmID.src = alarmsLink+"&isPopupWindow=true";
											else
											{
												if(isHistory == "true" || isHistory == "yes")
												{
													alarmIfrmID.src="/final/monitor/EgAlarms.jsp?isPopupWindow=true&selectedCTypeWithName="+encodeURIComponent(CompTypeandCompName)+"&selectedUser="+encodeURIComponent(sInfo)+"&isUserExperiencePage=true&isHistory=true&History_Time="+encodeURIComponent(time_period);
												}
												else
												{
													alarmIfrmID.src="/final/monitor/EgAlarms.jsp?isPopupWindow=true&selectedCTypeWithName="+encodeURIComponent(CompTypeandCompName)+"&selectedUser="+encodeURIComponent(sInfo)+"&isUserExperiencePage=true";
												}
											}
										}
									}
								}
								catch(er)
								{
									
								}
							}
						},
						tools:[
								{
									xtype:'button',
									iconCls:'iconHelp',
									id:'btnHelpId',
									hidden:btnHelpHide,
									listeners:{
										afterrender: function(){
											Ext.create('Ext.tip.ToolTip',{
												target: this.id,
												anchor: 'top',
												cls: 'yellowTip',
												trackMouse: true,
												html: alarmHelp
											});
										}
									},
									style:{
										'background' : 'none',
										'border' : '0px',
										'margin':'0 10 0 0',
									},
									handler : function()
									{
										//openAlarmHelpWin();
										var helpwin = window.open("/final/eghelp/EgHelpApp.jsp?forwardPage=EgMHelp.jsp&params="+encodeURIComponent('|amp|from|equal|Alarms'),
										"HelpWindow",
										"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+left+",top="+top+",screenx="+left+",screeny="+top+",resizable=yes");
										helpwin.focus();
									}
								},
								{
									xtype : 'button',
									iconCls : 'iconMaximizeGray',
									action:'maximize',
									id:'btnMaxId',
									hidden:btnMaxHide,
									listeners: {
										afterrender: function (){
											Ext.create('Ext.tip.ToolTip',{
												target: this.id,
												anchor: 'top',
												cls: 'yellowTip',
												trackMouse: true,
												html: newWindow
											});
										}
									},
									style : {
										'background' : 'none',
										'border' : '0px',
										'margin':'0 10 0 0',
									},
									handler : function()
									{
										alarmWindowRef = window.open("/final/monitor/EgAlarms.jsp",
										"alarmWindow",
										"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+left+",top="+top+",screenx="+left+",screeny="+top+",resizable=yes");
										this.up('window').close();
									}
								},
								{
									xtype : 'button',
									iconCls : 'iconClose3',
									id:'btnCloseId',
									//hidden:true,
									//disabled:true,
									action:'destroy',
									style : {
										'background' : 'none',
										'border' : '0px',
										'margin':'0 10 0 0',
									},
									handler : function()
									{
										this.up('window').close();
									}
								}
						],
						html: '<iframe id="alarmIframeId" width="'+cwidth1+'" height="'+cheight+'" scrolling="no" frameborder="0" ></iframe>',
					}).show();
				});
			}
			else
			{
				alarmWindowRef = window.open("/final/monitor/EgAlarms.jsp",
						"alarmWindow",
						"toolbar=no,location=no,status=no,menubar=no,width="+cwidth1+",height="+cheight+",left="+cwidth2+",top="+cheight+",screenx=0,screeny=0,resizable=yes");
			}
		}
		else if(isAlarmViewerUser!=null && isAlarmViewerUser!="true")
		{
			if((showAlertAdmin!=null && showAlertAdmin=="true") && adminPressed)
			{
				if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
				{
					if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
					{
						if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
						{
							if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
							{
								getSmartAlert();
								alarmWindowRef = null;
							}
							else
							{
								getSmartAlert();
								alarmWindowRef = null;
							}
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
			{
				if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
			{
				if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
			{
				if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
			{
				getSmartAlert();
				alarmWindowRef = null;
			}
			else
			{
				getSmartAlert();
				alarmWindowRef = null;
			}
		}
		return;
	}
	function loadAlarmFrame()
	{
		if(!Ext.isEmpty(Ext.getCmp('btnCloseId')))
			Ext.getCmp('btnCloseId').disable();
		if(!Ext.isEmpty(Ext.getCmp('btnMaxId')))
			Ext.getCmp('btnMaxId').disable();
		if(!Ext.isEmpty(Ext.getCmp('btnHelpId')))
			Ext.getCmp('btnHelpId').disable();
		var alarmIfrmID = document.getElementById("alarmIframeId");
		if(!Ext.isEmpty(alarmIfrmID) && alarmIfrmID!=null && alarmIfrmID!=undefined)
			alarmIfrmID.src="/final/monitor/EgAlarms.jsp?isPopupWindow=true";
	}

	function get_browser_info(){
		var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; 
		if(/trident/i.test(M[1])){
			tem=/\brv[ :]+(\d+)/g.exec(ua) || []; 
			return {name:'IE ',version:(tem[1]||'')};
		}
		if(M[1]==='Chrome'){
			tem=ua.match(/\bOPR\/(\d+)/)
			if(tem!=null){return {name:'Opera', version:tem[1]};}
		}
		M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
		if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1]);}
		return {
			name: M[0],
			version: M[1]
		};
	}

	/*function openAlarmHelpWin()
		{
			Ext.onReady(function(){
			 Ext.widget("window", {
					title: "Help",
					resizable: false,
					width: 1000,
					frame: false,
					constrain: true,
					padding: "3 10 10 10",
					height: 550,
					scroll: false,
					autoScroll: false,
					border: false,
					layout: "fit",
					
					margin: "0 10 0 0",
					html: '<iframe width="100%" height="100%" scrolling="no" frameborder="0" src="/final/eghelp/EgHelpApp.jsp?forwardPage=EgMHelp.jsp&params='+encodeURIComponent('|amp|from|equal|Alarms')+'"></iframe>'
				}).show();
			});
		}*/	

	function openSmartAlarm()
	{
		if(<%=!isAlarmViewer%>)
		{
			if((showAlertAdmin!=null && showAlertAdmin=="true") && adminPressed)
			{
				if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
				{
					if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed)
					{
						if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
						{
							if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
							{
								getSmartAlert();
								alarmWindowRef = null;
							}
							else
							{
								getSmartAlert();
								alarmWindowRef = null;
							}
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
			{
				if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
						else
						{
							getSmartAlert();
							alarmWindowRef = null;
						}
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
			{
				if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
					else
					{
						getSmartAlert();
						alarmWindowRef = null;
					}
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
			{
				if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
				else
				{
					getSmartAlert();
					alarmWindowRef = null;
				}
			}
			else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
			{
				getSmartAlert();
				alarmWindowRef = null;
			}
			else
			{
				getSmartAlert();
				alarmWindowRef = null;
			}
		}
		return;
	}

	function licenseAlertCheck(Alertstr)
	{
		alert(Alertstr);
	}

	function startupActivities(licenseExpiryAlert, enablePermission,userExpiryMsg,showPopUp)
	{
		//<%
		//if (!isUsersLimitCrossed && alertUserAbtUserCert)
		//{
		//%>
		//	alert('<%=message%>');
		//<%
		//}
		//if (isUsersLimitCrossed)
		//{			
		//%>
		//	alert('<%=message2%>');
		//<%		
		//}
		//%>		
		//if(userExpiryMsg != "")
		//	alert(userExpiryMsg);
		
		//if(licenseExpiryAlert != undefined && licenseExpiryAlert != null && licenseExpiryAlert !="")
		//{
		//	if(enablePermission == "True")
		//	{
		//<%
		//		if(isMonitor ||isConfig ||isReport)
		//		{
		//%>
		//			licenseAlertCheck(licenseExpiryAlert);
		//<%
		//		}
		//%>
		//	}
		//	if(<%=isAdmin%>)
		//	{
		//		licenseAlertCheck(licenseExpiryAlert);
		//	}
		//}
		//if(homepage!='Current Alarms' && smartHomePage!='Current Alarms')
	/*	if(homepage!='/final/monitor/EgAlarms.jsp' && smartHomePage!='Current Alarms')
		{
			if(showPopUp == 'yes')
			{
				openAlarmPopupWindow();
			}
		}*/
		if(homepage!='' && homepage!='/final/monitor/EgAlarms.jsp' && smartHomePage!='Current Alarms')
		{
			if(showPopUp == 'yes')
			{
				if(hideAlarmPopup!=null && (hideAlarmPopup.toLowerCase()=="yes" || hideAlarmPopup.toLowerCase()=="true"))
				{
					openAlarmPopupWindow();
				}
			}
			if(monitorPressed)
			{
				openSmartAlarm();
			}
		}
		else
		{
			openSmartAlarm();
		}

		var isOpenMyDashboard='<%=isOpenMyDashboard%>';
		if(isOpenMyDashboard!=null && isOpenMyDashboard=="true")
		{
			openMyDashboard();
		}
	}
	var myDashReference=null;
	function openMyDashboard()
	{
		if(document.getElementById("hidHomePageURL").value!='/final/monitor/MyDashboard.jsp')
		{
			var scrWidth=screen.width;
			var scrHeight=screen.height;
			if(scrWidth!=null && scrWidth>700)
			{
				scrWidth = scrWidth-20;
			}
			if(scrHeight!=null && scrHeight>600)
			{
				scrHeight = scrHeight-110;
			}
			if(myDashReference==null)
				myDashReference=parent.openWindow("/final/monitor/MyDashboard.jsp?newWindow=true","MyDashboard","toolbar=no,menubar=no,location=no,status=no,width="+scrWidth+",height="+scrHeight+",left=10,top=10,screenx=0,screeny=0,resizable=yes,scrollbars=1,scrollbars=yes");
			else
			{
				try
				{
					if(myDashReference.focus().trim()=="undefined")
					{
						myDashReference=null;
						myDashReference=parent.openWindow("/final/monitor/MyDashboard.jsp?newWindow=true","MyDashboard","toolbar=no,menubar=no,location=no,status=no,width="+scrWidth+",height="+scrHeight+",left=10,top=10,screenx=0,screeny=0,resizable=yes,scrollbars=1,scrollbars=yes");
					}
					else
					{
						//alert("inside timeout");
						setTimeout(myDashReference.focus(),1);
					}
				}
				catch(e)
				{
					myDashReference=null;
					myDashReference=parent.openWindow("/final/monitor/MyDashboard.jsp?newWindow=true","MyDashboard","toolbar=no,menubar=no,location=no,status=no,width="+scrWidth+",height="+scrHeight+",left=10,top=10,screenx=0,screeny=0,resizable=yes,scrollbars=1,scrollbars=yes");
				}
			}
		}
	}

	function HelpMenuShow()
	{
		document.getElementById("help").style.visibility = 'visible';
		document.getElementById("help").style.display = 'block';
		document.getElementById("help").style.position = 'absolute';
		//document.getElementById("help").style.left='absolute';
	}

	function HelpMenuHide()
	{
		document.getElementById("help").style.visibility = 'hidden';
		document.getElementById("help").style.display = 'block';
		document.getElementById("help").style.position = 'absolute';
	}

	function NewWindow(mypage, myname, w, h, scroll)
	{
		LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0;
		TopPosition = (screen.height) ? (screen.height - h) / 2 : 0;
		settings = 'height=' + h + ',width=' + w + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable=no'
		win = window.open(mypage, myname, settings)
	}

	function HelpWin()
	{
		var helpwin = window.open(helpURL,"helpwindow","toolbar=no,menubar=no,location=no,status=no,width=600,height=400,left=206,top=155,screenx=0,screeny=0,resizable=yes,scrollbars=1,scrollbars=yes");
		helpwin.focus();
	}
	function goSignOut()
	{
		cleanupWindows();
		var mainIFrameObj = document.getElementById('main');
		mainIFrameObj.src = "";
		mainIFrameObj.src = "/final/admin/EgLogoutA.jsp?userid=<%=isAdmin%>&fromTab=<%=entry%>&fromPage=proceedingSignout&cache="+new Date().getTime();
	}
	function openWindow(path,name,winOptions)
	{
		var freeCell = windowsList.length;
		var defaultWidth;
		var defaultHeight;
		var isIE = /*@cc_on!@*/false || !!document.documentMode;
		var isEdge = !isIE && !!window.StyleMedia;
		var isChrome = !!window.chrome && !!window.chrome.webstore;
		var isFirefox = typeof InstallTrigger !== 'undefined';
		if(isIE)
		{
			defaultHeight=655;
			defaultWidth=1095;
		}
		else
		{
			defaultHeight=655;
			defaultWidth=1099;
		}


		var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left;
		var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top;

		if(isIE){
			dualScreenTop = 0;
			dualScreenLeft = 0;
		}

		width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
		height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
		if(isFirefox){
			height = height + 5;
		}
		var left = ((width / 2) - (defaultWidth / 2)) + dualScreenLeft;
		var top = ((height / 2) - (defaultHeight / 2)) + dualScreenTop;
		//var win = window.open(path,name,winOptions);
		var win = window.open(path,name,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, width='+defaultWidth+', height='+defaultHeight+', top='+top+', left='+left);
		windowsList[freeCell]=win;
		return win;
	}

	function openWindowSpecific(path,name,winOptions)
	{
		var freeCell = windowsList.length;
		var win = window.open(path,name,winOptions);
		//var win = window.open(path,name,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, width='+defaultWidth+', height='+defaultHeight+', top='+top+', left='+left);
		windowsList[freeCell]=win;
		return win;
	}

	function cleanupWindows()
	{
		for(var i=0;i<windowsList.length;i++)
		{
			if(windowsList[i]!=null && !windowsList[i].closed)
				windowsList[i].close();
		}
	}
	function licencePeriodAlert()
	{
	
	}
	function goUserProfile()
	{
		if(<%=isAlarmViewer%>)
		{
			if(document.getElementById("main_head")!=null)
				document.getElementById("main_head").style.visibility='hidden';
		}
	}
	
	var MONTH_NAMES_JS=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
	var MONTH_INT_JS=new Array('0','1','2','3','4','5','6','7','8','9','10','11');
	function getMonthValue(mon_text)
	{
		var index_mon=-1;
		try
		{
			index_mon = MONTH_NAMES_JS.indexOf(mon_text);
		}
		catch (e)
		{
			if(index_mon==null || index_mon<0)
			{
				index_mon = MONTH_INT_JS.indexOf(mon_text); 
			}
		}

		try
		{
			if(index_mon==null || index_mon<0)
			{
				index_mon = MONTH_INT_JS.indexOf(mon_text); 
			}
		}
		catch(ee)
		{}
		
		return index_mon;
	}

	/*var s_yr = <%//=cal.get(cal.YEAR)%>;
    var s_mon = <%//=cal.get(cal.MONTH)%>;
    var s_day = <%//=cal.get(cal.DAY_OF_MONTH)%>;
    var s_hr = <%//=cal.get(cal.HOUR_OF_DAY)%>;
    var s_min = <%//=cal.get(cal.MINUTE)%>;
    var s_sec = <%//=cal.get(cal.SECOND)%>;*/
	var isAlarmViewer='<%=isAlarmViewer%>';
    var s_yr = <%=timeZoneConverter.getYear(true)%>;
    var s_mon = getMonthValue('<%=timeZoneConverter.getMonth()%>');
    var s_day = <%=timeZoneConverter.getDay()%>;
    var s_hr = <%=timeZoneConverter.getHour()%>;
    var s_min = <%=timeZoneConverter.getMinute()%>;
    var s_sec = <%=timeZoneConverter.getSecond()%>;
    var eday = new Date(s_yr,s_mon,s_day,s_hr,s_min,s_sec);
	function egClock()
    {   
		timediff = eday.getUTCMilliseconds();
		timediff = timediff + 1003;
		eday.setUTCMilliseconds(timediff);
		hourNow = eday.getHours();
		mnNow = eday.getMinutes();
		scNow = eday.getSeconds();
		miNow = eday.getTime();
		monNow = (eday.getMonth()+1);
		dayNow = eday.getDate();
		if(monNow <= 9)
		{
			mon = "0" + monNow;
		}
		else
		{
			mon = monNow;
		}
		if(dayNow <= 9)
		{
			day = "0" + dayNow;
		}
		else
		{
			day = dayNow;
		}
		if(hourNow <= 9)
		{
			hour = "0" + hourNow;
		}
		else
		{
			hour = hourNow;
		}
		if(mnNow <= 9)
		{
			min = "0" + mnNow;
		}
		else
		{
			min = mnNow;
		}
		if (scNow <= 9)
		{
			secs = "0" + scNow;
		}
		else
		{
			secs = scNow;
		}
		var display_date_time  = '<%=dispDate%>' +  " " + hour + ":" + min + ":" + secs + ' <%=tzName%>';
			return display_date_time;
	}

	function egDateClock(dispDate,tzName)
    {   
		timediff = eday.getUTCMilliseconds();
		timediff = timediff + 1003;
		eday.setUTCMilliseconds(timediff);
		hourNow = eday.getHours();
		mnNow = eday.getMinutes();
		scNow = eday.getSeconds();
		miNow = eday.getTime();
		monNow = (eday.getMonth());
		dayNow = eday.getDate();
		if(monNow <= 9)
		{
			mon = "0" + monNow;
		}
		else
		{
			mon = monNow;
		}
		if(dayNow <= 9)
		{
			day = "0" + dayNow;
		}
		else
		{
			day = dayNow;
		}
		if(hourNow <= 9)
		{
			hour = "0" + hourNow;
		}
		else
		{
			hour = hourNow;
		}
		if(mnNow <= 9)
		{
			min = "0" + mnNow;
		}
		else
		{
			min = mnNow;
		}
		if (scNow <= 9)
		{
			secs = "0" + scNow;
		}
		else
		{
			secs = scNow;
		}

		if(dispDate==null || dispDate==undefined || dispDate=="")
			dispDate="<%=dispDate%>";

		if(tzName==null || tzName==undefined || tzName=="")
			tzName="<%=tzName%>";

		var display_date_time  = dispDate +  " " + hour + ":" + min + ":" + secs + ' ' + tzName;
		return display_date_time;
	}
	</script>

<%

	ArrayList extensionList = new ArrayList();
	extensionList.add("gif");
	extensionList.add("jpeg");
	extensionList.add("jpg");
	extensionList.add("png");

	String MailHomeUrl = configmsg.getStrValue("MISC_ARGS","MailHomeUrl");
	String EnableUtilityTools = configmsg.getStrValue("eG_Utilities","EnableUtilityTools");
	String WebServiceURL = configmsg.getStrValue("eG_Utilities","CheckForUpdateURL");	
	String imageName = null;
	String tempLogo=user.getUserLogo();
	
	String saveScheduleReport = "No";
	saveScheduleReport = configmsg.getStrValue("MISC_ARGS","SaveScheduleReport");
	if(saveScheduleReport==null || saveScheduleReport.length()==0 || saveScheduleReport.equalsIgnoreCase("no"))
	{
		saveScheduleReport = "No";
	}
	else
	{
		saveScheduleReport = "Yes";
	}

	String userLogo[] = StringUtils.getTokens(tempLogo,"\\");
	if (entry.equalsIgnoreCase("admin") || entry.equalsIgnoreCase("monitor"))
	{
		String temp="";
		if(userLogo!=null && userLogo.length==5)
		{
			temp=userLogo[1];
		}
		if(EgInstallInfo.isSuperManager)
		{
			if(!temp.equals("c"))
			{
				imageName = ui.getMonitorHomeLogo();
			}
			else
			{
				imageName="/final/monitor/eg_images/egsm_monitor.gif";
				for (int ext = 0; ext < extensionList.size(); ext++)
				{
					String strExtension = (String)extensionList.get(ext);
					File sourceFile = new File(EgInstallInfo.getInstallDir()+"/manager/tomcat/webapps/final/monitor/eg_images/egsm_monitor."+strExtension);
					if (sourceFile.exists())
					{
						imageName="/final/monitor/eg_images/egsm_monitor."+strExtension;
						break;
					}
				}
			}
		}
		else if(!temp.equals("c"))
		{
			imageName = ui.getMonitorHomeLogo();
		}
		else if(EgInstallInfo.isSuperManager)
		{
			imageName="/final/monitor/eg_images/egsm_monitor.gif";
		}
		else
		{
			if(temp_id!=null && temp_id.indexOf("samlsso/")>-1)
			{
				String tmpName = temp_id.substring(temp_id.indexOf("/")+1);
				String idpName = tmpName.substring(0,tmpName.indexOf("/"));
				String userName = tmpName.substring(tmpName.indexOf("/")+1,tmpName.length());
				temp_id = idpName.toLowerCase()+"_"+userName;
			}
			else if(temp_id!=null && temp_id.indexOf("/")>-1)
			{
				String domainName=temp_id.substring(0,temp_id.indexOf("/"));
				String userName=temp_id.substring(temp_id.indexOf("/")+1,temp_id.length());

				//MAS/Grp/Domain Users

				if(userName.indexOf("Grp")>-1)
				{
					userName=userName.substring(userName.indexOf("/")+1,userName.length());
				}
				temp_id=domainName.toLowerCase()+"_"+userName;
			}
			temp_id = StringUtils.replace(temp_id," ","");

			for (int ext = 0; ext < extensionList.size(); ext++)
			{
				String strExtension = (String)extensionList.get(ext);
				File sourceFile = new File(EgInstallInfo.getInstallDir()+"/manager/tomcat/webapps/final/monitor/eg_images/"+temp_id+"_monitor."+strExtension);
				if (sourceFile.exists())
				{
					imageName="/final/monitor/eg_images/"+EgURLEncoder.encode(temp_id,"UTF-8")+"_monitor."+strExtension;
					break;
				}
			}
		}
		
	}
	else if (entry.equalsIgnoreCase("reporter"))
	{
		String temp="";
		if(userLogo!=null && userLogo.length==5)
		{
			temp=userLogo[2];
		}
		if(!temp.equals("c"))
		{
			imageName = ui.getReporterHomeLogo();
		}
		else
		{
			if(temp_id!=null && temp_id.indexOf("samlsso/")>-1)
			{
				String tmpName = temp_id.substring(temp_id.indexOf("/")+1);
				String idpName = tmpName.substring(0,tmpName.indexOf("/"));
				String userName = tmpName.substring(tmpName.indexOf("/")+1,tmpName.length());
				temp_id = idpName.toLowerCase()+"_"+userName;
			}
			else if(temp_id!=null && temp_id.indexOf("/")>-1)
			{
				String domainName=temp_id.substring(0,temp_id.indexOf("/"));
				String userName=temp_id.substring(temp_id.indexOf("/")+1,temp_id.length());
				if(userName.indexOf("Grp")>-1)
				{
					userName=userName.substring(userName.indexOf("/")+1,userName.length());
				}
				temp_id=domainName.toLowerCase()+"_"+userName;
			}
			temp_id = StringUtils.replace(temp_id," ","");
			for (int ext = 0; ext < extensionList.size(); ext++)
			{
				String strExtension = (String)extensionList.get(ext);
				File sourceFile = new File(EgInstallInfo.getInstallDir()+"/manager/tomcat/webapps/final/reporter/images/"+temp_id+"_reporter."+strExtension);
				if (sourceFile.exists())
				{
					imageName="/final/reporter/images/"+EgURLEncoder.encode(temp_id,"UTF-8")+"_reporter."+strExtension;
					break;
				}
			}
		}
		
	}
	else if (entry.equalsIgnoreCase("config"))
	{
		String temp="";
		if(userLogo!=null && userLogo.length==5)
		{
			temp=userLogo[3];
		}
		if(!temp.equals("c"))
		{
			imageName = ui.getConfigHomeLogo();
		}
		else
		{
			if(temp_id!=null && temp_id.indexOf("samlsso/")>-1)
			{
				String tmpName = temp_id.substring(temp_id.indexOf("/")+1);
				String idpName = tmpName.substring(0,tmpName.indexOf("/"));
				String userName = tmpName.substring(tmpName.indexOf("/")+1,tmpName.length());
				temp_id = idpName.toLowerCase()+"_"+userName;
			}
			else if(temp_id!=null && temp_id.indexOf("/")>-1)
			{
				String domainName=temp_id.substring(0,temp_id.indexOf("/"));
				String userName=temp_id.substring(temp_id.indexOf("/")+1,temp_id.length());
				if(userName.indexOf("Grp")>-1)
				{
					userName=userName.substring(userName.indexOf("/")+1,userName.length());
				}
				temp_id=domainName.toLowerCase()+"_"+userName;
			}
			temp_id = StringUtils.replace(temp_id," ","");
			for (int ext = 0; ext < extensionList.size(); ext++)
			{
				String strExtension = (String)extensionList.get(ext);
				File sourceFile = new File(EgInstallInfo.getInstallDir()+"/manager/tomcat/webapps/final/config/images/"+temp_id+"_config."+strExtension);
				if (sourceFile.exists())
				{
					imageName="/final/config/images/"+EgURLEncoder.encode(temp_id,"UTF-8")+"_config."+strExtension;
					break;
				}
			}
		}
	}
	else if (entry.equalsIgnoreCase("sla") && isEnableSLA)
	{
		String temp="";
		if(userLogo!=null && userLogo.length==5)
		{
			temp=userLogo[4];
		}
		if(!temp.equals("c"))
		{
			imageName = ui.getSlaHomeLogo();
		}
		else
		{
			if(temp_id!=null && temp_id.indexOf("samlsso/")>-1)
			{
				String tmpName = temp_id.substring(temp_id.indexOf("/")+1);
				String idpName = tmpName.substring(0,tmpName.indexOf("/"));
				String userName = tmpName.substring(tmpName.indexOf("/")+1,tmpName.length());
				temp_id = idpName.toLowerCase()+"_"+userName;
			}
			else if(temp_id!=null && temp_id.indexOf("/")>-1)
			{
				String domainName=temp_id.substring(0,temp_id.indexOf("/"));
				String userName=temp_id.substring(temp_id.indexOf("/")+1,temp_id.length());
				if(userName.indexOf("Grp")>-1)
				{
					userName=userName.substring(userName.indexOf("/")+1,userName.length());
				}
				temp_id=domainName.toLowerCase()+"_"+userName;
			}
			temp_id = StringUtils.replace(temp_id," ","");

			for (int ext = 0; ext < extensionList.size(); ext++)
			{
				String strExtension = (String)extensionList.get(ext);
				File sourceFile = new File(EgInstallInfo.getInstallDir()+"/manager/tomcat/webapps/final/SLA/images/"+temp_id+"_sla."+strExtension);
				if (sourceFile.exists())
				{
					imageName="/final/SLA/images/"+EgURLEncoder.encode(temp_id,"UTF-8")+"_sla."+strExtension;
					break;
				}
			}
		}
	}
	String text  = "";
	if (imageName == null)
	{
		//out.print("&nbsp;");
	}
	else
	{
		String title = configmsg.getStrValue("MISC_ARGS", "ManagerTitle");
		if (com.egurkha.util.StringUtils.isNull(title))
		{
			text = "v" + EgInstallInfo.version;
		}
		else
		{
			text = title;
		}
	}
	if(entry.equalsIgnoreCase("admin") && isAdmin)
	{
		if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
		{
%>
			<title><%=browserTitle%></title>
<%
		}
		else
		{
%>
			<title><%=strPrefix%> Admin - <%=text%> - <%=id%></title>
<%
		}
	}
	else
	{
		String titleText=entry;
		try
		{
			if(titleText!=null && titleText.trim().length()>0)
				titleText=titleText.substring(0,1).toUpperCase()+titleText.substring(1);
		}
		catch(Exception ee)
		{
			titleText=entry;
		}
		if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
		{
%>
			<title><%=browserTitle%></title>
<%
		}
		else
		{
%>
		<title><%=strPrefix%> <egui:intnl text="<%=titleText%>"/> - <%=text%> - <%=id%></title>
<%
		}
	}
	String isSM =(String)session.getAttribute("fromSM");
%>

</head>
<jsp:useBean id="SiteBean" scope="page" class="egurkha.ConfigSiteBean"/>
<jsp:useBean id="transBean" scope="page" class="egurkha.TransactionBean"/>

<%
	transBean.createFile("eg_ui.ini");
	String enableLicenseAlert = transBean.getStrValue("LICENSE_EXPIRY_ALERT","enable");
	String licenceValidAlert = SiteBean.lcat();
	
	String userExpiryMsg = "";
	transBean.createFile("eg_services.ini");
	String userID = (String)session.getAttribute("sess_userid");
	long noOfDays = 0L;
	if (session.getAttribute("sess_uservalidtill") != null)
		noOfDays = ((Long)session.getAttribute("sess_uservalidtill")).longValue();
	if(userID != null && !userID.equals("admin") && !userID.equals("supermonitor"))
	{
		if(noOfDays <= 7)
		{
			userExpiryMsg = transBean.getStrValue("MISC_ARGS","LicenseExpiryMess");
			if(userExpiryMsg.indexOf("[no_of_days]")>-1)
			{
				userExpiryMsg = userExpiryMsg.substring(0,userExpiryMsg.indexOf("[no_of_days]")) + noOfDays + userExpiryMsg.substring(userExpiryMsg.lastIndexOf("[no_of_days]") + 12,userExpiryMsg.length());
			}
		}
	}
	
	String showAlarmPopUp = "yes";
	if((fromPage != null && fromPage.equals("newAlarmAlert")) || isAlarmQView)
	{
		showAlarmPopUp = "no";
	}
	if(fromSm!=null && (fromSm.equals("yes") || fromSm.equals("home")) && request.getParameter("fromsuperHome")==null)
	{
		showAlarmPopUp = "no";
	}
	//if(monitorLastSession!=null && !monitorLastSession.equalsIgnoreCase("/final/servlet/com.eg.EgMonitorController?monCmd=dashboard"))
	if(monitorLastSession!=null && !monitorLastSession.equalsIgnoreCase(currentMonitorHomePageURL))
	{
		showAlarmPopUp = "no";
	}
	

	if(isFromQuickLaunch)
	{
		showAlarmPopUp = "no";
	}

	if(fromSm!=null)
	{
		session.setAttribute("fromSM", "yes");
	}
	if(fromQuickLaunch!=null)
	{
		//session.setAttribute("fromQuickLaunchPage", "yes");
	}

	boolean hasAllComponentAccess=userRole.hasAllComponentAccess();
	if(isIE)
	{
%>
		<body onUnload="javascript:closeChildren()" background="transparent">
<%
	}
	else
	{
%>
		<body onUnload="javascript:closeChildren()">
<%
	}
%>

<%
	EgDbAdapterUI egDb;
	String loginFirstTime = (String)session.getAttribute("isLoggingFirstTime");
	String loggedInUser = (String)session.getAttribute("sess_userid");
	String demoUser = (String)session.getAttribute("demoUser");
	String switchedUser = request.getParameter("switchedUser");
	if (StringUtils.isNull(switchedUser))
	{
		switchedUser = (String)session.getAttribute("switchedUser");
	}
	boolean hideSwitchUser = true;
	boolean switchback = true;
	IniFile mgrMiscIni = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_mgrmisc.ini");
	EgUuidInfo egUuidInfo = new EgUuidInfo();
	boolean isSuperOU = egUuidInfo.isSuperOrg(loggedInUser);
	boolean isOU = egUuidInfo.isOrg(loggedInUser);
	boolean hasOURole = egUuidInfo.hasOURole(loggedInUser);
	String orgName = "";
	if (!isSuperOU)
	{
		orgName = egUuidInfo.getDirectDependentOU(loggedInUser);
	}
	 
	String enableSwitchUser = mgrMiscIni.getValue("MISC_ARGS","enableSwitchUser");
	if (enableSwitchUser != null && 
		enableSwitchUser.equalsIgnoreCase("true") && 
		((userRole.hasAllComponentAccess() && (userRole.getAdminPerm() == 9223372036854775807L || userRole.getAdminPerm() == sas.getAdminAllPermissionValue())) || isSuperOU || isOU || hasOURole))
	{
		hideSwitchUser = false;
	}

	if (switchedUser != null && switchedUser.equalsIgnoreCase("true"))
	{
		hideSwitchUser = true;
		switchback = false;
	}

	boolean hideDownloadAgent = true;
	String enableDownloadAgent = mgrMiscIni.getValue("MISC_ARGS","enableDownloadAgent");
	if (enableDownloadAgent != null && enableDownloadAgent.equalsIgnoreCase("true") && 
		adminPermCheckList != null && !adminPermCheckList.isEmpty() && 
		(adminPermCheckList.contains("Component Management") || adminPermCheckList.contains("External/Remote Agent Configuration")))
	{
		hideDownloadAgent = false;
	}

	boolean isDouble=EgDbInfo.doubleByteEnabled;

	ArrayList defUsersList = User.getDefaultUsers();
	defUsersList.remove("egenterprise");
	boolean hidePasswordChangeWindow = true;
	String usersForPasswordChange = "";
	String usersForPasswordChangeIntimation = "";
	
	if (defUsersList.contains(loggedInUser) && 
		((EgInstallInfo.isSuperManager && loggedInUser.equalsIgnoreCase("egsm")) || 
		(!EgInstallInfo.isSuperManager && !loggedInUser.equalsIgnoreCase("egsm"))))
	{
		UserInfo userInfoObj = new UserInfo();
		ResultSet rs = userInfoObj.getPassword(loggedInUser);
		while(rs.next())
		{
			String str_upass = rs.getString("USER_PASS");
			str_upass = EgCrypt.decrypt(str_upass);
			if (loggedInUser.equalsIgnoreCase(str_upass))
			{
				usersForPasswordChange = loggedInUser;
				hidePasswordChangeWindow = false;
			}
		}
		if (loggedInUser.equalsIgnoreCase(EgConstants.DEFAULT_ADMIN_USER) && !EgInstallInfo.isSuperManager)
		{
			defUsersList.remove(loggedInUser);
			
			for (int i=0;i<defUsersList.size();i++)
			{
				String UserID = (String)defUsersList.get(i);
				if (!UserID.equalsIgnoreCase("egsm"))
				{
					ResultSet rs1 = userInfoObj.getPassword(UserID);
					while(rs1.next())
					{
						String str_upass1 = rs1.getString("USER_PASS");
						str_upass1 = EgCrypt.decrypt(str_upass1);
						if (UserID.equalsIgnoreCase(str_upass1))
						{
							usersForPasswordChangeIntimation += UserID + ",";
							hidePasswordChangeWindow = false;
						}
					}
				}
			}
		}
		userInfoObj.closeDB();
	}

	 String hasPasswordChangeWindow = (String)session.getAttribute("hasPasswordChangeWindow");
	 if (hasPasswordChangeWindow == null || hasPasswordChangeWindow.length() == 0)
	 {
		hasPasswordChangeWindow = "yes";
	 }

	if (usersForPasswordChangeIntimation != null && usersForPasswordChangeIntimation.endsWith(","))
	{
		usersForPasswordChangeIntimation = usersForPasswordChangeIntimation.substring(0,usersForPasswordChangeIntimation.length()-1);
	}

	boolean isAdminUser = (loggedInUser != null && loggedInUser.equalsIgnoreCase(EgConstants.DEFAULT_ADMIN_USER));
	boolean isLoginFirstTime = (loginFirstTime != null && loginFirstTime.equalsIgnoreCase("false"));

	if (isLoginFirstTime)
	{
		//if (eGMgrModel != null && eGMgrModel.equalsIgnoreCase("msp"))
		{
			IniFile egUIIniFileWr = EgConfigFilesSync.getInstance(EgInstallInfo.getInstallDir()+"/manager/config/eg_ui.ini",true);
			egUIIniFileWr.setValue("LOGIN","AUTHENTICATION","Yes");
			egUIIniFileWr.saveFile();
			EgConfigFilesSync.releaseInstance(egUIIniFileWr);
		}
	}

	ResultSet rs_upass = null;
	String str_conn = "";
	String str_query = "";
	String str_pass = "";
	boolean b_state = false;
	String current_user=_user.getLoginID();
	egDb=EgDbAdapterTypeUI.getObject();
	int x=0;
	try
	{
		str_conn = egDb.setConnection();
		str_query = "SELECT user_pass FROM user_info WHERE user_id='admin'";
		if(EgInstallInfo.isSuperManager)
		{
			Hashtable ht = new Hashtable();
			ht.put("LocalQuery","yes");
			ht.put("Query",str_query);
			rs_upass = new com.eg.supermanager.EgSMDBHelper().getResultSet(ht);
			while(rs_upass.next())
			{
				str_pass=rs_upass.getString("user_pass");
			}
			b_state=egDb.getState();
			rs_upass.close();
		}
		else
		{
			rs_upass = egDb.SelectExec(str_query);
			while(rs_upass.next())
			{
				str_pass=rs_upass.getString("user_pass");
			}
			b_state=egDb.getState();
			rs_upass.close();
		}
		egDb.releaseConnection(false);
		EgDbAdapterTypeUI.releaseObject(egDb);
	}
	catch(Exception e)
	{
		if(!str_conn.equals("CONNECTED"))
		{
			out.println("Connection could not be established");
		}
		else if(!b_state==true)
		{
			out.println("Error in sql query");
		}
		else
		{
			out.println("");
		}
		out.println(e.toString());
		if (rs_upass != null)
		{
			try
			{
				rs_upass.close();
			}
			catch (Exception bug123)
			{
			}
		}
		try
		{
			egDb.releaseConnection(true);
			EgDbAdapterTypeUI.releaseObject(egDb);
		}
		catch(Exception e1)
		{}
	}
	str_pass = EgCrypt.decrypt(str_pass);
	session.removeAttribute("isLoggingFirstTime");
	String demoPass = "";
	if (demoUser != null && (demoUser.equalsIgnoreCase("egdemo") || demoUser.equalsIgnoreCase("egpartner") || demoUser.equalsIgnoreCase("egpartner_de")))
	{
		egDb=EgDbAdapterTypeUI.getObject();
		try
		{
			str_conn = egDb.setConnection();
			str_query = "SELECT user_pass FROM user_info WHERE user_id='"+demoUser+"'";
			rs_upass = egDb.SelectExec(str_query);
			while(rs_upass.next())
			{
				demoPass =rs_upass.getString("user_pass");
			}
			session.setAttribute("demoUser",demoUser);
			session.setAttribute("demoPass",demoPass);
			rs_upass.close();
			egDb.releaseConnection(false);
			EgDbAdapterTypeUI.releaseObject(egDb);
		}
		catch(Exception e)
		{
			if (rs_upass != null)
			{
				try
				{
					rs_upass.close();
				}
				catch (Exception bug123)
				{
				}
			}
			try
			{
				egDb.releaseConnection(true);
				EgDbAdapterTypeUI.releaseObject(egDb);
			}
			catch(Exception e1)
			{}
		}
	}

	com.eg.EgMgrUpgradeInfo mgrUpgradeInfo  = new com.eg.EgMgrUpgradeInfo();
	boolean showUpgradeTests = mgrUpgradeInfo.isUpgradeTestsAvailable(); 
%>

<input type="hidden" name="isInternetAvailable" id="isInternetAvailable" value=""/>
<input type="hidden" name="isCustomDashboardEnabled" id="isCustomDashboardEnabled" value="<%=isCustomDashboardEnabled%>"/>
<input type="hidden" name="usrSession" id="usrSession" value="<%=sessionID%>"/>
<input type="hidden" name="mapLicense" id="mapLicense" value="<%=mapEnabled%>"/>
<input type="hidden" name="javaver" id="javaver" value="<%=javaVersion%>"/>
<input type="hidden" name="UViewOpt" id="UViewOpt" value="<%=hasAllComponentAccess%>"/>
<input type="hidden" name="changepwd" id="changepwd" value="<%=changepwd%>"/>
<input type="hidden" name="hidHomePage" id="hidHomePage" value="<%=monHomeDashURL%>">
<input type="hidden" name="hidHomePageURL" id="hidHomePageURL" value="<%=HidForHomePageUrl%>">
<input type="hidden" name="hidSmartHomePage" id="hidSmartHomePage" value="<%=smartHome%>">
<input type="hidden" name="aggEnabled" id="aggEnabled" value="<%=memCheck.isMAEnabled()%>">
<input type="hidden" name="auditlogEnabled" id="auditlogEnabled" value="<%=serviceInfo.isAuditlogEnabled()%>">
<input type="hidden" name="autoconfigEnabled" id="autoconfigEnabled" value="<%=serviceInfo.isAutoConfigureEnabled()%>">
<input type="hidden" name="isAggregateEnabled" id="isAggregateEnabled" value="<%=EgInstallInfo.isAggSupported%>">
<input type="hidden" name="wyseReportEnabled" id="wyseReportEnabled" value="<%=serviceInfo.isWyseReportEnabled()%>">
<input type="hidden" name="BillingReportEnabled" id="BillingReportEnabled" value="<%=serviceInfo.isBillingDataEnabled()%>">
<input type="hidden" name="isNewWindow" id="isNewWindow" value="<%=newWindow%>">
<input type="hidden" name="isFromSm" id="isFromSm" value="<%=fromSm%>">
<input type="hidden" name="fromQuickLaunchPage" id="fromQuickLaunchPage" value="<%=fromQuickLaunch%>">
<input type="hidden" name="access" id="access" value="<%=access%>">
<input type="hidden" name="accessPageName" id="accessPageName" value="<%=accessPageName%>">
<input type="hidden" name="isConfigMgmtEnabled" id="isConfigMgmtEnabled" value="<%=hasConfigTab%>"><!--Config Mgmt-->
<input type="hidden" name="isReporterTabEnabled" id="isReporterTabEnabled" value="<%=hasReporterTab%>"><!--Reporter-->
<input type="hidden" name="isMonitorTabEnabled" id="isMonitorTabEnabled" value="<%=hasMonitorTab%>">
<input type="hidden" name="isAdminTabEnabled" id="isAdminTabEnabled" value="<%=hasAdminTab%>">
<input type="hidden" name="isSlaTabEnabled" id="isSlaTabEnabled" value="<%=hasSlaTab%>">
<input type="hidden" name="capacityReportEnabled" id="capacityReportEnabled" value="<%=serviceInfo.isCapacityReportEnabled()%>">
<input type="hidden" name="menuForVM" id="menuForVM" value="<%=menuForVM%>">
<input type="hidden" name="menuForVMAlso" id="menuForVMAlso" value="<%=menuForVMAlso%>">
<input type="hidden" name="saveScheduleReport" id="saveScheduleReport" value="<%=saveScheduleReport%>">
<input type="hidden" name="hasVMs" id="hasVMs" value="<%=hasVMs%>">
<input type="hidden" name="enableServiceHealth" id="enableServiceHealth" value="<%=enableServiceHealth%>">
<input type="hidden" name="enableEndUserDashboard" id="enableEndUserDashboard" value="<%=enableEndUserDashboard%>">
<input type="hidden" name="enableHighUserProfile" id="enableHighUserProfile" value="<%=enableHighUserProfile%>">
<input type="hidden" name="usersByLocation" id="usersByLocation" value="<%=usersByLocation%>">
<input type="hidden" name="grpByUsrTypes" id="grpByUsrTypes" value="<%=grpByUsrTypes%>">
<input type="hidden" name="enableCitrixCloudMenu" id="enableCitrixCloudMenu" value="<%=isCitrixCloudDash%>">
<input type="hidden" name="enableUEDSubMenu" id="enableUEDSubMenu" value="<%=uedSubMenu%>">
<input type="hidden" name="enableUEDSepMenu" id="enableUEDSepMenu" value="<%=sepSubMenu%>">
<input type="hidden" name="enableVMUEDSubMenu" id="enableVMUEDSubMenu" value="<%=vmUEDSubMenu%>">
<input type="hidden" name="enableHighUEDSubMenu" id="enableHighUEDSubMenu" value="<%=highUedSubMenu%>">
<input type="hidden" name="subMenuUEDStr" id="subMenuUEDStr" value="<%=menuStr%>">
<input type="hidden" name="sepMenuUEDStr" id="sepMenuUEDStr" value="<%=sepMenuStr%>">
<input type="hidden" name="subMenuVMUEDStr" id="subMenuVMUEDStr" value="<%=menuVMStr%>">
<input type="hidden" name="subMenuHighUEDStr" id="subMenuHighUEDStr" value="<%=highMenuStr%>">
<input type="hidden" name="menuSupportStr" id="menuSupportStr"  value="<%=menuSupportStr%>">
<input type="hidden" name="defaultUserType" id="defaultUserType"  value="<%=defaultUserType%>">
<input type="hidden" name="enableSEUMDashboard" id="enableSEUMDashboard" value="<%=enableSEUMDashboard%>">
<input type="hidden" name="enableRUM" id="enableRUM" value="<%=enableRUM%>">
<input type="hidden" name="hasRemoteControlEnabled" id="hasRemoteControlEnabled" value="<%=hasRemoteControlEnabled%>">
<input type="hidden" name="rcEnabled" id="rcEnabled" value="<%=rcEnabled%>">
<input type="hidden" name="login_as_egsm_in_sm" id="login_as_egsm_in_sm" value="<%=login_as_egsm_in_sm%>">
<input type="hidden" name="isSMSupported" id="isSMSupported" value="<%=EgInstallInfo.isSMSupported%>">
<input type="hidden" name="isClusterSupported" id="isClusterSupported" value="<%=EgInstallInfo.isClusterSupported%>">
<input type="hidden" name="clusterType" id="clusterType" value="<%=EgInstallInfo.iclusterType%>">
<input type="hidden" name="isICEnabled" id="isICEnabled" value="<%=memCheck.isExtensible()%>">
<input type="hidden" name="isSuperManager" id="isSuperManager" value="<%=EgInstallInfo.isSuperManager%>">
<input type="hidden" name="isDdEnabled" id="isDdEnabled" value="<%=memCheck.isDdEnabled()%>">
<input type="hidden" name="isAnalyticsEnabled" id="isAnalyticsEnabled" value="<%=EgInstallInfo.isAnalyticsSupported%>">
<input type="hidden" name="isSapMenuEnable" id="isSapMenuEnable" value="<%=isSapMenuEnable%>">
<input type="hidden" name="showUpgradeTests" id="showUpgradeTests" value="<%=showUpgradeTests%>">
<input type="hidden" name="enableLogonSubMenu" id="enableLogonSubMenu" value="<%=logonSubMenu%>">
<input type="hidden" name="em_default_url" id="em_default_url" value="<%=em_default_url%>">
<input type="hidden" name="subMenuLogonStr" id="subMenuLogonStr" value="<%=logStr%>">
<input type="hidden" name="enableLogonSimulator" id="enableLogonSimulator" value="<%=enableLogonSimulator%>">
<input type="hidden" name="enableSapAbapInMenu" id="enableSapAbapInMenu" value="<%=enableSapAbapInMenu%>">
<input type="hidden" name="enableSapPlatformInMenu" id="enableSapPlatformInMenu" value="<%=enableSapPlatformInMenu%>">
<input type="hidden" name="enableSapDashboardsInMenu" id="enableSapDashboardsInMenu" value="<%=enableSapDashboardsInMenu%>">
<input type="hidden" name="isEnableSLA" id="isEnableSLA" value="<%=isEnableSLA%>">
<input type="hidden" name="defaultVDIDashType" id="defaultVDIDashType" value="<%=defaultVDIDashType%>">


<%
	if (!isAlarmViewer)
	{
%>
		
		
<%
	}
	else if(isAlarmViewer)
	{
		if(fromSm==null)
		{
%>
			<center><span id="main_head" style="color:#ffffff;visibility:visible;">LIST OF CURRENT ALARMS</span></center>
<%
		}
		else if(fromSm!=null && fromSm.trim().length()>0 && fromSm.equalsIgnoreCase("hist"))
		{
%>
			<center><span id="main_head" style="color:#ffffff;visibility:visible;">FIX HISTORY</span></center>
<%
		}
		else if(fromSm!=null && fromSm.trim().length()>0 && fromSm.equalsIgnoreCase("feedback"))
		{
%>
			<center><span id="main_head" style="color:#ffffff;visibility:visible;">FIX FEEDBACK</span></center>
<%
		}
	}
%>

<div id="treeRefreshDiv" style="border:0px solid #ff0000;height:1px" class="eg_blankspace">&nbsp;</div>

	<!-- new Ui Design Scripts start here-->
<script language="JavaScript1.2" src="/final/admin/eg_scripts/validate.js"></script>
<script language = "javascript">
	var noUserSearchAlert = '<egui:intnl text="admin.user.No user found for your current search"/>';
	var LoadSearchAlert = '<table border="0" width="100%" height="170px"><tr><td align="center" valign="middle"><div class="iconInformation"></div><div class="commonErrorMsgText" id="noCompAlrtDiv">'+noUserSearchAlert+'</div></td></tr></table>';
	var orgName='<%=orgName%>';
	var pageTitleForPwdChange = '<egui:intnl text="admin.user.Password Alert"/>';
	var pwdLabelText1 = '<egui:intnl text="admin.user.New Password"/>';
	var pwdLabelText2 = '<egui:intnl text="admin.user.Confirm New Password"/>';
	var userPwdValidationMsg1 = '<egui:intnl text="admin.user.Please enter the new password"/>';
	var userCnfPwdValidationMsg1 = '<egui:intnl text="admin.user.Please enter the confirm new password"/>';
	var userCnfPwdValidationMsg2 = '<egui:intnl text="admin.user.Passwords do not match"/>';
	var userPwdValidationMsg2 = '<egui:intnl text="admin.user.Password cannot be same as user name"/>';
	var passLabel1 = '<egui:intnl text="admin.user.Password should contain atleast"/>';
	var passLabel2 = '<egui:intnl text="admin.user.characters"/>';
	var userPwdValidationMsg3 = '<egui:intnl text="admin.user.Password policy requirements are not satisfied"/>';
	var userPwdValidationMsg4 = '<egui:intnl text="admin.user.Password is not allowed in DBL(Chinese,Korean,Japanese),since manager is SingleByte"/>';
	var passCheckMsg1 = '<egui:intnl text="admin.user.a lowercase alphabet"/>';
	var passCheckMsg2 = '<egui:intnl text="admin.user.an uppercase alphabet"/>';
	var passCheckMsg3 = '<egui:intnl text="admin.user.a number"/>';
	var passCheckMsg4 = '<egui:intnl text="admin.user.a special character other than double quotes"/>';
	var pwdSuccessMsg = '<egui:intnl text="admin.user.Password updated successfully"/>';
	var pwdFailureMsg = '<egui:intnl text="admin.user.Error in updating the password"/>';
	var pwdLabel = '<egui:intnl text="admin.user.You are logged in as"/>';
	var pwdLabel1 = '<egui:intnl text="admin.user.Your account has a default password"/>.';
	var pwdLabel2 = '<egui:intnl text="admin.user.Please provide a new password now"/>.';
	var pwdLabel3 = '<egui:intnl text="admin.user.The following accounts have a default password"/>.';
	var pwdLabel4 = '<egui:intnl text="admin.user.Please instruct the users to change their passwords for security reasons"/>.';
	var pwdLabel5 = '<egui:intnl text="admin.user.account has a default password"/>.';
	var pwdLabel6 = '<egui:intnl text="admin.user.Please instruct the"/>';
	var pwdLabel7 = '<egui:intnl text="admin.user.user to change the password for security reasons"/>.';
	var isDoubleByteEnabled = '<%=isDouble%>'
	var usersForPasswordChange='<%=usersForPasswordChange%>';
	var usersForPasswordChangeIntimation='<%=usersForPasswordChangeIntimation%>';
	var hidePasswordChangeWindow = <%=hidePasswordChangeWindow%>;
	var logoImageName='<%=imageName%>';
	var demoUser='<%=demoUser%>';
//if(logoImageName==null || logoImageName=="null" || logoImageName.toLowerCase()=="none" || logoImageName.toLowerCase()=="undefined")
//	logoImageName="";
<%
	if (!isAlarmViewer)
	{
%>
		setURLPrefix('<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/final"%>');
		if(<%=hasMonitorTab%>)
		{
			if((showAlertAdmin!=null && showAlertAdmin=="true") && adminPressed)
			{
				if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
				{
					if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
					{
						if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
						{
							if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
							{
								setInterval("getSmartAlert()", "90000")
							}
							else
							{
								setInterval("getSmartAlert()", "90000")
							}
						}
						else
						{
							setInterval("getSmartAlert()", "90000")
						}
					}
					else
					{
						setInterval("getSmartAlert()", "90000")
					}
				}
				else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
						{
							setInterval("getSmartAlert()", "90000")
						}
						else
						{
							setInterval("getSmartAlert()", "90000")
						}
					}
					else
					{
						setInterval("getSmartAlert()", "90000")
					}
				}
				else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						setInterval("getSmartAlert()", "90000")
					}
					else
					{
						setInterval("getSmartAlert()", "90000")
					}
				}
				else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					setInterval("getSmartAlert()", "90000")
				}
				else
				{
					setInterval("getSmartAlert()", "90000")
				}
			}
			else if((showAlertMonitor!=null && showAlertMonitor=="true") && monitorPressed)
			{
				if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
				{
					if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
					{
						if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
						{
							setInterval("getSmartAlert()", "90000")
						}
						else
						{
							setInterval("getSmartAlert()", "90000")
						}
					}
					else
					{
						setInterval("getSmartAlert()", "90000");
					}
				}
				else
				{
					setInterval("getSmartAlert()", "90000");
				}
			}
			else if((showAlertReporter!=null && showAlertReporter=="true") && reporterPressed) 
			{
				if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
				{
					if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
					{
						setInterval("getSmartAlert()", "90000")
					}
					else
					{
						setInterval("getSmartAlert()", "90000")
					}
				}
				else
				{
					setInterval("getSmartAlert()", "90000");
				}
			}
			else if((showAlertConfig!=null && showAlertConfig=="true") && configPressed)
			{
				if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
				{
					setInterval("getSmartAlert()", "90000")
				}
				else
				{
					setInterval("getSmartAlert()", "90000")
				}
			}
			else if((showAlertSla!=null && showAlertSla=="true") && slaPressed)
			{
				setInterval("getSmartAlert()", "90000")
			}
		}
		var delayCtr = false;
<%
	}
%>

	function showDiv(mydiv)
	{
		return;
		var thisDiv = document.getElementById(mydiv);
		if (thisDiv == null || thisDiv == "undefined")
			return;
		var visibility = thisDiv.style.visibility;
		if (visibility != null && visibility != "undefined")
		{
			if (visibility == "visible")
			{
				if (! delayCtr)
				{
					delayCtr = true;
					setTimeOut("showDiv('" + mydiv + "')", 3000);
				}
				thisDiv.style.display = "none"
				thisDiv.style.visibility = "hidden"
			}
			else
				thisDiv.style.visibility = "visible"

			if (delayCtr)
				delayCtr = false;
		}

		var display = thisDiv.style.display;

		if (display != null && display != "undefined")
		{
			if (display == "block")
			{
				if (! delayCtr)
				{
					delayCtr = true;
					setTimeOut("showDiv('" + mydiv + "')", 3000);
				}
					thisDiv.style.display = "none"
			}
			else
				thisDiv.style.display = "block"
				if (delayCtr)
					delayCtr = false;
		}
	}

	function closeChildren()
	{
		if (alarmWindowRef!=null && alarmWindowRef!="undefined")
		{
			alarmWindowRef.close();
			alarmWindowRef=null;
		}
		if (tabPopUp!=null && tabPopUp!="undefined")
		{
			changeNewWindowStatus();
			tabPopUp.close();
			tabPopUp=null;
		}
		if (win!=null && win!="undefined")
		{
			win.close();
			win=null;
		}
		cleanupWindows();
	}

	var xmlhttp;
	

	function state_Change2()
	{
		var menuItemsDiv = document.getElementById("menuItemsDiv");
		if (xmlhttp.readyState == 4)
		{
			try
			{
				if (xmlhttp.status == 200)
				{
					val = xmlhttp.responseText;
					menuItemsDiv.innerHTML = val;
					menuItemsDiv.style.visibility = "visible";
					menuItemsDiv.style.display = "block";
				}
			}
			catch (error)
			{
				//error
			}
		}
	}

	function configureQuickLinks()
	{
		var mainIframe = document.getElementById("main");
		if (mainIframe != null )
		{
			mainIframe.src = "/final/admin/egQuickMenu.jsp?newwindow="+newwin;	
		}
	}

	function changeNewWindowStatus()
	{
		xmlhttp = null;
		if (window.XMLHttpRequest)
		{
			xmlhttp = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (xmlhttp != null)
		{
			var params = "";
			var url = "/final/servlet/com.eg.EgHelperServlet;jsessionid=<%=sessionID%>";
			xmlhttp.open('POST',url,true);
			xmlhttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
			xmlhttp.setRequestHeader('Content-length',params.length);
			xmlhttp.setRequestHeader('Connection','close');
			xmlhttp.send(params);
		}
		else
		{
			alert('<egui:intnl text="admin.login.Your browser does not support XMLHTTP"/>');
		}
	}

	function goToReporterUrl(url,obj)
	{ 
		var textContent= obj.innerHTML;
		if (textContent.indexOf('RUM Report')>-1)
		{
			textContent=textContent.substring(16);
			textContent=textContent.substring(0,textContent.indexOf('</'));
			url+='&er_RmDispName='+textContent;
		}
		document.getElementsByTagName('iframe')['main'].contentWindow.loadQuickLinkFromEgIndex(url);
  	}
	function goToUrl(url)
	{
		window.location.href = url+"&quickLinksClicked="+clicked;
	}

	function destroyNotificationWindow()
	{
		var winObj = Ext.getCmp('mangerNotificationWindow');
		Ext.get('notifications').removeCls("circleSelected");
		winObj.destroy();
		managernofclicked=false;
	}


	function closecurrentwinodow()
	{
		changeNewWindowStatus();
		closeChildren();
		window.close();
<%
		if(isFromQuickLaunch)
		{
%>
		window.location.href="/final/admin/EgLogoutA.jsp?userid=<%=isAdmin%>&fromPage=proceedingSignout";
		window.close();
<%
		}
%>
	}

var $ = jQuery.noConflict();

// code for wayToLayerModel 

function wayToLayerModel(alarmQryStr)
{
	if(alarmQryStr!=null && alarmQryStr.indexOf("?")>0)
		alarmQryStr = alarmQryStr.substr(alarmQryStr.indexOf("?")+1);
	if ('<%=reqFrom%>' != null && '<%=reqFrom%>' == 'clsTrial')
	{
		window.location.href = "/final/egIndex.jsp?entry=monitor&qViewParam=" + encodeURIComponent(alarmQryStr) + "&fromPage=alarmQView&newwindow=false&displayTab=all&reqFrom=clsTrial"
	}
	else
	{

		window.location.href = "/final/egIndex.jsp?entry=monitor&qViewParam=" + encodeURIComponent(alarmQryStr) + "&fromPage=alarmQView&newwindow=false&displayTab=all"	
	}

}

<%
	String isCallToEnableCPFromReporter = request.getParameter("isCallToEnableCPFromReporter");
	if (isCallToEnableCPFromReporter != null && isCallToEnableCPFromReporter.equalsIgnoreCase("true"))
	{
		url = "/final/admin/EgManagerSettingsTree.jsp?reqfrom=navlink&isCallToEnableCPFromReporter=true&selectedNode=capacityPlanningNode";
	}

	String accessKey = specsIni.getValue("SETTINGS","EG_SERVER");
	accessKey = EgCrypt.encrypt(accessKey);

	String si = session.getId();
	si = EgCrypt.encrypt(si);

	String secretKey = GoogleAuthenticator.getRandomSecretKey();
	String encryptedSecretKey = EgCrypt.encrypt(secretKey);
%>

// wayToLayerModel code ends here
var hideSwitchUser = <%=hideSwitchUser%>;
var hideDownloadAgent = <%=hideDownloadAgent%>;
var switchback = <%=switchback%>;
var ape='<%=accessKey%>';
var spe='<%=si%>';
var kpe='<%=encryptedSecretKey%>';
var reqFrom='<%=reqFrom%>';
var displayTab='<%=displayTab%>';
var isSM = '<%=isSM%>';
var showAdminHelpPageForSm='<%=showAdminHelpPageForSm%>';
var queryString = '<%=queryString%>';
var sessionID = '<%=sessionID%>';
var url='<%=url%>';
var adminPressed=eval('<%=adminPressed%>');
var monitorPressed=eval('<%=monitorPressed%>');
var reporterPressed=eval('<%=reporterPressed%>');
var configPressed=eval('<%=configPressed%>');
var slaPressed=eval('<%=slaPressed%>');

var isAdminNewWindow = eval('<%=isAdminNewWindow%>');
var isMonitorNewWindow = eval('<%=isMonitorNewWindow%>');
var isReporterNewWindow = eval('<%=isReporterNewWindow%>');
var isConfigNewWindow =eval('<%=isConfigNewWindow%>');
var isSlaNewWindow =eval('<%=isSlaNewWindow%>');

var isAdminSeperator=eval('<%=isAdminSeperator%>');
var isMonitorSeperator = eval('<%=isMonitorSeperator%>');
var isReporterSeperator=eval('<%=isReporterSeperator%>');
var isConfigSeperator=eval('<%=isConfigSeperator%>');
var isSlaSeperator=eval('<%=isSlaSeperator%>');

var currYear = '<%=currYear%>';
var version = '<%=EgInstallInfo.version%>';
var footerText = '<%=strFooterText%>';

var stateIcons = '<%=stateIcons%>';
var stateIconsHTML ='';

var eTvShowHide = '';
if(hasTVModeSelectedscreens)
{
	eTvShowHide = 'none';
}
else
{
	eTvShowHide = 'block'; 
}

if ( stateIcons != undefined && stateIcons != null )
{
	var isNewBrowWin = '<%=newWindow%>';
	var isShowFullScreenBtn='block';
	if(isNewBrowWin!=null && isNewBrowWin=="yes")
	{
		isShowFullScreenBtn='none';
	}
	if ( stateIcons == 'yes' )
	{
		stateIconsHTML = '<div style="float:right;"><div style="float:left;display:'+isShowFullScreenBtn+';margin-top:2px" id="resizeBrowserDiv" name="resizeBrowserDiv" class="iconGoFullScreen" onclick="javascript:toggleFullScreen();"></div><div style="float:left;display:'+isShowFullScreenBtn+';margin-top:2px;margin-right:5px;font-size:9px" id="resizeBrowserMsg" name="resizeBrowserMsg" class="iconFullViewText" onclick="javascript:toggleFullScreen();"><egui:intnl text="admin.common.Go Full Screen" /></div><div style="float:left;margin-top:2px;display:'+eTvShowHide+'" id="tvModeGeneric"></div><div style="float:left;margin-right:5px;margin-left:5px;overflow:hidden" class="state_transition_HIGH"><div style="float:left" class="critical">Critical</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_INTERMEDIATE" ><div style="float:left" class="intermediate">Major</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_LOW" ><div style="float:left" class="low">Minor</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_UNKNOWN" ><div style="float:left" class="unknown">Unknown</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_GOOD" ><div style="float:left" class="good">Normal</div> </div></div>';

		//<div style="float:left;margin-right:5px" class="state_transition_HIGH"><div style="float:left" class="critical">Critical</div><div style="float:right;" class="stateEffect_HIGH " title="Critical"></div> </div>
	}
	else
	{
		stateIconsHTML = '<div style="float:right;"><div style="float:left;display:'+isShowFullScreenBtn+'" id="resizeBrowserDiv" name="resizeBrowserDiv" class="iconGoFullScreen"  onclick="javascript:toggleFullScreen();"></div><div style="float:left;display:'+isShowFullScreenBtn+';margin-top:2px;margin-right:5px;font-size:9px" id="resizeBrowserMsg" name="resizeBrowserMsg" class="iconFullViewText" onclick="javascript:toggleFullScreen();"><egui:intnl text="admin.common.Go Full Screen" /></div><div style="float:left;margin-top:2px;display:'+eTvShowHide+'" id="tvModeGeneric"></div><div style="float:left;margin-right:5px;margin-left:5px;overflow:hidden" class="state_transition_HIGH"><div style="float:left" class="critical">Critical</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_INTERMEDIATE" ><div style="float:left" class="intermediate">Major</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_LOW" ><div style="float:left" class="low">Minor</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_UNKNOWN" ><div style="float:left" class="unknown">Unknown</div> </div><div style="float:left;margin-right:5px;overflow:hidden" class="state_transition_GOOD" ><div style="float:left" class="good">Normal</div> </div>'; 
	}

		//  old design state class name replaced with new class name in the else part. Also need to check the else part (No need).

		//<div style="float:left;margin-right:5px" class="stateEffect_HIGH_optional" title="Critical"> </div><div style="float:left;margin-right:5px" class="stateEffect_INTERMEDIATE_optional" title="Major"> </div><div style="float:left;margin-right:5px" class="stateEffect_LOW_optional" title="Minor"> </div><div style="float:left;margin-right:5px" class="stateEffect_UNKNOWN_optional" title="Unknown"> </div><div style="float:left;margin-right:5px;margin-left:5px;" class="stateEffect_GOOD_optional" title="Normal"> </div></div>'; 	}

}

var user = '<%=id%>';
var isAdminNewWindowIcon = eval('<%=isAdminNewWindowIcon%>');
var isMonitorNewWindowIcon =eval('<%=isMonitorNewWindowIcon%>');
var isReporterNewWindowIcon = eval('<%=isReporterNewWindowIcon%>');
var isConfigNewWindowIcon=eval('<%=isConfigNewWindowIcon%>');
var isSlaNewWindowIcon=eval('<%=isSlaNewWindowIcon%>');

var isIndexMegaLinkEnabled=eval('<%=isIndexMegaLinkEnabled%>');
var isIndexMenuLinkEnabled=eval('<%=isIndexMenuLinkEnabled%>');
var userTooltipMsg='<egui:intnl text="admin.user.You are logged in as " />';
var userTooltipMsg1='<egui:intnl text="admin.user.belong to " />';
var managerNotifyMsg='<egui:intnl text="admin.common.Manager Notification" />';
var downloadAgentMsg='<egui:intnl text="admin.common.Download eG Enterprise Agent" />';
var switchProfileMsg='<egui:intnl text="admin.common.Switch Profile" />';
/* smoth menu script ennds */

var isLicenceValid = '<%=licenceValidAlert%>';
var isLicenseEnabled = '<%=enableLicenseAlert%>';
var isUserExpired = '<%=userExpiryMsg%>';
var isUsersLimitCrossed = '<%=isUsersLimitCrossed%>';
var alertUserAbtUserCert = '<%=alertUserAbtUserCert%>';
var isAdminModule = '<%=isAdmin%>';
var isMonitorModule = '<%=isMonitor%>';
var isRepModule = '<%=isReport%>';
var isConfigModule = '<%=isConfig%>';
var isSlaModule = '<%=isSla%>';
var messageOne = '<%=message%>';
var messageTwo = '<%=message2%>';
var hasNotificationWindow = '<%=hasNotificationWindow%>';
var hasPasswordChangeWindow = '<%=hasPasswordChangeWindow%>';
var isWindowClosable = true;
var adminAlertConfig = "";
var adminWarnings = "";
var tmpAccessPrevilage = '<%=userRole.hasAllComponentAccess()%>';
var hasAllComponentAccess = tmpAccessPrevilage == "true" ? true:false;
var hasMonitorTab = <%=hasMonitorTab%>;
var fromReportTemplate = <%=fromReportTemplate%>;
var showMonHome = <%=showMonHome%>;
var tmpEnableSLA = '<%=isEnableSLA%>';
var isEnableSLA = (tmpEnableSLA == "true") ? true:false;
var show_user_profile=eval('<%=show_user_profile%>');
var userIDValidationMsg65 = '<egui:intnl text="admin.user.As 2-Step verification feature has enabled"/>';
var userIDValidationMsg66 = '<egui:intnl text="admin.user.Please provide vaild To Mail ID"/>';
</script>
<!-- ext js and css -->
<!-- script type="text/javascript" src="../extjs/ext-all.js" ></script -->

<script src="/final/styles/jscrollpane/jquery.jscrollpane.js" ></script>
<script src="/final/styles/jscrollpane/jquery.mousewheel.js" ></script>
<script src="/final/styles/jscrollpane/mwheelIntent.js" ></script>
<link rel="stylesheet" href="/final/styles/jscrollpane/jquery.jscrollpane.css"/>

<script type="text/javascript" src="/final/admin/eg_scripts/validate.js"></script>

<script language="javascript" src="<%=menuAdminItemJSLink%>"></script>
<script language="javascript" src="<%=menuMonitorItemJSLink%>"></script>
<script language="javascript" src="<%=menuReporterItemJSLink%>"></script>
<script language="javascript" src="<%=menuConfigItemJSLink%>"></script>
<script language="javascript" src="<%=menuSlaItemJSLink%>"></script>


<script type="text/javascript" src="/final/admin/eg_scripts/navlinksAdminMega.js"></script>
<%
	if (reqFrom != null && reqFrom.equalsIgnoreCase("clsTrial"))
	{
%>
		<script type="text/javascript" src="/final/monitor/eg_scripts/navlinksMonitorMegaLS.js"></script>
		<style type="text/css">
			/*#configModQuickAlarm{ left:-358px !important;top:25px !important;}*/
			/*#mangerNotificationWindow{left:-182px !important;top:25px !important;}*/
		</style>
<%
	}
	else
	{
%>
		<script type="text/javascript" src="/final/monitor/eg_scripts/navlinksMonitorMega.js"></script>
		<style type="text/css">
			/*#configModQuickAlarm{ left:-325px !important;top:25px !important;}*/
			/*#mangerNotificationWindow{left:-150px !important;top:25px !important;}*/
		</style>
<%
	}
%>
<script type="text/javascript" src="/final/config/scripts/navlinksConfigMega.js"></script>
<script type="text/javascript" src="/final/reporter/scripts/navlinksReporterMega.js"></script>
<script type="text/javascript" src="/final/SLA/scripts/navlinksSLAMega.js"></script>

<egui:loadApp baseDir="/final/scripts" appName="EgIndexApp/app"/>


<script>
var cloudModel = '<%=cloudModel%>';
var isNewBrowWin = '<%=newWindow%>';
var hideInSuperManager = false;
var hideSearch = false;
var hideQuickAlert = false;
var hideInAv_SuperManager = eval('<%=EgInstallInfo.isSuperManager%>');
var hideQuickLink = <%=hideQuickLink%>;
var hiddenUserProfile = '<%=hiddenUserProfile%>'=='true';
var indexTabURL = '';
var assetPopupWindow = '';
var hideUserSearchBox=false; 
var assetmanagent = '<egui:intnl text="admin.Asset.Asset Management" />';
//Asset Info PopupWindow;
function loadPopup()
{
	assetPopupWindow = new Ext.create('Ext.window.Window', {
		title: assetmanagent,
		id: 'assetPopupWindow',
		name: 'assetPopupWindow',
		cls: 'llightbox',
		ui: 'newPopupWindow assetAlarmPopupWinHeader',
		header: {
			height: 48,
			padding: '0 20',
			margin: 0
		},
		layout: 'fit',
		closeAction: 'destroy',
		shadow: 'sides',
		modal: true,
		draggable: true,
		resizable: true,
		constrain: true,
		ghost: false,
		//height: 350,
		height: 565,
		//width: 840,
		width: 605,
		listeners: {
			show: function(win) {
				if (this.modal) {
					var dom = Ext.dom.Query.select('.x-mask');
					var el = Ext.get(dom[0]);
					el.addCls('windowModal');
					
				}
			},
			hide: function(win) {
				if (this.modal) {
					var dom = Ext.dom.Query.select('.x-mask');
					var el = Ext.get(dom[0]);
					el.removeCls('windowModal');
					
				}
			},
		}
	}); 
	return assetPopupWindow;
}

<%
	if(user.isOnlyVMAssigned())
	{
%>
	hideQuickAlert = true;
<%
	}
%>

<%
	if(EgInstallInfo.isSuperManager)
	{
%>
	hideInSuperManager = true;
<%
	}
%>
if(hideInSuperManager || isAlarmViewer=="true" ||( displayTab!=null && (displayTab!='monitor' && displayTab!='all')))
{
	hideUserSearchBox=true;
}
if(!hasMonitorTab  || isAlarmViewer=="true")
{
	hideUserSearchBox=true;
	hideSearch=true;
	hideQuickAlert=true;
}

if (reqFrom == "clsTrial")
{
	hideSearch=true;
	hideDownloadAgent = true;
}

if (cloudModel != null && cloudModel.toLowerCase() == "phoenix")
{
	hideDownloadAgent = true;
	if (!hasAllComponentAccess)
	{
		hideQuickLink = true;
		hideSwitchUser = true;
	}
}

Ext.onReady(function(){
		Ext.Ajax.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
		Ext.data.Connection.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};
		Ext.data.ScriptTagProxy.prototype.extraParams = {"com.eg.CSRF_NONCE" : csrfToken};

		 Ext.Ajax.on('requestexception', function (conn, response, options) {
                var errorStr = response.responseText;
                if (errorStr != undefined && errorStr != 'undefined' && errorStr.indexOf("customerror") != -1)
                {
                    if (errorStr.indexOf("user-session-invalid") != -1)
                    {
                        callWindow(1);
                    }
                    else if (errorStr.indexOf("user-deleted") != -1)
                    {
                        callWindow(2);
                    }
                    else if (errorStr.indexOf("user-timedout") != -1)
                    {
                        callWindow(3);
                    }
                }
            });

	});


Ext.onReady(function(){
//Ext.EventManager.on(Ext.getBody(), 'keypress', function() { alert("keypress"); });
if(isNewBrowWin==null || isNewBrowWin!="yes")
{
	Ext.EventManager.addListener(Ext.getBody(), 'keyup', handleKeyPrs);
}
else
{
	var resizeBrowserDiv = Ext.get('resizeBrowserDiv');
	var resizeBrowserMsgDiv = Ext.get('resizeBrowserMsg');
	if(!Ext.isEmpty(resizeBrowserDiv))
	{
		resizeBrowserDiv.hide();
	}
	if(!Ext.isEmpty(resizeBrowserMsgDiv))
	{
		resizeBrowserMsgDiv.hide();
	}
}
/*Ext.getBody().on('keypress', function(f, e) {
	alert(e.getKey());
    if (e.getKey() === Ext.EventObject.ENTER)
    {
		alert("key down");
        //do whatever you want here
    }
});*/

	try
	{
		Ext.state.Manager.setProvider(new Ext.state.LocalStorageProvider());
	}
	catch (error)
	{
		console.log("error in creating local storage @ egindex.jsp ",error);
	}
});



Ext.onReady(function(){

	//alert('registerint');
	Ext.EventManager.addListener(window, 'keyup', handleTVModeKeyPrsss);
	
	function handleTVModeKeyPrsss(e){
		if(e!=null && !Ext.isEmpty(e) && e.keyCode!=null && e.keyCode==27)
		{
			Ext.defer(function(){
				frame = document.getElementById('tvMode');
				frameDoc = frame.contentDocument || frame.contentWindow.document;
				frameDoc.documentElement.innerHTML = " ";
				frame.src="about:blank";
				
			},400);
		}
	}
});



	function showFullScreenOption(isF11FullView1)
	{
		Ext.onReady(function(){
		var resizeBrowserDiv = Ext.get('resizeBrowserDiv');
		var resizeBrowserMsgDiv = Ext.get('resizeBrowserMsg');
	/*	 var heightMargin = 5;
        if(Ext.isWebKit && /Apple Computer/.test(navigator.vendor)) {
            // Safari in full screen mode shows the navigation bar,which is 40px
            heightMargin = 42;
        }*/
	//	var isInFullScreenMode = (screen.width == window.innerWidth &&
     //       Math.abs(screen.height - window.innerHeight) < heightMargin);

		
		if(isF11FullView1)
		{
			resizeBrowserDiv.dom.className='iconExitFullScreen';
			if(!Ext.isEmpty(resizeBrowserMsgDiv))
			{
				resizeBrowserMsgDiv.update(exitFullViewMsg);
			}
			if(!Ext.isEmpty(resizeBrowserDiv))
			{
				resizeBrowserDiv.hide();
			}
			if(!Ext.isEmpty(resizeBrowserMsgDiv))
			{
				resizeBrowserMsgDiv.hide();
			}
		}
		else
		{
			resizeBrowserDiv.dom.className='iconGoFullScreen';
			if(!Ext.isEmpty(resizeBrowserMsgDiv))
			{
				resizeBrowserMsgDiv.update(goFullViewMsg);
			}
			if(!Ext.isEmpty(resizeBrowserDiv))
			{
				resizeBrowserDiv.show();
			}
			if(!Ext.isEmpty(resizeBrowserMsgDiv))
			{
				resizeBrowserMsgDiv.show();				
			}
		}
		});
	}

	function changeFullScreenIconAndText()
	{
		Ext.onReady(function(){
		var resizeBrowserDiv = Ext.get('resizeBrowserDiv');
		
		if(!Ext.isEmpty(resizeBrowserDiv) && resizeBrowserDiv.dom.className=='iconGoFullScreen')
		{
			resizeBrowserDiv.dom.className='iconExitFullScreen';
			var resizeBrowserMsgDiv = Ext.get('resizeBrowserMsg');
			if(!Ext.isEmpty(resizeBrowserMsgDiv))
			{
				resizeBrowserMsgDiv.update(exitFullViewMsg);
			}
		}
		else if(!Ext.isEmpty(resizeBrowserDiv) && resizeBrowserDiv.dom.className=='iconExitFullScreen')
		{
			resizeBrowserDiv.dom.className='iconGoFullScreen';
			var resizeBrowserMsgDiv = Ext.get('resizeBrowserMsg');
			if(!Ext.isEmpty(resizeBrowserMsgDiv))
			{
				resizeBrowserMsgDiv.update(goFullViewMsg);
			}
		}
		});
	}
		 
	function toggleFullScreen() {

		Ext.onReady(function(){
		var resizeBrowserDiv = Ext.get('resizeBrowserDiv');
		changeFullScreenIconAndText();
		var isIE = Ext.isIE;
		if(isIE)
		{
			if(typeof window.ActiveXObject!="undefined"){
				// for Internet Explorer
				try {
					var wscript = new ActiveXObject("WScript.Shell");
					wscript.SendKeys("{F11}");
				} catch(e){
					Ext.Msg.show({
						title:'Alert',
						 msg: 'Your security settings are preventing full screen access please press F11 on your keyboard.',
						buttons: Ext.Msg.OK,
						icon: Ext.Msg.WARNING
					 });
					return;
				}
			}
		}
		else
		{
		  /*if (!document.fullscreenElement &&    // alternative standard method
			  !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msRequestFullscreenElement) {  // current working methods*/
			 
			  // To Support latest versions of Chrome, Firefox and IE(11) also
			  if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
			if (document.documentElement.requestFullscreen) {
				fullScreenApi.lastState = 'fullScreen';
			  document.documentElement.requestFullscreen();
			} else if (document.documentElement.mozRequestFullScreen) {
				fullScreenApi.lastState = 'fullScreen';
			  document.documentElement.mozRequestFullScreen();
			} else if (document.documentElement.webkitRequestFullscreen) {
				fullScreenApi.lastState = 'fullScreen';
			  document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
			}else if (document.documentElement.msRequestFullscreen) {
				fullScreenApi.lastState = 'fullScreen';
			  document.documentElement.msRequestFullscreen();
			}
		  } else {

			if (document.cancelFullScreen) {
				fullScreenApi.lastState = 'exitScreen';
			  document.cancelFullScreen();
			} else if (document.mozCancelFullScreen) {
				fullScreenApi.lastState = 'exitScreen';
			  document.mozCancelFullScreen();
			} else if (document.webkitCancelFullScreen) {
				fullScreenApi.lastState = 'exitScreen';
			  document.webkitCancelFullScreen();
			} else if (document.msExitFullscreen) {
				fullScreenApi.lastState = 'exitScreen';
			  document.msExitFullscreen();
			}
		  }
		}
		
		});
	}
	$(window).keydown(function(e) {
		if (e.which == 116 || e.keyCode == 82 && e.ctrlKey) { //116 = F5
			refreshEgIndexPage();
			return false;
		}				
	});
	var refreshInProgress = false;
	function refreshEgIndexPage(r)
	{ 
		if(refreshInProgress)
			return;

		refreshInProgress = true;
		
		Ext.onReady(function(){
			if(lastTabQueryString!=null && lastTabQueryString!="" && lastTabQueryString.indexOf("?")>0)
			{
				lastTabQueryString=lastTabQueryString.substring(lastTabQueryString.indexOf("?")+1);
			}
				Ext.Ajax.request({
					url : '/final/scripts/EgIndexApp/data/egIndexJson.jsp',
					method : 'POST',
					params : lastTabQueryString,
					async : false,
					success : function(response)
					{
						var jsonText=response.responseText;
						var jsonData=Ext.decode(jsonText);
						isShowAlarmsInLightBox=jsonData['isShowAlarmsInLightBox'];
						isShowSlaAlertsPopup=jsonData['isShowSlaAlertsPopup'];
						homepage=jsonData['homepage'];
						smartHomePage=jsonData['smartHomePage'];
						url=jsonData['url'];
						adminPressed=jsonData['adminPressed'];
						monitorPressed=jsonData['monitorPressed'];
						reporterPressed=jsonData['reporterPressed'];
						configPressed=jsonData['configPressed'];
						slaPressed=jsonData['slaPressed'];
						helpURL=jsonData['helpURL'];
						selectedTabTheme=jsonData['selectedTabTheme'];
						isDisableMydashboardPopout=jsonData['isDisableMydashboardPopout'];
						var mainIframe = document.getElementById("main");
						hasTVModeSelectedscreens=jsonData['hasTVModeSelectedscreens'];
						if(hasTVModeSelectedscreens){
							//Ext.get('tvModeGeneric').hide();
							Ext.get('tvModeGeneric').setStyle('display', 'none');
						}else{
							Ext.get('tvModeGeneric').show();
						}
						//document.getElementById("hidHomePageURL").value=homepage;
						if( r=="userprofile_monitor_homepage")
						{
							var egTheme_userpro = jsonData['egTheme'];
							var currentSkin="";
							var previousSkin="";	
							if(egTheme_userpro != null&&egTheme_userpro=="Dark")
							{
								currentSkin="Dark";
								previousSkin="Light";								
							}
							else
							{
								previousSkin="Dark";
								currentSkin="Light";								
							}
							$('link[href="/final/styles/eG'+previousSkin+'Theme.css"]').attr('href',"/final/styles/eG"+currentSkin+"Theme.css");
							$('link[href="/final/styles/eG'+previousSkin+'ThemeIcons.css"]').attr('href',"/final/styles/eG"+currentSkin+"ThemeIcons.css");
							$('link[href="/final/styles/index'+previousSkin+'.css"]').attr('href',"/final/styles/index"+currentSkin+".css");	
						}
						if (mainIframe != null )
						{
							if(monitorPressed && r=="userprofile_monitor_homepage")
							{
								mainIframe.src = homepage; 
								Ext.get('dropdownhidemonitor').update(getstrMegaMonitor(true));
 							}
							else
							{
								if (url.indexOf("EgReporter.jsp")>-1)	// for reporter module
								{
									//var contentWindow=document.getElementsByTagName('iframe')['main'].contentWindow; 
									var contentWindow=mainIframe.contentWindow; 
									//console.log(contentWindow);
									if(fromReportTemplate)
										mainIframe.src = '/final/reporter/ReporterTemplate.jsp?';
									else if(contentWindow.callFromIndexJsp!=undefined)
									{
										contentWindow.callFromIndexJsp();
										contentWindow=null;
										delete contentWindow;
									}
									else
									{
										mainIframe.src = url;
									}
								}
								else
								{
									mainIframe.src = url;	
								}
							}
						}
						refreshInProgress=false;
					},
					failure : function(response)
					{
						console.log(response);
						refreshInProgress=false;
					}
				});

			});
			var divId = document.getElementById("alarmsListDiv");
			if(divId != null)
				closeDiv();
			
			return false;
	}
	function getSearchBoxObj()
	{
		var searchBoxObj = null;
		Ext.onReady(function(){

		searchBoxObj = Ext.getCmp('egsearches');
		});

		return searchBoxObj;
	}
	function getSearchComboObj()
	{
		var searchCmpObj = null;
		Ext.onReady(function(){
			searchCmpObj = Ext.getCmp('searchCombo');
		});
		return searchCmpObj;
	}

	function goToTestConfiguration (queryString)
	{
		if(queryString!=null && queryString.indexOf("?")>0)
		{
			var meTabSetView=Ext.getCmp('tabset');
			queryString=queryString.substring(queryString.indexOf("?")+1);
			lastTabQueryString=queryString;
			Ext.Ajax.request({
				url : '/final/scripts/EgIndexApp/data/egIndexJson.jsp',
				method : 'POST',
				params : queryString,
				success : function(response)
				{
					var jsonText=response.responseText;
					var jsonData=Ext.decode(jsonText);
					isShowAlarmsInLightBox=jsonData['isShowAlarmsInLightBox'];
					homepage=jsonData['homepage'];
					smartHomePage=jsonData['smartHomePage'];
					url=jsonData['url'];
					adminPressed=eval(jsonData['adminPressed']);
					monitorPressed=jsonData['monitorPressed'];
					reporterPressed=jsonData['reporterPressed'];
					configPressed=jsonData['configPressed'];
					slaPressed=jsonData['slaPressed'];
					isUsersLimitCrossed=jsonData['isUsersLimitCrossed'];
					alertUserAbtUserCert=jsonData['alertUserAbtUserCert'];
					userExpiryMsg=jsonData['userExpiryMsg'];
					isLicenseEnabled=jsonData['isLicenseEnabled'];
					isLicenceValid=jsonData['isLicenceValid'];
					var previousSkin=jsonData['previousSkin'];
					var currentSkin=jsonData['currentSkin'];
					logoImageName = jsonData['LogoImageName'];
					moduleName=jsonData['moduleName'];
					egTheme=jsonData['egTheme'];
					selectedTabTheme=jsonData['selectedTabTheme'];
					hideAlarmPopup=jsonData['hideAlarmPopup'];
					showAlarmPopUp=jsonData['showAlarmPopUp'];
					//HomePageURL=homepage;
					Ext.getCmp('help').helpUrl=jsonData['helpURL'];
					//document.getElementById("hidHomePageURL").value=homepage;
					//$("a[id='monitor_homepage_anch']").attr('href',HomePageURL);

					$('link[href="'+previousSkin+'"]').attr('href',currentSkin);
					$('img[id="logoImg"]').attr('src',logoImageName);
					if(adminPressed!=null && (adminPressed==true || adminPressed=="true"))
					{
						var pagetitle=document.title;
						var pagetitleType_admin=null;
						var pageindex1=pagetitle.indexOf('G');
						var pageindex2=pagetitle.indexOf('-');
						if(pageindex1!=-1 && pageindex2!=-1)
						{
							pagetitleType_admin=pagetitle.substring(pageindex1+1,pageindex2);
						}
						if(pagetitleType_admin!=null)
						{
							var titlePath_admin = pagetitle.replace(pagetitleType_admin," admin ");								
							document.title = titlePath_admin;
						}
						isAdminModule = true;
						isMonitorModule=false;
						isConfigModule=false;
						isRepModule=false;
						isSlaModule=false;
						selectedTabModule='admin';
						adminPressed=true;
						monitorPressed=false;
						reporterPressed=false;
						configPressed=false;
						slaPressed=false;

						/*var Historyurl_admin = document.URL;								
						var opt0=Historyurl_admin.indexOf('?');
						var opt01=Historyurl_admin.indexOf('&');
						var moduleType_admin=Historyurl_admin.substring(opt0+1,opt01);
						if(moduleType_admin!=null)
						{
							var historyPath_admin = Historyurl_admin.replace(moduleType_admin,"entry=admin");								
							var stateObj_admin = { foo: 1000 + Math.random()*1001 };
							history.pushState(stateObj_admin, "....", historyPath_admin);
						}*/

						Ext.getCmp('adminIndexMenuIcon').show();
						Ext.getCmp('monitorIconIndexMenuId').hide();
						Ext.getCmp('reporterIndexMenuIcon').hide();
						Ext.getCmp('configIndexMenuIcon').hide();
						Ext.getCmp('slaIndexMenuIcon').hide();
						var isMonitorTabObj = Ext.getCmp('monitor');
						if(isMonitorTabObj!=null && !isMonitorTabObj.isHidden())
						{
							Ext.getCmp('monitorNewWindowBtn').show();
						}
						var isRepTabObj = Ext.getCmp('reporter');
						if(isRepTabObj!=null && !isRepTabObj.isHidden())
						{
							Ext.getCmp('reporterNewWindowBtn').show();
						}
						var isConfigTabObj = Ext.getCmp('config');
						if(isConfigTabObj!=null && !isConfigTabObj.isHidden())
						{
							Ext.getCmp('configNewWindowBtn').show();
						}
						var isSlaTabObj = Ext.getCmp('sla');
						if(isSlaTabObj!=null && !isSlaTabObj.isHidden())
						{
							Ext.getCmp('slaNewWindowBtn').show();
						}
						meTabSetView.getComponent('monitorTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('reporterTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('configTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('slaTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('adminTabContainer').fireEvent('afterrender', meTabSetView.getComponent('adminTabContainer'));
					}
					else if(monitorPressed!=null && (monitorPressed==true || monitorPressed=="true"))
					{
						var pagetitle1=document.title;
						var pagetitleType_monitor=null;
						var pageindex_mon=pagetitle1.indexOf('G');
						var pageindex_mon1=pagetitle1.indexOf('-');
						if(pageindex_mon!=-1 && pageindex_mon1!=-1 )
						{
							pagetitleType_monitor=pagetitle1.substring(pageindex_mon+1,pageindex_mon1);
						}
						if(pagetitleType_monitor!=null)
						{
							var titlePath_monitor = pagetitle1.replace(pagetitleType_monitor," monitor ");	
							document.title = titlePath_monitor;
						}
						isAdminModule = false;
						isMonitorModule=true;
						isConfigModule=false;
						isRepModule=false;
						isSlaModule=false;
						selectedTabModule='monitor';
						adminPressed=false;
						monitorPressed=true;
						reporterPressed=false;
						configPressed=false;
						slaPressed=false;
						var isRepTabObj = Ext.getCmp('reporter');
						/*var Historyurl = document.URL;								
						var opt1=Historyurl.indexOf('?');
						var opt2=Historyurl.indexOf('&');
						var moduleType=Historyurl.substring(opt1+1,opt2);
						if(moduleType!=null)
						{
							var historyPath = Historyurl.replace(moduleType,"entry=monitor");								
							var stateObj = { foo: 1000 + Math.random()*1001 };
							history.pushState(stateObj, "....", historyPath);
						}*/
						if(isRepTabObj!=null && !isRepTabObj.isHidden())
						{
							Ext.getCmp('reporterNewWindowBtn').show();
						}
						var isConfigTabObj = Ext.getCmp('config');
						if(isConfigTabObj!=null && !isConfigTabObj.isHidden())
						{
							Ext.getCmp('configNewWindowBtn').show();
						}
						var isSlaTabObj = Ext.getCmp('sla');
						if(isSlaTabObj!=null && !isSlaTabObj.isHidden())
						{
							Ext.getCmp('slaNewWindowBtn').show();
						}
						if(isAlarmViewerUser=='false'){
						Ext.getCmp('monitorIconIndexMenuId').show();
						}
						Ext.getCmp('adminIndexMenuIcon').hide();
						Ext.getCmp('reporterIndexMenuIcon').hide();
						Ext.getCmp('configIndexMenuIcon').hide();
						Ext.getCmp('slaIndexMenuIcon').hide();
						meTabSetView.getComponent('adminTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('reporterTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('configTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('slaTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('monitorTabContainer').fireEvent('afterrender', meTabSetView.getComponent('monitorTabContainer'));
						startupActivities(licenceValidAlert,enableLicenseAlert,userExpiryMsg,showAlarmPopUp);
					}
					else if(reporterPressed!=null && (reporterPressed==true || reporterPressed=="true"))
					{
						var pagetitle2=document.title;
						var pagetitleType_reporter=null
						var pageindex_rep=pagetitle2.indexOf('G');
						var pageindex_rep1=pagetitle2.indexOf('-');
						if(pageindex_rep!=-1 && pageindex_rep1!=-1)
						{
							pagetitleType_reporter=pagetitle2.substring(pageindex_rep+1,pageindex_rep1);
						}
						if(pagetitleType_reporter!=null)
						{
							var titlePath_reporter = pagetitle2.replace(pagetitleType_reporter," reporter ");								
							document.title = titlePath_reporter;
						}
						isAdminModule = false;
						isMonitorModule=false;
						isConfigModule=false;
						isRepModule=true;
						isSlaModule=true;
						selectedTabModule='reporter';
						adminPressed=false;
						monitorPressed=false;
						reporterPressed=true;
						configPressed=false;
						slaPressed=false;
						/*var Historyurl_rep = document.URL;								
						var opt3=Historyurl_rep.indexOf('?');
						var opt4=Historyurl_rep.indexOf('&');
						var moduleType_rep=Historyurl_rep.substring(opt3+1,opt4);
						if(moduleType_rep!=null)
						{
							var historyPath_rep = Historyurl_rep.replace(moduleType_rep,"entry=reporter");								
							var stateObj_rep = { foo: 1000 + Math.random()*1001 };
							history.pushState(stateObj_rep, "....", historyPath_rep);
						}*/

						meTabSetView.getComponent('adminTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('monitorTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('configTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('slaTabContainer').removeCls('indexButtonBgPressed');
						Ext.getCmp('adminIndexMenuIcon').hide();
						Ext.getCmp('monitorIconIndexMenuId').hide();
						Ext.getCmp('reporterIndexMenuIcon').show();
						Ext.getCmp('configIndexMenuIcon').hide();
						Ext.getCmp('slaIndexMenuIcon').hide();
						meTabSetView.getComponent('reporterTabContainer').fireEvent('afterrender', meTabSetView.getComponent('reporterTabContainer'));
					}
					else if(configPressed!=null && (configPressed==true || configPressed=="true"))
					{
						var pagetitle3=document.title;
						var pagetitleType_config=null;
						var pageindex_con=pagetitle3.indexOf('G');
						var pageindex_con1=pagetitle3.indexOf('-');
						if(pageindex_con!=-1 && pageindex_con1!=-1)
						{
							pagetitleType_config=pagetitle3.substring(pageindex_con+1,pageindex_con1);
						}
						if(pagetitleType_config!=null)
						{
							var titlePath_config = pagetitle3.replace(pagetitleType_config," config ");								
							document.title = titlePath_config;
						}
						isAdminModule = false;
						isMonitorModule=false;
						isConfigModule=true;
						isRepModule=false;
						isSlaPressed=false;
						selectedTabModule='config';
						adminPressed=false;
						monitorPressed=false;
						reporterPressed=false;
						configPressed=true;
						slaPressed=true;
						/*var Historyurl_con = document.URL;								
						var opt5=Historyurl_con.indexOf('?');
						var opt6=Historyurl_con.indexOf('&');
						var moduleType_con=Historyurl_con.substring(opt5+1,opt6);
						if(moduleType_con!=null)
						{
							var historyPath_con = Historyurl_con.replace(moduleType_con,"entry=config");								
							var stateObj_con = { foo: 1000 + Math.random()*1001 };
							history.pushState(stateObj_con, "....", historyPath_con);
						}*/
						var isMonitorTabObj = Ext.getCmp('monitor');
						if(isMonitorTabObj!=null && !isMonitorTabObj.isHidden())
						{
							Ext.getCmp('monitorNewWindowBtn').show();
						}
						var isRepTabObj = Ext.getCmp('reporter');
						if(isRepTabObj!=null && !isRepTabObj.isHidden())
						{
							Ext.getCmp('reporterNewWindowBtn').show();
						}
						var isSlaTabObj = Ext.getCmp('sla');
						if(isSlaTabObj!=null && !isSlaTabObj.isHidden())
						{
							Ext.getCmp('slaNewWindowBtn').show();
						}
						meTabSetView.getComponent('adminTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('monitorTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('reporterTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('slaTabContainer').removeCls('indexButtonBgPressed');
						Ext.getCmp('adminIndexMenuIcon').hide();
						Ext.getCmp('monitorIconIndexMenuId').hide();
						Ext.getCmp('reporterIndexMenuIcon').hide();
						Ext.getCmp('configIndexMenuIcon').show();
						Ext.getCmp('slaIndexMenuIcon').show();
						meTabSetView.getComponent('configTabContainer').fireEvent('afterrender', meTabSetView.getComponent('configTabContainer'));
					}
					else if(slaPressed!=null && (slaPressed==true || slaPressed=="true"))
					{
						var pagetitle4=document.title;
						var pagetitleType_sla=null;
						var pageindex_sla=pagetitle4.indexOf('G');
						var pageindex_sla1=pagetitle4.indexOf('-');
						if(pageindex_sla!=-1 && pageindex_sla1!=-1)
						{
							pagetitleType_sla=pagetitle4.substring(pageindex_sla+1,pageindex_sla1);
						}
						if(pagetitleType_sla!=null)
						{
							var titlePath_sla = pagetitle4.replace(pagetitleType_sla," sla ");								
							document.title = titlePath_sla;
						}
						isAdminModule = false;
						isMonitorModule=false;
						isConfigModule=true;
						isRepModule=false;
						isSlaModule=false;
						selectedTabModule='sla';
						adminPressed=false;
						monitorPressed=false;
						reporterPressed=false;
						configPressed=true;
						slaPressed=true;
						/*var Historyurl_sla = document.URL;								
						var opt5=Historyurl_sla.indexOf('?');
						var opt6=Historyurl_sla.indexOf('&');
						var moduleType_sla=Historyurl_sla.substring(opt5+1,opt6);
						if(moduleType_sla!=null)
						{
							var historyPath_sla = Historyurl_sla.replace(moduleType_con,"entry=sla");								
							var stateObj_sla = { foo: 1000 + Math.random()*1001 };
							history.pushState(stateObj_sla, "....", historyPath_sla);
						}*/
						var isMonitorTabObj = Ext.getCmp('monitor');
						if(isMonitorTabObj!=null && !isMonitorTabObj.isHidden())
						{
							Ext.getCmp('monitorNewWindowBtn').show();
						}
						var isRepTabObj = Ext.getCmp('reporter');
						if(isRepTabObj!=null && !isRepTabObj.isHidden())
						{
							Ext.getCmp('reporterNewWindowBtn').show();
						}
						var isConTabObj = Ext.getCmp('config');
						if(isConTabObj!=null && !isConTabObj.isHidden())
						{
							Ext.getCmp('configNewWindowBtn').show();
						}
						meTabSetView.getComponent('adminTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('monitorTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('reporterTabContainer').removeCls('indexButtonBgPressed');
						meTabSetView.getComponent('configTabContainer').removeCls('indexButtonBgPressed');
						Ext.getCmp('adminIndexMenuIcon').hide();
						Ext.getCmp('monitorIconIndexMenuId').hide();
						Ext.getCmp('reporterIndexMenuIcon').hide();
						Ext.getCmp('configIndexMenuIcon').hide();
						Ext.getCmp('slaIndexMenuIcon').show();
						meTabSetView.getComponent('slaTabContainer').fireEvent('afterrender', meTabSetView.getComponent('slaTabContainer'));
					}
					var mainIframe = document.getElementById("main");
					if (mainIframe != null )
					{
						mainIframe.src = jsonData.LayerTestConfigUrl;
					}
				},
				failure : function(response)
				{
					console.log(response);
				}
			});
		}
	}

	var isInternetAvailable  = false;
	(function (isInternetAvailable){
		try
		{
			// Disabling the browser back button - starts here
			var _hash = "!";
			var noBackPlease = function () {
				window.location.href += "#";

				window.setTimeout(function () {
					window.location.href += "!";
				}, 50);
			};

			window.onhashchange = function () {
				if (window.location.hash !== _hash) {
					window.location.hash = _hash;
				}
			};

			noBackPlease();

			// disables backspace on page except on input fields and textarea..
			document.body.onkeydown = function (e) {
				var elm = e.target.nodeName.toLowerCase();
				if (e.which === 8 && (elm !== 'input' && elm  !== 'textarea')) {
					e.preventDefault();
				}

				/*if (e.which === 17)
				{
					alert('<egui:intnl text="monitor.common.This Operation not Allowed"/>');
					return false;
				}*/
				// stopping event bubbling up the DOM tree..
				e.stopPropagation();
			};

			// Disabling the browser back button - ends here

			if(Ext.isEmpty(strInternetAvailable) || strInternetAvailable == null || strInternetAvailable == 'null' || strInternetAvailable == 'undefined'){
				$.ajax({
					url: '//www.google.com/jsapi',
					timeout: 3000,
					headers: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					type: "GET", /* or type:"GET" or type:"PUT" */
					dataType: "script",
					success: function (result) {
						//console.log("----success----");
						isInternetAvailable = true;
						document.getElementById("isInternetAvailable").value=true;
						$.ajax({
							url: '/final/egInternetAvailabilitySession.jsp?isInternetAvailable=true',
							headers: {
								'Content-Type': 'application/x-www-form-urlencoded'
							},
							type: "GET", /* or type:"GET" or type:"PUT" */
							dataType: "html",
							timeout:2000
						});
					},
					error: function(jqXHR, textStatus, errorThrown) {
						//console.log("----error----");
						if(textStatus==="timeout") {
							//do something on timeout
							//console.log("----timeout----");
						}
						
						isInternetAvailable = false;
						document.getElementById("isInternetAvailable").value=false;
						$.ajax({
							url: '/final/egInternetAvailabilitySession.jsp?isInternetAvailable=false',
							headers: {
								'Content-Type': 'application/x-www-form-urlencoded'
							},
							type: "GET", /* or type:"GET" or type:"PUT" */
							dataType: "html",
							timeout: 2000
						});
					}
				});
			}
			else if(strInternetAvailable == true || strInternetAvailable == 'true'){
				isInternetAvailable = true;
				document.getElementById("isInternetAvailable").value=true;
			}
			else{
				isInternetAvailable = false;
				document.getElementById("isInternetAvailable").value=false;
			}
		}
		catch (eee)
		{
			//console.log("----exception----");
			isInternetAvailable = false;
			document.getElementById("isInternetAvailable").value=false;
			$.ajax({
				url: '/final/egInternetAvailabilitySession.jsp?isInternetAvailable=false',
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				type: "GET", /* or type:"GET" or type:"PUT" */
				dataType: "html",
				timeout: 2000
			});
		}
	})(isInternetAvailable);

</script>

<div  class="div_scroll" style="width:50%;height:100px !important;border:0px solid black;visibility:hidden;display:none" id="alarmsListDiv"></div>


<script type="text/javascript">
		var	ie10window;
      function makeFullScreen(frame,url) {
        divObj = document.getElementById(frame);

        if (divObj.requestFullscreen) {
          divObj.requestFullscreen();
        }
        else if (divObj.msRequestFullscreen) {
          divObj.msRequestFullscreen();
        }
          // Moz uses camel case caps on "screen"
        else if (divObj.mozRequestFullScreen) {
          divObj.mozRequestFullScreen();
        }
        else if (divObj.webkitRequestFullscreen) {
          divObj.webkitRequestFullscreen();
        }else{

			ie10window = window.open (url,"", "titlebar=no, channelmode=yes, addressbar=no, toolbar=no, scrollbars=no, resizable=no, fullscreen=yes");
			//alert('IE10');
		}
		divObj.setAttribute('src',url);
      }
    </script>

<iframe id="tvMode" tabindex="-1" allowfullscreen mozallowfullscreen webkitallowfullscreen frameborder="0px" height="100%" width="100%"></iframe>

<script language="javascript">

var goFullViewMsg='<egui:intnl text="admin.common.Go Full Screen" />';
var exitFullViewMsg='<egui:intnl text="admin.common.Exit Full Screen" />';
var fullScreenApi = new Object();
var appCnt = '';
var clicked = '<%=quickLinksClicked%>';
var selectedTabModule='<%=entry%>';
var lastTabQueryString='<%=queryString%>';
var managerWarnings= '';
var licenceValidAlert='<%=licenceValidAlert%>';
var enableLicenseAlert='<%=enableLicenseAlert%>';
var userExpiryMsg='<%=userExpiryMsg%>';
var showAlarmPopUp='<%=showAlarmPopUp%>';
var userproclicked=false;
var managernofclicked=false;
var quickalarmclicked=false;
var quicklinkclicked=false;
$(window).ready(function(){
	//$('#menu li a').live('click',function(){
	$('body').on('click','#menu li a',function(){
		$('#menu li a.selectedLink').removeClass('selectedLink');
		$(this).addClass('selectedLink');
	});
	startupActivities(licenceValidAlert,enableLicenseAlert,userExpiryMsg,showAlarmPopUp);
	if(monitorPressed && (showMonitoringDomainPopup!=null && showMonitoringDomainPopup=='true'))
	{
		var isMonDomainPopupLoaded=Ext.state.Manager.get(loggedInUserId+"_isMonDomainPopupLoaded");
		if(Ext.isEmpty(isMonDomainPopupLoaded) || (isMonDomainPopupLoaded!=null && isMonDomainPopupLoaded!="yes"))
		{
			if(url!=null && url.indexOf("MyDashboard.jsp")==-1)
			{
				Ext.onReady(function(){
					Ext.defer(function(){
					openMonitoringDomainSelectionPopup();
					},60000);
				});
			}
		}
	}
});

var isClosable = true;

function closeWindow(activityWindow)
{
	var windowObj = Ext.getCmp(activityWindow);
	if (windowObj != null && windowObj != undefined)
	{
		if (isClosable == true)
		{
			windowObj.destroy();
		}
	}
}

function indexActivities(showActivity,alertMessages)
{
	if (showActivity)
	{
		var activityWindow = Ext.create('Ext.window.Window',{
			id : 'activityWindow',
			title : managerNotifyMsg,
			closeAction : 'destroy',
			bodyPadding : '5 5 5 5',
			listeners :  {
				click: {
					element: 'el', //bind to the underlying el property on the panel
					fn: function(){ isClosable = false; }
				}
			},
			items : [
				{
					xtype : 'component',
					margin :'0 0 10 0',
					id : 'warningMessage',
					tmpMessage : alertMessages,
					html : alertMessages,
				}
			]
		});
		activityWindow.setPosition(screen.width - 430,80);
		activityWindow.show();
		//activityWindow.addCls('');
	}
}

function calIntegrityCheckDialogBox(integrity)
{
	Ext.MessageBox.show({
		title:integrityTitle,
		icon : Ext.MessageBox.WARNING,
		msg : integrityCheckMsg1+" "+integrityCheckMsg2,
		buttonText: {yes: "Continue",no: "Signout"},
		fn: function(btn){
			if (btn == "no")
			{
				callWindow(4);
			}
		}
	});
}

function isMgrFullScreenMode()
{
	var isFullScrnMode = false;
		 /*if (!document.fullscreenElement &&    // alternative standard method
	  !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msRequestFullscreenElement) {  // current working methods */
	 
	// To Support latest versions of Chrome, Firefox and IE(11) also
	 if ((document.fullScreenElement !== undefined && document.fullScreenElement === null) || (document.msFullscreenElement !== undefined && document.msFullscreenElement === null) || (document.mozFullScreen !== undefined && !document.mozFullScreen) || (document.webkitIsFullScreen !== undefined && !document.webkitIsFullScreen)) {
	if (document.documentElement.requestFullscreen) {
		isFullScrnMode=true;
		} else if (document.documentElement.mozRequestFullScreen) {
			isFullScrnMode=true;
		} else if (document.documentElement.webkitRequestFullscreen) {
			isFullScrnMode=true;
		}else if (document.documentElement.msRequestFullscreen) {
			isFullScrnMode=true;
		}
	  } 
			
	return isFullScrnMode;
}

	window.onresize = function() {
		var resizeBrowserDiv = Ext.get('resizeBrowserDiv');
		var isMgrInFullScrMode = isMgrFullScreenMode();
		if (isMgrInFullScrMode && fullScreenApi.lastState == 'fullScreen') {
			if(!Ext.isEmpty(resizeBrowserDiv) && resizeBrowserDiv.dom.className=='iconExitFullScreen')
			{
				resizeBrowserDiv.dom.className='iconGoFullScreen';
				var resizeBrowserMsgDiv = Ext.get('resizeBrowserMsg');
				if(!Ext.isEmpty(resizeBrowserMsgDiv))
				{
					resizeBrowserMsgDiv.update(goFullViewMsg);
				}
			}
		}
		/*else  if (!isMgrInFullScrMode && fullScreenApi.lastState == 'fullScreen') {
						
			 if(!Ext.isEmpty(resizeBrowserDiv) && resizeBrowserDiv.dom.className=='iconExitFullScreen')
			{
				resizeBrowserDiv.dom.className='iconGoFullScreen';
				var resizeBrowserMsgDiv = Ext.get('resizeBrowserMsg');
				if(!Ext.isEmpty(resizeBrowserMsgDiv))
				{
					resizeBrowserMsgDiv.update(goFullViewMsg);
				}
			}
		}*/
		
     };


var isF11FullView=false;
function handleKeyPrs(e)
{
	if(e!=null && !Ext.isEmpty(e) && e.keyCode!=null && e.keyCode==122)
	{
		var isMgrInFullScrMode = isMgrFullScreenMode();
		if (isMgrInFullScrMode && fullScreenApi.lastState == 'fullScreen')
		{
			isF11FullView= false;
			fullScreenApi.lastState = 'exitScreen';
		}
		else
		{
			if(isF11FullView)
				isF11FullView= false;
			else
				isF11FullView= true;
				showFullScreenOption(isF11FullView);
			
		}
	}
}
function closeDiv(){
	var divId = document.getElementById("alarmsListDiv");
	divId.style.visibility='hidden';
}

function loadAlarmPopup(qUrl)
{	
	if(!Ext.isEmpty(qUrl))
	{
		window.open(qUrl,'GRAPHS','toolbar=no,menubar=no,location=no,status=no,width=1014,height=603,left=0,top=80,screenx=0,screeny=0,resizable=yes,scrollbars=yes');
	}
}

function OpenLayerModel(url){
	if(!Ext.isEmpty(url))
	{
		var tmpUrl = url.substring(0,url.indexOf("?"));
		var params = url.substring(url.indexOf("?")+1);
		if(tmpUrl.indexOf("/final/monitor") == -1)
			tmpUrl = "/final/monitor/"+tmpUrl;
		var mainIframe = document.getElementById("main");
		mainIframe.src=tmpUrl+"?"+params;
	}
	closeDiv();
}
<%
	String operSys=System.getProperty("os.name").toLowerCase();
	String os="";
	if (operSys.contains("win")) {
		os = "Windows";
		String osArch=System.getProperty("os.arch").toLowerCase();
		if(osArch.indexOf("64")>-1){
			os+="(64bit)";
		}else{
			os+="(32bit)";
		}
	} else if (operSys.contains("nix") || operSys.contains("nux")
			|| operSys.contains("aix")) {
		os = "Linux";
	} else if (operSys.contains("mac")) {
		os = "MAC";
	} else if (operSys.contains("sunos")) {
		os = "Solaris";
	}
%>
var utilityclicked=false;
var hideManagerUtilities=true;
var WebServiceURL='<%=WebServiceURL%>';
<%
if(EnableUtilityTools.equalsIgnoreCase("Yes") && (userRole.hasAdminRole(EgUserPermission.ADMIN)  || userRole.hasMonitorRole(EgUserPermission.MONITOR) || userRole.hasReporterRole(EgUserPermission.REPORTER) || userRole.hasConfigRole(EgUserPermission.CONFIG)))
{
%>
	hideManagerUtilities=false;
<%
}
%>
var reportWindow;
var reportMask;
var thisForm;
var senderID;
var os='<%=os%>';
var isReportFeature=false;
var reportTitle;
var reportErrTitle='<egui:intnl text="admin.utility.Could not able to reach server, Please check with the settings"/>.';
function getReportIssue(type){
	if(type=="feature"){
		isReportFeature=true;
		reportTitle = '<egui:intnl text="admin.utility.Suggest a Feature"/>';
	}
	else{
		isReportFeature=false;
		reportTitle='<egui:intnl text="admin.utility.Report an Incident"/>';
	}
	reportWindow = Ext.widget("window",{
	title: reportTitle,
	id:'reportwin',
	ui:'lightwindow',
	resizable:false,
	border:true,
	bodyPadding:10,
	padding:0,
	header:{
		padding:'8 10'
	},
	ghost:false,
	closeAction:'destroy',
	modal:true,
	listeners:{
		show: function(win) {
			if (this.modal) {
				var doms = Ext.dom.Query.select('.x-mask'); 
				for (var key in doms)
				{
					this.dom=doms[key];
					if (!Ext.isEmpty(this.dom.offsetParent))
					{
						if (this.dom.offsetParent.tagName=='BODY')
						{
							Ext.fly(this.dom).addCls('windowModal');
						}
					} 
				} 
			}
		},
		hide:  function(win) {
			if (this.modal) { 
				Ext.fly(this.dom).removeCls('windowModal');
			}
		},
		afterrender:function(){
			thisForm = Ext.getCmp('utilreport').getForm();
			Ext.EventManager.onWindowResize(function(){
			var me = this;
			me.center();
			},this);
		},
		destroy:function(){
			tinyMCE.execCommand('mceRemoveEditor', false, 'reportDescription-inputEl'); 
			tinyMCE.editors.length = 0;
		}
	},
	items:[{
			xtype:'container',
			items:[
				{
					xtype:'utilityreport',
				}
			]
		}],
		bbar:['->',{
				xtype:'toolbar',
				items:[
				{
					xtype: 'container',
					dock: 'bottom',
					ui:'footer',
					margin:'8px 0px 0px 0px',
					border: false,
					items: [
					{
						xtype: 'button',
						cls:'buttonBig',
						margin:'0px 10px 0px 10px',
						width:72,
						height:22,
						text: '<egui:intnl text="admin.common.Cancel"/>',
							listeners: {
							click: function() {
								Ext.destroy(thisForm);
								Ext.destroy(reportWindow);
								delete reportWindow;
								delete thisForm;
							}
						}
					},{
						xtype: 'button',
						cls:'buttonBig greenbtn',
						text: '<egui:intnl text="admin.common.Submit"/>',
						width:72,
						height:22,
						listeners: {
							click: function(win) {
								thisForm = Ext.getCmp('utilreport').getForm();
								if(validate(thisForm)){
									reportMask = new Ext.LoadMask(Ext.getCmp('reportwin'), {
									maskCls:'windowModal',
									msg: '<egui:intnl text="admin.utility.Connecting to eG support team, please wait"/>'+'...'
									});
									reportMask.show();
									var queryStr = {};
									queryStr['reportTitle']= thisForm.findField('reportTitle').getValue();
									if(!Ext.isEmpty(queryStr['reportTitle']))
									{
										queryStr['reportTitle']=filterEncode(queryStr['reportTitle']);
									}
									queryStr['requester']= thisForm.findField('requester').getValue();
									if(!Ext.isEmpty(queryStr['requester']))
									{
										queryStr['requester']=filterEncode(queryStr['requester']);
									}
									
									queryStr['toMailID']= Ext.getCmp('region').getValue();
									if(!Ext.isEmpty(queryStr['toMailID']))
									{
										queryStr['toMailID']=filterEncode(queryStr['toMailID']);
									}
									if(!Ext.isEmpty(thisForm.findField('CC').getValue()))
										queryStr['cc']= thisForm.findField('CC').getValue();

									if(!Ext.isEmpty(queryStr['cc']))
									{
										queryStr['cc']=filterEncode(queryStr['cc']);
									}
                                        
									queryStr['reportDescription']= tinyMCE.get('reportDescription-inputEl').getContent();
									if(!Ext.isEmpty(queryStr['reportDescription']))
									{
										queryStr['reportDescription']=filterEncode(queryStr['reportDescription']);
									}
									queryStr['mgrVersion']= version;
									
									queryStr['mgros']= filterEncode(os);
									queryStr['reportType']= thisForm.findField('reportType').getValue();
									queryStr['fromPage']= filterEncode(type);
									var fileName = thisForm.findField('FILE_0').getValue();
									queryStr['mgrTimeFormat']=egClock();
									if(!Ext.isEmpty(fileName))
									{
										queryStr['fileName']= filterEncode(fileName);
									}								
									if (thisForm.isValid())
									{
										if(fileName!=null && fileName.length >0){
											thisForm.submit(
											{
												url : "/final/scripts/EgIndexApp/data/EgUtilityReportFileUpload.jsp",
												scope:this,
												async : true,
												method : 'POST',
												enctype : 'multipart/form-data',
												success: function (form, action)
												{
													var jsonText = action.response.responseText;
													jsonText = Ext.decode(jsonText);
													var alertTextSuccessMsg = jsonText['success'];
													var ErrMsgsJson =jsonText['ErrMsgsJson'];
													if (!Ext.isEmpty(jsonText))
													{
														if(Ext.isEmpty(ErrMsgsJson))
														{
															sendReport(queryStr);
															jsonText = null;
															Ext.destroy(jsonText);
														}
														else{
															Ext.destroy(reportMask);
															delete reportMask;
															var msg = Ext.MessageBox.show({
																title : reportTitle,
																width:400,
																modal:true,
																msg : ErrMsgsJson ,
																buttons : Ext.MessageBox.OK,
																maskCls :'windowModal',
																icon: 'iconExclamation'
																
															});
															Ext.WindowManager.bringToFront(msg);
														}
													}
												},
												failure: function (form, action)
												{
													alert("File uploading failed!");						
												}
									
											});
										}
										else{
											sendReport(queryStr);
										}
									}
								}
							}
						}
					}
					]
			}]
			},'->']
			
	}).show();
}
function sendReport(queryStr)
{
//	var qStr = Ext.urlEncode(queryStr);
	Ext.Ajax.request({
		url : "/final/servlet/com.eg.EgUtilityReportSender",
		method : 'POST',
		params : queryStr,
		async : true,
		timeout : (600 * 1000),
		scope : this,
		success: function (response)
		{
			var jsonText = response.responseText;
			var mailResponse;
			Ext.destroy(reportMask);
			delete reportMask;
			var msgWidth=570;
			if(jsonText.indexOf("Mail sent successfully")>-1){
				if(isReportFeature){
					mailResponse = '<egui:intnl text="admin.utility.Your suggestion has been submitted successfully"/>.<egui:intnl text="admin.utility.Thank you"/>. !';
					msgWidth =430;
				}
				else{
					var reportType=Ext.getCmp("reportType").getValue();
					mailResponse = '<egui:intnl text="admin.utility.The"/> '+reportType+' <egui:intnl text="admin.utility.that you reported has been submitted successfully"/> . <egui:intnl text="admin.utility.You will hear from us shortly"/>.';
				}
			}
			else{
				mailResponse = '<egui:intnl text="admin.utility.An error occured while submitting your request, Please check your mail server settings"/>!';
			}
			var msg = Ext.MessageBox.show({
				title : reportTitle,
				width: msgWidth,
				modal:true,
				msg : mailResponse,
				buttons : Ext.MessageBox.OK,
				maskCls :'windowModal',
				icon: 'iconExclamation',
				fn: function() {
					Ext.destroy(thisForm);
					Ext.destroy(reportWindow);
					delete reportWindow;
					delete thisForm;
				}
			});
			Ext.WindowManager.bringToFront(msg);
		},
		failure: function (response)
		{
			Ext.destroy(reportMask);
			delete reportMask;
			alert("Report send failed, Try Again!");						
		}
	});
}
function validate(thisForm){
	var msg;
	var requester = thisForm.findField('requester').getValue().trim();
	if(Ext.isEmpty(thisForm.findField('reportTitle').getValue().trim())){
	   	msg = '<egui:intnl text="admin.utility.Please enter the subject"/>';
	   	thisForm.findField('reportTitle').focus(false, 100);
	}
	else if(Ext.isEmpty(requester)){
		msg = '<egui:intnl text="admin.utility.Please check with mail server settings"/>';
	}
	else if(!Ext.isEmpty(requester) && !validateEmail(requester)){
		msg = '<egui:intnl text="admin.utility.Please enter a valid email address"/>';
	}
	else if(thisForm.findField('region').getValue().indexOf("Choose a region")>-1){
		msg = '<egui:intnl text="admin.utility.Please select a region"/>';
	  
	}else if(!isReportFeature && thisForm.findField('reportType').getValue().indexOf("Choose a ticket type")>-1){
		msg = '<egui:intnl text="admin.utility.Please select the ticket type"/>';
	}
	else if(Ext.isEmpty(tinyMCE.get('reportDescription-inputEl').getContent().trim())){
		msg = '<egui:intnl text="admin.utility.Please enter the description"/>';
	}
	else if(!Ext.isEmpty(thisForm.findField('CC').getValue().trim())){
		var ccAddress = thisForm.findField('CC').getValue().trim();
		if(ccAddress.indexOf(",")>-1){
			var ccAddressList = ccAddress.split(',');
			var listSize = ccAddressList.length;
			if(listSize >0){
				for(var i = 0; i < listSize; i++) {
				   var mailID = ccAddressList[i];
				   if(!validateEmail(mailID)){
				   	msg = '<egui:intnl text="admin.utility.Please enter a valid email address"/>';
				   }
				}
			}
		}
		else if(!validateEmail(ccAddress)){
			msg = '<egui:intnl text="admin.utility.Please enter a valid email address"/>';
		}
	}
	if(!Ext.isEmpty(msg)){
		var msg = Ext.MessageBox.show({
			title : reportTitle,
			msg : '<div style="min-height:35px">' + msg + '</div>',
			modal:true,
			maskCls :'windowModal',
			buttons : Ext.MessageBox.OK,
			icon : Ext.MessageBox.WARNING
		});
		Ext.WindowManager.bringToFront(msg);
		return false;
	}
	return true;
}
function validateEmail(mail){
	var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    	if(pattern.test(mail)){         
		return true; 
    	}
	return false;
} 

</script>

<!-- new Ui Design Scripts end here-->
</body>

<%
	session.setAttribute("hasNotificationWindow","no");
	session.setAttribute("egEntry",entry);
	session.setAttribute("egVersion",text);
	if(newWindow!=null && newWindow.trim().length()>0 && newWindow.equals("yes"))
	{
		if(fromSm != null && (fromSm.equals("yes") || fromSm.equals("home")))
		{
			String reqUrl = request.getRequestURL().toString();
			String qryString = request.getQueryString();
			if(reqUrl != null && reqUrl.endsWith("egIndex.jsp"))
			{
				session.setAttribute("smIndexPage","/final/egIndex.jsp?"+qryString);
			}
			session.setAttribute("fromSm","yes");
		}
		session.setAttribute("egEntryChild", entry);
		session.setAttribute("childWindow","yes");
		session.setAttribute("isNewChildWindow","yes");
	}
	else 
		session.setAttribute("egEntryMain", entry);
 
}
catch(Throwable th)
{
	th.printStackTrace();
}
%>
</html>


