<%@ include file = "EgLoginTracker.jsp" %>
<%@ page import = "java.util.*" %>
<%@ page import = "java.net.*" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "com.eg.EgInstallInfo" %>
<%@ page import = "com.eg.IniFile" %>
<%@ page import ="com.egurkha.util.StringUtils"%>
<%@ page import = "egurkha.reporter.ErUtils"%>
<%@ page import = "egurkha.reporter.ErUserData"%>
<%@ page import = "com.egurkha.ini.IniUI"%>
<%@ page import = "com.eg.*"%>
<%@ page import = "com.egurkha.*"%>
<%@ page import = "com.egurkha.monitor.*"%>
<%@ page import = "com.egurkha.monitor.VmDashboardHelper"%>
<%@ page import = "com.egurkha.monitor.ServicesDashboardBean"%>
<%@ page import = "com.egurkha.monitor.MonitorUtilities"%>
<%@ page import = "com.eg.EgAggregateInfo"%>
<%@ page import="com.eg.EgExternalInfo"%>
<%@ page import = "com.eg.EgDateInfo" %>
<%@ page import = "com.eg.EgTopoInfo" %>
<%@ page import = "com.eg.*" %>
<%@ page import = "egurkha.*" %>
<%@ page import = "com.egurkha.*" %>
<%@ page import = "com.egurkha.util.*" %>
<%@ page import = "com.egurkha.EgTimeZoneConverter"%>
<%@ page import = "java.util.TimeZone"%>
<%@ page import = "java.util.Calendar"%>
<%@ page import = "com.egurkha.util.DateUtil"%>
<%@ page import="net.sf.json.*"%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="egui" uri="../WEB-INF/eg-taglib.tld" %>
<%@ page errorPage="EgProbsM.jsp" %>

<!DOCTYPE html>
<%!
	ServicesDashboardBean serviceBean = new ServicesDashboardBean();
	String s_iniFile_dir = EgInstallInfo.getInstallDir()+ "/manager/config/";

	public List getSortedServiceList(List servicesList)
	{
		if(servicesList != null && servicesList.size() > 0)
		{
			EgList egServiceList = new EgList();
			CompositeComparator compObj = new CompositeComparator();
			for (int sl=0; sl < servicesList.size(); sl++)
			{
				String tmpServiceName = (String) servicesList.get(sl);
				String name = "Service:"+tmpServiceName+":NULL";
				String state = (String)EgStateZone.getState(name);
				EgService tmpService = new EgService(tmpServiceName, State.getState(state));
				if(tmpService!=null) 
					egServiceList.add(tmpService);
			}
			compObj.add(new StateComparatorDes());
			compObj.add(new NameComparatorAsc());
			Collections.sort(egServiceList,compObj);

			List tmpServList = new LinkedList();
			if(egServiceList!=null && egServiceList.size()>0)
			{
				for(int s=0;s<egServiceList.size();s++)
				{
					EgService service1 = (EgService) egServiceList.get(s);
					String service_name=(String)service1.getName();
					if(service_name!=null && tmpServList!=null && !tmpServList.contains(service_name))
						tmpServList.add(service_name);
				}
			}
			return (tmpServList);
		}
		else
			return servicesList;
	}

	public HashMap getServiceBasedFilter(String appliesTo)
	{
		String filterFlagT = "";
		String filterByParamFlagT = "";
		String hasTransactions = "false";
		String hasEmulatedTransactions = "false";
		String hasLogonSimulations = "false";
		String hasRUM = "false";
		String hasCitrix = "false";
		String aggregateTab = "false";
		String comp_type_rum = "";
		EgTopoInfo topoInfo = new EgTopoInfo("manager");
		HashMap returnParams = new HashMap();
		com.eg.IniFile iniFileforComp = new com.eg.IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_dashboardConfig.ini", false);
		ArrayList dashComps = com.egurkha.util.StringUtils.egTokenizer((iniFileforComp.getValue("InfraDashboard_service_redirectURL","componenetTypes")),",",false,true,true);
		ArrayList emulationComps = com.egurkha.util.StringUtils.egTokenizer((iniFileforComp.getValue("Support_Emulation_Types","ComponentTypes")),",",false,true,true);
		if(appliesTo!=null && appliesTo.trim().length()>0)
		{
			if(filterFlagT=="" || filterFlagT.trim().length()==0)
				filterFlagT= appliesTo.substring(0,appliesTo.indexOf(":"));

			if(filterByParamFlagT=="" || filterByParamFlagT.trim().length()==0)
				filterByParamFlagT = appliesTo.substring(appliesTo.indexOf(":")+1);

			if(filterFlagT != null && filterFlagT.trim().length() > 0 && filterFlagT.equalsIgnoreCase("Service")){
				if(filterByParamFlagT != null && filterByParamFlagT.trim().length() > 0){
					boolean isSite=false;
					EgList transactionList = new EgList();
					IniFile iniValue = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_topology.ini");
					String siteCheck = iniValue.getValue("SERVICE",filterByParamFlagT);
					if(siteCheck != null && siteCheck.equalsIgnoreCase("site"))
						isSite = true;
					EgAggregateInfo aggregateInfo = new EgAggregateInfo("manager");
					ArrayList aggregateArray = aggregateInfo.getAggregateComponentsOfElement("service",filterByParamFlagT);
					if(aggregateArray != null && aggregateArray.size() > 0)
						aggregateTab = "true";
					if(isSite)
					{
						EgDbAdapterUI egDb;
						egDb=EgDbAdapterTypeUI.getObject();
						String s_conn = null;
						ResultSet rs=null;
					
						try
						{
							s_conn = egDb.setConnection();
							rs = egDb.SelectEgAddMonTrans(filterByParamFlagT.trim());

							while(rs.next())
							{
								transactionList.add(rs.getString("trans_name") +"~~#~~"+ rs.getString("user_id"));
							}

							rs.close();
						}
						catch(Exception e)
						{
							
						}
						finally
						{
							try
							{
								if(rs!=null)
								{
									rs.close();
									rs=null;
								}
							}
							catch(Exception e)
							{
								
							}
							egDb.releaseConnection(false);
							EgDbAdapterTypeUI.releaseObject(egDb);
						}
					}
					if(transactionList != null && transactionList.size() > 0)
					{
						hasTransactions = "true";
					}
					ArrayList simulationTypes = new ArrayList();
					String[] s_types = iniFileforComp.getVariables("SIMULATION_SUPPORT");
					Vector logonVar = iniFileforComp.getAllValues("SIMULATION_SUPPORT");
					if(s_types != null && s_types.length > 0){
						for(int k=0;k<s_types.length;k++){
							String type = s_types[k];
							if(type != null && type.length() > 0)
								simulationTypes.add(type);
						}
					}
					Vector compVec = topoInfo.getAssociatesForSite(filterByParamFlagT);
					for(int k=0; k<compVec.size(); k++)
					{
						String comp =(String) compVec.get(k);
						
						if(comp!=null && emulationComps.contains(comp.substring(0,comp.indexOf(":"))))
						{
							hasEmulatedTransactions = "true";
						}
						//if(comp.indexOf("Citrix_XcLogon_Emulation") > -1){
						if(simulationTypes != null && simulationTypes.size() > 0 && comp != null && comp.indexOf(":") > 0 && simulationTypes.contains(comp.substring(0,comp.indexOf(":")))){
							hasLogonSimulations = "true";
							String logon_treeTitle = null;
							String logonCompType = comp.substring(0,comp.indexOf(":"));
							int index = simulationTypes.indexOf(logonCompType);
							if(logonVar != null && logonVar.size() > 0 && index >= 0)
								logon_treeTitle = (String)logonVar.get(index);
							if(logon_treeTitle != null && logon_treeTitle.trim().length() > 0){
								String logonUrl= iniFileforComp.getValue("TREE_PAGE_SETTINGS",logon_treeTitle);
								if(logonUrl != null && logonUrl.trim().length() > 0){
									String logonParam = logonUrl.substring(logonUrl.indexOf("?")+1);
									String logonTitle = logonUrl.substring(0,logonUrl.indexOf("~$~"));
									if(logonParam != null && logonParam.trim().length() > 0){
										returnParams.put("logon_treeTitle",logon_treeTitle);
										returnParams.put("logonParam",logonParam);
										returnParams.put("logonTitle",logonTitle);
										returnParams.put("isLogonType",hasLogonSimulations);
									}
								}
							}
						}
						if(comp.indexOf("Real_user_monitor") > -1){
							hasRUM = "true";
							comp_type_rum = comp.substring(comp.indexOf(":")+1);
						}
						if(dashComps != null && dashComps.contains(comp.substring(0,comp.indexOf(":")))){
							hasCitrix = "true";
						}
					}					
				}
			}
			else if(filterFlagT != null && filterFlagT.trim().length() > 0 && (!filterFlagT.equalsIgnoreCase("Service")||!filterFlagT.equalsIgnoreCase("Services"))){
			//else if(filterFlagT != null && filterFlagT.trim().length() > 0 && (filterFlagT.equalsIgnoreCase("ComponentType") || filterFlagT.equalsIgnoreCase("Components") ||filterFlagT.equalsIgnoreCase("Segment"))){
				hasCitrix = "true";
			}
		}
		returnParams.put("hasTransactions",hasTransactions);
		returnParams.put("hasEmulatedTransactions",hasEmulatedTransactions);
		returnParams.put("hasLogonSimulations",hasLogonSimulations);
		returnParams.put("hasRUM",hasRUM);
		returnParams.put("aggregateTab",aggregateTab);
		returnParams.put("comp_type_rum",comp_type_rum);
		returnParams.put("hasCitrix",hasCitrix);
		return returnParams;
	}
	public String getDashboardMapping(IniFile commonDashIni,String filterFlag,String filterByParamFlag,User user,String dashboard_name)
	{
		String userName = user.getLoginID();
		String getDashboards[] = commonDashIni.getVariables(userName+":"+dashboard_name+":Mapping");
		String temp_dashboard_map = "";
		if(getDashboards != null && getDashboards.length > 0)
		{
			for(int l=0;l<getDashboards.length;l++)
			{
				String dash_keys = getDashboards[l];
				if(dash_keys == null || dash_keys.trim().length() ==0)
					continue;

				
				if(dash_keys.equalsIgnoreCase("DefaultView"))
					continue;
				
				String dash_value = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping",dash_keys);

				//if(!dash_value.toLowerCase().startsWith("service:"))
					//continue;
				
				if(dash_value.indexOf(":") > -1 && dash_value.indexOf("#~#") > -1)
					dash_value = dash_value.substring(dash_value.indexOf(":")+1,dash_value.indexOf("#~#"));
				
				
				if(dash_value!= null && dash_value.trim().length() > 0 && dash_value.equalsIgnoreCase(filterByParamFlag))
				{
					temp_dashboard_map = dash_keys;
					break;
				}
			}
		}
		return temp_dashboard_map;
	}
	public String getStateForSegment(String serviceName, String segmentName)
	{
		ServiceDAO dao = MonitorDAOFactory.getInstance().getServiceDAO();
		return dao.getStateForSegment(serviceName.trim(),"SEG:"+segmentName);
	}
	public boolean showSystemMenu(String service_name ,boolean isSystem)
	{
		
		String subject = "EXCLUDED_TYPES_IN_METRICS_VIEW";
		if(isSystem)
		{
			subject = "EXCLUDED_TYPES_IN_SYSTEMS_VIEW";
		}
		
		com.eg.IniFile egDashConfig = new com.eg.IniFile(s_iniFile_dir+"eg_dashboardConfig.ini");
		String excludedCompType=egDashConfig.getValue(subject,"Types");
		ArrayList excludedCompTypeList=new ArrayList(); 
		if(excludedCompType!=null && excludedCompType.trim().length()>0)
		{
			StringTokenizer tokenComp=new StringTokenizer(excludedCompType,",");
			if(tokenComp!=null)
			{
				while(tokenComp.hasMoreTokens())
				{
					String com_Type=(String)tokenComp.nextToken();
					excludedCompTypeList.add(com_Type);
				}
			}
		}
		boolean hasSystem = true;
		EgList tmpCompList = serviceBean.getComponentsForSelection("services",service_name,"");
		if(tmpCompList!=null && tmpCompList.size() > 0 )
		{
			int a = 0;
			for(int c = 0; c < tmpCompList.size(); c++)
			{
				EgComponent component = (EgComponent)tmpCompList.get(c);
				String componentTypeVal = (String)component.getType();
				if(excludedCompTypeList.contains(componentTypeVal))
				{
					a++;
				}
			}
			if(a==tmpCompList.size())
				hasSystem = false;
		}
		return hasSystem;
	}
	public String UrlParamReplace(String orgUrl,String replaceKey,String replaceValue)
    {
        String url = null;
        if(orgUrl!=null && orgUrl.indexOf(replaceKey)>0)
        {
            String params = orgUrl.substring(orgUrl.indexOf("?")+1);
            url = orgUrl.substring(0,orgUrl.indexOf("?"))+"?";
            String param[]=params.split("&");
            if(param != null && param.length>0)
            {
                for(int a = 0;a<param.length;a++)
                {
                    if(param[a].startsWith(replaceKey))
                    {
                        param[a] = replaceKey+"="+replaceValue;
                    }
                    if(a<param.length-1)
                        url = url + param[a]+"&";
                    else
                        url = url + param[a];
                }
            }
        }
        else
        {
            url = orgUrl + "&" +replaceKey+"="+replaceValue;
        }
       return url;
    }
	
	public ArrayList getDashboardList(String dashboardViews,String hasCitrix,String fromSerComboChange,String hasTransactions,String hasEmulatedTransactions,String hasLogonSimulations,String activeView,boolean hideMetricsView,String aggregateTab,String filterFlag,String filterByParamFlag, String activeViewreq, ArrayList topologyViews, boolean ctxDashboardView)
	{
		ArrayList otherViewsList = new ArrayList();
		if(dashboardViews!=null && dashboardViews.trim().length()>0)
		{
			otherViewsList =  com.egurkha.util.StringUtils.egTokenizer(dashboardViews.trim(),",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
		}

		ArrayList dashboardViewsList = new ArrayList();				
		ArrayList noCitrixDashboardViewsList = new ArrayList();
		if(!ctxDashboardView)
		{
			try
			{
				String ued_msg="Unclickable_Sub_View:User Experience:sidebarmenuItems_user_Experience";
				String ued_children ="";
				
				if(hasTransactions != null && hasTransactions.equalsIgnoreCase("true"))
					ued_children += "Web_Transaction_Sub_View:Web Transactions:sidebarmenuItems_web_transactions~|~";
				
				if(hasEmulatedTransactions != null && hasEmulatedTransactions.equalsIgnoreCase("true"))
					ued_children += "Emulated_Transaction_Sub_View:Full Session Simulations:sidebarmenuItems_full_session_simulations~|~";

				if(hasLogonSimulations != null && hasLogonSimulations.equalsIgnoreCase("true"))
					ued_children += "Logon_Sub_View:Logon Simulations:sidebarmenuItems_logon_simulations~|~";

				if(hasCitrix != null && hasCitrix.equalsIgnoreCase("true"))
					ued_children += "UserExperience_View:Real Users:sidebarmenuItems_real_users~|~";

				if(ued_children.endsWith("~|~"))
					ued_children = ued_children.substring(0,ued_children.lastIndexOf("~|~"));
				
				if(ued_children.trim().length() > 0)
					noCitrixDashboardViewsList.add(0,ued_msg+"~$~"+ued_children);
				
				if(hasCitrix != null && hasCitrix.equalsIgnoreCase("true"))
					activeView = "UserExperience_View";
				if(hasLogonSimulations != null && hasLogonSimulations.equalsIgnoreCase("true"))
					activeView = "Logon_Sub_View";
				if(hasEmulatedTransactions != null && hasEmulatedTransactions.equalsIgnoreCase("true"))
					activeView = "Emulated_Transaction_Sub_View";
				if(hasTransactions != null && hasTransactions.equalsIgnoreCase("true"))
					activeView = "Web_Transaction_Sub_View";			
				
			}
			catch(Exception ee)
			{
				ee.printStackTrace();
			}
			
			dashboardViewsList.addAll(noCitrixDashboardViewsList);
		}
		//adding Topology Views		
		try
		{
			if(topologyViews.size() == 2)
			{
				String topologyViewString = (String)topologyViews.get(0);
				if(topologyViewString != null && topologyViewString.length() > 0)
				{
					dashboardViewsList.add(topologyViewString);
					hideMetricsView = ((Boolean)topologyViews.get(1)).booleanValue();
					if(activeView == null || (activeView != null && activeView.trim().length() == 0))
						activeView = topologyViewString.substring(0,topologyViewString.indexOf(":"));
				}
			}
		}
		catch(Exception e)
		{
		}
		//Removing Metrics View and manually Loading
		if(!ctxDashboardView && !hideMetricsView && showSystemMenu(filterByParamFlag,false))
		{
			dashboardViewsList.add("Metrics_View:Components:sidebarmenuItems_components");
			if(activeView == null || (activeView != null && activeView.trim().length() == 0))
				activeView = "Metrics_View";
			if(filterFlag.equalsIgnoreCase("service"))
			{
				if(aggregateTab != null && aggregateTab.trim().equalsIgnoreCase("true"))
					dashboardViewsList.add("Aggregates_View:Aggregates:sidebarmenuItems_agrregates");
				if(showSystemMenu(filterByParamFlag,true))
					dashboardViewsList.add("Systems_View:Systems:sidebarmenuItems_systems");
			}
		}
		
		if(ctxDashboardView || dashboardViewsList.size() > 0)
		{			
			if(dashboardViews != null && dashboardViews.length() > 0)
			{
				String otherViewStr = "";
				for(int u=0;u<otherViewsList.size();u++)
				{
					otherViewStr+=otherViewsList.get(u)+"~|~";
				}
				if(otherViewStr.endsWith("~|~"))
					otherViewStr = otherViewStr.substring(0,otherViewStr.lastIndexOf("~|~"));
				
				if(activeView == null || (activeView != null && activeView.trim().length() == 0))
					activeView = otherViewStr.substring(0,otherViewStr.indexOf(":"));
				
				if(!ctxDashboardView)
					dashboardViewsList.add("seeMore:See More:sidebarmenuItems_seeMore~$~"+otherViewStr);
				else
				{
					String newotherViewStr = otherViewStr.substring(0,otherViewStr.indexOf("sidebarmenuItems_logon~|~")+25)+"UserExperience_View:User Experience:sidebarmenuItems_user_Experience~|~"+otherViewStr.substring(otherViewStr.indexOf("sidebarmenuItems_logon~|~")+25);
					dashboardViewsList.add("~$~"+newotherViewStr);
				}
			}
			//dashboardViews			
		}
		//setting activeview from param
		if(activeViewreq != null && activeViewreq.trim().length() > 0 && !activeViewreq.equalsIgnoreCase("User Experience")) 
			activeView = activeViewreq;
		
		dashboardViewsList.add("activeView~"+activeView);
		return dashboardViewsList;
	}	
%>
<%
	EgTopoInfo topoInfo = new EgTopoInfo("manager");
	String selectNode=request.getParameter("selectNode");
	selectNode = (selectNode==null)?"Service":selectNode;
	if(selectNode != null)
	{
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"|eq|","=");
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"|plus|","+");
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"|amp|","&");
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"|pct|","%");
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"|hash|","#");
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"$cap$","^");
		selectNode = com.egurkha.util.StringUtils.replace(selectNode,"$pipe$","|");
	}
	String selectedParam = request.getParameter("selectedParam");
	String openNode=request.getParameter("openNode");
	String treeFlag=request.getParameter("treeFlag");
	String currentTab=request.getParameter("currentTab");
	String transTab=request.getParameter("transTab");
	String configOnTopology=request.getParameter("configOnTopology");
	String isSite=request.getParameter("isSite");
	String serviceFromZone=request.getParameter("serviceFromZone");
	serviceFromZone=(serviceFromZone==null)?"":serviceFromZone;
	
	String monitorsBy = request.getParameter("monitorsBy");
	String ltest = request.getParameter("ltest");
	String treeTitle = request.getParameter("treeTitle");
	String tempFromHomepage =request.getParameter("fromHomepage");
	String tempLogonType =request.getParameter("isLogonType");
	String msmt_host =request.getParameter("msmt_host");
	String fromDashListCombo =request.getParameter("fromDashListCombo");
	boolean dashListCombo =false;
	if(fromDashListCombo!=null && fromDashListCombo.trim().length()>0 && fromDashListCombo.equalsIgnoreCase("true"))
		dashListCombo= true;
	String treeFlagg=request.getParameter("treeFlag");
	treeFlagg=(treeFlagg==null)?"false":treeFlagg;


	ArrayList sitesOnly = topoInfo.getAllSitesOnly();
	if(sitesOnly!=null)
	{
		if(sitesOnly.contains(serviceFromZone))
		{
			isSite="true";
		}
	}
	String sesCombo = request.getParameter("sesCombo");
	String selectedScript = request.getParameter("selectedScript");
	String setSession = request.getParameter("setSession");
	String view_Name = request.getParameter("view_name");
	if(setSession != null && setSession.equalsIgnoreCase("true"))
	{
		String qryString = (String)session.getAttribute("monitorLastSession");
		qryString = UrlParamReplace(qryString,"view_name",view_Name);
		qryString = UrlParamReplace(qryString,"fromUED","false");
		session.setAttribute("monitorLastSession",qryString);
		return;
	}
	IniFile dashCongIni = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_dashboardConfig.ini");
	IniFile iniUiObj = new IniFile(EgInstallInfo.getInstallDir() + "/manager/config/eg_ui.ini");
	String myServerName = request.getScheme() + "://" +request.getServerName();
	String myPort = ""+request.getServerPort();
	String myScheme = request.getScheme();
	
	Vector simulationSupportList = dashCongIni.getAllValues("SIMULATION_SUPPORT");
	String transactionChart = iniUiObj.getValue("CHART_TYPE","transactionChart");
	transactionChart = ( transactionChart == null || transactionChart.trim().length() ==0 )?"area":transactionChart;
	String isArea = ( transactionChart.equalsIgnoreCase("area") )?"yes":"no";

	if (myScheme.equals("http") && !myPort.equals("80"))
		myServerName += ":"+myPort;
	else if (myScheme.equals("https") && !myPort.equals("443"))
		myServerName += ":"+myPort;
	String google_map_key = iniUiObj.getValue("ZONE_MAP",myServerName);
	if(google_map_key == null || google_map_key.equals("") || google_map_key.equalsIgnoreCase("None"))
	{
		myServerName = myServerName+ "/";
		google_map_key = iniUiObj.getValue("ZONE_MAP",myServerName);
		if(google_map_key == null || google_map_key.equals("") || google_map_key.equalsIgnoreCase("None"))
		{
				google_map_key = iniUiObj.getValue("ZONE_MAP","google_map_key");
		}
	}

	com.eg.IniFile endUserIniObj=new com.eg.IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_endUserDetails.ini");
	String show_app_from_dd = endUserIniObj.getValue("END_USER_DASHBOARD_SETTINGS","ShowApplicationsFromDD");
	String show_app_overview = endUserIniObj.getValue("END_USER_DASHBOARD_SETTINGS","ShowApplicationsOverview");

	if(session!=null)
		session.setAttribute("Page_IdentifierM", request.getRequestURI());

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

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

	String qry=request.getQueryString();

	UserRegistry registry = UserRegistry.getInstance();
	User user = registry.getUser(session.getId());

	EgUserRole userRole = null;
	boolean isAllCompAccess=false;
	MonitorUtilities mUtilities = null;
	String roleName = null;
	String thisLanguage = "";
	String userName = "admin";
	String fileName="eg_commondashboard.ini";
	String iniName = request.getParameter("iniName");
	iniName=(iniName==null || iniName.trim().length()==0)?"eg_commondashboard":iniName;

	if(iniName != null && iniName.trim().length() > 0){
		if(!iniName.endsWith(".ini"))
			fileName = iniName+".ini";
		else
			fileName = iniName;
	}
	IniFile commonDashIni = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/"+fileName);
	//IniFile commonDashSaveIni = new IniFile(EgInstallInfo.getInstallDir()+ "/manager/config/"+fileName,true);
	String commonDashSaveIniName = EgInstallInfo.getInstallDir()+ "/manager/config/"+fileName;
	String strWithoutLogin = request.getParameter("without_login");

	if(user==null && strWithoutLogin!=null && (strWithoutLogin.equals("yes") || strWithoutLogin.equals("true")))
	{
		String login_user = request.getParameter("user_name");

		userName=(login_user==null || login_user.trim().length()==0)?"admin":login_user;
		ErUserData userData = new ErUserData(userName,false);
		if(userData==null)
		{
			userName="admin";
			userData = new ErUserData(userName,false);
			user = userData.usr;
		}
		else if(userData!=null)
		{
			user = userData.usr;
		}

		if(user!=null)
		{
			userRole = user.getUserRole();
			roleName = userRole.getRoleName();
			isAllCompAccess = userRole.hasAllComponentAccess();
			mUtilities = new MonitorUtilities(user);
			thisLanguage = user.getLanguage();
		}
	}
	else if(user!=null)
	{
		userName = user.getLoginID();
		userRole = user.getUserRole();
		isAllCompAccess = userRole.hasAllComponentAccess();
		roleName = userRole.getRoleName();
		mUtilities = new MonitorUtilities(user);
		thisLanguage = user.getLanguage();
	}

	EgMappingInfo mappingInfo = new EgMappingInfo(thisLanguage);

	boolean isAdminRole = (roleName.equals("Admin") || roleName.equals("Supermonitor"));
	boolean hasMonitorTab = userRole.hasAnyMonitorRole(EgUserPermission.MONITOR);
	boolean isModifyPanels=false;
	if(isAdminRole && hasMonitorTab)
	{
		isModifyPanels=true;
	}

	boolean isUserBased=false;
	String strUserBased=request.getParameter("userBased");
	if(strUserBased==null || strUserBased.trim().length()==0)
		strUserBased=commonDashIni.getValue("DASHBOARD_SETTINGS","User_Based");
	strUserBased=(strUserBased==null || strUserBased.trim().length()==0)?"true":strUserBased;

	if(strUserBased!=null && (strUserBased.equalsIgnoreCase("yes") || strUserBased.equalsIgnoreCase("true")))
	{
		isUserBased=true;
	}

	String dashboard_type=request.getParameter("dashboard_type");

	List userZones = new LinkedList();
	List userServices = new LinkedList();
	List userSegments = new LinkedList();
	List userServerTypes = new LinkedList();
	List userServers = new LinkedList();
	if(user!=null)
	{
		userZones.addAll(user.getZones());

		userServices.addAll(user.getSites());
		userServices.addAll(user.getServices());

		userSegments.addAll(user.getSegments());

		userServerTypes.addAll(user.getServerTypes());

		userServers.addAll(user.getServers(false));
	}

	boolean isCreateUserBasedEnt=false;
	String strCreateUserBasedEnt=request.getParameter("createUserBasedEntries");
	if(strCreateUserBasedEnt!=null && (strCreateUserBasedEnt.equalsIgnoreCase("yes") || strCreateUserBasedEnt.equalsIgnoreCase("true")))
	{
		isCreateUserBasedEnt=true;
	}

	boolean isShowConfig=false;
	String strShowConfig=request.getParameter("showConfig");
	if(strShowConfig==null || strShowConfig.trim().length()==0)
		strShowConfig=commonDashIni.getValue("DASHBOARD_SETTINGS","Show_Config");
	strShowConfig=(strShowConfig==null || strShowConfig.trim().length()==0)?"false":strShowConfig;

	if(strShowConfig!=null && (strShowConfig.equalsIgnoreCase("yes") || strShowConfig.equalsIgnoreCase("true")))
	{
		isShowConfig=true;
	}

	String showDashboardCombo=request.getParameter("showDashboardCombo");
	if(showDashboardCombo==null || showDashboardCombo.trim().length()==0)
		showDashboardCombo=commonDashIni.getValue("DASHBOARD_SETTINGS","ShowDashboard_Combo");
	showDashboardCombo=(showDashboardCombo==null || showDashboardCombo.trim().length()==0)?"false":showDashboardCombo;

	boolean isShowDashboardCombo=false;
	if(showDashboardCombo!=null && (showDashboardCombo.equalsIgnoreCase("yes") || showDashboardCombo.equalsIgnoreCase("true")))
	{
		isShowDashboardCombo=true;
	}

	String showAnalysisByCombo=request.getParameter("showAnalysisByCombo");
	if(showAnalysisByCombo==null || showAnalysisByCombo.trim().length()==0)
		showAnalysisByCombo=commonDashIni.getValue("DASHBOARD_SETTINGS","ShowAnalysisBy_Combo");
	showAnalysisByCombo=(showAnalysisByCombo==null || showAnalysisByCombo.trim().length()==0)?"false":showAnalysisByCombo;

	boolean isShowAnalysisByCombo=false;
	if(showAnalysisByCombo!=null && (showAnalysisByCombo.equalsIgnoreCase("yes") || showAnalysisByCombo.equalsIgnoreCase("true")))
	{
		isShowAnalysisByCombo=true;
	}

	String showAnalysisCombo=request.getParameter("showAnalysisCombo");
	if(showAnalysisCombo==null || showAnalysisCombo.trim().length()==0)
		showAnalysisCombo=commonDashIni.getValue("DASHBOARD_SETTINGS","ShowAnalysis_Combo");
	showAnalysisCombo=(showAnalysisCombo==null || showAnalysisCombo.trim().length()==0)?"false":showAnalysisCombo;

	boolean isShowAnalysisCombo=false;
	if(showAnalysisCombo!=null && (showAnalysisCombo.equalsIgnoreCase("yes") || showAnalysisCombo.equalsIgnoreCase("true")))
	{
		isShowAnalysisCombo=true;
	}

	String showTimelineCombo=request.getParameter("showTimelineCombo");
	if(showTimelineCombo==null || showTimelineCombo.trim().length()==0)
		showTimelineCombo=commonDashIni.getValue("DASHBOARD_SETTINGS","ShowTimeline_Combo");
	showTimelineCombo=(showTimelineCombo==null || showTimelineCombo.trim().length()==0)?"false":showTimelineCombo;

	boolean isShowTimelineCombo=false;
	if(showTimelineCombo!=null && (showTimelineCombo.equalsIgnoreCase("yes") || showTimelineCombo.equalsIgnoreCase("true")))
	{
		isShowTimelineCombo=true;
	}
	
	String analysisStr=null;
	analysisStr=commonDashIni.getValue("DASHBOARD_SETTINGS","Analysis_List");
	analysisStr=(analysisStr==null || analysisStr.trim().length()==0)?"":analysisStr;
	ArrayList analysisByList = new ArrayList();
	if(analysisStr!=null && analysisStr.trim().length()>0)
	{
		analysisByList =  com.egurkha.util.StringUtils.egTokenizer(analysisStr.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	}

	String timeLineOptions=null;
	String req_timeline=request.getParameter("time_line");
	
	String dashboard_name=request.getParameter("dashboard_name");
	String dashboard_mapping=request.getParameter("dashboard_mapping");
	dashboard_mapping = (dashboard_mapping==null||dashboard_mapping.trim().length()==0||dashboard_mapping.equalsIgnoreCase("NULL"))?"":dashboard_mapping;
	ArrayList dashboardList = new ArrayList();
	String dashboardStr = "";
	if(isUserBased)
		dashboardStr=commonDashIni.getValue("User_Dashboard_List",userName+":Dashboard_Names");

	if(dashboardStr==null || dashboardStr.trim().length()==0)
		dashboardStr=commonDashIni.getValue("Dashboard_List","Dashboard_Names");

	if(dashboardStr!=null && dashboardStr.trim().length()>0)
		dashboardList =  com.egurkha.util.StringUtils.egTokenizer(dashboardStr.trim(),",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	//Below code not required since dashboard_name input is mandatory
	/*if(dashboard_name==null || dashboard_name.trim().length()==0)
	{
		if(isUserBased)
		{
			dashboard_name=commonDashIni.getValue("User_Dashboard_List",userName+":Default_Dashboard");
		}

		if(dashboard_name==null || dashboard_name.trim().length()==0)
		{
			dashboard_name=commonDashIni.getValue("Dashboard_List","Default_Dashboard");
		}
	}
	else if(dashboard_name!=null && dashboard_name.trim().length()>0)
	{
		String temp_dashboard_name=commonDashIni.getValue("User_Dashboard_List",userName+":Default_Dashboard");
		String tmp_dashboard_title=null;
		if(temp_dashboard_name!=null && temp_dashboard_name.trim().length()>0)
		{
			tmp_dashboard_title=commonDashIni.getValue(userName+":"+temp_dashboard_name,"Dashboard_Title");
				//dashboard_mapping = temp_dashboard_name;
		}

		if(tmp_dashboard_title==null || tmp_dashboard_title.trim().length()==0)
		{
			temp_dashboard_name=commonDashIni.getValue("Dashboard_List","Default_Dashboard");

			tmp_dashboard_title=commonDashIni.getValue(userName+":"+temp_dashboard_name,"Dashboard_Title");
		}
		else if(tmp_dashboard_title!=null && tmp_dashboard_title.trim().length()>0)
		{
			dashboard_name = temp_dashboard_name;
		}

		if(tmp_dashboard_title==null || tmp_dashboard_title.trim().length()==0)
		{
			tmp_dashboard_title=commonDashIni.getValue(temp_dashboard_name,"Dashboard_Title");
		}

		if(tmp_dashboard_title!=null && tmp_dashboard_title.trim().length()>0)
		{
			dashboard_name = temp_dashboard_name;
		}
	}*/

	String userMappingApplisTo=null;
	boolean isFromHomePage = false;
	boolean isFromZonePage = false;
	boolean isFromServiceMenu = false;
	boolean isFromZoneMain = false;
	boolean isFromZoneMenu = false;


	boolean isFromLayerModel = false;
	String fromLayerModel=request.getParameter("isFromLayerModel");
	if(fromLayerModel != null && fromLayerModel.trim().length() > 0 && (fromLayerModel.equalsIgnoreCase("true") || fromLayerModel.equalsIgnoreCase("yes")))
		isFromLayerModel = true;
	

	String fromHomePage=request.getParameter("fromServiceHomePage");
	if(fromHomePage != null && fromHomePage.trim().length() > 0 && (fromHomePage.equalsIgnoreCase("true") || fromHomePage.equalsIgnoreCase("yes")))
		isFromHomePage = true;
	String fromServiceMenu=request.getParameter("isFromServiceMenu");
	if(fromServiceMenu != null && fromServiceMenu.trim().length() > 0 && (fromServiceMenu.equalsIgnoreCase("true") || fromServiceMenu.equalsIgnoreCase("yes")))
		isFromServiceMenu = true;
		
	String fromZoneMain=request.getParameter("isFromZoneMain");
	if(fromZoneMain != null && fromZoneMain.trim().length() > 0 && (fromZoneMain.equalsIgnoreCase("true") || fromZoneMain.equalsIgnoreCase("yes")))
		isFromZoneMain = true;

	String fromZoneMenu=request.getParameter("isFromZoneMenu");
	if(fromZoneMenu != null && fromZoneMenu.trim().length() > 0 && (fromZoneMenu.equalsIgnoreCase("true") || fromZoneMenu.equalsIgnoreCase("yes")))
		isFromZoneMenu = true;
	boolean isFromServiceGroup = false;
	String fromServiceGroup=request.getParameter("isFromServiceGroup");
	if(fromServiceGroup != null && fromServiceGroup.trim().length() > 0 && (fromServiceGroup.equalsIgnoreCase("true") || fromServiceGroup.equalsIgnoreCase("yes")))
		isFromServiceGroup = true;
	String fromZonePage=request.getParameter("fromZonePage");
	if(fromZonePage != null && fromZonePage.trim().length() > 0 && (fromZonePage.equalsIgnoreCase("true") || fromZonePage.equalsIgnoreCase("yes")))
		isFromZonePage = true;
	
	boolean isZoneFromHomepage = false;
	String zoneFromHomepage =request.getParameter("fromHomepage");
	if(zoneFromHomepage != null && zoneFromHomepage.trim().length() > 0 && (zoneFromHomepage.equalsIgnoreCase("true") || zoneFromHomepage.equalsIgnoreCase("yes")))
		isZoneFromHomepage = true;
	String selectedSegmentName = request.getParameter("segmentName");
	String componentNameSearch = request.getParameter("componentNameSearch");
	String simulationName = request.getParameter("simulationName");

	String selectedSystemCompType = request.getParameter("selectedSystemCompType");

	String filterByParam = "";
	String filterParam = "";
	String filterFlag = "";
	String filterByParamFlag = "";
	filterFlag=request.getParameter("filter");
	filterByParamFlag=request.getParameter("filterBy");
	if(dashboard_mapping == null || dashboard_mapping.trim().length() == 0){
		if(fromHomePage == null || fromHomePage.trim().length() == 0 || fromHomePage.equalsIgnoreCase("false") || fromHomePage.equalsIgnoreCase("no")){
			if(dashboard_name != null && dashboard_name.trim().length() > 0 )
				dashboard_mapping = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping","DefaultView");
		}
		else if(isFromHomePage){
			filterParam = request.getParameter("filter");
			filterByParam = request.getParameter("filterBy");
			if(dashboard_name == null || dashboard_name.trim().length() == 0)
				dashboard_name = commonDashIni.getValue("Dashboard_List",userName+":"+filterParam+":"+filterByParam+":DefaultDashboard");
			if(dashboard_name == null || dashboard_name.trim().length() == 0){
				DashboardModel dashModel = new DashboardModel();
				dashboard_name = dashModel.getDashboardName(filterParam,filterByParam,commonDashIni,user,dashboardList);
				com.eg.IniFile commonDashSaveIni = EgConfigFilesSync.getInstance(commonDashSaveIniName,true);
				commonDashSaveIni.setValue("Dashboard_List",userName+":"+filterParam+":"+filterByParam+":DefaultDashboard",dashboard_name);
				commonDashSaveIni.saveFile();
				EgConfigFilesSync.releaseInstance(commonDashSaveIni);
				commonDashSaveIni = null;
			}
			if(dashboard_name != null && dashboard_name.trim().length() > 0 ) {
				dashboard_mapping = getDashboardMapping(commonDashIni,filterParam,filterByParam,user,dashboard_name);
			}
		}
	}

	String type_dash_str=null;
	if(dashboard_type!=null && dashboard_type.trim().length()>0)
	{
		type_dash_str=commonDashIni.getValue("Dashboard_Types",dashboard_type);
	}

	if(type_dash_str==null || type_dash_str.trim().length()==0)
	{
		String[] Dashboard_Types_Arr=commonDashIni.getVariables("Dashboard_Types");
		if(Dashboard_Types_Arr!=null && Dashboard_Types_Arr.length>0 && dashboard_name!=null && dashboard_name.trim().length()>0)
		{
			for(int gg=0;gg<Dashboard_Types_Arr.length;gg++)
			{
				String dash_type=(String)Dashboard_Types_Arr[gg];
				if(dash_type!=null)
				{
					String type_dash_str2=commonDashIni.getValue("Dashboard_Types",dash_type);
					if(type_dash_str2!=null && type_dash_str2.trim().length()>0)
					{
						ArrayList type_dash_list = (ArrayList)com.egurkha.util.StringUtils.egTokenizer(type_dash_str2, ",",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(dash_name!=null && dash_name.equalsIgnoreCase(dashboard_name) && userServerTypes!=null && userServerTypes.contains(d_comp_type))
									{
										type_dash_str = type_dash_str2;
										break;
									}
								}
							}
						}
					}

					if(type_dash_str!=null && type_dash_str.length()>0)
						break;
				}
			}
		}
	}

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

	if(dashboard_mapping!=null && dashboard_mapping.trim().length()>0)
	{
		String dashVal = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping",dashboard_mapping);
		if(dashVal!=null && dashVal.trim().length()>0 && dashVal.indexOf("#~#") > 0){
			userMappingApplisTo = dashVal.substring(0,dashVal.indexOf("#~#"));
		}
		else
		{
			String[] dashboard_mappingarray=commonDashIni.getVariables(userName+"_Mapping");
			if(dashboard_mappingarray==null || dashboard_mappingarray.length==0)
				dashboard_mappingarray=commonDashIni.getVariables(dashboard_mapping+"_Mapping");
			if(dashboard_mappingarray!=null && dashboard_mappingarray.length>0)
			{
				userMappingApplisTo=(String)dashboard_mappingarray[0];
			}
			else
				userMappingApplisTo="ComponentType:Citrix_XcXenApp_server";

		}
	}
	else if(isFromHomePage){
		filterParam = request.getParameter("filter");
		filterByParam = request.getParameter("filterBy");
		if(fromHomePage != null && fromHomePage.trim().length() > 0)
			userMappingApplisTo = filterParam+":"+filterByParam;
	}
	else if(isFromZonePage){
		filterParam = request.getParameter("filter");
		filterByParam = request.getParameter("filterBy");
		if(fromHomePage != null && fromHomePage.trim().length() > 0)
			userMappingApplisTo = filterParam+":"+filterByParam;
	}
	else if(dashboard_name!=null && dashboard_name.trim().length()>0)
	{
		String dashVal = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping",dashboard_name);
		if(dashVal!=null && dashVal.trim().length()>0 && dashVal.indexOf("#~#") > 0){
			userMappingApplisTo = dashVal.substring(0,dashVal.indexOf("#~#"));
		}
		else if(commonDashIni.getValue(userName+":"+dashboard_name+":Mapping","DefaultView") != null && commonDashIni.getValue(userName+":"+dashboard_name+":Mapping","DefaultView").trim().length() > 0)
		{
			String dashVar = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping","DefaultView");
			if(dashVar!=null && dashVar.trim().length()>0){
				dashVal = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping",dashVar);
				if(dashVal!=null && dashVal.trim().length()>0 && dashVal.indexOf("#~#") > 0){
					userMappingApplisTo = dashVal.substring(0,dashVal.indexOf("#~#"));
				}
			}
			
		}
		else
		{
			String[] dashboard_mappingarray=commonDashIni.getVariables(userName+"_Mapping");

			if(dashboard_mappingarray==null || dashboard_mappingarray.length==0)
				dashboard_mappingarray=commonDashIni.getVariables(dashboard_name+"_Mapping");

			if(dashboard_mappingarray!=null && dashboard_mappingarray.length>0)
			{
				userMappingApplisTo=(String)dashboard_mappingarray[0];
			}
		}
	}
	

	boolean isFromUED = false;
	String fromUEDStr = request.getParameter("fromUED");
	if(fromUEDStr != null && fromUEDStr.trim().length() > 0 && (fromUEDStr.equalsIgnoreCase("true") || fromUEDStr.equalsIgnoreCase("yes")))
		isFromUED = true;

	String filterName = request.getParameter("filterName");
	String view_name = request.getParameter("view_name");
	String filterViewName = request.getParameter("filterViewName");
	String countryCode = request.getParameter("countryCode");
	String regionName = request.getParameter("regionName");
	IniFile geoIni = new IniFile(EgInstallInfo.getInstallDir()+"/manager/config/eg_geodetails.ini",true);
	if(filterName != null && filterName.trim().length() > 0)
	{
		if(filterName.trim().length() > 2)
		{
			String locCode = geoIni.getValue("COUNTRY_NAME_TO_CODE_MAPPING",filterName.trim());
			if(locCode != null && locCode.trim().length() > 0)
				filterName = locCode;
		}
	}
	if(countryCode != null && countryCode.trim().length() > 0)
	{
		if(countryCode.trim().length() > 2)
		{
			String locCode = geoIni.getValue("COUNTRY_NAME_TO_CODE_MAPPING",countryCode.trim());
			if(locCode != null && locCode.trim().length() > 0)
				countryCode = locCode;
		}
	}
	// for Inner User Experience tab
	String hasTransactions = request.getParameter("hasTransactions");
	String hasEmulatedTransactions = request.getParameter("hasEmulatedTransactions");
	String hasLogonSimulations = request.getParameter("hasLogonSimulations");
	String aggregateTab = request.getParameter("aggregateTab");
	String hasRUM = request.getParameter("hasRUM");
	String subject="";
	String dashboard_title="";
	String logon_treeTitle = "";
	String logonParam = "";
	String logonTitle = "";
	String isLogonType = "";
	
	String fromMenu = request.getParameter("fromMenu");
	boolean ctxDashboardView=false;
	if(fromMenu!= null && fromMenu.equalsIgnoreCase("true") && !(isFromHomePage || isFromServiceMenu || isFromZonePage))
	{
		ctxDashboardView=true;
	}

	if(dashboard_name!=null && dashboard_name.trim().length()>0)
	{
		if(isUserBased)
			subject=userName+":"+dashboard_name;
		else
			subject=dashboard_name;

		dashboard_title=commonDashIni.getValue(subject,"Dashboard_Title");

		if(dashboard_title==null || dashboard_title.trim().length()==0)
		{
			subject=dashboard_name;
			dashboard_title=commonDashIni.getValue(subject,"Dashboard_Title");
		}

		if(isUserBased && isCreateUserBasedEnt)
		{
			String tmpDashRefreshFreq=commonDashIni.getValue(subject,"Dashboard_Refresh_Frequency");
			if(tmpDashRefreshFreq==null || tmpDashRefreshFreq.trim().length()==0)
			{
				boolean tabFlge=false;
				String tmpStrTabsName=null;
				boolean viewsFlge=false;
				String tmpStrViewsName=null;
				String tmpAdditionalView=null;
				Object[] dashboardVariableEntriesArray=commonDashIni.getVariables(dashboard_name);
				if(dashboardVariableEntriesArray!=null && dashboardVariableEntriesArray.length>0)
				{
					Vector vars = new Vector();
					Vector vals = new Vector();
					boolean isAdded = false;
					for(int p=0;p<dashboardVariableEntriesArray.length;p++)
					{
						String panelVarEntry=(String)dashboardVariableEntriesArray[p];

						if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
						{
							String valueEntry=commonDashIni.getValue(dashboard_name,panelVarEntry);
							if(panelVarEntry.equals("Tabs_Name"))
							{
								tabFlge = true;
								tmpStrTabsName = valueEntry;
							}
							else if(panelVarEntry.equals("Dashboard_views"))
							{
								viewsFlge = true;
								tmpStrViewsName = valueEntry;
							}
							else if(panelVarEntry.equals("Dashboard_Additional_view"))
							{
								tmpAdditionalView = valueEntry;
							}

							//commonDashSaveIni.setValue(subject,panelVarEntry,valueEntry);
							vars.add(panelVarEntry);
							vars.add(valueEntry);
							isAdded = true;
						}
					}
					if(isAdded)
					{
						com.eg.IniFile commonDashSaveIni = EgConfigFilesSync.getInstance(commonDashSaveIniName,true);
						commonDashSaveIni.setValues(subject,vars,vals,false);
						commonDashSaveIni.saveFile();
						EgConfigFilesSync.releaseInstance(commonDashSaveIni);
						commonDashSaveIni = null;
					}
				}

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

					if(tmp_tabsList!=null && tmp_tabsList.size()>0)
					{
						for(int z=0;z<tmp_tabsList.size();z++)
						{
							String tabName = (String)tmp_tabsList.get(z);
							if(tabName!=null && tabName.trim().length()>0)
							{
								String tmpTabSub=dashboard_name+":"+tabName+":Panels";
								String saveSubject=subject+":"+tabName+":Panels";
								Object[] dashboardTabVariableEntriesArray=commonDashIni.getVariables(tmpTabSub);
								if(dashboardTabVariableEntriesArray!=null && dashboardTabVariableEntriesArray.length>0)
								{
									Vector vars = new Vector();
									Vector vals = new Vector();
									boolean isAdded = false;
									for(int p=0;p<dashboardTabVariableEntriesArray.length;p++)
									{
										String panelVarEntry=(String)dashboardTabVariableEntriesArray[p];

										if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
										{
											String valueEntry=commonDashIni.getValue(tmpTabSub,panelVarEntry);
											if(valueEntry!=null && valueEntry.trim().length()>0)
											{
												//commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
												vars.add(panelVarEntry);
												vars.add(valueEntry);
												isAdded = true;
											}
										}
									}

									if(isAdded)
									{
										com.eg.IniFile commonDashSaveIni = EgConfigFilesSync.getInstance(commonDashSaveIniName,true);
										commonDashSaveIni.setValues(saveSubject,vars,vals,false);
										commonDashSaveIni.saveFile();
										EgConfigFilesSync.releaseInstance(commonDashSaveIni);
										commonDashSaveIni = null;
									}
								}
							}
						}
					}
				}
				else if(viewsFlge && tmpStrViewsName!=null && tmpStrViewsName.trim().length()>0)
				{
					ArrayList tmp_List = new ArrayList();
					tmp_List =  com.egurkha.util.StringUtils.egTokenizer(tmpStrViewsName.trim(),",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

					if(tmp_List!=null && tmp_List.size()>0)
					{
						for(int z=0;z<tmp_List.size();z++)
						{
							String viewFormatVal = (String)tmp_List.get(z);
							if(viewFormatVal!=null && viewFormatVal.trim().length()>0)
							{
								ArrayList dashItemList =  com.egurkha.util.StringUtils.egTokenizer(viewFormatVal.trim(),":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

								if(dashItemList!=null && dashItemList.size()>0)
								{
									String dash_view=(String)dashItemList.get(0);
									//String dash_display_name=mappingInfo.getTextDescription("monitor.common."+(String)dashItemList.get(1));
									//String dash_css=(String)dashItemList.get(2);

									String tmpViewSub=dashboard_name+"_"+dash_view;
									String saveSubject=subject+"_"+dash_view;
									Object[] dashboardViewVariableEntriesArray=commonDashIni.getVariables(tmpViewSub);
									Vector vars = new Vector();
									Vector vals = new Vector();
									boolean isAdded = false;
									if(dashboardViewVariableEntriesArray!=null && dashboardViewVariableEntriesArray.length>0)
									{
										for(int p=0;p<dashboardViewVariableEntriesArray.length;p++)
										{
											String panelVarEntry=(String)dashboardViewVariableEntriesArray[p];

											if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
											{
												String valueEntry=commonDashIni.getValue(tmpViewSub,panelVarEntry);
												if(valueEntry!=null && valueEntry.trim().length()>0)
												{
													//commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
													vars.add(panelVarEntry);
													vars.add(valueEntry);
													isAdded = true;
												}
											}
										}
									}

									if(isAdded)
									{
										com.eg.IniFile commonDashSaveIni = EgConfigFilesSync.getInstance(commonDashSaveIniName,true);
										commonDashSaveIni.setValues(saveSubject,vars,vals,false);
										commonDashSaveIni.saveFile();
										EgConfigFilesSync.releaseInstance(commonDashSaveIni);
										commonDashSaveIni = null;
									}
								}
							}
						}
					}

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

						if(tmp_List!=null && tmp_List.size()>0)
						{
							for(int z=0;z<tmp_List.size();z++)
							{
								String dash_view = (String)tmp_List.get(z);
								if(dash_view!=null && dash_view.trim().length()>0)
								{
									String tmpViewSub=dashboard_name+"_"+dash_view;
									String saveSubject=subject+"_"+dash_view;
									Object[] dashboardViewVariableEntriesArray=commonDashIni.getVariables(tmpViewSub);
									Vector vars = new Vector();
									Vector vals = new Vector();
									boolean isAdded = false;
									if(dashboardViewVariableEntriesArray!=null && dashboardViewVariableEntriesArray.length>0)
									{
										for(int p=0;p<dashboardViewVariableEntriesArray.length;p++)
										{
											String panelVarEntry=(String)dashboardViewVariableEntriesArray[p];

											if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
											{
												String valueEntry=commonDashIni.getValue(tmpViewSub,panelVarEntry);
												if(valueEntry!=null && (valueEntry.trim().length()>0 || valueEntry.trim().length()==0))
												{
													//commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
													vars.add(panelVarEntry);
													vars.add(valueEntry);
													isAdded = true;
												}
											}
										}
									}

									if(isAdded)
									{
										com.eg.IniFile commonDashSaveIni = EgConfigFilesSync.getInstance(commonDashSaveIniName,true);
										commonDashSaveIni.setValues(saveSubject,vars,vals,false);
										commonDashSaveIni.saveFile();
										EgConfigFilesSync.releaseInstance(commonDashSaveIni);
										commonDashSaveIni = null;
									}
								}
							}
						}
					}
				}
				else
				{
					String tmpTabSub=dashboard_name+":Panels";
					String saveSubject=subject+":Panels";
					Object[] dashboardPanelVariableEntriesArray=commonDashIni.getVariables(tmpTabSub);
					if(dashboardPanelVariableEntriesArray!=null && dashboardPanelVariableEntriesArray.length>0)
					{
						Vector vars = new Vector();
						Vector vals = new Vector();
						boolean isAdded = false;
						for(int p=0;p<dashboardPanelVariableEntriesArray.length;p++)
						{
							String panelVarEntry=(String)dashboardPanelVariableEntriesArray[p];

							if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
							{
								String valueEntry=commonDashIni.getValue(tmpTabSub,panelVarEntry);
								if(valueEntry!=null && valueEntry.trim().length()>0)
								{
									//commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
									vars.add(panelVarEntry);
									vars.add(valueEntry);
									isAdded = true;
								}
							}
						}

						if(isAdded)
						{
							com.eg.IniFile commonDashSaveIni = EgConfigFilesSync.getInstance(commonDashSaveIniName,true);
							commonDashSaveIni.setValues(saveSubject,vars,vals,false);
							commonDashSaveIni.saveFile();
							EgConfigFilesSync.releaseInstance(commonDashSaveIni);
							commonDashSaveIni = null;
						}
					}
				}
				//commonDashSaveIni.saveFile();
			}
		}
	}
	/*else //Below code not required since dashboard_name is mandatory
	{
		if(isUserBased && isCreateUserBasedEnt)
		{
			if(dashboardList==null || dashboardList.size()==0)
			{
				dashboardStr=commonDashIni.getValue("Dashboard_List","Dashboard_Names");
				if(dashboardStr!=null && dashboardStr.trim().length()>0)
				{
					commonDashSaveIni.setValue("User_Dashboard_List",userName+":Dashboard_Names",dashboardStr);
					dashboardList =  com.egurkha.util.StringUtils.egTokenizer(dashboardStr.trim(),",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				}

				dashboard_name=commonDashIni.getValue("Dashboard_List","Default_Dashboard");
				if(dashboard_name!=null && dashboard_name.trim().length()>0)
				{
					commonDashSaveIni.setValue("User_Dashboard_List",userName+":Default_Dashboard",dashboard_name);
				}

				subject=userName+":"+dashboard_name;

				dashboard_title=commonDashIni.getValue(subject,"Dashboard_Title");

				String tmpDashRefreshFreq=commonDashIni.getValue(subject,"Dashboard_Refresh_Frequency");
				if(tmpDashRefreshFreq==null || tmpDashRefreshFreq.trim().length()==0)
				{
					boolean tabFlge=false;
					String tmpStrTabsName=null;
					boolean viewsFlge=false;
					String tmpStrViewsName=null;
					String tmpAdditionalView=null;

					Object[] dashboardVariableEntriesArray=commonDashIni.getVariables(dashboard_name);
					if(dashboardVariableEntriesArray!=null && dashboardVariableEntriesArray.length>0)
					{
						for(int p=0;p<dashboardVariableEntriesArray.length;p++)
						{
							String panelVarEntry=(String)dashboardVariableEntriesArray[p];

							if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
							{
								String valueEntry=commonDashIni.getValue(dashboard_name,panelVarEntry);
								if(panelVarEntry.equals("Tabs_Name"))
								{
									tabFlge = true;
									tmpStrTabsName = valueEntry;
								}
								else if(panelVarEntry.equals("Dashboard_views"))
								{
									viewsFlge = true;
									tmpStrViewsName = valueEntry;
								}
								else if(panelVarEntry.equals("Dashboard_Additional_view"))
								{
									tmpAdditionalView = valueEntry;
								}
								commonDashSaveIni.setValue(subject,panelVarEntry,valueEntry);
							}
						}
					}

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

						if(tmp_tabsList!=null && tmp_tabsList.size()>0)
						{
							for(int z=0;z<tmp_tabsList.size();z++)
							{
								String tabName = (String)tmp_tabsList.get(z);
								if(tabName!=null && tabName.trim().length()>0)
								{
									String tmpTabSub=dashboard_name+":"+tabName+":Panels";
									String saveSubject=subject+":"+tabName+":Panels";
									Object[] dashboardTabVariableEntriesArray=commonDashIni.getVariables(tmpTabSub);
									if(dashboardTabVariableEntriesArray!=null && dashboardTabVariableEntriesArray.length>0)
									{
										for(int p=0;p<dashboardTabVariableEntriesArray.length;p++)
										{
											String panelVarEntry=(String)dashboardTabVariableEntriesArray[p];

											if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
											{
												String valueEntry=commonDashIni.getValue(tmpTabSub,panelVarEntry);
												if(valueEntry!=null && valueEntry.trim().length()>0)
												{
													commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
												}
											}
										}
									}
								}
							}
						}
					}
					else if(viewsFlge && tmpStrViewsName!=null && tmpStrViewsName.trim().length()>0)
					{
						ArrayList tmp_List = new ArrayList();
						tmp_List =  com.egurkha.util.StringUtils.egTokenizer(tmpStrViewsName.trim(),",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

						if(tmp_List!=null && tmp_List.size()>0)
						{
							for(int z=0;z<tmp_List.size();z++)
							{
								String viewFormatVal = (String)tmp_List.get(z);
								if(viewFormatVal!=null && viewFormatVal.trim().length()>0)
								{
									ArrayList dashItemList =  com.egurkha.util.StringUtils.egTokenizer(viewFormatVal.trim(),":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

									if(dashItemList!=null && dashItemList.size()>0)
									{
										String dash_view=(String)dashItemList.get(0);
										//String dash_display_name=mappingInfo.getTextDescription("monitor.common."+(String)dashItemList.get(1));
										//String dash_css=(String)dashItemList.get(2);

										String tmpViewSub=dashboard_name+"_"+dash_view;
										String saveSubject=subject+"_"+dash_view;
										Object[] dashboardViewVariableEntriesArray=commonDashIni.getVariables(tmpViewSub);
										if(dashboardViewVariableEntriesArray!=null && dashboardViewVariableEntriesArray.length>0)
										{
											for(int p=0;p<dashboardViewVariableEntriesArray.length;p++)
											{
												String panelVarEntry=(String)dashboardViewVariableEntriesArray[p];

												if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
												{
													String valueEntry=commonDashIni.getValue(tmpViewSub,panelVarEntry);
													if(valueEntry!=null && valueEntry.trim().length()>0)
													{
														commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
													}
												}
											}
										}
									}
								}
							}
						}


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

							if(tmp_List!=null && tmp_List.size()>0)
							{
								for(int z=0;z<tmp_List.size();z++)
								{
									String dash_view = (String)tmp_List.get(z);
									if(dash_view!=null && dash_view.trim().length()>0)
									{
										String tmpViewSub=dashboard_name+"_"+dash_view;
										String saveSubject=subject+"_"+dash_view;
										Object[] dashboardViewVariableEntriesArray=commonDashIni.getVariables(tmpViewSub);
										if(dashboardViewVariableEntriesArray!=null && dashboardViewVariableEntriesArray.length>0)
										{
											for(int p=0;p<dashboardViewVariableEntriesArray.length;p++)
											{
												String panelVarEntry=(String)dashboardViewVariableEntriesArray[p];

												if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
												{
													String valueEntry=commonDashIni.getValue(tmpViewSub,panelVarEntry);
													if(valueEntry!=null && (valueEntry.trim().length()>0 || valueEntry.trim().length()==0))
													{
														commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
													}
												}
											}
										}
									}
								}
							}
						}
					}
					else
					{
						String tmpTabSub=dashboard_name+":Panels";
						String saveSubject=subject+":Panels";
						Object[] dashboardPanelVariableEntriesArray=commonDashIni.getVariables(tmpTabSub);
						if(dashboardPanelVariableEntriesArray!=null && dashboardPanelVariableEntriesArray.length>0)
						{
							for(int p=0;p<dashboardPanelVariableEntriesArray.length;p++)
							{
								String panelVarEntry=(String)dashboardPanelVariableEntriesArray[p];

								if(panelVarEntry!=null && panelVarEntry.trim().length()>0)
								{
									String valueEntry=commonDashIni.getValue(tmpTabSub,panelVarEntry);
									if(valueEntry!=null && valueEntry.trim().length()>0)
									{
										commonDashSaveIni.setValue(saveSubject,panelVarEntry,valueEntry);
									}
								}
							}
						}
					}
				}
				commonDashSaveIni.saveFile();
			}
		}
	}*/

	if(req_timeline==null || req_timeline.trim().length()==0)
	{
		req_timeline=commonDashIni.getValue(subject,"Dashboard_Default_Timeline");
	}
	req_timeline=(req_timeline==null || req_timeline.trim().length()==0)?"Current":req_timeline;

	timeLineOptions=commonDashIni.getValue(subject,"Dashboard_Timeline");

	if(timeLineOptions==null || timeLineOptions.trim().length()==0)
	{
		timeLineOptions=commonDashIni.getValue("DASHBOARD_SETTINGS","TimeLine_Options");
	}

	timeLineOptions=(timeLineOptions==null || timeLineOptions.trim().length()==0)?"Current,1 day,1 week":timeLineOptions;

	ArrayList timeLineOptionsList =  com.egurkha.util.StringUtils.egTokenizer(timeLineOptions.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

	boolean isTabView=false;
	String strTabsName=request.getParameter("tabs_name");
	if(strTabsName==null || strTabsName.trim().length()==0)
	{
		strTabsName=commonDashIni.getValue(subject,"Tabs_Name");
	}

	strTabsName=(strTabsName==null || strTabsName.trim().length()==0)?"":strTabsName;
	if(strTabsName!=null && strTabsName.length()>0)
	{
		isTabView=true;
		//strTabsName="USER,APP";
	}

	boolean isUserDefindApp=false;
	String appName = request.getParameter("appName");
	appName=(appName==null || appName.trim().length()==0)?"":appName;
	if(appName!=null && appName.length()>0)
	{
		isUserDefindApp=true;
	}
	
	ArrayList tabsList = new ArrayList();
	if(isTabView && strTabsName!=null && strTabsName.trim().length()>0)
	{
		tabsList =  com.egurkha.util.StringUtils.egTokenizer(strTabsName.trim(),",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	}

	String activeTab=null;
	if(isTabView)
	{
		activeTab = request.getParameter("active_tab");
	}
	activeTab=(activeTab==null || activeTab.trim().length()==0)?"":activeTab;

	String activeView=null;
	String activeViewreq=null;
	activeView = request.getParameter("view_name");
	activeViewreq = request.getParameter("view_name");
	String hasCitrix=request.getParameter("hasCitrix");
	activeView=(activeView==null || activeView.trim().length()==0)?"":activeView;
	
	boolean isExpendAllBlocks=false;
	String strExpendAllAccordionBlocks=commonDashIni.getValue(subject,"Accordion_Expend_All_Blocks");
	if(strExpendAllAccordionBlocks!=null && (strExpendAllAccordionBlocks.equalsIgnoreCase("yes") || strExpendAllAccordionBlocks.equalsIgnoreCase("true")))
	{
		isExpendAllBlocks=true;
	}

	//To refresh whole dashboard
	long sessionRefreshFrequency = 2500 * 1000L;
	String dashRefreshFreq=commonDashIni.getValue(subject,"Dashboard_Refresh_Frequency");
	if(dashRefreshFreq!=null && dashRefreshFreq.length()>0)
	{
		sessionRefreshFrequency =  Long.valueOf(dashRefreshFreq).longValue() * 1000L;
	}

	long refFrequency = 60 * 1000L;
	String refreshFreq=commonDashIni.getValue(subject,"Panel_Refresh_Frequency");
	if(refreshFreq!=null && refreshFreq.length()>0)
	{
		refFrequency =  Long.valueOf(refreshFreq).longValue() * 1000L;
	}

	String analysisBy=request.getParameter("analysisBy");
	analysisBy=(analysisBy==null || analysisBy.trim().length()==0)?"":analysisBy;
	
	String analysis=request.getParameter("analysis");
	analysis=(analysis==null || analysis.trim().length()==0)?"":analysis;

	String appliesTo=request.getParameter("appliesTo");
	String fromSerComboChange=request.getParameter("fromSerComboChange");
	
	String isFromZone = request.getParameter("isFromZone");
	String iszoneName = request.getParameter("iszoneName");
	String parentZone = request.getParameter("parentZone");
	
	if(isFromHomePage && userMappingApplisTo != null && userMappingApplisTo.trim().length() > 0)
		appliesTo = userMappingApplisTo;
	
	if(appliesTo==null || appliesTo.trim().length()==0)
	{
		appliesTo=commonDashIni.getValue(subject,"AppliesTo");
	}

	if(appliesTo!=null && appliesTo.trim().length()>0)
	{
		if(analysisBy==null || analysisBy.trim().length()==0)
		{
			analysisBy= appliesTo.substring(0,appliesTo.indexOf(":"));
		}

		if(analysis==null || analysis.trim().length()==0)
		{
			analysis = appliesTo.substring(appliesTo.indexOf(":")+1);
		}
	}

	analysisBy=(analysisBy==null || analysisBy.trim().length()==0)?"ComponentType":analysisBy;
	analysis=(analysis==null || analysis.trim().length()==0)?"All":analysis;

	String dashboardViews=request.getParameter("DashboardViews");
	if(dashboardViews==null || dashboardViews.trim().length()==0)
	{
		if(hasCitrix == null || (hasCitrix != null && hasCitrix.equalsIgnoreCase("true")))
			dashboardViews=commonDashIni.getValue(subject,"Dashboard_views");
		else if(hasCitrix != null && hasCitrix.equalsIgnoreCase("false")) 
			dashboardViews="";		
	}
	if((filterFlag == null || filterFlag.trim().length() == 0 || filterFlag.equalsIgnoreCase("null")) && (filterByParamFlag == null || filterByParamFlag.trim().length() == 0 || filterByParamFlag.equalsIgnoreCase("null")) ){
		HashMap paramsNeeded = getServiceBasedFilter(userMappingApplisTo);		
		if(paramsNeeded != null){
			if(userMappingApplisTo != null && userMappingApplisTo.trim().length() > 0)
			{
				if(userMappingApplisTo.indexOf(":") > -1)
				{
					filterFlag = userMappingApplisTo.substring(0,userMappingApplisTo.indexOf(":"));
					filterByParamFlag = userMappingApplisTo.substring(userMappingApplisTo.indexOf(":")+1);
				}
			}
			hasTransactions = (String)paramsNeeded.get("hasTransactions");
			hasEmulatedTransactions = (String)paramsNeeded.get("hasEmulatedTransactions");
			hasLogonSimulations = (String)paramsNeeded.get("hasLogonSimulations");
			hasRUM = (String)paramsNeeded.get("hasRUM");
			aggregateTab = (String)paramsNeeded.get("aggregateTab");
			hasCitrix = (String)paramsNeeded.get("hasCitrix");
			if(hasCitrix != null && hasCitrix.equalsIgnoreCase("false")) 
				dashboardViews="";
			logon_treeTitle = (String)paramsNeeded.get("logon_treeTitle");
			logonParam = (String)paramsNeeded.get("logonParam");
			logonTitle = (String)paramsNeeded.get("logonTitle");
			isLogonType = (String)paramsNeeded.get("isLogonType");
		}
	}else if(fromSerComboChange != null && fromSerComboChange.trim().length() != 0 && fromSerComboChange.equalsIgnoreCase("true")){
		String filterGroup = filterFlag+":"+filterByParamFlag;
		HashMap paramsNeeded = getServiceBasedFilter(filterGroup);	
		if(paramsNeeded != null){
			hasTransactions = (String)paramsNeeded.get("hasTransactions");
			hasEmulatedTransactions = (String)paramsNeeded.get("hasEmulatedTransactions");
			hasLogonSimulations = (String)paramsNeeded.get("hasLogonSimulations");
			hasRUM = (String)paramsNeeded.get("hasRUM");
			aggregateTab = (String)paramsNeeded.get("aggregateTab");
			hasCitrix = (String)paramsNeeded.get("hasCitrix");
			if(hasCitrix != null && hasCitrix.equalsIgnoreCase("false"))
				dashboardViews="";
			logon_treeTitle = (String)paramsNeeded.get("logon_treeTitle");
			logonParam = (String)paramsNeeded.get("logonParam");
			logonTitle = (String)paramsNeeded.get("logonTitle");
			isLogonType = (String)paramsNeeded.get("isLogonType");
		}
	}
	else if((fromSerComboChange == null || fromSerComboChange.equalsIgnoreCase("null")) && (hasTransactions == null || hasTransactions.equalsIgnoreCase("null")) && (hasEmulatedTransactions == null || hasEmulatedTransactions.equalsIgnoreCase("null")) && (hasLogonSimulations == null || hasLogonSimulations.equalsIgnoreCase("null"))){
		String filterGroup = filterFlag+":"+filterByParamFlag;
		HashMap paramsNeeded = getServiceBasedFilter(filterGroup);	
		if(paramsNeeded != null){
			hasTransactions = (String)paramsNeeded.get("hasTransactions");
			hasEmulatedTransactions = (String)paramsNeeded.get("hasEmulatedTransactions");
			hasLogonSimulations = (String)paramsNeeded.get("hasLogonSimulations");
			hasRUM = (String)paramsNeeded.get("hasRUM");
			aggregateTab = (String)paramsNeeded.get("aggregateTab");
			hasCitrix = (String)paramsNeeded.get("hasCitrix");
			if(hasCitrix != null && hasCitrix.equalsIgnoreCase("false"))
				dashboardViews="";
			logon_treeTitle = (String)paramsNeeded.get("logon_treeTitle");
			logonParam = (String)paramsNeeded.get("logonParam");
			logonTitle = (String)paramsNeeded.get("logonTitle");
			isLogonType = (String)paramsNeeded.get("isLogonType");
		}
	}
	
	boolean hideMetricsView = false;
	String ifSerrSegrZone = null;
	String ifSerrSegrZoneName = null;
	Boolean isZoneViewNeeded = false;
	String ifAssSeg = null;
	String ifAssSegState = null;
	ArrayList segWithState = new ArrayList();
	
	List userAnalysisList = new LinkedList();
	if(analysisBy!=null && analysisBy.equalsIgnoreCase("Zone"))
	{
		userAnalysisList = userZones;
	}
	else if(analysisBy!=null && (analysisBy.equalsIgnoreCase("Service") || analysisBy.equalsIgnoreCase("Site")))
	{
		userAnalysisList = userServices;
	}
	else if(analysisBy!=null && analysisBy.equalsIgnoreCase("Segment"))
	{
		userAnalysisList = userSegments;
	}
	else if(analysisBy!=null && analysisBy.equalsIgnoreCase("ComponentType"))
	{
		userAnalysisList = userServerTypes;
	}
	else if(analysisBy!=null && (analysisBy.equalsIgnoreCase("Component") || analysisBy.equalsIgnoreCase("Components")))
	{
		userAnalysisList = userServers;
	}

	String Dashboard_ComponentType_st="";
	String selected_CompType_st="";
	String Dashboard_ComponentType=commonDashIni.getValue(subject,"Dashboard_ComponentType");
	
	if(Dashboard_ComponentType != null && Dashboard_ComponentType.trim().length() > 0 && Dashboard_ComponentType.startsWith("Agg_")
			&& dashboard_name != null && dashboard_name.trim().length() > 0){
		Dashboard_ComponentType = commonDashIni.getValue(dashboard_name,"Dashboard_Original_ComponentType");
	}
	else{
		if(dashboard_name!=null && dashboard_name.trim().length()>0){
			Dashboard_ComponentType = commonDashIni.getValue(dashboard_name,"Dashboard_Original_ComponentType");
			Dashboard_ComponentType_st = Dashboard_ComponentType;
		}
	}
	String componentType = request.getParameter("componentType");
	if(componentType != null && componentType.trim().length()>0 && !componentType.equalsIgnoreCase("NULL")){
		//Dashboard_ComponentType = componentType;
		selected_CompType_st = componentType;
	}
	String dispDashboard_ComponentType = mappingInfo.getComponentTypeDescription(Dashboard_ComponentType);
	String director_types=commonDashIni.getValue("Broker_Supported_Types",Dashboard_ComponentType_st);
	director_types=(director_types==null || director_types.trim().length()==0)?"":director_types;
	ArrayList directorSupportedTypes =  com.egurkha.util.StringUtils.egTokenizer(director_types.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
	if(dashboard_mapping != null && dashboard_mapping.trim().length() > 0){
			String entry = commonDashIni.getValue(userName+":Mapping",dashboard_mapping);
			if(entry != null && entry.indexOf("#~#") > 0){
				if(entry.startsWith("ComponentType") || entry.startsWith("Components")){
					String val = entry.substring(entry.indexOf(":")+1);
					if(val.startsWith("Agg_"))
						Dashboard_ComponentType = "";
				}
			}
	}

	if((selected_CompType_st == null || selected_CompType_st.trim().length()==0 ) && Dashboard_ComponentType != null && Dashboard_ComponentType.trim().length()>0){
		selected_CompType_st = Dashboard_ComponentType;
	}

	boolean isUserHaveDirector=false;
	String directorTypes = "";
	if(directorSupportedTypes!=null && directorSupportedTypes.size()>0)
	{
		for (int i=0;i<directorSupportedTypes.size() ; i++)
		{
			String supp_type=(String)directorSupportedTypes.get(i);
			if(userServerTypes!=null && supp_type!=null && userServerTypes.contains(supp_type))
			{
				directorTypes += ","+supp_type;
				//break;
			}
		}
	}

	if(directorTypes != null && directorTypes.trim().length() > 0){
		isUserHaveDirector = true;
		directorTypes = (directorTypes.startsWith(","))?directorTypes.substring(1):directorTypes;
	}

	boolean addBrokerView = false;
	boolean isBrokerTestRunning = false;
	List servers = mUtilities.getComponents(filterFlag,filterByParamFlag,false);
	String directorTest = commonDashIni.getValue("Broker_Supported_Tests",Dashboard_ComponentType_st);
	try
	{
		Hashtable measureLast=(Hashtable)com.eg.EgLastMeasureThread.measureLast;
		if(measureLast == null)
			measureLast=new Hashtable();
		Hashtable testDetails = null;
		String org_comp_type = "", org_host_name = "";
		List serversTypeList = new ArrayList();
		if(servers!=null && servers.size()>0)
		{
			for(int i=0;i<servers.size();i++)
			{
				String tempserv = (String)servers.get(i);
				if(tempserv != null && tempserv.indexOf(":") > -1)
				{
					org_comp_type = tempserv.substring(0,tempserv.indexOf(":"));
					org_host_name = tempserv.substring(tempserv.indexOf(":")+1);

					serversTypeList.add(org_comp_type);
					if(!isBrokerTestRunning && directorTest != null && directorTest.length() > 0 && org_comp_type != null && Dashboard_ComponentType_st != null && org_comp_type.equals(Dashboard_ComponentType_st)){
						testDetails =(Hashtable) measureLast.get(org_host_name);
						if(testDetails == null || testDetails.size() == 0)
							continue;
						if(testDetails.containsKey(directorTest))
							isBrokerTestRunning = true;
					}
				}
			}
		}
		if((isBrokerTestRunning || directorTest == null || directorTest.length() == 0)&& serversTypeList!=null && serversTypeList.size()>0)
		{
			if(directorSupportedTypes!=null && directorSupportedTypes.size()>0)
			{
				for(int r=0;r<directorSupportedTypes.size();r++)
				{
					if(serversTypeList.contains(directorSupportedTypes.get(r)))
						addBrokerView = true;
				}
			}
		}
	}
	catch(Exception e)
	{
	}
	String Broker_Supported_View = commonDashIni.getValue(subject,"Broker_Supported_View");
	Broker_Supported_View=(Broker_Supported_View==null || Broker_Supported_View.trim().length()==0)?"":Broker_Supported_View;
	ArrayList brokerSupportedViewList =  com.egurkha.util.StringUtils.egTokenizer(Broker_Supported_View.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim

	String userType = null, userTypeAppUED = null;
	String[] userTypeComps = endUserIniObj.getVariables("USER_TYPE_COMPONENTS");


	if (userTypeComps != null && userTypeComps.length > 0){
		for(int k=0;k<userTypeComps.length;k++){
			String param = (String)userTypeComps[k];
			ArrayList userTypeCompList = com.egurkha.util.StringUtils.egTokenizer(endUserIniObj.getValue("USER_TYPE_COMPONENTS",param),",",false,true,true);
			if(userTypeCompList != null && userTypeCompList.contains(Dashboard_ComponentType))
			{
				if(show_app_from_dd!=null && (show_app_from_dd.equalsIgnoreCase("true") || show_app_from_dd.equalsIgnoreCase("yes")))
				{
					if(param.startsWith("AppDD"))
						userTypeAppUED = param;
					else if(param.startsWith("AppLaunchDD"))
						userTypeAppUED = param;
					else if(param.startsWith("App") || param.startsWith("OverviewAppXenApp7") || param.startsWith("OverviewAppVDI"))
						continue;
					else
						userType = param;
				}
				else if(param.startsWith("AppLaunchDD"))
					userTypeAppUED = param;
				else if(param.startsWith("AppDD"))
					continue;
				else if(param.startsWith("App") || param.startsWith("OverviewAppXenApp7") || param.startsWith("OverviewAppVDI"))
				{
					if(param.startsWith("OverviewAppXenApp7") && show_app_overview!=null && (show_app_overview.equalsIgnoreCase("true") || show_app_overview.equalsIgnoreCase("yes")))
						userTypeAppUED = "OverviewAppXenApp7";
					else if(param.startsWith("OverviewAppVDI") && show_app_overview!=null && (show_app_overview.equalsIgnoreCase("true") || show_app_overview.equalsIgnoreCase("yes")))
						userTypeAppUED = "OverviewAppVDI";
					else
						userTypeAppUED = param;
				}
				else
					userType = param;

				if(userTypeAppUED != null && userType != null)
					break;
			}
		}
	}
/*
	String uiFileTemp = "eg_ui.ini";
	String s_iniFile_dir_temp = EgInstallInfo.getInstallDir()+ "/manager/config/";
	IniFile egUIIni = new IniFile(s_iniFile_dir_temp + uiFileTemp);

	String currentDateFormatForJS = egUIIni.getValue("CURRENT_DATE_FORMAT","selectedDateFormat");

	String timezoneOffsetValue ="";
	EgDateInfo tracker_tdateInfo = new EgDateInfo();
	TimeZone tracker_tz = null;
	Calendar cal = Calendar.getInstance();
	java.util.Date local_date = new java.util.Date(tracker_tdateInfo.egetUTCDate());
	cal.setTime(local_date);
	cal.setTimeZone(tracker_tdateInfo.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 trac_currentDateFormat = currentDateFormatForJS;
	String dispDate = DateUtil.changeDateFormat(temp1,"MM/dd/yyyy",trac_currentDateFormat);
	EgTimeZoneConverter tracker_timeZoneConverter = new EgTimeZoneConverter(dispDate+" "+mgr_time,user);
	tracker_tz = tracker_timeZoneConverter.getTimeZone();

	long timezoneinMins = (Math.abs((tracker_tz.getRawOffset() / (60 * 1000))));
	long daylighttime = (tracker_tz.getDSTSavings() / (60 * 1000));
	timezoneOffsetValue = String.valueOf(Math.abs(timezoneinMins-daylighttime));

	Calendar cal3 = GregorianCalendar.getInstance(tracker_tz);
	int offsetInMillis = tracker_tz.getOffset(cal3.getTimeInMillis());
	int offsetmin = 0;
	if(offsetInMillis<0)
		offsetmin =(Math.abs(offsetInMillis)/1000)/60;
	else
		offsetmin = (offsetInMillis/1000)/60;
	String offset = String.valueOf(offsetmin);

	if(tracker_tz.getRawOffset()>=0)
		timezoneOffsetValue="-"+offset;
	else
		timezoneOffsetValue="+"+offset;

	String monitor_Skin  = user.getMonitorSkin();
*/
	EgDateInfo egDt = new EgDateInfo();
	java.util.Date local_date = new java.util.Date(egDt.egetUTCDate());
	Calendar cal = Calendar.getInstance();
	cal.setTime(local_date);
	cal.setTimeZone(egDt.getRealTimeZone());
	String defaultUrl="/final/monitor/citrixDashboard.jsp";
	if(qry!=null)
	{
		qry=com.egurkha.util.StringUtils.replace(qry, "\\", "\\\\");
		defaultUrl = "/final/monitor/citrixDashboard.jsp?"+qry;
	}

	String[] dashboards_arr = null;
	String defaultView = "";
	if(dashboard_name != null && dashboard_name.trim().length() > 0){
		dashboards_arr = commonDashIni.getVariables(userName+":"+dashboard_name+":Mapping");
		defaultView = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping","DefaultView");
	}
	 
	String deleted_dashboard_mapping = request.getParameter("deleted_dashboard_mapping");
		
	ArrayList dashboardsList = new ArrayList();
	if(dashboards_arr!=null)
		dashboardsList.addAll(Arrays.asList(dashboards_arr));

	boolean isEntry = false;
	if((dashboard_name==null || dashboard_name.trim().length()==0 || (!dashboardList.contains(dashboard_name)||dashboard_name.equalsIgnoreCase("NULL")))||( filterByParam!=null && filterByParam.trim().length()>0))
		isEntry = true;

	if((fromHomePage==null || fromHomePage.trim().length()==0||!fromHomePage.equalsIgnoreCase("true")) && fromMenu != null && fromMenu.trim().length()>0 && fromMenu.equalsIgnoreCase("true") && (dashboardsList!=null && dashboardsList.size()==0))
	{
		String tmp_dash_name = "DefaultDashboard";
		dashboardsList.add(tmp_dash_name);
		defaultView = tmp_dash_name;
	}
	else if(fromHomePage!=null && fromHomePage.trim().length()>0 && fromHomePage.equalsIgnoreCase("true"))
	{
		if(dashboardsList!=null && dashboardsList.size()==0 && filterByParam!=null && filterByParam.trim().length()>0)
		{
			String tmp_filterby = filterByParam+"_Dash";
			dashboardsList.add(tmp_filterby);
			defaultView = tmp_filterby;
		}
		else if(isEntry && dashboardsList!=null && dashboardsList.size()>0 && filterByParam!=null && !dashboardsList.contains(filterByParam+"_Dash"))
		{
			String tmp_filterby = filterByParam+"_Dash";
			dashboardsList.add(tmp_filterby);
			defaultView = filterByParam+"_Dash";
		}
	}
	if(dashboard_mapping!=null && dashboard_mapping.trim().length()>0 && !dashboard_mapping.equalsIgnoreCase("NULL"))
	{
		defaultView = dashboard_mapping; 
	}
	else if(deleted_dashboard_mapping!=null && deleted_dashboard_mapping.trim().length()>0 && deleted_dashboard_mapping.equalsIgnoreCase(defaultView))
	{
		defaultView = "DefaultDashboard";
	}

	if(defaultView==null || defaultView.trim().length()==0)
		defaultView = "DefaultDashboard";

	if(defaultView!=null)
	{
		String defaultViewcheckSite = commonDashIni.getValue(userName+":"+dashboard_name+":Mapping",defaultView);	
		if(directorSupportedTypes!=null && directorSupportedTypes.size()>0)
		{
			for(int r=0;r<directorSupportedTypes.size();r++)
			{
				String directorSupportedTypesele = (String)directorSupportedTypes.get(r);
				if(defaultViewcheckSite.indexOf(directorSupportedTypesele) > -1)
					addBrokerView = true;
			}
		}
		//if(defaultViewcheckSite.indexOf("#~#All") > -1 || defaultViewcheckSite.indexOf("#~#All,All") > -1 || defaultViewcheckSite.indexOf("#~#All,-1") > -1 || defaultViewcheckSite.indexOf("#~#All,NONE") > -1)
		{
			if(filterFlag != null && filterFlag.equalsIgnoreCase("ComponentType"))
			{
				for(int r=0;r<directorSupportedTypes.size();r++)
				{
					String directorSupportedTypesele = (String)directorSupportedTypes.get(r);
					if(userServerTypes.indexOf(directorSupportedTypesele) > -1)
					{
						addBrokerView = true;
						break;
					}
				}
			}
			else if(filterFlag != null && filterFlag.equalsIgnoreCase("Service") )
			{
				if(servers!=null && servers.size()>0)
				{
					for(int i=0;i<servers.size();i++)
					{
						String tempserv = (String)servers.get(i);
						if(tempserv != null && tempserv.indexOf(":") > -1)
						{
							String ser_comp_type = tempserv.substring(0,tempserv.indexOf(":"));
							if(directorSupportedTypes.indexOf(ser_comp_type) > -1)
							{
								addBrokerView = true;
								break;
							}
						}
					}
				}
			}
			//addBrokerView = true;
		}
	}
	if(!addBrokerView)
		isUserHaveDirector = false;
	String dashboardTitleString = "";
	if(dashboard_name != null && dashboard_name.length() > 0)
		dashboardTitleString = commonDashIni.getValue(dashboard_name,"Dashboard_Title");
	dashboardTitleString = (dashboardTitleString == null || dashboardTitleString.length() == 0)?"CITRIX":dashboardTitleString;
	if(filterFlag != null && filterFlag.equalsIgnoreCase("Service"))
		dashboardTitleString = "SERVICE DASHBOARD for "+dashboardTitleString;
	if(hasCitrix != null && hasCitrix.equalsIgnoreCase("false"))
		dashboardTitleString = "SERVICE DASHBOARD";
	dashboardTitleString = mappingInfo.getTextDescription("monitor.common."+dashboardTitleString);

	String serviceCombolbl = "Service";
	String viewsCombolbl = "Views";
	String backbtnlbl = "Back";
	serviceCombolbl = mappingInfo.getTextDescription("monitor.common."+serviceCombolbl);
	viewsCombolbl = mappingInfo.getTextDescription("monitor.common."+viewsCombolbl);
	backbtnlbl = mappingInfo.getTextDescription("monitor.common."+backbtnlbl);
	
	String noalertslbl = "No Alerts";
	String foundlbl = "Found";
	String nodatalbl = "No Data Found!";
	String secslbl = "Secs";
	String toposerlbl = "TOPOLOGY FOR Service : ";
	String topolbl = "TOPOLOGY";
	String segCombolbl = "Segments";
	String geoHeaderlbl = "Geo Map";
	String countrylbl = "Countries";
	String userxplbl = "USER EXPERIENCE";
	String userxpRUlbl = "USER EXPERIENCE - REAL USERS";
	String userxpFSSlbl = "USER EXPERIENCE - FULL SESSION SIMULATION";
	String userxpLSlbl = "USER EXPERIENCE - LOGON SIMULATIONS";
	String userxpWTlbl = "USER EXPERIENCE - WEB TRANSACTIONS";
	String manDashlbl = "Manage Dashboard Views";
	noalertslbl = mappingInfo.getTextDescription("monitor.common."+noalertslbl);
	foundlbl = mappingInfo.getTextDescription("monitor.common."+foundlbl);
	nodatalbl = mappingInfo.getTextDescription("monitor.common."+nodatalbl);
	secslbl = mappingInfo.getTextDescription("monitor.common."+secslbl);
	toposerlbl = mappingInfo.getTextDescription("monitor.common."+toposerlbl);
	topolbl = mappingInfo.getTextDescription("monitor.common."+topolbl);
	segCombolbl = mappingInfo.getTextDescription("monitor.common."+segCombolbl);
	geoHeaderlbl = mappingInfo.getTextDescription("monitor.common."+geoHeaderlbl);
	countrylbl = mappingInfo.getTextDescription("monitor.common."+countrylbl);
	userxplbl = mappingInfo.getTextDescription("monitor.common."+userxplbl);
	userxpRUlbl = mappingInfo.getTextDescription("monitor.common."+userxpRUlbl);
	userxpFSSlbl = mappingInfo.getTextDescription("monitor.common."+userxpFSSlbl);
	userxpLSlbl = mappingInfo.getTextDescription("monitor.common."+userxpLSlbl);
	userxpWTlbl = mappingInfo.getTextDescription("monitor.common."+userxpWTlbl);
	manDashlbl = mappingInfo.getTextDescription("monitor.common."+manDashlbl);
	//noalertslbl <br> <div style="padding-top: 5px;">Found</div>

	String topologyExistViews = "";
	if(userMappingApplisTo != null && userMappingApplisTo.trim().length() > 0)
	{
		if(userMappingApplisTo.indexOf(":") > -1){
			ifSerrSegrZone = userMappingApplisTo.substring(0,userMappingApplisTo.indexOf(":"));
			ifSerrSegrZoneName = userMappingApplisTo.substring(userMappingApplisTo.indexOf(":")+1);
		}
		if(ifSerrSegrZone != null)
		{
			//EgTopoInfo topoInfo = new EgTopoInfo("manager");
			if(ifSerrSegrZone.equalsIgnoreCase("Service"))
			{
				ifAssSeg=(String)topoInfo.getSegmentsForSite(ifSerrSegrZoneName);
				String segName = "";
				/*if(ifAssSeg.indexOf(",") > -1)
					segName = ifAssSeg.substring(0,ifAssSeg.indexOf(","));
				else
					segName = ifAssSeg;
				ifAssSegState=getStateForSegment(ifSerrSegrZoneName,segName);*/


				ArrayList ifAssSegList =  com.egurkha.util.StringUtils.egTokenizer(ifAssSeg.trim(), ",",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				int segSize = ifAssSegList.size();
				if(ifAssSegList!=null && segSize>0)
				{
					ArrayList statelist=new ArrayList();

					for(int dd=0;dd<segSize;dd++)
					{
						String newSegName=(String)ifAssSegList.get(dd);
						String state_name=(String)getStateForSegment(ifSerrSegrZoneName,newSegName);
						statelist.add(state_name);
						segWithState.add(newSegName);
						segWithState.add(state_name);
					}
					if(statelist!=null && statelist.size()>0)
					{
						Object[] arrayState=statelist.toArray();
						if(arrayState!=null && arrayState.length >=1)
							ifAssSegState=EgAlarmTable.getHighestPriority(arrayState);
					}
				}

				if(!ctxDashboardView)
				{
					if(topologyExistViews != null && topologyExistViews.trim().length()!=0)
						topologyExistViews+=",Services_Topology_View:Topology:sidebarmenuItems_topology";
					else
						topologyExistViews+="Services_Topology_View:Topology:sidebarmenuItems_topology";
				}
				Vector compVec = topoInfo.getAssociatesForSite(ifSerrSegrZoneName);
				if(compVec != null && compVec.size() > 0){
					ArrayList typeList = new ArrayList();
					for(int l=0;l<compVec.size();l++){
						String type = (String)compVec.get(l);
						type = type.substring(0,type.indexOf(":"));
						if(!typeList.contains(type))
							typeList.add(type);
					}

					if(typeList != null && typeList.size() == 1 && ((String)typeList.get(0)).startsWith("Agg_"))
						hideMetricsView = true;
				}
			}
			else if(ifSerrSegrZone.equalsIgnoreCase("Segment"))
			{
				ifAssSegState=(String)EgStateZone.getState("Segment:"+ifSerrSegrZoneName+":NULL");
				if(!ctxDashboardView)
				{
					if(topologyExistViews != null && topologyExistViews.trim().length()!=0)
						topologyExistViews+=",Segments_Topology_View:Topology:sidebarmenuItems_topology";
					else
						topologyExistViews+="Segments_Topology_View:Topology:sidebarmenuItems_topology";
				}
				Vector compVec = topoInfo.getAssociatesForSegment(ifSerrSegrZoneName,2);
				if(compVec != null && compVec.size() > 0){
					ArrayList typeList = new ArrayList();
					for(int l=0;l<compVec.size();l++){
						String type = (String)compVec.get(l);
						type = type.substring(0,type.indexOf(":"));
						if(!typeList.contains(type))
							typeList.add(type);
					}

					if(typeList != null && typeList.size() == 1 && ((String)typeList.get(0)).startsWith("Agg_"))
						hideMetricsView = true;
				}
			}
			else if(ifSerrSegrZone.equalsIgnoreCase("Zones"))
			{
				//dashboardViews+=",Zone_Topology_View:Topology:sidebarmenuItems_resources";
				//isZoneViewNeeded = true;
				EgGroupInfo groupinfo=new EgGroupInfo();
				ArrayList compVec = groupinfo.getAllComponentsUnderZone(ifSerrSegrZoneName);
				if(compVec != null && compVec.size() > 0){
					ArrayList typeList = new ArrayList();
					for(int l=0;l<compVec.size();l++){
						String type = (String)compVec.get(l);
						type = type.substring(0,type.indexOf(":"));
						if(!typeList.contains(type))
							typeList.add(type);
					}

					if(typeList != null && typeList.size() == 1 && ((String)typeList.get(0)).startsWith("Agg_"))
						hideMetricsView = true;
				}
			}
		}
	}

	ArrayList topologyViews = new ArrayList();	
	topologyViews.add(topologyExistViews);
	topologyViews.add(new Boolean(hideMetricsView));
%>
<html id="citrixdashboard">
<head>
<script  async defer  id="mapscript"></script>

<meta charset="UTF-8">
<title>eG Manager- CITRIX DASHBOARD</title>
<script src="/final/scripts/eg_DateUtil.js" type='text/javascript'></script>	
<egui:skin ui="monitor"/>
<link rel="stylesheet" href="/final/monitor/eg_scripts/citrixDashboard/css/citrixdashboard<%=monitor_Skin%>.css" />
<script src="/final/jquery/jquery.js"></script>
<script src="/final/scripts/d3.min.js" charset="utf-8"></script>
<script src="/final/scripts/lodash.core.min.js"></script>
<script src="/final/monitor/eg_scripts/eg_date.js"></script>
<script src="/final/Highcharts/js/highstock.js"></script>
<!-- <script src="/final/Highcharts/js/highcharts.js"></script> -->
<script  async defer  id="mapscript"></script>
<script>

	var strRumSkin='<%=monitor_Skin%>';
	var sesCombo='<%=sesCombo%>';
	var selectedScript='<%=selectedScript%>';
	var selAgent='<%=msmt_host%>';
	
	var panelOrder=new Array();
	var defaultView="<%=defaultView%>";
	var iniName="<%=iniName%>";
	var user_name="<%=userName%>";
	var subject="<%=subject%>";
	var dashboard="<%=dashboard_name%>";
	var dashboard_mapping="<%=dashboard_mapping%>";
	var fromSerComboChange="<%=fromSerComboChange%>";
	var defaultAppliesTo="<%=appliesTo%>";
	var isFromZone="<%=isFromZone%>";
	var iszoneName="<%=iszoneName%>";
	var parentZone="<%=parentZone%>";
	var ifAssSeg="<%=ifAssSeg%>";
	var ifAssSegState="<%=ifAssSegState%>";
	var selectedSegmentName='<%=selectedSegmentName%>';
	var componentNameSearch='<%=componentNameSearch%>';
	var simulationName='<%=simulationName%>';
	var Dashboard_ComponentType="<%=Dashboard_ComponentType%>";
	var dispDashboard_ComponentType="<%=dispDashboard_ComponentType%>";
	var selected_CompType_st="<%=selected_CompType_st%>";
	var defaultAnalysisBy="<%=analysisBy%>";
	var defaultAnalysis="<%=analysis%>";
	//var mgrDateFormat_1 = '<%=currentDateFormatForJS%>';
	//var mgrDateFormat = '<%=mgrDateFormat%>';
	var mgrDateFormat = getExtjsDateFormat('<%=dateFormatForDatePicker%>');
	var timeZoneOffsetVal='<%=timezoneOffsetValue%>';
	var timezoneOffsetValue='<%=timezoneOffsetValue%>';
	var userMappingApplisTo='<%=userMappingApplisTo%>';
	var isAreaChart= '<%=isArea%>';
	var isFromHomePage=<%=isFromHomePage%>;
	var isFromServiceMenu=<%=isFromServiceMenu%>;
	var isFromZoneMain=<%=isFromZoneMain%>;
	var isFromZoneMenu=<%=isFromZoneMenu%>;
	var fromMenu='<%=fromMenu%>';
	var tempFromHomepage='<%=tempFromHomepage%>';
	var monitorsBy='<%=monitorsBy%>';
	var ltest='<%=ltest%>';
	var treeTitle='<%=treeTitle%>';
	var tempLogonType='<%=tempLogonType%>';
	var isFromLayerModel='<%=isFromLayerModel%>';
	var isFromServiceGroup=<%=isFromServiceGroup%>;
	var serviceGroup='';
	var isFromZonePage=<%=isFromZonePage%>;
	var isZoneFromHomepage=<%=isZoneFromHomepage%>;
	var isFromOtherPage=<%=(isFromHomePage || isFromServiceMenu || isFromZonePage)%>;
	var filterFlag = '<%=filterFlag%>';
	var filterByParamFlag = '<%=filterByParamFlag%>';
	var strSkin='<%=monitor_Skin%>';
	//var strSkin='Dark';
	var noMeasure='<egui:intnl text="monitor.common.No Measures Available" />';
	var noDetails='<egui:intnl text="monitor.common.No details found" />';
	var noWidgetsFound='<egui:intnl text="monitor.common.Widgets not found" />';
	var requestParams=new Object();
	
	var refFreq = '<%=sessionRefreshFrequency%>';
	var panelRefFreq = '<%=refFrequency%>';
	var defaultUrl='<%=defaultUrl%>';

	var isTabView = <%=isTabView%>;
	var isModifyEnable = <%=isModifyPanels%>;
	var showBackButon=false;
	var showScheduleButon=false;
	var isUserBased=<%=isUserBased%>;
	var isShowConfig=<%=isShowConfig%>;
	var showDashboard=<%=isShowDashboardCombo%>;
	var showAnalysisBy=<%=isShowAnalysisByCombo%>;
	var showAnalysis=<%=isShowAnalysisCombo%>;
	var showTimeline=<%=isShowTimelineCombo%>;
	var dashboardTitle="<%=dashboard_title%>";
	var isExpendAllBlocks=<%=isExpendAllBlocks%>;
	var isUserHaveDirector=<%=isUserHaveDirector%>;
	var directorTypes="<%=directorTypes%>";
	var userTypeUED="<%=userTypeAppUED%>";
	var userType="<%=userType%>";

	var isFromUED = <%=isFromUED%>;
	var filterName = "<%=filterName%>";
	var filterViewName = "<%=filterViewName%>";
	var countryCode = "<%=countryCode%>";
	var regionName = "<%=regionName%>";
	var logon_treeTitle = "<%=logon_treeTitle%>";
	var logonParam = "<%=logonParam%>";
	var logonTitle = "<%=logonTitle%>";
	var isLogonType = "<%=isLogonType%>";
	
	var hasCitrix = "<%=hasCitrix%>";
	var dashboardTitle = "<%=dashboardTitleString%>";
	var serviceCombolbl = "<%=serviceCombolbl%>";
	var viewsCombolbl = "<%=viewsCombolbl%>";
	var backbtnlbl = "<%=backbtnlbl%>";
	var noalertslbl = "<%=noalertslbl%>";
	var foundlbl = "<%=foundlbl%>";
	var nodatalbl = "<%=nodatalbl%>";
	var secslbl = "<%=secslbl%>";
	var toposerlbl = "<%=toposerlbl%>";
	var topolbl = "<%=topolbl%>";
	var segCombolbl = "<%=segCombolbl%>";
	var geoHeaderlbl = "<%=geoHeaderlbl%>";
	var countrylbl = "<%=countrylbl%>";
	var userxplbl = "<%=userxplbl%>";
	var userxpRUlbl = "<%=userxpRUlbl%>";
	var userxpFSSlbl = "<%=userxpFSSlbl%>";
	var userxpLSlbl = "<%=userxpLSlbl%>";
	var userxpWTlbl = "<%=userxpWTlbl%>";
	var manDashlbl = "<%=manDashlbl%>";
	var selectedSystemCompType = "<%=selectedSystemCompType%>";
	var dashboardArray = new Array();
	var dashboardCombo=new Array();

	var analysisByArray = new Array();
	var analysisByCombo=new Array();
	
	var userAnalysisArray = new Array();
	var serviceComboArray = new Array();
	var analysisCombo=new Array();
	var serviceCombo=new Array();
	
	var timeLineArray = new Array();
	var timeLineCombo=new Array();
	var dashboardListCombo = new Array();
	var dashboardListArray = new Array();

	var dashboardTypeListCombo = new Array();
	var dashboardTypeListArray = new Array();

	var tabsArray = new Array();
	var dashViewArray = new Array();

	var gMapUrl="";
	function onLine() {
	//document.getElementById('mapscript').src = "https://maps.googleapis.com/maps/api/js?key=AIzaSyCyxV_cYiNyeaTLvKhDFPxN3YCYvl5ucsw&callback=initMap";
	//window.initMap = function(){};
	//gMapUrl="https://maps.googleapis.com/maps/api/js?key=AIzaSyCyxV_cYiNyeaTLvKhDFPxN3YCYvl5ucsw&callback=initMap";
	}
	function offLine() {
	// Grab the LOCAL JQ
	}
	var helpwin=null;
	function HelpWin()
	{
		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-240;
		var top = (Ext.getBody().getViewSize().height/2)-(cheight/2);
		HelpWinOth("/final/eghelp/EgHelpApp.jsp?forwardPage=EgMHelp.jsp", cwidth1, cheight, left, top, left, top);
	}

	var eGLogoImage = new Image();
	//eGLogoImage.onload = onLine;
	eGLogoImage.onerror = offLine;
	//eGLogoImage.src = 'https://maps.gstatic.com/mapfiles/api-3/images/google_white5.png?d=' + escape(Date());

	var curMonthStr = '<%=(cal.get(cal.MONTH)+1)%>';
	var curMnthInt = parseInt( curMonthStr );
	curMonthStr = ( curMnthInt <= 9 )?0+curMonthStr:curMonthStr;
	var curr_date_value=curMonthStr+"/"+'<%=cal.get(cal.DAY_OF_MONTH)+"/"+cal.get(cal.YEAR)%>';
	var cur_mgr_hour_str = '<%=cal.get(cal.HOUR_OF_DAY)%>';
	var cur_mgr_hour = parseInt(cur_mgr_hour_str);
	cur_mgr_hour_str = ( cur_mgr_hour <= 9 )?0+cur_mgr_hour_str:cur_mgr_hour_str;
	var curr_min_str  ='<%=cal.get(cal.MINUTE)%>';
	var cur_mgr_min = parseInt(curr_min_str);
	curr_min_str = ( cur_mgr_min <= 9 )?0+curr_min_str:curr_min_str;
	var curDateTime = curr_date_value+" "+cur_mgr_hour_str+":"+curr_min_str+":00";
	
	var publicJson;
	var searchDashLbl = '<egui:intnl text="monitor.common.Search Dashboard" />';
	var dataViewNoDashboardExistMsg = '<egui:intnl text="monitor.dashboard.No dashboards found for" />';
	var toolDelete = '<egui:intnl text="monitor.common.Delete"/>';
	var toolDeleteAll = '<egui:intnl text="monitor.common.Delete All"/>';
	var addDashLbl = '<egui:intnl text="monitor.common.Add Dashboard"/>';
	var searchDashLbl = '<egui:intnl text="monitor.common.Search Dashboard" />';
	var choosedashboardtypeLbl = '<egui:intnl text="monitor.common.CHOOSE DASHBOARD TYPE" />';
	var customTemplateLb = '<egui:intnl text="monitor.common.Here you can create your dashboards using Graphical library and Widget library" />';
	var oneClickLb = '<egui:intnl text="monitor.common.Here you can create your dashboards using templates with One Click" />';
	var ctxDashboardAlertLbl = '<egui:intnl text="monitor.common.Citrix Dashboard" />';
	var noZoneSelectedAlertMsg = '<egui:intnl text="monitor.common.Please choose a zone" />';
	var noSegmentSelectedAlertMsg = '<egui:intnl text="monitor.common.Please choose a segment" />';
	var noServiceSelectedAlertMsg = '<egui:intnl text="monitor.common.Please choose a service" />';
	var noCompTypeSelectedAlertMsg = '<egui:intnl text="monitor.common.Please choose a component type" />';
	var noTypeSelectedAlertMsg = '<egui:intnl text="monitor.common.Please choose atleast one type" />';
	var noFilterTypeSelectedAlertMsg = '<egui:intnl text="monitor.common.Please choose " />';
	var deleteDashboardsMsg = '<egui:intnl text="monitor.common.Are you sure you want to delete the selected dashboards"/>';
	var deleteDashboardMsg = '<egui:intnl text="monitor.common.Are you sure"/>';
	var singleDashboardDeleteMsg = '<egui:intnl text="monitor.dashboard.Selected dashboard has been deleted" />';
	var deleteAlertMsg = '<egui:intnl text="monitor.dashboard.Please select a dashboard to delete" />';
	var setasHome = '<egui:intnl text="monitor.common.Do you want to set this dashboard as home" />';
	var dashboardExistAlertMsg = '<egui:intnl text="monitor.dashboard.Dashboard name already exists"/>';
	var defaultDashboardAlertMsg = '<egui:intnl text="monitor.dashboard.There is no default view Please choose default view"/>';
	var dashboardBlankNameAlertMsg = '<egui:intnl text="monitor.dashboard.Please enter the dashboard name"/>';
	var dashboardChkSpaceAlertMsg = '<egui:intnl text="monitor.dashboard.Please give dashboard name without space"/>';
	var maxDashbrdLengthAlert= '<egui:intnl text="monitor.dashboard.Maximum allowed length for a dashboard name is 32 characters"/> ';
	var dashboardSplCharacterAlertMsg = '<egui:intnl text="monitor.dashboard.Please give dashboard name without special characters"/>';
	var homeTooltipLbl =  '<egui:intnl text="monitor.common.Home"/>';
	var editSettingsLbl = '<egui:intnl text="monitor.common.Edit dashboard" />';
	var setAsHomeLbl = '<egui:intnl text="monitor.common.Set As Home" />';
	var toolDelete= '<egui:intnl text="monitor.common.Delete"/>';
	var disptxt = '<egui:intnl text="monitor.common.Displaying"/>';
	var oftxt = '<egui:intnl text="monitor.common.of"/>';
	var defDashtxt = '<egui:intnl text="monitor.common.DefaultDashboard"/>';
	var webAppSimulation = '<egui:intnl text="monitor.common.WEB APP SIMULATION - TRANSACTION FLOW"/>';
	var fullSessionSimulation = '<egui:intnl text="monitor.common.FULL SESSION SIMULATION - TRANSACTION FLOW"/>';
	
	var selectedCompTypeValue = '';

	var loginUser = "<%=userName%>";
	var simulationSupportListHere=[];
<%
	if(simulationSupportList != null ){
		for(int c=0;c<simulationSupportList.size();c++){
			String supportName = (String) simulationSupportList.get(c);
			%>
				simulationSupportListHere.push('<%=supportName%>');
			<%
		}
	}
%>
	var segsWithState=new Array();
<%
	if(segWithState != null ){
		for(int c=0;c<segWithState.size();c=c+2){
			String seg = (String) segWithState.get(c);
			String segState = (String) segWithState.get(c+1);
			%>
				segsWithState.push({
					name: "<%=seg%>" ,
					state: '<%=segState%>',
				});
			<%
		}
	}
%>

</script>

<%
	if(tabsList!=null && tabsList.size()>0)
	{
		for(int z=0;z<tabsList.size();z++)
		{
			String tabName = (String)tabsList.get(z);

			String tab_id=tabName;
			String tab_index=String.valueOf(z);
			String tab_name=mappingInfo.getTextDescription("monitor.common."+tabName);

			if(activeTab==null || activeTab.trim().length()==0)
			{
				activeTab = tabName;
			}
%>
				<script>
					var temp=new Object();
					temp.id='<%=tab_id%>';
					temp.index='<%=tab_index%>';
					temp.name='<%=tab_name%>';
					temp.tabName='<%=tabName%>';
					tabsArray.push(temp);
				</script>
<%
		}
	}
%>
	<script>
		requestParams.tabs=tabsArray;
		requestParams.activeTab="<%=activeTab%>";
	</script>

<%
	if(dashboardList!=null && dashboardList.size()>0)
	{
		for(int z=0;z<dashboardList.size();z++)
		{
			String dashName = (String)dashboardList.get(z);
			String dashboardTitle= "";
			String Dashboard_Original_ComponentType="";
			if(isUserBased)
			{
				dashboardTitle=commonDashIni.getValue(userName+":"+dashName,"Dashboard_Title");
				Dashboard_Original_ComponentType=commonDashIni.getValue(userName+":"+dashName,"Dashboard_Original_ComponentType");
			}
			
			if(dashboardTitle==null || dashboardTitle.trim().length()==0)
			{
				dashboardTitle=commonDashIni.getValue(dashName,"Dashboard_Title");
				Dashboard_Original_ComponentType=commonDashIni.getValue(dashName,"Dashboard_Original_ComponentType");
			}

			dashboardTitle=(dashboardTitle==null || dashboardTitle.trim().length()==0)?dashName:dashboardTitle;
%>
				<script>
					var temp=new Object();
					temp.name='<%=dashboardTitle%>';
					temp.value='<%=dashName%>';
					temp.ctype='<%=Dashboard_Original_ComponentType%>';
					dashboardArray.push(temp);
				</script>
<%
		}
	}
%>
	<script>
		dashboardCombo.push({
			name: "dashboard" ,
			value: dashboardArray,
			selected:'<%=dashboard_name%>'
		});
		requestParams.dashboardCombo=dashboardCombo;
		requestParams.dashboardArray=dashboardArray;
	</script>

<%
	if(timeLineOptionsList!=null && timeLineOptionsList.size()>0)
	{
		for(int z=0;z<timeLineOptionsList.size();z++)
		{
			String tOption = (String)timeLineOptionsList.get(z);
			String tOptionName=tOption;
			if(tOption!=null && (tOption.equalsIgnoreCase("Current") || tOption.equalsIgnoreCase("Recent") || tOption.equalsIgnoreCase("Latest")))
			{
				tOptionName="10 mins";
			}
%>
			<script>
				var temp=new Object();
				temp.name='<%=tOptionName%>';
				temp.value='<%=tOption%>';
				timeLineArray.push(temp);
			</script>
<%
		}
	}

	if(dashboardsList!=null && dashboardsList.size()>0)
	{
		for(int a = 0; a < dashboardsList.size(); a++)
		{
			String dash_name = (String)dashboardsList.get(a); 
			String dash_name_enc = (String)dashboardsList.get(a);
			if(dash_name!=null && dash_name.trim().length()>0 && dash_name.equalsIgnoreCase("DefaultView"))
			{
				if(dashboardsList.contains("DefaultDashboard"))
				{
					continue;
				}
				else
				{
					dash_name="DefaultDashboard";
				}
			}
			if(dash_name_enc != null && dash_name_enc.trim().length()>0 && dash_name_enc.equalsIgnoreCase("DefaultDashboard"))
				dash_name_enc = mappingInfo.getTextDescription("monitor.common."+dash_name_enc);

			if(dashboard_name!=null && dashboard_name.trim().length()>0 && dash_name!=null && dash_name.trim().equalsIgnoreCase(dashboard_name))
			{
				defaultView = dashboard_name;
			}
			else if(filterByParam!=null && filterByParam.trim().length()>0 && dash_name!=null && dash_name.equalsIgnoreCase(filterByParam+"_Dash"))
			{
				defaultView = filterByParam + "_Dash";
			}
	%>
		<script>
			var temp=new Object();
			temp.name='<%=dash_name_enc%>';
			temp.value='<%=dash_name%>';
			dashboardListArray.push(temp);
		</script>
		
	<%
		}
		
		if(!dashboardsList.contains("DefaultView") && !dashboardsList.contains("DefaultDashboard"))
		{
%>
		<script>
			var temp=new Object();
			temp.name=defDashtxt;
			temp.value='DefaultDashboard';
			dashboardListArray.push(temp);
		</script>
		
	<%
		}
	}
	else
	{
%>
		<script>
			var temp=new Object();
			temp.name=defDashtxt;
			temp.value='DefaultDashboard';
			dashboardListArray.push(temp);
		</script>
		
<%
	}


	if(type_dash_list_main!=null && type_dash_list_main.size()>0)
	{
		for(int hh=0;hh<type_dash_list_main.size();hh++)
		{
			String type_dash_str_final=(String)type_dash_list_main.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);
				String d_agg_comp_type = "";
				if(d_comp_type != null && !d_comp_type.startsWith("Agg"))
					d_agg_comp_type = "Agg_"+d_comp_type;

				if(userServerTypes!=null && (userServerTypes.contains(d_comp_type) || userServerTypes.contains(d_agg_comp_type)))
				{
					String disp_comp_type=mappingInfo.getComponentTypeDescription(d_comp_type);
%>
		<script>
			var temp=new Object();
			temp.name='<%=disp_comp_type%>';
			temp.value='<%=dash_name%>';
			dashboardTypeListArray.push(temp);
		</script>
		
	<%
				}
			}
		}
	}
%>
	<script>
		timeLineCombo.push({
			name: "timeLine" ,
			value: timeLineArray,
			selected:'<%=req_timeline%>'
		});
		requestParams.timeLineCombo=timeLineCombo;
		
		dashboardListCombo.push({
			name: "dashboardslist" ,
			value: dashboardListArray,
			<%
				if(dashListCombo)
			{
			%>
				selected:dashboardListArray[0].name	
			<%
			}
			else
			{
			%>
				selected:'<%=defaultView%>'
			<%
			}
			%>
		});
		requestParams.dashboardListCombo=dashboardListCombo;

		dashboardTypeListCombo.push({
			name: "dashboardsTypelist" ,
			value: dashboardTypeListArray,
			selected:'<%=dashboard_name%>'
		});
		requestParams.dashboardTypeListCombo=dashboardTypeListCombo;
	</script>
<%
	if(analysisByList!=null && analysisByList.size()>0)
	{
		for(int z=0;z<analysisByList.size();z++)
		{
			String analysisby = (String)analysisByList.get(z);
			String analysisby_display_name="";
			String analysisby_name_value="";
			if(analysisby!=null && analysisby.indexOf(":")>-1)
			{
				analysisby_name_value=analysisby.substring(0,analysisby.indexOf(":"));
				analysisby_display_name=analysisby.substring(analysisby.indexOf(":")+1);
			}
			else
			{
				analysisby_name_value=analysisby;
				analysisby_display_name=analysisby;
			}

			boolean isValid=false;

			if(analysisby_name_value!=null && analysisby_name_value.equalsIgnoreCase("Zone") && userZones!=null && userZones.size()>0)
			{
				isValid= true;
			}
			else if(analysisby_name_value!=null && analysisby_name_value.equalsIgnoreCase("Service") && userServices!=null && userServices.size()>0)
			{
				isValid= true;
			}
			else if(analysisby_name_value!=null && analysisby_name_value.equalsIgnoreCase("Segment") && userSegments!=null && userSegments.size()>0)
			{
				isValid= true;
			}
			else if(analysisby_name_value!=null && analysisby_name_value.equalsIgnoreCase("ComponentType") && userServerTypes!=null && userServerTypes.size()>0)
			{
				isValid= true;
			}
			else if(analysisby_name_value!=null && (analysisby_name_value.equalsIgnoreCase("Component") || analysisby_name_value.equalsIgnoreCase("Components")) && userServers!=null && userServers.size()>0)
			{
				isValid= true;
			}

			if(isValid)
			{
%>
				<script>
					var temp=new Object();
					temp.name='<%=analysisby_display_name%>';
					temp.value='<%=analysisby_name_value%>';
					analysisByArray.push(temp);
				</script>
<%
			}
		}
	}
%>
	<script>

		if(analysisByArray!=null && analysisByArray.length==0)
		{
			var temp=new Object();
			temp.name='<egui:intnl text="monitor.common.Not Applicable"/>';
			temp.value='-1';
			analysisByArray.push(temp);
		}

		analysisByCombo.push({
			name: "analysisBy" ,
			value: analysisByArray,
			selected:'<%=analysisBy%>'
		});
		requestParams.analysisByCombo=analysisByCombo;
	</script>
	
<%
	String firstVal="";
	String serState="";
	String dispAnalysis ="";
	String hasRUMComp ="";
	String comp_type_rum ="";
	boolean isAddAll=true;
	if(userAnalysisList!=null && userAnalysisList.size()>0)
	{
		Set hs = new HashSet();
		hs.addAll(userAnalysisList);
		userAnalysisList.clear();
		userAnalysisList.addAll(hs);

		if(analysisBy!=null && (analysisBy.equalsIgnoreCase("Services") || analysisBy.equalsIgnoreCase("Service")))
			userAnalysisList = getSortedServiceList(userAnalysisList);
		for(int z=0;z<userAnalysisList.size();z++)
		{
			String userAnalysis = (String)userAnalysisList.get(z);

			if(analysisBy!=null && analysisBy.equalsIgnoreCase("ComponentType") && userAnalysis!=null && userAnalysis.equals("Host_system"))
				continue;

			String dispUserAnalysis=userAnalysis;
			if(analysisBy!=null && analysisBy.equalsIgnoreCase("ComponentType"))
			{
				dispUserAnalysis=mappingInfo.getComponentTypeDescription(userAnalysis);
			}
			else if(analysisBy!=null && (analysisBy.equalsIgnoreCase("Component") || analysisBy.equalsIgnoreCase("Components")))
			{
				String compType = dispUserAnalysis.substring(0,dispUserAnalysis.indexOf(":"));
				String compName = dispUserAnalysis.substring(dispUserAnalysis.indexOf(":")+1);

				if(compName!=null && compName.endsWith(":NULL"))
					compName=compName.substring(0,compName.indexOf(":"));

				dispUserAnalysis=mappingInfo.getComponentTypeDescription(compType)+":"+compName;				
			}
			else if(analysisBy!=null && (analysisBy.equalsIgnoreCase("Service") || analysisBy.equalsIgnoreCase("Service")))
			{
				if(dispUserAnalysis!=null && dispUserAnalysis.endsWith(":NULL"))
					dispUserAnalysis=dispUserAnalysis.substring(0,dispUserAnalysis.indexOf(":"));
				serState = EgStateZone.getState("Service:"+dispUserAnalysis+":NULL");
				HashMap paramsNeeded = getServiceBasedFilter("Service:"+dispUserAnalysis);	
				if(paramsNeeded != null){
					hasRUMComp = (String)paramsNeeded.get("hasRUM");					
					comp_type_rum = (String)paramsNeeded.get("comp_type_rum");					
				}
			}

				if(firstVal!=null && firstVal.trim().length()==0)
					firstVal=userAnalysis;					

			if(isAddAll)
			{
				isAddAll=false;
%>
			<script>
				var temp=new Object();
				temp.name='<%=mappingInfo.getTextDescription("monitor.common.All")%>';
				temp.value='All';
				userAnalysisArray.push(temp);
			</script>
<%
			}
%>
			<script>
				var temp=new Object();
				temp.name='<%=dispUserAnalysis%>';
				temp.value='<%=userAnalysis%>';
				temp.state='<%=serState%>';
				temp.hasRUMComp='<%=hasRUMComp%>';
				temp.comp_type_rum='<%=comp_type_rum%>';
				userAnalysisArray.push(temp);
				serviceComboArray.push(temp);
			</script>
<%
		}
	}

	if(analysis!=null && analysis.trim().length() == 0)
	{
		analysis = firstVal;
		//dispAnalysis = mappingInfo.getComponentTypeDescription(analysis);
		dispAnalysis = analysis;
		if(dispAnalysis!=null && dispAnalysis.endsWith(":NULL"))
			dispAnalysis=dispAnalysis.substring(0,dispAnalysis.indexOf(":"));
		serState = EgStateZone.getState("Service:"+dispAnalysis+":NULL");
	}
	else if(analysis!=null && analysis.trim().length() != 0)
	{
		//dispAnalysis = mappingInfo.getComponentTypeDescription(analysis); - no need to get description for service name
		dispAnalysis = analysis;
		if(dispAnalysis!=null && dispAnalysis.endsWith(":NULL"))
			dispAnalysis=dispAnalysis.substring(0,dispAnalysis.indexOf(":"));
		serState = EgStateZone.getState("Service:"+dispAnalysis+":NULL");
	}
%>
	<script>
		var selectedAna="<%=analysis%>";
		var selectedState="<%=serState%>";
		if(userAnalysisArray!=null && userAnalysisArray.length==0)
		{
			var temp=new Object();
			temp.name='<egui:intnl text="monitor.common.Not Applicable"/>';
			temp.value='-1';
			userAnalysisArray.push(temp);
		}

		analysisCombo.push({
			name: "analysisBy" ,
			value: userAnalysisArray,
			selected:selectedAna
		});
		
		if(serviceComboArray!=null && serviceComboArray.length==0)
		{
			var temp=new Object();
			temp.name='<egui:intnl text="monitor.common.Not Applicable"/>';
			temp.value='-1';
			serviceComboArray.push(temp);
		}

		serviceCombo.push({
			name: "analysisBy" ,
			value: serviceComboArray,
			selected:selectedAna,
			selectedState:selectedState
		});
		requestParams.serviceCombo=serviceCombo;
	</script>
<%
	int selectedViewIndex=0;	
	ArrayList dashboardViewsList = getDashboardList(dashboardViews,hasCitrix,fromSerComboChange,hasTransactions,hasEmulatedTransactions,hasLogonSimulations,activeView,hideMetricsView,aggregateTab,filterFlag,filterByParamFlag,activeViewreq,topologyViews, ctxDashboardView);
	String getActiveView = (String)dashboardViewsList.get(dashboardViewsList.size() - 1);
	activeView = getActiveView.substring(getActiveView.indexOf("~")+1);
	String activeRealView = activeView;
	if(dashboardViewsList!=null && dashboardViewsList.size()>0)
	{
		for(int z=0;z<dashboardViewsList.size();z++)
		{
			String dashItemStr = (String)dashboardViewsList.get(z);
			boolean isSubView=false;
			if(dashItemStr!=null && dashItemStr.trim().length()>0 && dashItemStr.indexOf(":") > -1)
			{
				String childItemStr = "";
				if(dashItemStr.indexOf("~$~")>-1)
				{
					childItemStr = dashItemStr.substring(dashItemStr.indexOf("~$~")+3);
					dashItemStr = dashItemStr.substring(0,dashItemStr.indexOf("~$~"));					
				}
				ArrayList childItemArrayList = new ArrayList();
				if(childItemStr.length() > 0)
				{
					ArrayList childItemList =  com.egurkha.util.StringUtils.egTokenizer(childItemStr.trim(),"~|~",false,true,true);
					for(int cz=0;cz<childItemList.size();cz++)
					{
						String childItemString = (String)childItemList.get(cz);

						//Removing Broker_View
						if(!addBrokerView && childItemString != null && childItemString.equalsIgnoreCase("Broker_View:Delivery Groups:sidebarmenuItems_delivery_groups"))
							continue;

						ArrayList childItemStringList =  com.egurkha.util.StringUtils.egTokenizer(childItemString.trim(),":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
						if(childItemStringList!=null && childItemStringList.size()>0)
						{
							String cdash_view=(String)childItemStringList.get(0);
							String cdash_display_name=mappingInfo.getTextDescription("monitor.common."+(String)childItemStringList.get(1));
							String cdash_css=(String)childItemStringList.get(2);
							JSONObject childParams = new JSONObject();
							childParams.put("id",cdash_view);	
							childParams.put("name",cdash_view);	
							childParams.put("caption",cdash_display_name);	
							String cdash_display_name_lang = mappingInfo.getTextDescription("monitor.common."+cdash_display_name);
							childParams.put("lcaption",cdash_display_name_lang);
							String cuserExpText = "User Experience";
							cuserExpText = mappingInfo.getTextDescription("monitor.common."+cuserExpText);
							childParams.put("iconCls",cdash_css);
							
							childItemArrayList.add(childParams);
							if(ctxDashboardView && dashItemStr != null && dashItemStr.length() == 0)
							{
								if(activeView!=null && (activeView.equalsIgnoreCase(cdash_display_name)))
									selectedViewIndex=z;
								else if(view_name!=null && (view_name.equalsIgnoreCase(cdash_view)))
									selectedViewIndex=z;
								else if(activeView != null && activeView.equalsIgnoreCase("geo") && cdash_display_name.equalsIgnoreCase("overview"))
									selectedViewIndex=z;
							
%>
								<script>
									var tempStore=new Object();
									tempStore.id='<%=cdash_view%>';
									tempStore.name='<%=cdash_view%>';
									tempStore.caption='<%=cdash_display_name%>';
									tempStore.lcaption='<%=cdash_display_name_lang%>';
									tempStore.iconCls='<%=cdash_css%>'
									dashViewArray.push(tempStore);									
								</script>
<%
							}
						}
					}					
				}

				boolean childrenFlag = true;
				if(childItemArrayList.size() == 0)
					childrenFlag = false;
				
				ArrayList dashItemList =  com.egurkha.util.StringUtils.egTokenizer(dashItemStr.trim(),":",false,true,true);//param 3-->includeEmpty,4-->unique,5-->trim
				if(dashItemList!=null && dashItemList.size()>0)
				{
					String dash_view=(String)dashItemList.get(0);
					String dash_display_name=mappingInfo.getTextDescription("monitor.common."+(String)dashItemList.get(1));
					String dash_css=(String)dashItemList.get(2);
					if(activeView!=null && (activeView.equalsIgnoreCase(dash_display_name)))
						selectedViewIndex=z;
					else if(view_name!=null && (view_name.equalsIgnoreCase(dash_view)))
						selectedViewIndex=z;
					else if(activeView != null && activeView.equalsIgnoreCase("geo") && dash_display_name.equalsIgnoreCase("overview"))
						selectedViewIndex=z;					
					
					if(brokerSupportedViewList!=null && dash_view!=null && brokerSupportedViewList.contains(dash_view))
					{
						//if(!isUserHaveDirector)
							//continue;
					}
					String dash_display_name_lang = mappingInfo.getTextDescription("monitor.common."+dash_display_name);
					String userExpText = "User Experience";
					userExpText = mappingInfo.getTextDescription("monitor.common."+userExpText);

%>
						<script>
							var temp=new Object();
							temp.id='<%=dash_view%>';
							temp.name='<%=dash_view%>';
							temp.caption='<%=dash_display_name%>';
							temp.lcaption='<%=dash_display_name_lang%>';
							temp.iconCls='<%=dash_css%>';

							if(<%=childrenFlag%>)
								temp.children=<%=childItemArrayList%>;

							dashViewArray.push(temp);
						</script>
<%
				}
			}
		}
	}
%>
	<script>
		requestParams.views=dashViewArray;
		requestParams.activeView="<%=activeRealView%>";
		requestParams.activeViewIndex=<%=selectedViewIndex%>;
		requestParams.aggError = '<%=mappingInfo.getTextDescription("monitor.common.No metrics running")%>';
		var image = 'image.jpeg';
		var labelColor="";
		var bodyColor="";
		if(strSkin=="Dark"){
			labelColor="#e2e2e2";
			bodyColor="#252525";
		}else{
			labelColor="#000";
			bodyColor="#fff";
		}

		var lightStyle =[
		  {
			"elementType": "geometry.fill",
			"stylers": [
			  {
				"color": "#ff0000"
			  },
			  {
				"weight": 8
			  }
			]
		  },
		  {
			"elementType": "labels",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "administrative",
			"stylers": [
			  {
				"color": "#edebee"
			  }
			]
		  },
		  {
			"featureType": "administrative",
			"elementType": "geometry.fill",
			"stylers": [
			  {
				"color": "#dadada"
			  },
			  {
				"weight": 1.5
			  }
			]
		  },
		  {
			"featureType": "administrative.country",
			"elementType": "geometry.stroke",
			"stylers": [
			  {
				"color": "#edebee"
			  }
			]
		  },
		  {
			"featureType": "administrative.land_parcel",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "administrative.neighborhood",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "landscape",
			"elementType": "geometry.fill",
			"stylers": [
			  {
				"color": "#e3ebee"
			  }
			]
		  },
		  {
			"featureType": "poi",
			"stylers": [
			  {
				"color": "#e3ebee"
			  }
			]
		  },
		  {
			"featureType": "road",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "transit",
			"stylers": [
			  {
				"color": "#e3ebee"
			  }
			]
		  },
		  {
			"featureType": "water",
			"elementType": "geometry.fill",
			"stylers": [
			  {
				"color": "#ffffff"
			  }
			]
		  }
		];
		
		var darkStyle = [
		  {
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#717171"
			  }
			]
		  },
		  {
			"elementType": "labels",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"elementType": "labels.icon",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#757575"
			  }
			]
		  },
		  {
			"elementType": "labels.text.stroke",
			"stylers": [
			  {
				"color": "#212121"
			  }
			]
		  },
		  {
			"featureType": "administrative",
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#757575"
			  },
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "administrative.country",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#9e9e9e"
			  }
			]
		  },
		  {
			"featureType": "administrative.land_parcel",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "administrative.locality",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#bdbdbd"
			  }
			]
		  },
		  {
			"featureType": "administrative.neighborhood",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "poi",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "poi",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#757575"
			  }
			]
		  },
		  {
			"featureType": "poi.park",
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#181818"
			  }
			]
		  },
		  {
			"featureType": "poi.park",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#616161"
			  }
			]
		  },
		  {
			"featureType": "poi.park",
			"elementType": "labels.text.stroke",
			"stylers": [
			  {
				"color": "#1b1b1b"
			  }
			]
		  },
		  {
			"featureType": "road",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "road",
			"elementType": "geometry.fill",
			"stylers": [
			  {
				"color": "#2c2c2c"
			  }
			]
		  },
		  {
			"featureType": "road",
			"elementType": "labels.icon",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "road",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#8a8a8a"
			  }
			]
		  },
		  {
			"featureType": "road.arterial",
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#373737"
			  }
			]
		  },
		  {
			"featureType": "road.highway",
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#404040"
			  }
			]
		  },
		  {
			"featureType": "road.highway.controlled_access",
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#4e4e4e"
			  }
			]
		  },
		  {
			"featureType": "road.local",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#616161"
			  }
			]
		  },
		  {
			"featureType": "transit",
			"stylers": [
			  {
				"visibility": "off"
			  }
			]
		  },
		  {
			"featureType": "transit",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#757575"
			  }
			]
		  },
		  {
			"featureType": "water",
			"elementType": "geometry",
			"stylers": [
			  {
				"color": "#404040"
			  }
			]
		  },
		  {
			"featureType": "water",
			"elementType": "labels.text.fill",
			"stylers": [
			  {
				"color": "#3d3d3d"
			  }
			]
		  }
		];
		
		var GRAY = {
			strokeColor: "#959595",
			strokeOpacity: 1,
			strokeWeight: 1,
			fillColor: "#959595",
			fillOpacity: 1
		};

		var GOOD = {
			strokeColor: "#0c9a12",
			strokeOpacity: 1,
			strokeWeight: 1,
			fillColor: "#0c9a12",
			fillOpacity: 1
		};

		var  LOW = {
			strokeColor: "#ccc100",
			strokeOpacity: 1,
			strokeWeight: 1,
			fillColor: "#ccc100",
			fillOpacity: 1
		};

		var INTERMEDIATE = {
			strokeColor: "#fa9d1c",
			strokeOpacity: 1,
			strokeWeight: 1,
			fillColor: "#fa9d1c",
			fillOpacity: 1
		};

		var HIGH = {
			strokeColor: "#cd0f0f",
			strokeOpacity: 1,
			strokeWeight: 1,
			fillColor: "#cd0f0f",
			fillOpacity: 1
		};

		var UNKNOWN = {
			strokeColor: "#30a1d9",
			strokeOpacity: 1,
			strokeWeight: 1,
			fillColor: "#30a1d9",
			fillOpacity: 1
		};	
		var newPopup=null;
		function loadPopup(qUrl)
		{
			//var defaultWidth=1099;
			var defaultWidth;
			var defaultHeight;
			//var defaultHeight=655;

			// Internet Explorer 6-11
			var isIE = /*@cc_on!@*/false || !!document.documentMode;

			// Edge 20+
			var isEdge = !isIE && !!window.StyleMedia;

			// Chrome 1+
			var isChrome = !!window.chrome && !!window.chrome.webstore;

			var isFirefox = typeof InstallTrigger !== 'undefined';

			//alert(isIE);
			//alert(isChrome);

			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;

			if(newPopup==null)
			{
				//newPopup=parent.openWindow(qUrl+"&fromLogonSimualtion=true","Logon Simualtion","left=100,top=10,toolbar=no,menubar=no,location=no,status=no,width=1012, height=623,screenx=0,screeny=0,resizable=0,scrollbars=1,scrollbars=yes");

				//newPopup=parent.openWindow(qUrl+'&fromLogonSimualtion=true','Logon Simualtion','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, width='+defaultWidth+', height='+defaultHeight+', top='+top+', left='+left);
				try
				{
					newPopup=parent.openWindowSpecific(qUrl+'&fromLogonSimualtion=true','Logon Simualtion','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, fullscreen=no, dialog=0, width='+defaultWidth+', height='+defaultHeight+', innerWidth='+defaultWidth+', innerHeight='+defaultHeight+',top='+top+', left='+left);
				}
				catch (e)
				{
					newPopup=parent.parent.openWindowSpecific(qUrl+'&fromLogonSimualtion=true','Logon Simualtion','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, fullscreen=no, dialog=0, width='+defaultWidth+', height='+defaultHeight+', innerWidth='+defaultWidth+', innerHeight='+defaultHeight+',top='+top+', left='+left);
				}

				//return window.open(qUrl, "Logon Simualtion", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=1099, height=655, top='+top+', left='+left);
			}
			else
			{
				if(newPopup!=null)
				{
					newPopup.close();
					newPopup=null;
				}

				//newPopup=parent.openWindow(qUrl+'&fromLogonSimualtion=true','Logon Simualtion','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, width='+defaultWidth+', height='+defaultHeight+', top='+top+', left='+left);
				try
				{
					newPopup=parent.openWindowSpecific(qUrl+'&fromLogonSimualtion=true','Logon Simualtion','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, fullscreen=no, dialog=0, width='+defaultWidth+', height='+defaultHeight+', innerWidth='+defaultWidth+', innerHeight='+defaultHeight+', top='+top+', left='+left);
				}
				catch (ee)
				{
					newPopup=parent.parent.openWindowSpecific(qUrl+'&fromLogonSimualtion=true','Logon Simualtion','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, copyhistory=no, resizable=yes, fullscreen=no, dialog=0, width='+defaultWidth+', height='+defaultHeight+', innerWidth='+defaultWidth+', innerHeight='+defaultHeight+', top='+top+', left='+left);
				}

				//return window.open(qUrl, "Logon Simualtion", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=1099, height=655, top='+top+', left='+left);
			}
			newPopup.focus();
		}
		function OpenLayerModel(url,flag){
			if(!Ext.isEmpty(url))
			{
				window.location.href=url;
			}
		}
		function setSession(view_name)
		{
			Ext.Ajax.request({
				url :'/final/monitor/citrixDashboard.jsp?setSession=true&view_name='+view_name,
				scope:this,
				async:true,
				success: function(response){
				}
			});
		}
		var isSite="<%=isSite%>";
		var hasTransactions="<%=hasTransactions%>";
		var selectedParam="<%=selectedParam%>";
		function loadTransConfigOnTopo(site)
		{
			var url ='/final/monitor/addTransactions.jsp';
			
			//if(site=='' || site=='null' || site==undefined || site=='null')
			//{
			//	 site=$j("#topo_site").val();
			//}
			var param='site='+encodeURI(site)+'&fromPage=Topology';
			var selectNode="<%=selectNode%>";
			var openNode="<%=openNode%>";
			var treeFlag="<%=treeFlagg%>";
			var currentTab="<%=currentTab%>";
			var transTab="<%=transTab%>";
			var configOnTopology="<%=configOnTopology%>";
			
			//param=param+'&param='+param+'&selectNode='+encodeURI(selectNode)+'&selectedParam='+encodeURI(selectedParam)+'&openNode='+openNode+'&treeFlag='+treeFlag+'&currentTab='+currentTab+'&transTab='+transTab+'&configOnTopology='+encodeURI(configOnTopology)+'&isSite='+isSite;
			
			param=param+'&selectNode='+encodeURI(selectNode)+'&selectedParam='+encodeURI(selectedParam)+'&openNode='+openNode+'&treeFlag='+treeFlag+'&currentTab='+currentTab+'&transTab='+transTab+'&configOnTopology='+encodeURI(configOnTopology)+'&isSite='+isSite+'&isCitrix=true';
			
			url = url+'?'+param;
			return url;
		}
		function loadTransHCGrap(seriesOptions,TotalTd,axisTitle,fmts,title,max,xmax,xmin,lineWidth, styleAttrbs,isareaChart)
		{
			try
			{
				var myImgHtml = '<div style="margin:12% 0 auto 25%"><img src="/final/images/'+strSkin+'/nomeasures_custom.png" width="70%" /></div>';
				var tmpChartId = "transchart"+TotalTd+"-body";
				if(Ext.isEmpty(seriesOptions))
				{
					Ext.getCmp(tmpChartId).update(myImgHtml);
				}
				else
				{
					var xlineWidth = 1,xGridLineWidth = 1,ylineWidth = 1,yGridLineWidth = 0;
					var ymax = max;
					max = max+1;
					var toolTipFmt = '';
					//Get current date format from jsp variable
					toolTipFmt = tooltipDateFormate('<%=dateFormatForDatePicker%>');
					var chartWidth = 0;
					var docWid = $(document).width();
					chartWidth = ( $( window ).width() / 3 ) - 100;
					var legendSize = seriesOptions.length;
					var yVal = "";
					var offSets = "";
					var mBottom = 40;
					if(fmts == "%H:%M")
					{
						yVal = 20;
						offSets = 60;
					}
					else
					{
						yVal = 38;
						offSets = 100;
						mBottom = 80;
					}

					var minPad = null;
					var ymin = 0;
					if (!Ext.isEmpty(isYaxisBasedOnData) && isYaxisBasedOnData)
					{
						minPad=0;
						ymin=null;
						ymax=null;
					}

					if(ymin!=null && ymax!=null && (ymin == ymax))
						ymax = ymin+1;

					Highcharts.setOptions({
						global: {
							useUTC: true,
							timezoneOffset:timeZoneOffsetVal
						}
					});
					var typeStr = (isAreaChart.toLowerCase() == 'yes' || isAreaChart.toLowerCase() == 'true')?"areaspline":"line";
					if(!Ext.isEmpty(isareaChart) && isareaChart){
						typeStr = "line";	
					}
					var chart= $('#'+tmpChartId).highcharts('StockChart', {
					//var chart= $('#'+tmpChartId).highcharts({
						chart: {
							type:typeStr,
							defaultSeriesType: typeStr,
							//renderTo: tmpChartId,
							zoomType: 'x',
							animation: false,
							height:210,
							width:chartWidth,
							plotBorderColor : 'transparent',
							backgroundColor:'transparent',
							spacing:[10, 10, 10, 10],
							//marginTop:50,
							marginBottom:mBottom,
							plotShadow: false,
							shadow: false,
							events: {
								selection: function (event) {
									var text,label;
									if (event.xAxis) {
										if(Highcharts.numberFormat(event.xAxis[0].min, 2)>0){
											isZoomMeasureGraph=true;
										}
									} else {
										isZoomMeasureGraph=false;
									}
								},
								/*click: function (event) {
									if(event.srcElement.firstChild == null )
									{
										showGraph('event',TotalTd);
									}
									else if( event.srcElement.firstChild.data === "Reset zoom")
									{
										//this.xAxis[0].setExtremes(xmin,xmax);
									}
								}*/
							}
							//plotShadow: true
						},
						navigator: {
							enabled: false
						},
						yAxis: {
							border :0,
							min: ymin,
							minPadding:minPad,
							max:ymax,
							lineWidth: ylineWidth,
							gridLineWidth: yGridLineWidth,
							gridLineColor:styleAttrbs['axisLabelGridColor'],
							tickPixelInterval: 50,
							opposite:false,
							labels: {
								align: 'right',
								x: -10,
								y: 3,
								formatter: function() {
									return (this.value > 0 ? ' ' : '') + this.value ;
								},
								style: {
									color :styleAttrbs['axisLabelColor'],
									fontFamily:styleAttrbs['axisLabelFontFmy'],
									fontSize:styleAttrbs['axisLabelFontSize']
								},
							},
							showLastLabel: true,
							lineColor: styleAttrbs['axisLabelLineColor'],
							minorGridLineColor: styleAttrbs['axisLabelMinorGrid'],
							tickColor: styleAttrbs['axisLabelTickColor']
						},
						plotOptions: {
							series: {
								threshold: null,
								turboThreshold: 50000,
								connectNulls : false,
								smoothed: true,
								stacking: null,
								 states: {
									hover: {
										lineWidthPlus: 0
									}
								},
								events: {
									click: function (event) {
										if(event)
										{
											showGraph('event',TotalTd);
										}
									}
								}
							},
							line: {
								shadow: false,
								lineWidth: lineWidth
							}
						},
						rangeSelector: {
						enabled: false
						},
						scrollbar: {
							enabled: false
						},
						exporting: {
								enabled: false
							},
						legend: {
							enabled: false,
							align:'right',
							layout: 'vertical',
							verticalAlign: 'top',
							borderWidth: 0,
							itemStyle: {
								color : styleAttrbs['legendColor'],
								fontFamily: styleAttrbs['legendFontFmy'],
								fontSize: styleAttrbs['legendFontSize'],
							},
							y:50
						},
						tooltip: {
							split: false,
						   	shared:true,
							crosshairs: [false,false],
							backgroundColor : styleAttrbs['TooltipBgColor'],
							borderColor: styleAttrbs['TooltipBorderColor'],
							headerFormat: '{point.key}<br>',
							pointFormat: '{series.name}  <b>:  {point.y}</b><br>',
							style: {
								color : '#2a292a',
								padding: 10,
								//fontWeight: 'bold',
								fontFamily: styleAttrbs['TooltipFontFmy'],
								fontSize: styleAttrbs['TooltipFontSize'],
							},
							xDateFormat:toolTipFmt,
							valueDecimals: 4,
							formatter: function() {
									var s ='';
									if(strSkin=='Dark' || strSkin=='dark'){
										if( legendSize==1)
											s = '<span style="color:white">'+Highcharts.dateFormat (toolTipFmt,this.x,true)+'</span><br/>';
										else
											s = '<span>'+Highcharts.dateFormat (toolTipFmt,this.x,true)+'</span><br/>';
									}else{
										 if( legendSize==1)
											s = '<span style="color:black">'+Highcharts.dateFormat (toolTipFmt,this.x,true)+'</span><br/>';
										else
											s = '<span>'+Highcharts.dateFormat (toolTipFmt,this.x,true)+'</span><br/>';
									}
									jQuery.each(this.points, function(i, point) {
										var val = Highcharts.numberFormat (point.y,4, '.','');
										var val_ar = val.split('.');
										if(val_ar.length>1)
										{
											if(val_ar[1]=='0000')
												val = val_ar[0];
										}
										if(strSkin=='Dark' || strSkin=='dark'){
											if (point.series.name != '' && point.series.name != undefined && true) {
												if(legendSize==1)
													s += '<b><span style="color:white">'+ point.series.name +' :  '+val+'</span></b><br/>';
												else
													s += '<b><span style="color:' + this.series.color + '">'+ point.series.name +'  :  '+val+'</span></b><br/>';
												//s += '<br/>'+ point.series.name +': <b>'+val+'</b>';
											}
											else
											{
												s += '<br/> <b><span style="color:white">'+val+'</span></b><br/>';
											}
										}else{
											if (point.series.name != '' && point.series.name != undefined && true) {
												if(legendSize==1)
													s += '<b><span style="color:black">'+ point.series.name +' :  '+val+'</span></b><br/>';
												else
													s += '<b><span style="color:' + this.series.color + '">'+ point.series.name +'  :  '+val+'</span></b><br/>';
												//s += '<br/>'+ point.series.name +': <b>'+val+'</b>';
											}
											else
											{
												s += '<br/> <b><span style="color:black">'+val+'</span></b><br/>';
											}
										}
									});
									return s;
							}
						},
						title: {
							style: {
								color :styleAttrbs['titleFontClr'],
								fontFamily:styleAttrbs['titleFontFmy'],
								fontSize:styleAttrbs['titleFontSize'],
							},
							text: title
						},
						credits: {
							enabled: false
						},
						xAxis: {
							tickWidth: 0,
							endOnTick: true,
							lineWidth: xlineWidth,
							gridLineWidth: xGridLineWidth,
							gridLineColor:styleAttrbs['axisLabelGridColor'],
							type: 'datetime',
							ordinal:false,
							labels: {
								rotation:270,
								y:yVal,
								x:4,
								align: 'center',
								style: {
									color :styleAttrbs['axisLabelColor'],
									fontFamily:styleAttrbs['axisLabelFontFmy'],
									fontSize:styleAttrbs['axisLabelFontSize']
								},
								overflow: 'justify',
								maxStaggerLines : 7,
								showLastLabel: true,
								showFirstLabel: false,
								startOnTick: true,
								useHTML: false,
								tickPixelInterval: 50,
							
								formatter: function() {
								return  Highcharts.dateFormat(fmts, this.value);
								}
							},
							title: {
								text: '',
								offset: ''
								
							},
							lineColor: styleAttrbs['axisLabelLineColor'],
							minorGridLineColor: styleAttrbs['axisLabelMinorGrid'],
							tickColor: styleAttrbs['axisLabelTickColor']
						},
						
						series: seriesOptions
					});
				}
				
			}
			catch(exp)
			{
				console.log("script error--->",exp);
			}

//			try
//			{
//				document.getElementById('highStckScript').src = null;
//			}
//			catch (e)
//			{
//			}
		}

		function getStyle(colorClass) {
			try{
				var wid=0,hit=0;
				if(colorClass.indexOf("1") != -1)
				{
					wid=25/2;
					wid=wid-2;
					hit=24;
				}else if(colorClass.indexOf("2") != -1){
					wid=29/2;
					wid=wid-3;
					hit=30;
				}else if(colorClass.indexOf("3") != -1){
					wid=38/2;
					wid=wid-3;
					hit=38;
				}else if(colorClass.indexOf("4") != -1){
					wid=45/2;
					wid=wid-4;
					hit=45;
				}else if(colorClass.indexOf("5") != -1){
					wid=51/2;
					wid=wid-7;
					hit=51;
					//hit=hit-1;
				}else{
					wid=25;
					hit=24;
				}
			}catch(e){
				wid= 0;
				hit=0;
				console.log(e)
			}

			var colPos = new Object();
			colPos.width=wid;
			colPos.height=hit;

			return colPos;
		}
		jQuery.fn.highlight = function(pat) {
			function innerHighlight(node, pat) {
				var skip = 0;
				if(node.nodeType == 3){
					var pos = node.data.toUpperCase().indexOf(pat);
					pos -= (node.data.substr(0, pos).toUpperCase().length - node.data.substr(0, pos).length);
					if (pos >= 0) {
						var spannode = document.createElement('span');
						spannode.className = 'highlight';
						var middlebit = node.splitText(pos);
						var endbit = middlebit.splitText(pat.length);
						var middleclone = middlebit.cloneNode(true);
						spannode.appendChild(middleclone);
						middlebit.parentNode.replaceChild(spannode, middlebit);
						skip = 1;
					}
				}
				else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
					for (var i = 0; i < node.childNodes.length; ++i) {
						i += innerHighlight(node.childNodes[i], pat);
					}
				}
				return skip;
			}
			return this.length && pat && pat.length ? this.each(function() {
				innerHighlight(this, pat.toUpperCase());
			}) : this;
	};

	jQuery.fn.removeHighlight = function() {
		return this.find("span.highlight").each(function() {
			this.parentNode.firstChild.nodeName;
			with (this.parentNode) {
				replaceChild(this.firstChild, this);
				normalize();
			}
		}).end();
	};
</script>


<script src="/final/scripts/eg_DateUtil.js" ></script>
<script>
	var isInternetAvailableFlag = true;
</script>
<%
	if(isInternetAvailable)
	{
%>
<script src="//maps.googleapis.com/maps/api/js?v=3.exp&amp;key=<%=google_map_key%>"></script>
<script language="javascript" type="text/javascript" src="/final/monitor/eg_scripts/infobox.js?1=1"></script>
<script language="javascript" type="text/javascript" src="/final/monitor/eg_scripts/markerwithlabel.js?1=1"></script>
<%
	}
	else
	{
%>
<script>
	function loadApiFiles(){
		var newScript1;
		newScript1 = document.createElement('script');
		newScript1.setAttribute('type','text/javascript');
		newScript1.setAttribute('src',"/final/monitor/eg_scripts/infobox.js?1=1");
		document.getElementsByTagName('head')[0].appendChild(newScript1);
		
		var newScript2;
		newScript2 = document.createElement('script');
		newScript2.setAttribute('type','text/javascript');
		newScript2.setAttribute('src',"/final/monitor/eg_scripts/markerwithlabel.js?1=1");
		document.getElementsByTagName('head')[0].appendChild(newScript2);
	}
	function loadScriptfile(){	
		$(document).ready(function() {
			var newScript;
			newScript = document.createElement('script');
			newScript.setAttribute('type','text/javascript');
			newScript.setAttribute('src',"//maps.googleapis.com/maps/api/js?v=3.exp&key=<%=google_map_key%>");
			newScript.setAttribute("onload","loadApiFiles()");
			document.getElementsByTagName('head')[0].appendChild(newScript);			
		});		
	}
	if(document.cookie != null && document.cookie.length > 0)
	{
		if(document.cookie.indexOf("isInternetAvailable=true") > -1)
		{
			loadScriptfile();			
		}
		else
			isInternetAvailableFlag = false;
	}
	else
		isInternetAvailableFlag = false;

</script>
<%
	}
%>
<script src="/final/monitor/eg_scripts/GeoJSON.js"></script>

<script src="/final/Highcharts/js/modules/exporting.js"></script>
<script src="/final/Highcharts/js/highcharts-more.js"></script>
<script src="/final/Highcharts/js/solid-gauge.src.js"></script>
<script  src="/final/extjs/ext-all.js"></script>

<script src="/final/monitor/eg_scripts/ajaxutils.js" type="text/javascript"></script>
<script  src="/final/monitor/eg_scripts/citrixDashboard/app.js"></script>
<script  language="JavaScript1.2" src="/final/jquery/jquery.sparkline.min.js"></script>
<!-- <script  src="/final/monitor/eg_scripts/EgHighChart.js"></script> -->
<script  src="/final/monitor/eg_scripts/EgCitrixDashboardHighChart.js"></script>
<!-- <script src="/final/monitor/eg_scripts/egDashboardHighChart.js"></script> -->

<script src="../monitor/eg_scripts/dashboards/GeneralMeasuresGrid.js"></script>
<script src="../monitor/eg_scripts/dashboards/GeneralMeasuresGridPanel.js"></script>
<script src="../monitor/eg_scripts/dashboards/DashboardGeneralMeasuresGridPanel.js"></script>
<script src="../monitor/eg_scripts/dashboards/DashboardGeneralMeasuresAggregatePanel.js"></script>
<script src="../monitor/eg_scripts/dashboards/DashboardGeneralMeasuresGrid.js"></script>
<script src="/final/scripts/utilities/EmptyPanel.js"></script>
<script src="/final/scripts/utilities/CustomGrid.js"></script>
<!--test---->

<style>
	
	.x-tip
	{
		width:auto !important;
	}

	.imagecombo .x-form-item-body input, .imagecombo .x-form-item-body input.x-form-text
	{
		font-size: 12px;
	}
	span.decimal-align{float: left; text-align: right; width:50%;}
	span.decimal-align2{float: right; text-align: left; width:50%;}

	/*.gm-style{
		max-width:512px !important;
		height:100% !important;
		margin:auto !important;
		left:auto !important;
		border:0px solid red !important;
		position: relative !important;
	    overflow: hidden;
	}*/
	
.gm-style-iw {
    width: auto !important;
    height: auto !important;
    div {
        width: auto !important;
        height: auto !important;
    }
}
	#map_canvas {
		width: 500;
		height: 350;
		margin: 0px;
		padding: 5px;
		/*background:#252525 !important;*/
	}
	#breadCrumbId
	{
		/*height: 15px;*/
		margin: 0px;
		/*padding: 0px;*/
		position:absolute;
		top:5px;
		left:5px;
		z-index:10000;
	}
	#copyright
	{
		display: none !important;
	}
	.gm-fullscreen-control
	{
		display: none !important;
	}
	a[href^="https://maps.google.com/maps"]{display:none !important}

	.gmnoprint a, .gmnoprint span {
		display:none;
	}
	.gmnoprint div {
		background:none !important;
	}
	#map-report div.gmnoprint,
	#map-report div.gmnoscreen {
		display: none;      
	}

	
	img[src="https://maps.gstatic.com/mapfiles/api-3/images/google_white2.png"] {
		display: none; 
	}


	img[src="https://maps.gstatic.com/mapfiles/google_white.png"] {
		display: none; 
	}

	#map-report a img { display:none; } 
	
	.infobox-wrapper {
		display:none;
	}
	/*	.x-mask-msg div {
		padding: 6px 10px 6px 42px;
		background-image: url("../images/Dark/preloader_dark.gif");
		background-repeat: no-repeat;
		background-position: 6px 7px;
		cursor: wait;
		border-width: 0;
		background-color: #fff;
		color: #0e0e0e;
		font-size: 12px;
	}*/

	.x-tip.yellowTip{background:#414141!important;border-radius:4px!important;opacity:.9;filter:alpha(opacity=90)}
	.x-tip.yellowTip .x-tip-body,.x-tip.yellowTip .x-form-invalid-tip-body{color:#fff!important;padding:0 8px!important;line-height:18px}
	.x-tip.yellowTip .x-tip-anchor{position:absolute;overflow:hidden;border-style:solid;border-width:5px;border-color:none;zoom:1}
	.x-tip.yellowTip .x-tip-anchor-top{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-bottom:5px solid #414141}
	.x-tip.yellowTip .x-tip-anchor-bottom{width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:5px solid #414141}
	.x-tip.yellowTip .x-tip-anchor-left{width:0;height:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-right:5px solid #414141}
	.x-tip.yellowTip .x-tip-anchor-right{width:0;height:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid #414141}

</style>

</head>

<body> 
<input type="hidden" name="isSessionWindowOpen" id="isSessionWindowOpen" value="false" />
</body>

</html>

<%
	if(qry!=null)
	{
		qry=com.egurkha.util.StringUtils.replace(qry, "\\", "\\\\");
		session.setAttribute("monitorLastSession","/final/monitor/citrixDashboard.jsp?"+qry);
	}
	else
		session.setAttribute("monitorLastSession","/final/monitor/citrixDashboard.jsp");

%>