var elemList,compToDelete,comptypeToDelete;
var i = 60000;

var runner = new Ext.util.TaskRunner();
var task = runner.newTask({
	run: function() {
		monitors = appCnt.getMonitorValue();
		if (!Ext.isEmpty(monitors) && (monitors == 'CitrixAgentLess' || monitors == 'CitrixAgentLessDisc' || monitors == 'VMwareHorizonAgentLess' || monitors == 'Hypervisors' || monitors == 'PublicCloud' || monitors == 'Kubernetes' || monitors == 'SaaSApp' || monitors == 'Office365' || monitors == 'LogonSimulator'))
		{
			if (i < autoRefresh)
			{
				i = i+60000;
			}
			task.restart(i);
			appCnt.gotoApplicationMonitors(monitors);
		}
		else
		{
			task.stop();
		}
	},
	interval: i
});

var compRunner = new Ext.util.TaskRunner();
var compTask = compRunner.newTask({
	run: function() {
		if (i < autoRefresh)
		{
			i = i+60000;
		}
		compTask.restart(i);
		appCnt.processView(this);
	},
	interval: i
});

var taskRunner = new Ext.util.TaskRunner();

var genericTask = taskRunner.newTask({
	run: function() {
		appCnt.processTask();
	},
	interval: 60000
});

var currentPageNo = 1;
var recCount = 0;

var serverData = "";
var jsonMsOffice = "";

Ext.define('LimitedAdminHome.controller.Main',{
	extend:'Ext.app.Controller',
	views:['Viewport','DownloadUtils','AdminWizard','ComponentDetailGrid','WhatNext','EgMSOfficeServersView','EgDiscoverServersView','DownloadAgents','EgAgentlessDiscoveryServers','EgConfigureServersForDiscovery','EgDiscoveryVirtualForm','DiscoveryDetailsGrid','UploadAgentsWizard','DownloadAgentsWizard','EgMSOfficeConfigurations','EgMSOfficeComponents','EgLogonSimulatorConfiguration','EgCitrixNetScalerConfiguration','EgConfigureAgentLessServers','EgDockerView'],
	refs : [
		{selector:'viewport', ref:'viewport'},
		{selector:'adminwizard', ref:'adminwizard'},
		{selector:'DownloadUtils', ref:'DownloadUtils'},
		{selector:'ComponentDetailGrid', ref:'ComponentDetailGrid'},
		{selector:'WhatNext', ref:'WhatNext'},
		{selector:'EgMSOfficeServersView', ref:'EgMSOfficeServersView'},
		{selector:'EgDiscoverServersView', ref:'EgDiscoverServersView'},
		{selector:'DownloadAgents', ref:'DownloadAgents'},
		{selector:'EgAgentlessDiscoveryServers', ref:'EgAgentlessDiscoveryServers'},
		{selector:'EgConfigureServersForDiscovery', ref:'EgConfigureServersForDiscovery'},
		{selector:'EgDiscoveryVirtualForm', ref:'EgDiscoveryVirtualForm'},
		{selector:'DiscoveryDetailsGrid', ref:'DiscoveryDetailsGrid'},
		{selector:'UploadAgentsWizard', ref:'UploadAgentsWizard'},
		{selector:'DownloadAgentsWizard', ref:'DownloadAgentsWizard'},
 		{selector:'EgMSOfficeConfigurations', ref:'EgMSOfficeConfigurations'},
 		{selector:'EgMSOfficeComponents', ref:'EgMSOfficeComponents'},
 		{selector:'EgLogonSimulatorConfiguration', ref:'EgLogonSimulatorConfiguration'},
 		{selector:'EgCitrixNetScalerConfiguration', ref:'EgCitrixNetScalerConfiguration'},
 		{selector:'EgConfigureAgentLessServers', ref:'EgConfigureAgentLessServers'},
 		{selector:'EgDockerView', ref:'EgDockerView'}

	],
	init : function(){
		thisController = this;
		appCnt = this;
		ctrler = this;
		this.buildMainData();

		this.control({
		});
	},

	processTask : function()
	{
		var viewName = Ext.getCmp('viewport').items.keys[0];
		this.buildMainData();
		var showUploadAgentUI = publicJson['showUploadAgentUI'];
		var showDownloadAgentUI = publicJson['showDownloadAgentUI'];
		if (viewName != null && viewName == 'UploadAgentsWizard')
		{
			if (!showUploadAgentUI)
			{
				Ext.getCmp('uploadAgentMsgCont').update('<div class="aNewLineBottom" style="margin:15px 10px 5px 10px;padding:0px 0px 16px 0px;">'+uploadAgentStatusMsg2+'.</div>');
				if (!Ext.isEmpty(Ext.getCmp('nextStep')))
				{
					Ext.getCmp('nextStep').setDisabled(false);
					Ext.getCmp('skipBtn').hide();
					genericTask.stop();
				}
			}
			else
			{
				Ext.getCmp('uploadAgentMsgCont').update('<div class="aNewLineBottom" style="margin:15px 10px 5px 10px;padding:0px 0px 16px 0px;">'+uploadAgentStatusMsg1+'. '+uploadAgentStatusMsg3+'.</div>');
				genericTask.start();
				if (!Ext.isEmpty(Ext.getCmp('nextStep')))
				{
					Ext.getCmp('nextStep').setDisabled(true);
					if (!hideSkip)
					{
						Ext.getCmp('skipBtn').show();
					}
				}
			}
		}
		else if (viewName != null && viewName == 'DownloadAgentsWizard')
		{
			Ext.Ajax.request({
				url : 'LimitedAdminHome/data/EgAdminOperationsJson.jsp?fromAction='+fromAction+'&osName='+osName,
				method : 'POST',
				async: false,
				success: function(response)
				{
					var jsonText = response.responseText;
					publicJson = Ext.decode(jsonText);
				}
			});
			var isAgentFileExists = publicJson['isAgentFileExists'];
			if (isAgentFileExists)
			{
				Ext.getCmp('donwloadAgentMsgCont').update('<img src="/final/images/spacer.gif" class="aIconDownload32" style="margin:13px 15px 5px 10px;vertical-align:baseline;float:left"/>'+'<div style="margin:10px 10px 5px 10px;"><a href="javascript:void(0)" style="text-decoration:underline;" class="aInfoMsgLinkText aLinkBottomBorder"  id="uploadAgentMsg" onclick="javascript:appCnt.goToDownloadAgentsUI()">'+downloadAgentMsg1+'</a> '+downloadAgentMsg2+' <span style="font-weight:500;">'+displayOsNameWithBit+'</span> '+downloadAgentMsg3+' <span style="font-weight:500;">'+hostName+'</span>.</div>'+
				'<div style="margin:15px 10px 0px 55px;font-weight:500;font-size:15px">'+downloadAgentStepMsg+':</div><ul class="aDiamondBullet"><li>'+downloadAgentStep1+'.</li><li style="margin-bottom:15px">'+getStartedInstallStepMsg2+'.</li></ul>');

				Ext.getCmp('donwloadAgentMsg').update('<div class="aNewLineBottom" style="margin:15px 10px 5px 10px;padding:0px 0px 16px 0px;">'+downloadAgentStatusMsg+' <span style="font-weight:500;">'+hostName+'</span>.</div>');
			}
			else
			{
				Ext.getCmp('donwloadAgentMsgCont').update('<div style="margin:16px 10px 10px 10px;">'+downloadAgentAltStep1+' <span style="font-weight:500;">'+displayOsNameWithBit+'</span> '+downloadAgentAltStep2+'.</div><div style="margin:16px 10px 16px 10px;">'+downloadAgentAltStep3+' <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder"  id="uploadAgentMsg" onclick="javascript:appCnt.goToUploadAgents()">'+downloadAgentAltStep4+'</a> '+downloadAgentAltStep5+'.</div>');

				Ext.getCmp('donwloadAgentMsg').update('<img src="/final/images/spacer.gif" class="aIconCross32" style="margin:10px 15px 8px 10px;vertical-align:baseline;float:left"/>'+'<div class="aNewLineBottom" style="margin:15px 10px 5px 10px;padding:0px 0px 16px 0px;">'+downloadAgentStatusMsg+' <span style="font-weight:500;">'+hostName+'</span>.</div>');
			}

			if (!showDownloadAgentUI)
			{
				if (!Ext.isEmpty(Ext.getCmp('proceedBtn')))
				{
					Ext.getCmp('proceedBtn').setDisabled(false);
					Ext.getCmp('skipBtn1').hide();
					Ext.getCmp('donwloadAgentMsgCont').hide();
					Ext.getCmp('donwloadAgentMsg').hide();
					Ext.getCmp('donwloadAgentSuccessMsgCont').show();
					genericTask.stop();
				}
			}
			else
			{
				if (!Ext.isEmpty(Ext.getCmp('proceedBtn')))
				{
					Ext.getCmp('proceedBtn').setDisabled(true);
					if (!hideSkip)
					{
						Ext.getCmp('skipBtn1').show();
					}
					Ext.getCmp('donwloadAgentMsgCont').show();
					Ext.getCmp('donwloadAgentMsg').show();
					Ext.getCmp('donwloadAgentSuccessMsgCont').hide();
				}
			}
		}
	},
	
	goToUploadAgents : function()
	{
		var viewportObj = Ext.getCmp('viewport');
		viewportObj.removeAll();
		viewportObj.add({
			xtype: 'UploadAgentsWizard'
		});
		viewportObj.doLayout();
	},

	goToDownloadAgentsUI : function()
	{
		var downloadUtils = Ext.widget('DownloadUtils');
		var urlStr = '/final/servlet/com.eg.AgentDownloadServlet?from='+encodeURIComponent('Remote')+'&os='+encodeURIComponent(osName)+'&folder='+encodeURIComponent('Universal')+'&agentVersion='+encodeURIComponent('Latest')+'&unzipit=false&issueUID=yes&issueDefaultSilentScript=true';
		downloadUtils.download(urlStr,displayOsNameWithBit,'Internal',true);
	},

	goToSkip : function(skipTo)
	{
		if (!Ext.isEmpty(skipTo) && skipTo == 'DownloadAgentsWizard')
		{
			var viewportObj = Ext.getCmp('viewport');
			viewportObj.removeAll();
			viewportObj.add({
				xtype: skipTo
			});
			viewportObj.doLayout();
			Ext.getCmp('DownloadAgentsWizard').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.goToUploadAgents()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+downloadAgentsTitle);
		}
		else
		{
			var viewportObj = Ext.getCmp('viewport');
			viewportObj.removeAll();
			viewportObj.add({
				xtype: 'getstarted'
			});
			viewportObj.doLayout();
		}
		Ext.Ajax.request({
			url : 'LimitedAdminHome/data/EgAdminOperationsJson.jsp?fromAction='+fromAction+'&reqFrom=iniWrite&skip='+skipTo,
			method : 'POST',
			async: false,
			success: function(response)
			{
				var jsonText = response.responseText;
				publicJson = Ext.decode(jsonText);
			}
		});
	},

	addNewComponent: function(fromAction, selectedType)
	{
		if (!Ext.isEmpty(selectedType) && selectedType.indexOf('Agg_') == 0)
		{
			url = "/final/admin/EgAggregateTree.jsp?server="+selectedType;

			if (!Ext.isEmpty(fromAction))
			{
				url += "&fromWizard="+fromAction;
			}
			window.location.href = url;
		}
		else
		{
			var remAgentForAgentlessDisc = '';
			if (fromAction.indexOf("monitors_") != -1)
			{
				remAgentForAgentlessDisc = sessionStorage.getItem("remoteAgent");
			}
			selectedType = encodeURIComponent(selectedType);
			var selectedCategory = "-1";
			selectedCategory = encodeURIComponent(selectedCategory);
			var url = "/final/admin/EgNewServer.jsp?server=new&serverType="+selectedType+"&fromAPP=wizard&isAggregateLink=false&treeViewSrc=null&serverGategory="+selectedCategory+"&fromWizard="+fromAction+"&remAgentForAgentlessDisc="+remAgentForAgentlessDisc;
			window.location.href = url;
		}
	},
	addNewNetScalerComponent: function(fromAction, selectedType, classify)
	{
		appCnt.refreshCompGlance("stop");
		if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
		{
			Ext.getCmp('WhatNextObj').destroy();
		}

		Ext.suspendLayouts();
		var innerCardObj = Ext.getCmp('card-1');
		innerCardObj.removeAll();
		innerCardObj.selectedType = selectedType;
		innerCardObj.classify = classify;
		innerCardObj.add({
				xtype: 'EgCitrixNetScalerConfiguration'
		});
		Ext.resumeLayouts(true);
	},
	gotoCtxNetScalerConfiguration : function(compType)
	{
		Ext.getCmp('card-1').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.detailedCompGlanceClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+ctxNetScalertitle);

		var urlStr = 'NewComponent/data/EgNewServerJson.jsp?&serverType='+encodeURIComponent(compType)+'&selectedServerGroup='+'all'+'&server=new';

		Ext.Ajax.request(
		{
			url: urlStr,
			method: 'POST',
			async:false,
			success: function( response )
			{
				if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
				{
					var jsonText = response.responseText;
					publicJSONMSOffice = Ext.decode( jsonText );
				}
			}
		});
	},
	submitNetScalerServerDetails : function()
	{
		var isValid = this.addServerValidation();
		if (!isValid)
		{
			return;
		}
	},

	addServerValidation : function()
	{
		pageTitle = ctxNetScalertitle;
		var me= this;
		var compType = Ext.getCmp('card-1').selectedType;
		var compNickObj = Ext.getCmp('hostname');
		var compNickVal = Ext.getCmp('hostname').getValue();
		var compSuffixObj = Ext.getCmp('hostnameSuffix')
		if (compSuffixObj != null && compSuffixObj != undefined)
		{
			var compSuffix = compSuffixObj.getValue();
			compNickVal += compSuffix;
		}
		//var compType = Ext.getCmp('stype').getValue();
		var agentLess = true; //Ext.getCmp('enableRemoteAgent').getValue();
		if(isDoubleByteMgr=="false")
		{
			if(!validateSingleByte(compNickVal))
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: alertMsg1,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					//width: 700,
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		//var isAggType = "";
		//if(compType.indexOf("_") > 0)
		//{
			//isAggType = (compType.substring(0,compType.indexOf("_")) == "Agg");
			//if(isAggType)
			//{
				//if(!checkblank(compNickVal))
				//{
					//Ext.Msg.show({
						//title: pageTitle,
						//msg: alertMsg22,
						//buttons: Ext.Msg.OK,
						//icon: 'gen-warning size32 color-warning',
						//fn: function(response) {
							//if(response == 'ok') {
								//compNickObj.focus(true);
							//}
						//}
					//});
					//return false;
				//}
			//}
		//}
		//var ext_agt = Ext.getCmp('extAgents').getValue().toString();
		//if (ext_agt == '' || ext_agt.toLowerCase() == 'not applicable')
		//{
			//Ext.Msg.show({
				//title: pageTitle,
				//msg: alertMsg7,
				//buttons: Ext.Msg.OK,
				//layout: 'auto',
				//icon: 'gen-warning size32 color-warning',
				//fn: function(response) {
					//if(response == 'ok') {
						////Ext.getCmp('extAgents').focus(true);
					//}
				//}
			//});
			//return false;
		//}
		//if (agentLess)
		//{
			//var rem_agt = Ext.getCmp('remoteAgent').getValue().toString();
			//if (rem_agt == '' || rem_agt.toLowerCase() == 'not applicable')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg61,
					//buttons: Ext.Msg.OK,
					//layout: 'auto',
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							////Ext.getCmp('extAgents').focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}
		//var alosObj = Ext.getCmp('alos');
		//if (!alosObj.isDisabled()) //Agentless enabled
		//{
			//var alosVal = alosObj.getValue();
			//if(alosVal =='None')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg2,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//alosObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//var almodeObj = Ext.getCmp('almode');
			//var almodeVal = almodeObj.getValue();
			//if (almodeVal == 'None')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg3,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//almodeObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if (almodeVal == "Perfmon" 
				//&& alosVal != "nt" 
				//&& alosVal != "2003" 
				//&& alosVal != "2008" 
				//&& alosVal != "w2k"
				//&& alosVal != "xp"
				//&& alosVal != "2012"
				//&& alosVal != "2016"
				//&& alosVal != "2019"
				//&& alosVal != "win7"
				//&& alosVal != "win8"
				//&& alosVal != "win10")
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg4,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//almodeObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if (( almodeVal == "SSH" || almodeVal == "Rexec")
				//&& (alosVal == "nt" 
				//|| alosVal == "2003" 
				//|| alosVal == "2008" 
				//|| alosVal == "w2k"
				//|| alosVal == "xp"
				//|| alosVal == "2012"
				//|| alosVal == "2016"
				//|| alosVal == "2019"
				//|| alosVal == "win7"
				//|| alosVal == "win8"
				//|| alosVal == "win10"))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: almodeVal+' '+alertMsg5,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//almodeObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(almodeVal!="SNMP" &&(compType == 'AS400_server'||compType == 'Snmp_generic_server' ||compType == 'Netware_server'))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg6,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//almodeObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(almodeVal == "SSH")
			//{
				//var encryptVal = Ext.getCmp('alencrypt').getValue();
				//if (encryptVal == 'Keybased')
				//{
					//var keyFileObj = Ext.getCmp('alkeyfile')
					//var keyFile = keyFileObj.getValue();
					//if (keyFile == '' || keyFile.toLowerCase() == 'none')
					//{
						//Ext.Msg.show({
							//title: pageTitle,
							//msg: alertMsg40,
							//buttons: Ext.Msg.OK,
							//icon: 'gen-warning size32 color-warning',
							//fn: function(response) {
								//if(response == 'ok') {
									//keyFileObj.focus(true);
								//}
							//}
						//});
						//return false;
					//}
				//}
			//}
		//}
		//var sshPortObj = Ext.getCmp('sshPort');
		//if (!sshPortObj.isDisabled())
		//{
			//var sshPortVal = sshPortObj.getValue();
			////Validate the port
			//if(!checkblank(sshPortVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg8,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sshPortObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(!checknumber("+",sshPortVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg9,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sshPortObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(!checkfordecimal(sshPortVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg10,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sshPortObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(sshPortVal < 1)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg11,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sshPortObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(sshPortVal > 99999)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg12,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sshPortObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(!checkspace(sshPortVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg13,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sshPortObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}
		//if (!Ext.getCmp('aluser').isDisabled() && !Ext.getCmp('alpwd').isDisabled())
		//{
			//if(!this.checkUserPwd())
				//return false;
		//}
		var hostIpObj = Ext.getCmp('hostip');
		var hostIpVal = Ext.getCmp('hostip').getValue();
		
		if(!publicJSON.hideHostIPField && !checkblank(hostIpVal))
		{
			if (isAllowHostName=='false')
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: alertMsg18,
					width: 300,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							hostIpObj.focus(true);
						}
					}
				});
			}
			else
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: alertMsg19,
					buttons: Ext.Msg.OK,
					width: 300,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							hostIpObj.focus(true);
						}
					}
				});
			}
			return false;
		}
		else if(!publicJSON.hideHostIPField && isAllowHostName=='false' && validateIpAddressExtjs(hostIpVal) != '0')
		{
			var updateValue = validateIpAddressExtjs(hostIpVal);
			if(updateValue == "1")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "5")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkspaceIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "6")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkAlpha,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "7")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "8")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _valIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "9")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _validateIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "10")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checknum,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && validateHostFieldExtjs(hostIpVal) != '0')
		{
			var updateValue =  validateHostFieldExtjs(hostIpVal);
			if(updateValue == "1")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "5")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkspaceIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "6")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkAlpha,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "7")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "8")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _valIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "9")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _validateIp,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "10")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checknum,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "11")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _chkIpv6,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "12")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _doubleColon,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "13")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _grpIpv6,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "14")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _digitIpv6,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "15")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _validateIpv6,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "16")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkNumberLabel,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(updateValue == "17")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkblank,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && checkspaceExtjs(hostIpVal) != '0')
		{
			var updateValue = checkspaceExtjs(hostIpVal);
			if(updateValue == "17")
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: _checkblank,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						if (btn == 'ok'){
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && checkSpecialExtjs(hostIpVal,"`~!@#$%^&*()+={}[]|\\;\"\'<>,?/") != '0') 
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: _checkspecial,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						hostIpObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(isAllowHostName=='true' && !this.checkForHostType(compNickVal))
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: alertMsg20 + alertMsg21,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(!checkblank(compNickVal))
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: alertMsg22,
				width:200,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		//else if(compType == 'Microsoft_Sharepoint_Online' && !checkForNameWithSuffix(compNickVal,"_spo"))
		//{
			//Ext.Msg.show({
				//title: pageTitle,
				//msg:alertMsg50+' _spo',
				//buttons: Ext.Msg.OK,
				//icon: 'gen-warning size32 color-warning',
				//fn: function(response) {
					//if(response == 'ok') {
						//compNickObj.focus(true);
					//}
				//}
			//});
			//return false;
		//}
		//else if(compType == 'MSExchangeOnline' && !checkForNameWithSuffix(compNickVal,"_exo"))
		//{
			//Ext.Msg.show({
				//title: pageTitle,
				//msg: alertMsg50+' _exo',
				//buttons: Ext.Msg.OK,
				//icon: 'gen-warning size32 color-warning',
				//fn: function(response) {
					//if(response == 'ok') {
						//compNickObj.focus(true);
					//}
				//}
			//});
			//return false;
		//}
		//else if(compType == 'MS_Office_365' && !checkForNameWithSuffix(compNickVal,"_365"))
		//{
			//Ext.Msg.show({
				//title: pageTitle,
				//msg: alertMsg50+' _365',
				//buttons: Ext.Msg.OK,
				//icon: 'gen-warning size32 color-warning',
				//fn: function(response) {
					//if(response == 'ok') {
						//compNickObj.focus(true);
					//}
				//}
			//});
			//return false;
		//}
		//else if(compType == 'MS_Skype_Online' && !checkForNameWithSuffix(compNickVal,"_sbo"))
		//{
			//Ext.Msg.show({
				//title: pageTitle,
				//msg: alertMsg50+' _sbo',
				//buttons: Ext.Msg.OK,
				//icon: 'gen-warning size32 color-warning',
				//fn: function(response) {
					//if(response == 'ok') {
						//compNickObj.focus(true);
					//}
				//}
			//});
			//return false;
		//}
		else if(checkspaceExtjs(compNickVal) != '0')
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: "Space is not allowed",
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(checkSpecialExtjs(compNickVal,"`~!@#$%^&*()+={}[]|\\:;\"\'<>,?/") != '0') 
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: _checkspecial,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(compNickVal.toLowerCase() == "none")
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: "You are not allowed to use eG reserved keyword \'"+compNickVal+"\' as component name",
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if (!this.checkForHostType(compNickVal))
		{
			Ext.Msg.show({
				title: pageTitle,
				msg: alertMsg20 + alertMsg21,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		//else if(!Ext.getCmp('underVmware').isDisabled() && Ext.getCmp('underVmware').getValue())
		//{
			//if (Ext.getCmp('esxServer').getValue()==-1)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg23,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//Ext.getCmp('esxServer').focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}
		//else if(!Ext.getCmp('underCloud').isDisabled() && Ext.getCmp('underCloud').getValue())
		//{
			//if (Ext.getCmp('cloudServer').getValue()==-1)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg24,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//Ext.getCmp('cloudServer').focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}
		else if(!this.checkdots(compNickVal))
		{
			compNickObj.focus(true);
			return;
		}
		else if(!this.isValidateHostName(compNickVal)/* && !isAggType*/)
		{
			if(compNickVal != hostIpVal)
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: alertMsg25,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		
		if (agentLess && this.validateHostNameWithRemote(compNickVal))
		{
			//Ext.getCmp("enableRemoteAgent").setValue(false);
			return false;
		}
		if (isDoubleByteMgr=='false')
		{
			if(compNickVal.toLowerCase() == compType.toLowerCase())
			{
				Ext.Msg.show({
					title: pageTitle,
					msg: alertMsg26,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		//var portObj = Ext.getCmp('sportno');
		//var portVal = Ext.getCmp('sportno').getValue();
		//if (!portObj.isDisabled())
		//{
			//if(!checkblank(portVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg27,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//portObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if (!checknumber("+",portVal) && portVal != 'NULL')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg28,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//portObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if (!checkfordecimal(portVal))
			//{
				//portObj.focus(true);
				//return false;
			//}
			//else if (portVal < 1)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg11,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//portObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if (portVal > 99999)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg12,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//portObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if (!checkspace(portVal))
			//{
				//portObj.focus(true);
				//return false;
			//}
			//else if (Ext.getCmp('extAgents').getValue() == '')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg7,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//Ext.getCmp('extAgents').focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}
		//if (compType=='Oracle_server')
		//{
			//var sidObj = Ext.getCmp('sid');
			//var sidVal = Ext.getCmp('sid').getValue();
			//if(!checkblank(sidVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg29,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sidObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(checkSpecialExtjs(sidVal,"&():<") != '0')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: _checkspecial,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sidObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(!checkCommaValue(sidVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg29,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sidObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(checkspaceExtjs(sidVal) != '0')
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: "Space is not allowed",
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sidObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			//else if(!checkduplicateValue(sidVal))
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg30,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//sidObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}

		//var optManual = Ext.getCmp('intAgentManual').getValue();
		//if(optManual && !agentLess)
		//{
			//var extListHasAgent = false;
			//var rmtListHasAgent = false;
			//for(var i = 0; i < extListArr.length; i++)
			//{
				//var extListStrSa = extListArr[i].trim();
				//if (extListStrSa == compNickVal)
				//{
					//extListHasAgent = true;
					//break;
				//}
			//}
			//for(var i = 0; i < rmtListArr.length; i++)
			//{
				//var rmtListStrSa = rmtListArr[i].trim();
				//if (rmtListStrSa == compNickVal)
				//{
					//rmtListHasAgent = true;
					//break;
				//}
			//}
			//if(extListHasAgent || rmtListHasAgent)
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg46,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//Ext.getCmp('intAgentAuto').setValue(true);
							//Ext.getCmp('currAgents').hide();
							//Ext.getCmp('currAgents').disable();
						//}
					//}
				//});
				//return false;
			//}

			//var intAgentObj = Ext.getCmp('currAgents');
			//var intAgentVal = intAgentObj.getValue();
			//if(compNickVal.toLowerCase() == intAgentVal.toLowerCase())
			//{
				//Ext.Msg.show({
					//title: pageTitle,
					//msg: alertMsg56+". "+alertMsg57,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//intAgentObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
		//}

		me.actualServerAdd();
	},

	actualServerAdd : function()
	{
		var alertMsgTitle = ctxNetScalertitle;
		var compType = Ext.getCmp('card-1').selectedType;
		var compNickVal = Ext.getCmp('hostname').getValue();
		var compIpVal = Ext.getCmp('hostip').getValue();
		var ssl = Ext.getCmp('ssl').getValue();
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var confpasswd = Ext.getCmp('confpasswd');
		var userVal = uname.getValue();
		var passVal = pass.getValue();
		var confpasswdVal = confpasswd.getValue();
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			uname.focus(true);
			return false;
		}
		else if(!checkspecial(userVal,"#=|\"\'<>,\/"))
		{
			uname.focus(true);
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(passVal == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			pass.focus(true);
			return false;
		}
		else if(!checkForPassValidity(passVal))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswdVal == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		else if(passVal != confpasswdVal)
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		
		var myMask = new Ext.LoadMask(Ext.getBody(), {msg: 'Updating...'});
		myMask.show();

		var me = this;

		Ext.Ajax.request({
			url:'/final/admin/LimitedAdminHome/data/EgCtxNetScalerJsonp.jsp?hostip='+encodeURIComponent(compIpVal)+'&hostname='+encodeURIComponent(compNickVal)+'&compType='+encodeURIComponent(compType)+'&NetScaler_username='+encodeURIComponent(userVal)+'&NetScaler_password='+encodeURIComponent(passVal)+'&ssl='+encodeURIComponent(ssl),
			method:'POST',
			success: function(response)
			{
				myMask.hide();
				var jsonText = response.responseText;
				var publicJson = Ext.decode(jsonText);
				var compTypeDisplay = publicJson.compTypeDisplay;
				var success = publicJson.success;
				if (!Ext.isEmpty(success) && success == 'true')
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: compTypeDisplay+' '+compSuccessMsg,
						width: 500,
						buttons: Ext.Msg.OK,
						icon: 'gen-info size32 color-info',
						fn: function() {
							me.detailedCompGlanceClose();
						}
					});
				}
				else
				{
					var errorMsg = publicJson.errorMsg;
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: errorMsg,
						width: 500,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							
						}
					});
				}
			},
			failure : function(response)
			{
				myMask.hide();
			}
		});
	},

	modifyComponent: function(fromAction, selectedType, grid, rowIndex, colIndex)
	{
		var obj = grid.getStore().getAt(rowIndex);

		if (!Ext.isEmpty(selectedType) && selectedType.indexOf('Agg_') == 0)
		{
			var server = obj.get('CompVariable');

			url = "/final/admin/EgAggregateTree.jsp?server="+server;
			if (!Ext.isEmpty(fromAction))
			{
				url += "&fromWizard="+fromAction;
			}
			window.location.href = url;
		}
		else
		{
			var compName = obj.get('DispCompName');
			if (compName.indexOf(":") < 0)
			{
				compName += ":NULL";
			}
			var selectedCType = selectedType;
			if (selectedCType == 'Oracle_server')
			{
				var tmpCompName = compName.substring(0,compName.lastIndexOf(":"));
				if (tmpCompName.indexOf(':') != -1)
				{
					compName = tmpCompName;
				}
			}
			selectedCType = encodeURIComponent(selectedCType);
			var selectedCategory = "-1";//Ext.getCmp('category').getValue();
			selectedCategory = encodeURIComponent(selectedCategory);
			compName = encodeURIComponent(compName);

			var remAgentForAgentlessDisc = '';
			if (fromAction.indexOf("monitors_") != -1)
			{
				remAgentForAgentlessDisc = sessionStorage.getItem("remoteAgent");
			}
			var url = "EgNewServer.jsp?server="+compName+"&serverType="+selectedCType+"&fromAPP=wizard&modifyserver=true&serverGategory="+selectedCategory+"&fromWizard="+fromAction+"&remAgentForAgentlessDisc="+remAgentForAgentlessDisc;
			window.location.href = url;
		}
	},
	changeIP: function(fromAction, selectedType, grid, rowIndex, colIndex)
	{
		var obj = grid.getStore().getAt(rowIndex);
		var compName = obj.get('DispCompName');
		var port = "NULL";
		if (compName.indexOf(":") > 0)
		{
			port = compName.substring(compName.indexOf(":")+1);
			compName = compName.substring(0,compName.indexOf(":"));
		}
		var compIp = obj.get('DispIpName');
		compName = encodeURIComponent(compName);
		var selectedCType = selectedType;
		selectedCType = encodeURIComponent(selectedCType);
		var selectedCategory = "-1";
		selectedCategory = encodeURIComponent(selectedCategory);

		var remAgentForAgentlessDisc = '';
		if (fromAction.indexOf("monitors_") != -1)
		{
			remAgentForAgentlessDisc = sessionStorage.getItem("remoteAgent");
		}

		var url = "EgDispServer.jsp?server="+compName+"&serverIP="+compIp+"&comptype="+selectedCType+"&fromAPP=wizard&modifyserver=true&category="+selectedCategory+"&fromWizard="+fromAction+"&remAgentForAgentlessDisc="+remAgentForAgentlessDisc+"&reqfrom=componentglance_ipchange";
		window.location.href = url;
	},
	deleteComponent: function(fromAction, grid, rowIndex, colIndex)
	{
		var classify = '';
		if (fromAction.indexOf('_') != -1)
		{
			classify = fromAction.substring(fromAction.indexOf('_')+1);
		}
		var me= this;
		elemList = "";
		var obj = grid.getStore().getAt(rowIndex);
		var selectedCType = obj.get('CompType');
		var compName = (selectedCType != null && selectedCType.toLowerCase() == "oracle_server") ? obj.get('DispCompName') : obj.get('ComponentName');
		var dispCompName = compName;
		if (!Ext.isEmpty(compName) && compName.lastIndexOf(':NULL') == compName.length - ':NULL'.length)
		{
			dispCompName = compName.substring(0,compName.indexOf(":NULL"));
		}
		compName = encodeURIComponent(compName);
		compToDelete = compName;
		var compNameWithType = obj.get('CompVariable');
		comptypeToDelete = selectedCType;
		selectedCType = encodeURIComponent(selectedCType);
		var tmpURL = "/final/admin/EgConfigEnv/data/EgdeleteserverpJson.jsp?performaction=true&refferalURL=AddComponent";
		tmpURL += "&fmanagewithcomptype="+compNameWithType+",&srvtype="+selectedCType+"&servertypes="+selectedCType+"&fmanage="+compName+",";
		tmpURL += "&componentDetails=&funmanage="+"&fromAction="+fromAction+"&comeFrom=addModifyglance";
		var tmpMask = new Ext.LoadMask(Ext.getBody(), {msg: updating+'...', maskCls:'modalWhiteBg'});
		tmpMask.show();
		Ext.Ajax.request(
		{
			url : tmpURL,
			method: 'POST',
			success: function(response)
			{
				tmpMask.hide();
				var jsonText = response.responseText;
				var resultObj = Ext.decode(jsonText);
				if (resultObj.requestStatus == "success")
				{
					var tmpObj = resultObj.result;
					Ext.Msg.show({
						title: glancePageTitle,
						msg: alertMsg37,
						buttons: Ext.Msg.OK,
						width: 400,
					//	icon: 'iconInformation',
						icon: 'gen-info size32 color-info',
					});
					me.getClassifiedComponents(classify);
				}
				else
				{
					var tmpObj = resultObj.errors;
					var errorText = me.getErrorMessageTemplate(tmpObj);
					me.showResultWindow(tmpObj.title,errorText,"delete");
				}
			},
			failure : function(response)
			{
				tmpMask.hide();
			}
		});
	},
	delComponent : function(isProceed)
	{
		var classify = '';
		if (fromAction.indexOf('_') != -1)
		{
			classify = fromAction.substring(fromAction.indexOf('_')+1);
		}
		var me = this;
		var selectedCType = encodeURIComponent(comptypeToDelete);
		var compNameWithType = selectedCType +":"+ compToDelete;
		var tmpURL = "/final/admin/EgConfigEnv/data/EgdeleteserverpJson.jsp?performaction=true&refferalURL=AddComponent";
		tmpURL += "&fmanagewithcomptype="+compNameWithType+",&srvtype="+selectedCType+"&servertypes="+selectedCType+"&fmanage="+compToDelete+",";
		tmpURL += "&componentDetails=&funmanage="+"&comeFrom=addModifyglance";
		if (isProceed != null && isProceed !== undefined && isProceed == true)
		{
			tmpURL += "&isProceed="+isProceed;
		}
		var tmpMask = new Ext.LoadMask(Ext.getBody(), {msg: updating+'...'});
		tmpMask.show();
		Ext.Ajax.request({
			url : tmpURL,
			method: 'POST',
			success: function(response)
			{
				tmpMask.hide();
				var jsonText = response.responseText;
				var resultObj = Ext.decode(jsonText);
				if (resultObj.requestStatus == "success")
				{
					var tmpObj = resultObj.result;
					Ext.Msg.show({
						title: tmpObj.title,
						width : 450,
						msg: tmpObj.message1,
						buttons: Ext.Msg.OK,
						//icon: 'iconInformation',
						icon: 'gen-info size32 color-info',
					});
					elemList = resultObj.elemList;
					me.getClassifiedComponents(classify);
				}
			},
			failure : function(response)
			{
				tmpMask.hide();
			}
		});
	},
	getErrorMessageTemplate :function(tmpObj)
	{
		var me = this;
		var tmpTable = "";
		if (tmpObj.allow != null && tmpObj.allow !== undefined && tmpObj.allow == true)
		{
			tmpTable = "";
			for (var key in tmpObj)
			{
				if (key == "title" || key == "allow") continue ;
				var errorMessage = tmpObj[key];
				tmpTable = tmpTable + errorMessage;
			}
		}
		else
		{
			tmpTable = '<div class="newTable" style="width:500px;"><table cellspacing="0" width="500px" cellpadding="5" border="0" align="center"><thead><tr><th>'
			+errorTitle+' : '+pageIntnl14+'</td></tr></thead><tbody>'
			for (var key in tmpObj)
			{
				if (key == "title") continue ;
				var errorMessage = tmpObj[key];
				tmpTable = tmpTable + '<tr style="background:transparent;"><td style="border:none;padding:5px;">'+errorMessage+'</td></tr>';
			}
			tmpTable = tmpTable + '</tbody></table></div>';
		}
		return tmpTable;
	},
	showResultWindow : function(title,resultText,action)
	{
		var me = this;
		var isProceed = false;
		Ext.Msg.show({
			title: glancePageTitle,
			msg: resultText,
			buttons: Ext.Msg.YESNO,
			shadow:false,
			//icon: 'iconConfirmation',
			icon: 'gen-question size32 color-question',
			fn: function(response) {
				if(response == 'yes') 
				{
					isProceed = true;
					if (action != null && action !== undefined && action == "delete")
					{
						me.delComponent(isProceed);
					}
				}
			}
		});
	},
	viewAssociatedEntities : function(action)
	{
		var me = this;
		Ext.widget("window",{
			extend: 'Ext.panel.Panel',
			title : associatedEntitiesTitle1,
			//ui:'newPopupWindow newplainHeader_border', 
			id:'assoEntitesWindow',
			width: '68%',
			//bodyPadding:'10 10 10 10',
			height: 350,
			modal : true,
			border : false,
			autoScroll:true,
			scroll:true,
			ghost:false,
			padding:'5 10 10 10',
			bodyPadding:'0 0 10 0',
			header:{
				//padding:'14 0 10 0',
				margin:'5 5 5 5',
			},
			closeAction: 'destory',
			doClose: function() {
				this.destroy();
			},
			listeners : {
				afterrender : function()
				{
					me.updateEntityAssociationPage(action);
				}
			},
			items:[
				{
					xtype: 'container',
					flex:1,
					id: 'entityAssociationContainer',
					margin: 10
				}
			]
		}).show();
	},
	updateEntityAssociationPage : function(action)
	{
		var me = this;
		var classify = '';
		if (fromAction.indexOf('_') != -1)
		{
			classify = fromAction.substring(fromAction.indexOf('_')+1);
		}
		var urlStr = "EgConfigEnv/data/EgComponentGroupedSummary.jsp?date="+new Date().getTime()+"&action="+action+"&srvtype="+comptypeToDelete+"&comeFrom=addModifyglance"+"&fromAction="+fromAction+"&classify="+classify;
		if (action != null && action !== undefined && (action == "showMod" || action == "showDel"))
		{
			urlStr += "&elemList=true"+"&hiddenElemList="+encodeURIComponent(elemList);
			Ext.getCmp('assoEntitesWindow').setTitle(associatedEntitiesTitle2);
		}
		else if (action != null && action !== undefined && action == "delete")
		{
			Ext.getCmp('assoEntitesWindow').setTitle(associatedEntitiesTitle1);
			var selectedCType = encodeURIComponent(comptypeToDelete);
			var fmngwithcomptype = selectedCType +":"+ compToDelete;
			urlStr += "&fmanage="+compToDelete+"&fmanagewithcomptype="+fmngwithcomptype;
		}
		var myMask = new Ext.LoadMask(Ext.getBody(), {msg: 'Updating...'});
		myMask.show();
		Ext.Ajax.request({
			url : urlStr,
			method: 'POST',
			success: function(response)
			{
				myMask.hide();
				var jsonText = response.responseText;
				var resultObj = Ext.decode(jsonText);
				me.updateResultPanel(resultObj);
			},
			failure : function(response)
			{
				myMask.hide();
			}
		});
	},
	updateResultPanel : function(resultObj)
	{
		var me = this;
		var entityAssociationCont = Ext.getCmp('entityAssociationContainer');
		entityAssociationCont.removeAll();

		var isElementsAssociated = resultObj['isElementsAssociated'];
		if (isElementsAssociated != undefined && isElementsAssociated == true)
		{
			var message = "<div>"+resultObj.usersGridArr+"</div>";
			Ext.getCmp('entityAssociationContainer').update(message);
		}
		else
		{
			var message = "<div class = \"gen-info size32 color-info\" style=\"margin:12% auto auto auto\"></div><div>No components associated.</div>";
			var tmpPanel = {
				xtype : 'component',
				width : '100%',
				border : false,
				style:{'text-align':'center'},
				html : message
			}
			entityAssociationCont.add(tmpPanel);
		}
	},
	unmanageComponent: function(cardLink, grid, rowIndex, colIndex)
	{
		var obj = grid.getStore().getAt(rowIndex);
		var selectedCType = obj.get('CompType');
		//var compName = obj.get('ComponentName');
		var compName = (selectedCType != null && selectedCType.toLowerCase() == "oracle_server") ? obj.get('DispCompName') : obj.get('ComponentName');

		if (compName.indexOf(":") < 0)
		{
			compName += ":NULL";
		}
		compName = encodeURIComponent(compName);

		if (!Ext.isEmpty(selectedCType) && selectedCType.indexOf('Agg_') == 0)
		{
			var requestURL = '/final/admin/aggConfigEnv.jsp?srvtype='+selectedCType+'&component='+compName;
			if (!Ext.isEmpty(cardLink))
			{
				requestURL += "&fromWizard="+cardLink;
			}
			window.location.href = requestURL;
		}
		else
		{
			window.location.href = "/final/admin/EgConfigEnv.jsp?srvtype="+selectedCType+"&component="+compName+"&fromWizard="+cardLink;
		}
	},
	pagingGridMainRender : function(publicJSON)
	{
		var me = this;
		Ext.getCmp('addCompButton').hide();
		Ext.getCmp('agentInstallerDwnld').hide();
		Ext.getCmp('compCountMsg').hide();
		Ext.getCmp('compGlanceSearch').hide();
		Ext.getCmp('card-1').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.detailedCompGlanceClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+glancePageTitle);
		if (!Ext.isEmpty(publicJSON.components))
		{
			var gridpanel = Ext.widget('allcomponentsgrid',{
				store:new Ext.data.Store({
					fields: [{name: 'DispCompName', sortType:Ext.data.SortTypes.asUCString},
						{name: 'Agent/Agentless', sortType:Ext.data.SortTypes.asUCString},
						'Configured',
						{name: 'MonitorStatus', sortType:Ext.data.SortTypes.asUCString},
						'Entity','DispCompName','DispIpName','ComponentName','Discovered','Managed','CompType','TestName','CompVariable','UnConfigTestType'],
					data: publicJSON.components,
					proxy: {
						type: "pagingmemory",
						reader: {
							type: "json"
						}
					},
					remoteFilter : true,
					remoteSort: true,
					autoLoad: true,
					pageSize : 50,
					simpleSortMode: true
				}),
				viewConfig: {
					forceFit: true,
					stripeRows : true
				},
				sortOnLoad: true,
				sorters: [{
					property: 'DispCompName',
					direction: 'DESC'
				}]
			});

			var resultPanelObj = Ext.getCmp('ComponentDetailGrid');
			resultPanelObj.show();
			resultPanelObj.removeAll();
			resultPanelObj.add(gridpanel);

			Ext.getCmp('compSearch').setDisabled(false);

			if (!publicJSON.hasMaintenancePolicyEnabled && !publicJSON.hasTestEnabled && !publicJSON.hasThreshEnabled)
			{
				gridpanel.columns[3].hide();
			}
			else
			{
				gridpanel.columns[3].show();
			}

			if (gridpanel.columns[6] !== undefined)
			{
				var isAllowIPModify = compGlanceJson.isAllowIPModify;
				if (publicJSON.hasComponentMangamentEnabled)
				{
					if (isAllowIPModify)
					{
						gridpanel.columns[6].show();
					}
					else
					{
						gridpanel.columns[6].hide();
					}
				}
				else
				{
					gridpanel.columns[6].hide();
				}
			}
		}
		else
		{
			var gridpanel = Ext.widget('allcomponentsgrid',{
				store:new Ext.data.Store({
					fields: [{name: 'DispCompName', sortType:Ext.data.SortTypes.asUCString},
						{name: 'Agent/Agentless', sortType:Ext.data.SortTypes.asUCString},
						'Configured',
						{name: 'MonitorStatus', sortType:Ext.data.SortTypes.asUCString},
						'Entity','DispCompName','DispIpName','ComponentName','Discovered','Managed','CompType','TestName','CompVariable','UnConfigTestType'],
					data: [],
					proxy: {
						type: "pagingmemory",
						reader: {
							type: "json"
						}
					},
					remoteFilter : true,
					remoteSort: true,
					autoLoad: true,
					pageSize : 50,
					simpleSortMode: true
				}),
				viewConfig: {
					forceFit: true,
					stripeRows : true
				},
				sortOnLoad: true,
				sorters: [{
					property: 'DispCompName',
					direction: 'DESC'
				}]
			});

			var resultPanelObj = Ext.getCmp('ComponentDetailGrid');
			resultPanelObj.show();
			resultPanelObj.removeAll();
			resultPanelObj.add(gridpanel);


			Ext.getCmp('compSearch').setDisabled(true);

			if (!publicJSON.hasMaintenancePolicyEnabled && !publicJSON.hasTestEnabled && !publicJSON.hasThreshEnabled)
			{
				gridpanel.columns[3].hide();
			}
			else
			{
				gridpanel.columns[3].show();
			}

			var noDataMsg = compGlanceJson.emptyMesssage;

			if (gridpanel.columns[6] !== undefined)
			{
				if (publicJSON.hasComponentMangamentEnabled)
				{
					var isAllowIPModify = compGlanceJson.isAllowIPModify;
					if (isAllowIPModify)
					{
						gridpanel.columns[6].show();
					}
					else
					{
						gridpanel.columns[6].hide();
					}
				}
				else
				{
					gridpanel.columns[6].hide();
				}
			}

			gridpanel.getStore().removeAll();
			gridpanel.store.loadData('');
			Ext.getCmp('compSearch').setDisabled(true);
			gridpanel.getView().emptyText = '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+noDataMsg+'</div></div>';
			gridpanel.getView().refresh();

		}

		Ext.getCmp('serverTitleLbl').update(publicJSON.serverTitleLbl);

		var classifyVal = Ext.getCmp('card-1').classify;
		
		if (!Ext.isEmpty(classifyVal) && classifyVal.toLowerCase() == 'all')
		{
			Ext.getCmp('filterBy').setValue('all');
		}
		else
		{
			if (!Ext.isEmpty(publicJSON.isShowOnlyConfigured))
			{
				if (publicJSON.isShowOnlyConfigured)
				{
					Ext.getCmp('filterBy').setValue('configured');
				}
				else
				{
					if (!Ext.isEmpty(classifyVal) && classifyVal.toLowerCase() == 'all')
					{
						Ext.getCmp('filterBy').setValue('all');
					}
					else
					{
						Ext.getCmp('filterBy').setValue('unconfigured');
					}
				}
			}
			else
			{
				Ext.getCmp('filterBy').setValue(classifyVal);
			}
		}
	},

	detailedCompGlanceClose : function()
	{
		var viewportObj = Ext.getCmp('viewport');
		viewportObj.removeAll();
		fromAction = "componentsGlance";
		isClassifyView = false;
		viewportObj.add({xtype:'adminwizard'});
	},

	gotoAddUserPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgAddUser.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},
	gotoModifyUserPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgChangeUserProfile.jsp?";

		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		window.location.href = requestURL; 
	},
	gotoDeleteUserPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgDeleteUser.jsp?";

		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		window.location.href = requestURL; 
	},
	gotoCloneUserPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgReplicateUser.jsp?";

		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		window.location.href = requestURL; 
	},

	gotoViewUserPage: function(cardLink)
	{
		var requestURL = "/final/admin/EgViewUser.jsp?";

		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		window.location.href = requestURL; 
	},

	compGlanceSearch : function()
	{
		var gridObj = Ext.getCmp('componentAtaGlanceView');
		var gridsearch = Ext.getCmp('compGlanceSearch').getValue();
		if (gridsearch == "" || gridsearch.length == 0)
		{
			Ext.get('MyTrigger_0').setStyle('display','none');
			Ext.get('MyTrigger_1').setStyle('display','block');
		}
		else
		{
			Ext.get('MyTrigger_1').setStyle('display','none');
			Ext.get('MyTrigger_0').setStyle('display','block');
		}

		if (gridsearch == "" || gridsearch.length == 0)
		{
			gridObj.store.clearFilter();
		}
		else
		{
			gridObj.store.clearFilter();
			var filterLogic = new Ext.util.Filter({
				filterFn: function(item) {
					var dispName = item.get('displayField');
					if (dispName.toLowerCase().indexOf(gridsearch.toLowerCase()) != -1)
					{
						return true
					}
				}
			});
			gridObj.store.filter(filterLogic);
		}

		if (Ext.isEmpty(gridObj.getStore().data.items))
		{
			Ext.getCmp('emptyCompMsg').update('<div class="emptyMsgDiv"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+compTypeSearchEmptyMsg+'.</div></div>');
			Ext.getCmp('emptyCompMsg').show();
			Ext.getCmp('componentAtaGlanceView').hide();
		}
		else
		{
			Ext.getCmp('emptyCompMsg').hide();
			Ext.getCmp('componentAtaGlanceView').show();
		}
		//gridObj.doLayout();
	},

	getClassifiedComponents: function(obj)
	{
		var compType = Ext.getCmp('card-1').selectedType;
		var classify = obj;
		if (Ext.isObject(obj))
		{
			classify = obj.getValue();
		}
		fromAction = "componentsGlance_"+classify;

		var myMask = new Ext.LoadMask(Ext.getCmp('allcomponentsgrid').getView(), {msg: 'Loading...', maskCls:'modalWhiteBg'});
		myMask.show();

		Ext.Ajax.request({
			url:"/final/admin/LimitedAdminHome/data/EgShowAllServerJson.jsp?server="+compType+"&fromAction="+fromAction+"&classify="+classify,
			async:true,
			success:function(response)
			{
				compGlanceJson = Ext.decode(response.responseText);
				Ext.getCmp('serverTitleLbl').update(compGlanceJson.serverTitleLbl);
				var moreGridObj = Ext.getCmp('allcomponentsgrid');
				if (!compGlanceJson.hasMaintenancePolicyEnabled && !compGlanceJson.hasTestEnabled && !compGlanceJson.hasThreshEnabled)
				{
					moreGridObj.columns[3].hide();
				}
				else
				{
					moreGridObj.columns[3].show();
				}

				if (!Ext.isEmpty(compGlanceJson.components))
				{
					Ext.getCmp('compSearch').setDisabled(false);
					moreGridObj.getStore().removeAll();
					moreGridObj.getStore().loadRawData(compGlanceJson.components);
					moreGridObj.getStore().setProxy({type: "pagingmemory", enablePaging: true, data:compGlanceJson.components}); 

				}
				else
				{
					var noDataMsg = compGlanceJson.emptyMesssage;
					moreGridObj.getStore().removeAll();
					moreGridObj.store.loadData('');
					Ext.getCmp('compSearch').setDisabled(true);
					moreGridObj.getView().emptyText = '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+noDataMsg+'</div></div>';
					moreGridObj.getView().refresh();
				}
				myMask.hide();
			},
			failure: function(response)
			{
				myMask.hide();
			}
		});
	},
	moreComponentSearch: function(val)
	{
		var gridObj = Ext.getCmp('allcomponentsgrid');
		var value = val;
		//if (value == "" || value.length == 0)
		//{
			//Ext.get('MyTrigger_0').setStyle('display','none');
			//Ext.get('MyTrigger_1').setStyle('display','block');
		//}
		//else
		//{
			//Ext.get('MyTrigger_1').setStyle('display','none');
			//Ext.get('MyTrigger_0').setStyle('display','block');
		//}

		if (value == "" || value.length == 0)
		{
			gridObj.store.clearFilter();
		}
		else
		{
			gridObj.store.clearFilter();
			var filterLogic = new Ext.util.Filter({
				filterFn: function(item) {
					var testName = item.get('ComponentName');
					var dispName = testName;
					if (dispName.toLowerCase().indexOf(value.toLowerCase()) != -1)
					{
						return true
					}
				}
			});
			gridObj.store.filter(filterLogic);
		}
		gridObj.doLayout();
	},
	loadComponentSummaryData:function(compType)
	{
		var componentSummaryGrid1 = this.getComponentSummaryGrid();
		var componentSummaryGrid = this.getComponentSummary();
		var queryString="";
		{
			queryString='/final/admin/LimitedAdminHome/data/EgShowAllServerJson.jsp?limit=15&server='+compType;
		}
		//end
		var loader = new Ext.LoadMask(componentSummaryGrid,{msg:"Loading...", maskCls:'modalWhiteBg'});
		loader.show();

		
		var infoRandomNo ;
		infoRandomNo = Math.random();
		queryString = queryString+"&infoRandom="+infoRandomNo;

		Ext.Ajax.request({
			url : queryString,
			scope:this,
			async:true,
		    success: function(response){
				var jsonText = response.responseText;
				var jsonData=Ext.decode(jsonText);

				this.getComponentSummaryStore().pageSize = parseInt(jsonData.eventsPerPage);
				this.getComponentSummaryStore().getProxy().data = jsonData;

				this.getComponentSummaryStore().load();

				loader.hide();


		//Ajax Request For Count TotalRecords...

				Ext.Ajax.request({
					url : queryString+"&count=true",
					async:false,
					success: function(response)
					{
						var jsonText = response.responseText;
					
						//totalRecords=30;
						var ttlPages;

						jsonText = jsonText.substring(0,jsonText.indexOf("|"));
						if(jsonText.indexOf("^")>=0)
						{
							pageCount = jsonText.substring(0,jsonText.indexOf("^"));
							ttlPages = jsonText.substring((jsonText.indexOf("^")+1),jsonText.lastIndexOf("^")).trim();
						
							recCount = jsonText.substring((jsonText.lastIndexOf("^")+1)).trim();
						}
						else
							ttlPages = 0;

						var ptot = Ext.getCmp("paginationTotals");

						var comp = Ext.getCmp("totalPg");
						totalRecords = ttlPages;
						ptot.setValue(currentPageNo);
						comp.setText(" of "+ttlPages);
							
						if(ttlPages==0)
						{
							var disp = Ext.getCmp("displayInfo");
							var msg = "";
							disp.setText(msg);
							var dPage= Ext.getCmp("dockedPagnation");
							dPage.setVisible(false);
						}
						else
						{
							var dPage= Ext.getCmp("dockedPagnation");
							dPage.setVisible(true);
							var disp = Ext.getCmp("displayInfo");
						
							if(pageCount==null || pageCount=="")
							{
								disp.setText("");
							}
							else
							{
								var msg = "Displaying "+(""+1)+"-"+pageCount+" of "+parseInt(recCount);
								disp.setText(msg);
							}
						}

						//validate..
						var first = Ext.getCmp("pfirst");
						var prev = Ext.getCmp("pprev");
						first.disabled=true;
						prev.disabled=true;

						if(parseInt(totalRecords)==1)
						{
							var next = Ext.getCmp("pnext");
							var last = Ext.getCmp("plast");
							next.disabled=true;
							last.disabled=true;
						}
					}
				});
			}
		});
	},
	buildMainData : function()
	{
		Ext.Ajax.request({
			url : '/final/admin/LimitedAdminHome/data/EgAdminOperationsJson.jsp?fromAction='+fromAction,
			method : 'POST',
			async: false,
			success: function(response)
			{
				var jsonText = response.responseText;
				publicJson = Ext.decode(jsonText);
				if (!Ext.isEmpty(via) && via == 'register' && sendUserDataToCMS != null && sendUserDataToCMS == 'true')
				{
					var firstName = publicJson['firstName'];
					var lastName = publicJson['lastName'];
					var email = publicJson['email'];
					var phoneNo = publicJson['phoneNo'];
					var comp = publicJson['comp'];
					var timeZone = publicJson['timeZone'];
					var pass = publicJson['pass'];

					jQuery.ajax({
						type: "POST",
						async: true,
						url: "https://www.eginnovations.com/company/whs_reg_collector_cloud.php",
						data: {
							'First_Name': firstName,
							'Last_Name': lastName,
							'Email': email,
							'Phone': phoneNo,
							'Company_Name': comp,
							'Time_Zone': timeZone,
							'Password': pass
						},
						cache: false,
						success: function(result){
							via = '';
						},
						error: function(error)
						{
							//console.log(error);
						}
					});
				}
			}
		});
	},

	gotoMoreComponents:  function(classify,compType)
	{
		appCnt.refreshCompGlance("stop");
		if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
		{
			Ext.getCmp('WhatNextObj').destroy();
		}
		Ext.suspendLayouts();
		var innerCardObj = Ext.getCmp('card-1');
		innerCardObj.removeAll();
		innerCardObj.classify = classify;
		innerCardObj.selectedType = compType;
		innerCardObj.add({
				xtype: 'ComponentDetailGrid'
		});
		Ext.resumeLayouts(true);
	},
	
	refreshCompGlance : function(action)
	{
		if (action == 'stop')
		{
			if (!Ext.isEmpty(compTask))
			{
				compTask.stop();
			}
		}
		else
		{
			compTask.start();
		}
	},

	configureRemoteAgents: function(cardLink) 
	{
		var requestURL = "/final/admin/EgRemoteAgents.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	configureRUMDataCollectors: function(cardLink)
	{
		var requestURL = "/final/admin/EgRUMCollector.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	downloadVMAgents: function(cardLink)
	{
		var requestURL = "/final/admin/EgDownloadAgentPack.jsp?from=VM";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "&fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoAggComponentsPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgAggregateTree.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoAggManageComponentsPage: function(cardLink) 
	{
		var requestURL = "/final/admin/aggConfigEnv.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoComponentsPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgDispServer.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoManageComponentsPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgConfigEnv.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoMaintenancePolicyPage: function(cardLink,compType,sCompName) 
	{
		var requestURL = "/final/admin/QuickMaintenance.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		if (!Ext.isEmpty(compType))
		{
			requestURL += "&server="+compType;
		}

		if (!Ext.isEmpty(sCompName))
		{
			requestURL += "&compName="+sCompName;
		}
		window.location.href = requestURL; 
	},

	gotoServicesPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgComponentServices.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoSegmentsPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgComponentSegments.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoGroupsPage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgComponentGroups.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	gotoZonePage: function(cardLink) 
	{
		var requestURL = "/final/admin/EgComponentZones.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	specificExternalAgentsWindow: function(cardLink) 
	{
		var requestURL = "/final/admin/EgExternalAgents.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}
		window.location.href = requestURL; 
	},

	specificThresholdConfigWindow: function(cardLink,strCompVariable,sCompName,testName,sCompType) 
	{
		var requestURL = "/final/admin/EgSpecificThresh.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		if (!Ext.isEmpty(sCompType))
		{
			requestURL += "&server="+sCompType;
		}

		if (!Ext.isEmpty(sCompName))
		{
			requestURL += "&compName="+sCompName;
		}
		window.location.href = requestURL;
	},

	specificTestConfigWindow: function(cardLink,sCompType,sCompName,testType) 
	{
		var requestURL = "/final/admin/EgSpecificTestConfiguration.jsp?";
		if (!Ext.isEmpty(cardLink))
		{
			requestURL += "fromWizard="+cardLink;
		}

		if (!Ext.isEmpty(sCompType))
		{
			requestURL += "&componentType="+sCompType;
		}

		if (!Ext.isEmpty(testType))
		{
			requestURL += "&testType="+testType;
		}

		if (!Ext.isEmpty(sCompName))
		{
			sCompName = sCompName.substring(sCompName.indexOf(":") +1);
			requestURL += "&componentName="+sCompName;
		}
		window.location.href = requestURL; 
	},

	processView: function(obj)
	{
		Ext.Ajax.request({
			url : '/final/admin/LimitedAdminHome/data/EgConfigEnvJson.jsp?fromAction='+fromAction,
			method : 'POST',
			success: function(response)
			{
				var jsonText = response.responseText;
				compGlanceJson = Ext.decode(jsonText);
				var infoGridObj = Ext.getCmp('componentAtaGlanceView');
				var infoGridData = compGlanceJson['compTypeSummaryData'];
				var totalComp = compGlanceJson['totalcount'];
				var unConfigCompCountMsg = compGlanceJson['unConfiguredTestsCount'];

				var svg = d3.select('#dashmenu_model_id');
				var menuitem = svg.selectAll('.menuitemC');

				var menuArr = new Array();
				menuitem.each(function(d,i){
					menuArr.push(d.ItemNo);
				});

				appCnt.compGlanceSearch();

				if(!Ext.isEmpty(infoGridData))
				{
					var compCntMsg = totalComp;
					if (!Ext.isEmpty(unConfigCompCountMsg))
					{
						compCntMsg += ' | '+unConfigCompCountMsg;
					}
					Ext.getCmp('compCountMsg').update('<div class="aPanelSmallText" style="font-size:14px;">'+compCntMsg+'</div>');
					Ext.getCmp('compCountMsg').show();
					Ext.getCmp('emptyCompMsg').hide();
					infoGridObj.getStore().removeAll();
					infoGridObj.getStore().loadRawData(infoGridData);
					infoGridObj.show();
					var compView = Ext.getCmp('componentAtaGlanceView');
					compView.fireEvent('viewready', compView);

					if (Ext.isEmpty(Ext.getCmp('proxyDetailsWinForProxy')))
					{
						if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
						{
							Ext.getCmp('WhatNextObj').destroy();
						}
						Ext.getCmp('card-1').add({
							xtype: 'WhatNext',
							id:'WhatNextObj',
						});
						if (Ext.Array.contains(menuArr,0))
						{
							Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div ><ol class="listCount"><li>'+compAtAGlanceWhatNextLinkMsg+' <a class="whatNextLink" href="javascript:void(0)" onclick="javascript:appCnt.installAgentClick()">'+compAtAGlanceWhatNextLink+'</a> now'+'.</li><li>'+compAtAGlanceWhatNext+'.</li></ol></div>');
							Ext.getCmp('WhatNextObj').setWidth(250);
							Ext.getCmp('WhatNextObj').setHeight(160);
						}
						else
						{
							if (hideDownloadInstaller)
							{
								Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div ><ol class="listDefault"><li>'+compAtAGlanceWhatNext+'.</li></ol></div>');
								Ext.getCmp('WhatNextObj').setWidth(250);
								Ext.getCmp('WhatNextObj').setHeight(110);
							}
							else
							{
								Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div ><ol class="listCount"><li>'+compAtAGlanceWhatNextLinkMsg+' <a class="whatNextLink" href="javascript:void(0)" onclick="javascript:appCnt.installAgentClick()">'+compAtAGlanceWhatNextLink+'</a> now'+'.</li><li>'+compAtAGlanceWhatNext+'.</li></ol></div>');
								Ext.getCmp('WhatNextObj').setWidth(250);
								Ext.getCmp('WhatNextObj').setHeight(160);
							}
						}
					}
				}
				else
				{
					Ext.getCmp('card-1').setTitle(glancePageTitle);
					infoGridObj.getStore().removeAll();
					infoGridObj.store.loadData('');
					Ext.getCmp('emptyCompMsg').update('<div class="emptyMsgDiv"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+noManageCompMsg+'.</div></div>');
					Ext.getCmp('emptyCompMsg').show();
					infoGridObj.hide();
					Ext.getCmp('compCountMsg').hide();

					if (Ext.isEmpty(Ext.getCmp('proxyDetailsWinForProxy')))
					{
						if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
						{
							Ext.getCmp('WhatNextObj').destroy();
						}

						Ext.getCmp('card-1').add({
							xtype: 'WhatNext',
							id:'WhatNextObj',
						});

						if (Ext.Array.contains(menuArr,0))
						{
							Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+compAtAGlanceWhatNextTitle+'</div><div><ol class="listCount"><li>'+compAtAGlanceEmptyWhatNext+'</li><li>'+compAtAGlanceEmptyWhatNext0+'</li><li>'+compAtAGlanceEmptyWhatNext1+'</li><li>'+compAtAGlanceEmptyWhatNext2+'</li><li>'+compAtAGlanceEmptyWhatNext3+'</li></ol></div>');
							Ext.getCmp('WhatNextObj').setWidth(250);
							Ext.getCmp('WhatNextObj').setHeight(270);
						}
						else
						{
							if (hideDownloadInstaller)
							{
								Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div ><ol class="listDefault"><li>'+compAtAGlanceWhatNext+'.</li></ol></div>');
								Ext.getCmp('WhatNextObj').setWidth(250);
								Ext.getCmp('WhatNextObj').setHeight(110);
							}
							else
							{
								Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+compAtAGlanceWhatNextTitle+'</div><div><ol class="listCount"><li>'+compAtAGlanceEmptyWhatNext+'</li><li>'+compAtAGlanceEmptyWhatNext0+'</li><li>'+compAtAGlanceEmptyWhatNext1+'</li><li>'+compAtAGlanceEmptyWhatNext2+'</li><li>'+compAtAGlanceEmptyWhatNext3+'</li></ol></div>');
								Ext.getCmp('WhatNextObj').setWidth(280);
								Ext.getCmp('WhatNextObj').setHeight(220);
							}
						}
					}
				}
				if (Ext.isEmpty(Ext.getCmp('proxyDetailsWinForProxy')))
				{
					Ext.getCmp('WhatNextObj').show();
				}
			},
			failure : function(response)
			{
			}
		});
	},

	installAgentClick : function()
	{
		if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
		{
			Ext.getCmp('WhatNextObj').destroy();
		}

		Ext.getCmp('card-1').add({
			xtype: 'WhatNext',
			id:'WhatNextObj',
		});

		if (hideDownloadInstaller)
		{
			Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+compAtAGlanceWhatNextTitle+'</div><div><ol class="listCount"><li>'+compAtAGlanceEmptyWhatNext+'</li><li>'+compAtAGlanceEmptyWhatNext0+'</li><li>'+compAtAGlanceEmptyWhatNext1+'</li><li>'+compAtAGlanceEmptyWhatNext2+'</li><li>'+compAtAGlanceEmptyWhatNext3+'</li></ol></div>');
			Ext.getCmp('WhatNextObj').setWidth(250);
			Ext.getCmp('WhatNextObj').setHeight(270);
		}
		else
		{
			Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+compAtAGlanceWhatNextTitle+'</div><div><ol class="listCount"><li>'+compAtAGlanceEmptyWhatNext+'</li><li>'+compAtAGlanceEmptyWhatNext0+'</li><li>'+compAtAGlanceEmptyWhatNext1+'</li><li>'+compAtAGlanceEmptyWhatNext2+'</li><li>'+compAtAGlanceEmptyWhatNext3+'</li></ol></div>');
			Ext.getCmp('WhatNextObj').setWidth(280);
			Ext.getCmp('WhatNextObj').setHeight(220);
		}
		Ext.getCmp('whatNextClose').update('<div style="position:absolute;top:-7px;right:-7px;overflow:visible"><img src="/final/images/spacer.gif" class="awCloseWhite" id="whatNextClose" onclick="javascript:appCnt.WhatNextCloseForCompGlance();"/></div>');
		Ext.getCmp('WhatNextObj').show();
	},

	WhatNextCloseForCompGlance : function()
	{
		if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
		{
			Ext.getCmp('WhatNextObj').destroy();
		}

		Ext.getCmp('card-1').add({
			xtype: 'WhatNext',
			id:'WhatNextObj',
		});

		Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div ><ol class="listCount"><li>'+compAtAGlanceWhatNextLinkMsg+' <a class="whatNextLink" href="javascript:void(0)" onclick="javascript:appCnt.installAgentClick()">'+compAtAGlanceWhatNextLink+'</a> now'+'.</li><li>'+compAtAGlanceWhatNext+'.</li></ol></div>');
		Ext.getCmp('WhatNextObj').setWidth(250);
		Ext.getCmp('WhatNextObj').setHeight(180);
		Ext.getCmp('WhatNextObj').show();
	},

	loadMonitors : function(obj)
	{
		if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
		{
			Ext.getCmp('WhatNextObj').destroy();
		}

		if (!Ext.isEmpty(obj))
		{
			Ext.Ajax.request({
				url : '/final/admin/LimitedAdminHome/data/EgMonitorsJson.jsp?fromAction='+fromAction,
				success: function(response)
				{
					publicMonitorsJSON = Ext.decode(response.responseText);
					var data = publicMonitorsJSON['MonitorsList'];
					Ext.getCmp('monitorsView').getStore().suspendEvents(true);
					Ext.getCmp('monitorsView').getStore().loadRawData(data);
					Ext.getCmp('monitorsView').getStore().resumeEvents();
				}
			});
		}
	},

	WhatNextClose :function()
	{
		Ext.getCmp('WhatNextObj').hide();
	},

	loadManageUser : function(obj)
	{
		if (!Ext.isEmpty(obj))
		{
			Ext.Ajax.request({
				url : '/final/admin/LimitedAdminHome/data/EgMenuItems.jsp?from=userManage&fromAction='+fromAction,
				method: 'POST',
				success: function(response)
				{
					var jsonText = response.responseText;
					publicJSON = Ext.decode(jsonText);
					Ext.getCmp('manageUserItems').getStore().loadRawData(publicJSON.userManageItems);

					if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
					{
						Ext.getCmp('WhatNextObj').destroy();
					}

					Ext.getCmp('card-4').add({
						xtype: 'WhatNext',
						id:'WhatNextObj',
					});
					Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div><ol class="listDefault"><li>'+manageUsersWhatNext+'.</li></ol></div>');
					Ext.getCmp('WhatNextObj').setWidth(250);
					Ext.getCmp('WhatNextObj').setHeight(90);
					Ext.getCmp('WhatNextObj').show();
				}
			});
		}
	},

	gotoApplicationServers : function(monitors)
	{
		if (monitors == 'Office365' && office365Model == 'basic')
		{
			sessionStorage.setItem("remoteAgent",remoteAgenForO365);
			appCnt.gotoAgentlessDiscoveryServers(monitors);
		}
		else if (monitors == 'Docker')
		{
			Ext.suspendLayouts();
			var innerCardObj = Ext.getCmp('card-0');
			innerCardObj.removeAll();
			innerCardObj.monitors = monitors;
			innerCardObj.add({
				xtype: 'EgDockerView'
			});
			Ext.resumeLayouts(true);
		}
		else
		{
			Ext.suspendLayouts();
			var innerCardObj = Ext.getCmp('card-0');
			innerCardObj.removeAll();
			innerCardObj.monitors = monitors;
			innerCardObj.add({
				xtype: 'EgDiscoverServersView'
			});
			Ext.resumeLayouts(true);
		}
	},
	
	modifyMSOfficeConfiguration : function(type,hostname)
	{
		Ext.suspendLayouts();
		var innerCardObj = Ext.getCmp('card-0');
		innerCardObj.removeAll();
		innerCardObj.add({
			xtype: 'EgMSOfficeServersView'
		});

		remoteAgent = sessionStorage.getItem("remoteAgent");

		Ext.getCmp('resultPanel').add({
			xtype: 'EgMSOfficeConfigurations',
			listeners:{
				boxready:function() 
				{
					comeFrom = "null";
					var monitors = Ext.getCmp('card-0').monitors;
					fromAction = "monitors_"+monitors+":"+"category";
					Ext.getCmp('addCompButton').hide();
					if (office365Model == 'basic')
					{
						Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.gotoApplicationServers(\'Office365\')"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeTitle);
					}
					else
					{
						Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessComponentConfigClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeInnerTitle+' '+remoteAgent);
					}
					if (!Ext.isEmpty(hostname) && hostname.toLowerCase() != 'new')
					{
						Ext.getCmp('O365_User_Name').focus();
					}
					else
					{
						Ext.getCmp('hostname').focus();
					}
				}
			}
		});

		var urlStr = 'NewComponent/data/EgNewServerJson.jsp?&serverType='+encodeURIComponent('MS_Office_365')+'&selectedServerGroup='+'all'+'&server=new';

		Ext.Ajax.request({
			url: urlStr,
			method: 'POST',
			async:false,
			success: function( response )
			{
				if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
				{
					var jsonText = response.responseText;
					publicJSONMSOffice = Ext.decode( jsonText );
				}
			}
		});

		if (!Ext.isEmpty(hostname) && hostname.toLowerCase() != 'new')
		{
			var configuredServerValues = jsonMsOffice['testConfigParamsForServer'];
			var compDetailsObj = jsonMsOffice['compDetailsObj'];

			if (!Ext.isEmpty(configuredServerValues))
			{
				var selectedConfigureComp = configuredServerValues[hostname];
				var selectedCompDetails = compDetailsObj[hostname];
				for (var i in selectedConfigureComp) 
				{
					if (selectedConfigureComp.hasOwnProperty(i)) 
					{
						var extCompName = i.substring(1);
						var objName = Ext.getCmp(extCompName);
						if (!Ext.isEmpty(objName))
						{
							var objValue = selectedConfigureComp[i];
							objName.setValue(objValue);
						}
					}
				}

				var hostIp = selectedCompDetails[0];
				var hostNick = selectedCompDetails[1];

				Ext.getCmp('hostip').setValue(hostIp);
				Ext.getCmp('hostip').setReadOnly(true);

				Ext.getCmp('hostname').setValue(hostNick);
				Ext.getCmp('hostname').setReadOnly(true);

				Ext.getCmp('hostip').setFieldLabel(office365HostIPLbl);
				Ext.getCmp('hostname').setFieldLabel(office365HostNameLbl);
				Ext.getCmp('O365_User_Name').setFieldLabel(office365UNameLbl);
				Ext.getCmp('O365_Password').setFieldLabel(office365PwdLbl);
			}
		}
		else
		{
			Ext.getCmp('hostip').setValue('portal.office.com');
			Ext.getCmp('hostname').setValue('');
			Ext.getCmp('O365_User_Name').setValue('');
			Ext.getCmp('O365_Password').setValue('');
			Ext.getCmp('Domain_User_Name').setValue('none');
			Ext.getCmp('Domain_Password').setValue('none');
			Ext.getCmp('Domain_Name').setValue('none');
			Ext.getCmp('Proxy_Host').setValue('none');
			Ext.getCmp('Proxy_Port').setValue('none');
			Ext.getCmp('Proxy_User_Name').setValue('none');
			Ext.getCmp('Proxy_Password').setValue('none');
		}

		if (jsonMsOffice.showValidateButton)
		{
			Ext.getCmp('validateMSOff').show();
		}
		else
		{
			Ext.getCmp('validateMSOff').hide();
		}

		Ext.resumeLayouts(true);
		officeProperties = new Object();
	},

	gotoMSOfficeConfiguration : function(modifyJson)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");

		if (office365Model == 'basic')
		{
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeTitle);
		}
		else
		{
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.goToDiscoverServers(event,\''+'SaaSApp'+'\',\''+remoteAgent+'\')"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeInnerTitle+' '+remoteAgent);
		}
		Ext.getCmp('addCompButton').hide();
		Ext.getCmp('hostip').setValue('portal.office.com');
		//Ext.getCmp('O365_User_Name').setValue('$unconfigured');
		//Ext.getCmp('O365_Password').setValue('$unconfigured');
		Ext.getCmp('Domain_User_Name').setValue('none');
		Ext.getCmp('Domain_Password').setValue('none');
		Ext.getCmp('Domain_Name').setValue('none');
		Ext.getCmp('Proxy_Host').setValue('none');
		Ext.getCmp('Proxy_Port').setValue('none');
		Ext.getCmp('Proxy_User_Name').setValue('none');
		Ext.getCmp('Proxy_Password').setValue('none');
		Ext.getCmp('hostname').focus();

		if (jsonMsOffice.showValidateButton)
		{
			Ext.getCmp('validateMSOff').show();
		}
		else
		{
			Ext.getCmp('validateMSOff').hide();
		}

		var urlStr = 'NewComponent/data/EgNewServerJson.jsp?&serverType='+encodeURIComponent('MS_Office_365')+'&selectedServerGroup='+'all'+'&server=new';

		Ext.Ajax.request(
		{
			url: urlStr,
			method: 'POST',
			async:false,
			success: function( response )
			{
				if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
				{
					var jsonText = response.responseText;
					publicJSONMSOffice = Ext.decode( jsonText );
				}
			}
		});
		//appCnt.loadMonitorsData();
	},

	submitMSConfigurations : function()
	{
		var isValid = this.addComponentValidation(true);
		if (!isValid)
		{
			return;
		}
	},

	addComponentValidation : function(isAdd)
	{
		var me= this;
		var compNickObj = Ext.getCmp('hostname');
		var compNickVal = compNickObj.getValue();
		var compSuffixObj = ['_365','_spo','_exo','_sbo','_mtm','_odb'];
		msOfficeTitle = Ext.getCmp('EgMSOfficeConfigurations').title;

		//for(var i = 0; i < compSuffixObj.length; i++)
		{
			if(isDoubleByteMgr=="false")
			{
				if(!validateSingleByte(compNickVal))
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: alertMsg1,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						//width: 700,
						fn: function(response) {
							if(response == 'ok') {
								compNickObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			var hostIpObj = Ext.getCmp('hostip');
			var hostIpVal = Ext.getCmp('hostip').getValue();
			
			if(!publicJSONMSOffice.hideHostIPField && !checkblank(hostIpVal))
			{
				if (isAllowHostName=='false')
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: alertMsg18,
						width: 300,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								hostIpObj.focus(true);
							}
						}
					});
				}
				else
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: alertMsg19,
						buttons: Ext.Msg.OK,
						width: 300,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								hostIpObj.focus(true);
							}
						}
					});
				}
				return false;
			}
			else if(!publicJSONMSOffice.hideHostIPField && isAllowHostName=='false' && validateIpAddressExtjs(hostIpVal) != '0')
			{
				var updateValue = validateIpAddressExtjs(hostIpVal);
				if(updateValue == "1")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "5")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkspaceIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "6")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkAlpha,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "7")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "8")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _valIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "9")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _validateIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "10")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checknum,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSONMSOffice.hideHostIPField && isAllowHostName=='true' && validateHostFieldExtjs(hostIpVal) != '0')
			{
				var updateValue =  validateHostFieldExtjs(hostIpVal);
				if(updateValue == "1")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "5")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkspaceIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "6")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkAlpha,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "7")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "8")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _valIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "9")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _validateIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "10")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checknum,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "11")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _chkIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "12")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _doubleColon,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "13")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _grpIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "14")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _digitIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "15")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _validateIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "16")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkNumberLabel,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "17")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSONMSOffice.hideHostIPField && isAllowHostName=='true' && checkspaceExtjs(hostIpVal) != '0')
			{
				var updateValue = checkspaceExtjs(hostIpVal);
				if(updateValue == "17")
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSONMSOffice.hideHostIPField && isAllowHostName=='true' && checkSpecialExtjs(hostIpVal,"`~!@#$%^&*()+={}[]|\\;\"\'<>,?/") != '0') 
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(isAllowHostName=='true' && !this.checkForHostType(compNickVal))
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: alertMsg20 + alertMsg21,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(!checkblank(compNickVal))
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: alertMsg22,
					buttons: Ext.Msg.OK,
					width:200,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
			//else if(!checkForNameWithSuffix(compNickVal,compSuffix))
			//{
				//Ext.Msg.show({
					//title: msOfficeTitle,
					//msg:alertMsg50+' '+compSuffix,
					//buttons: Ext.Msg.OK,
					//icon: 'gen-warning size32 color-warning',
					//fn: function(response) {
						//if(response == 'ok') {
							//compNickObj.focus(true);
						//}
					//}
				//});
				//return false;
			//}
			else if(checkspaceExtjs(compNickVal) != '0')
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: "Space is not allowed",
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(checkSpecialExtjs(compNickVal,"`~!@#$%^&*()+={}[]|\\:;\"\'<>,?/") != '0') 
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(compNickVal.toLowerCase() == "none")
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: "You are not allowed to use eG reserved keyword \'"+compNickVal+"\' as component name",
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
			else if (!this.checkForHostType(compNickVal))
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: alertMsg20 + alertMsg21,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
			else if(!this.checkdots(compNickVal))
			{
				compNickObj.focus(true);
				return;
			}
			else if(!this.isValidateHostName(compNickVal))
			{
				if(compNickVal != hostIpVal)
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: alertMsg25,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								compNickObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			if (this.validateHostNameWithRemote(compNickVal))
			{
				//Ext.getCmp("enableRemoteAgent").setValue(false);
				return false;
			}

			var result = this.validateConfigParams();
			if (!result.success)
			{
				Ext.Msg.show({
					title: msOfficeTitle,
					msg: result.msg,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							result.component.focus(true);
						}
					}
				});
				return false;
			}
		}
		if (isAdd)
		{
			me.actualAdd();
		}
		else
		{
			return true;
		}
	},
	isCheckEgKeywords: function(value)
	{
		var paramval = value.toString().toLowerCase();
		var tcKey = "";
		var tcKeyWordCaught =  false;
		var tcKeywords = ['$unconfigured','$pattern','$adminport','$unconfig','$delay','$domain','$fromid','$homedir','$processname:$pattern','$processname:$processpattern','$hostname','$user','$remotefile','$rootpath','$servername','$servicename','$community','$toid','$name:$url','$url','$username','$webserverportno','$webserverport','$password','$passwd','$dbhost','$dbport','$database','$name:$pattern','(EG_RUNTIME)','$hostIp:$portNo'];
		for (var z=0;z<tcKeywords.length;z++)
		{
			tcKey = tcKeywords[z].toLowerCase();
			if (paramval == tcKey)
			{
				tcKeyWordCaught = true;
				break;
			}
			if (tcKey.indexOf(":") != -1)
			{
				var splitKey = tcKey.split(":");
				var key1 = "";
				for(var i =0 ; i < splitKey.length;i++)
				{
					key1 = splitKey[i]+"";
					if (paramval == key1)
					{
						tcKeyWordCaught = true;
					}
				}

				if(tcKeyWordCaught)
				{
					break;
				}
			}
		}
		return tcKeyWordCaught;
	},
	validateConfigParams : function()
	{
		var object = { success:true,msg:''};
		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";

		var msO365UnameObj = Ext.getCmp('O365_User_Name');
		var msO365Uname = msO365UnameObj.getValue();
		if(!checkblank(msO365Uname))
		{
			object.success = false;
			object.msg = office365Lbl8;
			object.component = msO365UnameObj;
			return object;
		}
		else if(this.isCheckEgKeywords(msO365Uname))//replaced checkspecial by checkSpecialExtjs fn
		{
			object.success = false;
			object.msg = _tcKeyword;
			object.component = msO365UnameObj;
			return object;
		}
		else if(checkSpecialExtjs(msO365Uname,"#$%^&*+={}|:;\"\'<>,\/") != '0')//replaced checkspecial by checkSpecialExtjs fn
		{
			object.success = false;
			object.msg = validationMsg13;
			object.component = msO365UnameObj;
			return object;
		}
		
		var msO365PwdObj = Ext.getCmp('O365_Password');
		var msO365Pwd = msO365PwdObj.getValue();
		if(msO365Pwd == "")
		{
			object.success = false;
			object.msg = validationMsg38;
			object.component = msO365PwdObj;
			return object;
		}
		else if(checkspaceExtjs(msO365Pwd) != '0')
		{
			object.success = false;
			object.msg = _checkblank;
			object.component = msO365PwdObj;
			return object;
		}
		else if(this.isCheckEgKeywords(msO365Pwd))
		{
			object.success = false;
			object.msg = _tcKeyword;
			object.component = msO365PwdObj;
			return object;
		}

		var domainUserNameObj = Ext.getCmp('Domain_User_Name');
		var domainUserName = domainUserNameObj.getValue();

		if(!checkblank(domainUserName))
		{
			object.success = false;
			object.msg = _checkempty;
			object.component = domainUserNameObj;
			return object;
		}
		else if(this.isCheckEgKeywords(domainUserName))
		{
			object.success = false;
			object.msg = _tcKeyword;
			object.component = domainUserNameObj;
			return object;
		}
		else if (!checkspecialnomess(domainUserName,"@*+=|:;\"\'<>\/[]?,"))
		{
			object.success = false;
			object.msg = validationMsg13;
			object.component = domainUserNameObj;
			return object;
		}
		else if (domainUserName.indexOf("..") > -1)
		{
			object.success = false;
			object.msg = _checkdots;
			object.component = domainUserNameObj;
			return object;
		}
		else if (domainUserName.indexOf("  ") > -1)
		{
			object.success = false;
			object.msg = _checkSpaces;
			object.component = domainUserNameObj;
			return object;
		}

		var domainPwdObj = Ext.getCmp('Domain_Password');
		var domainPwd = domainPwdObj.getValue();
		if(domainPwd == "")
		{
			object.success = false;
			object.msg = validationMsg38;
			object.component = domainPwdObj;
			return object;
		}
		else if(checkspaceExtjs(domainPwd) != '0')
		{
			object.success = false;
			object.msg = _checkblank;
			object.component = domainPwdObj;
			return object;
		}
		else if(this.isCheckEgKeywords(domainPwd))
		{
			object.success = false;
			object.msg = _tcKeyword;
			object.component = domainPwdObj;
			return object;
		}

		var domainNameObj = Ext.getCmp('Domain_Name');
		var domainName = domainNameObj.getValue();

		if(!checkblank(domainName))
		{
			object.success = false;
			object.msg = _checkempty;
			object.component = domainNameObj;
			return object;
		}

		var domainLen = domainName.length;
		if (domainName.indexOf("..") > -1)
		{
			object.success = false;
			object.msg = _checkdots;
			object.component = domainNameObj;
			return object;
		}
		else if (domainName.indexOf(".") > -1)
		{
			if (domainName.charAt(domainLen-1) == ".")
			{
				object.success = false;
				object.msg = _domainPeriod;
				object.component = domainNameObj;
				return object;
			}
		}
		var domainSplChars = " !\"#$&()*+':;<=>?@[]^'{|}~";
		var numbers = "0123456789";
		var numberCounts = 0;
		for(var i=0;i < domainLen;i++)
		{
			var tempChar = domainName.charAt(i);
			if(domainSplChars.indexOf(tempChar) > -1)
			{
				object.success = false;
				object.msg = _checkspecial;
				object.component = domainNameObj;
				return object;
			}
			else if (numbers.indexOf(tempChar) > -1)
			{
				numberCounts = numberCounts + 1;
			}
		}

		if (numberCounts == domainLen)
		{
			object.success = false;
			object.msg = _aplhabets;
			object.component = domainNameObj;
			return object;
		}
	
		var proxyHostObj = Ext.getCmp('Proxy_Host');
		var proxyHost = proxyHostObj.getValue();
		var alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		var checkCharacter = "";
		var temp = false;
		for(var m=0; m<proxyHost.length; m++)
		{
			checkCharacter = alphabets.indexOf(proxyHost.charAt(m))
			//Returns value 1 if thecharacter listed is found
			if(checkCharacter >= 0)
			{
				temp = true;
				break;
			}
		}

		if(temp)
		{
			//Hostname should not have space
			if(checkspaceExtjs(proxyHost) != '0')
			{
				object.success = false;
				object.msg = _checkblank;
				object.component = proxyHostObj;
				return object;
			}
			else if(this.isCheckEgKeywords(proxyHost))
			{
				object.success = false;
				object.msg = _tcKeyword;
				object.component = proxyHostObj;
				return object;
			}
			//Checks for dots before & after hostname as well as dots in consecutive positions.
			if (!checkdots(proxyHost))
			{
				object.success = false;
				object.msg = _checkHost;
				object.component = proxyHostObj;
				return object;
			}
			if(!checkspecialnomess(proxyHost,"`~!@#%^&*()+={}[]|\\;\"\'<>,?"))
			{
				object.success = false;
				object.msg = _checkspecial;
				object.component = proxyHostObj;
				return object;
			}
		}
		else 
		{
			var errMsg = validateIpWithMsg(proxyHost);
			if(!Ext.isEmpty(errMsg))
			{
				object.success = false;
				object.msg = errMsg;
				object.component = proxyHostObj;
				return object;
			}
		}

		var proxyPortObj = Ext.getCmp('Proxy_Port');
		var proxyPort = proxyPortObj.getValue();
		if ((!checknumber("+",proxyPort) || proxyPort == 0) && (proxyPort != "none"))
		{
			object.success = false;
			object.msg = _checkproxy;
			object.component = proxyPortObj;
			return object;
		}

		var errMsg = checkDecimalExtJs(proxyPort);
		if (!Ext.isEmpty(errMsg))
		{
			object.success = false;
			object.msg = errMsg;
			object.component = proxyPortObj;
			return object;
		}


		var proxyUserNameObj = Ext.getCmp('Proxy_User_Name');
		var proxyUserName = proxyUserNameObj.getValue();
		var splChars = "|:;\"\'<>,\/[]?";

		if(!checkblank(proxyUserName))
		{
			object.success = false;
			object.msg = _checkempty;
			object.component = proxyUserNameObj;
			return object;
		}
		else if(this.isCheckEgKeywords(proxyUserName))
		{
			object.success = false;
			object.msg = _tcKeyword;
			object.component = proxyUserNameObj;
			return object;
		}
		else if (checkSpecialExtjs(proxyUserName,splChars) != '0')
		{
			object.success = false;
			object.msg = validationMsg13;
			object.component = proxyUserNameObj;
			return object;
		}
		else if(proxyUserName.indexOf("..") > -1)
		{
			object.success = false;
			object.msg = _checkdots;
			object.component = proxyUserNameObj;
			return object;
		}
		else if(proxyUserName.indexOf("  ") > -1)
		{
			object.success = false;
			object.msg = _checkSpaces;
			object.component = proxyUserNameObj;
			return object;
		}


		var proxyPwdObj = Ext.getCmp('Proxy_Password');
		var proxyPwd = proxyPwdObj.getValue();

		if(proxyPwd == "")
		{
			object.success = false;
			object.msg = validationMsg38;
			object.component = proxyPwdObj;
			return object;
		}
		else if(checkspaceExtjs(proxyPwd) != '0')
		{
			object.success = false;
			object.msg = _checkblank;
			object.component = proxyPwdObj;
			return object;
		}
		else if(this.isCheckEgKeywords(proxyPwd))
		{
			object.success = false;
			object.msg = _tcKeyword;
			object.component = proxyPwdObj;
			return object;
		}
		return object;
	},
	checkForHostType : function(compType)
	{
		var servers = publicJSONMSOffice.servTypes;
		for (var s=0; s<servers.length;s++)
		{
			if(servers[s] == compType)
			{
				return false;
			}
		}
		return true;
	},

	checkdots : function(fieldvalue)
	{
		var val = fieldvalue;
		if(val.charAt(0) == '.' || val.charAt(val.length - 1) == '.')
		{
			Ext.Msg.show({
				title: msOfficeTitle,
				msg: alertMsg31,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning'
			});
			return false;
		}
		else
		{
			for(var k=0;k < val.length;k++)
			{
				if(val.charAt(k) == '.' && val.charAt(k + 1) == '.')
				{
					Ext.Msg.show({
						title: msOfficeTitle,
						msg: alertMsg41,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning'
					});
					return false;
				}
				else
				{
					continue;
				}
			}
		}
		return true;
	},

	isValidateHostName:function (server)
	{
		var b_flag = false;
		if(checkDigit(server))
		{
			b_flag =  true;
		}
		else
		{
			if (isDoubleByteMgr=='false')
			{
				if(checkAlpha(server))
				{
					b_flag = true;
				}
			}
			else
			{
				b_flag = true;
			}
		}
		return b_flag;
	},

	validateHostNameWithRemote : function(hostname)
	{
		var me = this;
		var allRemAgents = publicJSONMSOffice.hiddenVals.allRemAgents;
		var isRmtAgentExist = false;
		if((allRemAgents != undefined && allRemAgents != "") && (hostname != undefined && hostname != ""))
		{
			if(me.contains2(allRemAgents,hostname))
			{
				var alertMsg = alertMsg47+". "+alertMsg49;
				Ext.Msg.show({
					title : msOfficeTitle,
					msg : alertMsg,
					buttons : Ext.Msg.OK,
					icon : 'gen-warning size32 color-warning'
				});
				isRmtAgentExist = true;
			}
		}
		return isRmtAgentExist;
	},
	
	contains2 : function(largeStr, smallStr)
	{
		var string = largeStr;
		var contains = false;
		var prevIndex = 0;
		var index = string.indexOf(',');
		while (index > -1)
		{
			var substring = string.substring(prevIndex, index);
			if (substring.toLowerCase() == smallStr.toLowerCase())
			{
				contains = true;
				break;
			}
			else
			{
				prevIndex = index;
				string = string.substring(1, string.length);
				index = string.indexOf(',');
			}
		}

		if (string.toLowerCase() == smallStr.toLowerCase())
		{
			contains = true;
		}

		return contains;
	},
	
	actualAdd: function()
	{
		var formObj = this.getEgMSOfficeConfigurations();
		if (Ext.isEmpty(formObj) )
		{
			thisForm = Ext.getCmp('EgMSOfficeConfigurations1').form;
			formObj = thisForm;
		}
		else
		{
			thisForm = this.getEgMSOfficeConfigurations().getForm();
		}

		msOfficeTitle = Ext.getCmp('EgMSOfficeConfigurations').title;
		if (thisForm.isValid())
		{
			formObj.submit({
				url: '/final/admin/LimitedAdminHome/data/EgMSOfficeConfigurationJson.jsp?fromAction='+fromAction,
				method: 'POST',
				success: function(form, action)
				{
					var resObj  = action.response.responseText;
					var publicJSON = Ext.decode(resObj);
					var remainCTypes = publicJSON.remainingTypes;
					if (!Ext.isEmpty(remainCTypes))
					{
						officeProperties = publicJSON.hiddenParams;
						appCnt.specificCompWindow(publicJSON,remainCTypes);
					}
					else
					{
						Ext.Msg.show({
							title: msOfficeTitle,
							width : 450,
							msg: office365Lbl4+". "+office365Lbl5+". ",
							buttons: Ext.Msg.OK,
							//icon: 'iconInformation',
							icon: 'gen-info size32 color-info',
						});
					}
				},
				failure: function(form,action)
				{
					console.log("failure : ", action.response.responseText);
				}
			});
		}
	},
	specificCompWindow : function (publicJSON,remainCTypes)
	{
		 _cNick = publicJSON.hostname;
		var label = office365CompsConfirmLbl + "&nbsp;'"+_cNick+"'?";
		var modifylabel = office365CompsModifyConfirmLbl + "&nbsp;'"+_cNick+"'?";
		var _exo = true, _spo = true, _365 = true, _sbo = true, _mtm = true, _odb = true;

		var proceed = (remainCTypes != null && remainCTypes != undefined && remainCTypes.length>0);
		if (proceed)
		{
			resMsg += " " +alertMsg55;
			var typesArr = remainCTypes.split(",");
			for (var j=0; j<typesArr.length; j++)
			{
				sType = typesArr[j];
				if (sType == 'MSExchangeOnline')
				{
					_exo = false;
				}
				if (sType == 'Microsoft_Sharepoint_Online')
				{
					_spo = false;
				}
				if (sType == 'MS_Office_365')
				{
					_365 = false;
				}
				if (sType == 'MS_Skype_Online')
				{
					_sbo = false;
				}
				if (sType == 'Microsoft_Teams')
				{
					_mtm = false;
				}
				if (sType == 'MS_OneDrive_Business')
				{
					_odb = false;
				}
			}
		}

		var modArr = [];

		if (_exo == true)
		{
			modArr.push("MSExchangeOnline:"+_cNick+"_exo:NULL");
		}
		if (_spo == true)
		{
			modArr.push("Microsoft_Sharepoint_Online:"+_cNick+"_spo:NULL");
		}
		if (_365 == true)
		{
			modArr.push("MS_Office_365:"+_cNick+"_365:NULL");
		}
		if (_sbo == true)
		{
			modArr.push("MS_Skype_Online:"+_cNick+"_sbo:NULL");
		}
		if (_mtm == true)
		{
			modArr.push("Microsoft_Teams:"+_cNick+"_mtm:NULL");
		}
		if (_odb == true)
		{
			modArr.push("MS_OneDrive_Business:"+_cNick+"_odb:NULL");
		}

		var _exoMod = true, _spoMod = true, _365Mod = true, _sboMod = true, _mtmMod = true, _odbMod = true;

		var configuredServerValues = jsonMsOffice['testConfigParamsForServer'];
		if (!Ext.isEmpty(configuredServerValues))
		{
			if (!Ext.isEmpty(modArr))
			{
				for (var m in modArr) 
				{
					var compName = modArr[m];
					var selectedConfigureComp = configuredServerValues[compName];
					var stype = compName.substring(0,compName.indexOf(":"));
					for (var i in selectedConfigureComp) 
					{
						if (selectedConfigureComp.hasOwnProperty(i)) 
						{
							var extCompName = i.substring(1);
							var objName = Ext.getCmp(extCompName);
							if (!Ext.isEmpty(objName))
							{
								var objValue = selectedConfigureComp[i];
								var preObjValue = objName.getValue();
								if (preObjValue != objValue)
								{
									if (stype == 'MSExchangeOnline')
									{
										_exoMod = false;
									}
									if (stype == 'Microsoft_Sharepoint_Online')
									{
										_spoMod = false;
									}
									if (stype == 'MS_Office_365')
									{
										_365Mod = false;
									}
									if (stype == 'MS_Skype_Online')
									{
										_sboMod = false;
									}
									if (stype == 'Microsoft_Teams')
									{
										_mtmMod = false;
									}
									if (stype == 'MS_OneDrive_Business')
									{
										_odbMod = false;
									}
								}
							}
						}
					}
				}
			}
		}

		var resMsg = office365Lbl6;
		Ext.suspendLayouts();
		var innerCardObj = Ext.getCmp('card-0');
		innerCardObj.removeAll();
		//innerCardObj.monitors = monitors;
		innerCardObj.add({
			xtype:'EgMSOfficeServersView'});

		Ext.getCmp('resultPanel').add({
			xtype: 'EgMSOfficeComponents'
		});

		Ext.getCmp('pageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+office365Lbl2+':</div>');

		Ext.getCmp('specificCompChkGrp').setFieldLabel(label);
		Ext.getCmp('specificCompChkGrpModify').setFieldLabel(modifylabel);
		Ext.getCmp('exo').hidden = _exo;
		Ext.getCmp('spo').hidden = _spo;
		Ext.getCmp('365').hidden = _365;
		Ext.getCmp('sbo').hidden = _sbo;
		Ext.getCmp('mtm').hidden = _mtm;
		Ext.getCmp('odb').hidden = _odb;

		if (_exo == false)
		{
			Ext.getCmp('exo').setValue(true);
		}
		if (_spo == false)
		{
			Ext.getCmp('spo').setValue(true);
		}
		if (_365 == false)
		{
			Ext.getCmp('365').setValue(true);
		}
		if (_sbo == false)
		{
			Ext.getCmp('sbo').setValue(true);
		}
		if (_mtm == false)
		{
			Ext.getCmp('mtm').setValue(true);
		}
		if (_odb == false)
		{
			Ext.getCmp('odb').setValue(true);
		}

		if (_exoMod == false || _spoMod == false || _365Mod == false || _sboMod == false || _mtmMod == false || _odbMod == false)
		{
			Ext.getCmp('specificCompChkGrpModify').show();
			Ext.getCmp('exoModify').hidden = _exoMod;
			Ext.getCmp('spoModify').hidden = _spoMod;
			Ext.getCmp('365Modify').hidden = _365Mod;
			Ext.getCmp('sboModify').hidden = _sboMod;
			Ext.getCmp('mtmModify').hidden = _mtmMod;
			Ext.getCmp('odbModify').hidden = _odbMod;
			if (_exoMod == false)
			{
				Ext.getCmp('exoModify').setValue(true);
			}
			if (_spoMod == false)
			{
				Ext.getCmp('spoModify').setValue(true);
			}
			if (_365Mod == false)
			{
				Ext.getCmp('365Modify').setValue(true);
			}
			if (_sboMod == false)
			{
				Ext.getCmp('sboModify').setValue(true);
			}
			if (_mtmMod == false)
			{
				Ext.getCmp('mtmModify').setValue(true);
			}
			if (_odbMod == false)
			{
				Ext.getCmp('odbModify').setValue(true);
			}
		}

		var thisForm = this.getEgMSOfficeComponents().getForm();
		var me = Ext.getCmp('egmsofficecomponents');
		var hiddenParams = publicJSON.hiddenParams;
		for (var hiddenParam in hiddenParams) {
			if (!thisForm.findField("'" + hiddenParam + "'")) {
				me.add({
					xtype: 'hidden',
					name: hiddenParam,
					value: hiddenParams[hiddenParam]
				});
			} else {
				thisForm.findField("'" + hiddenParam + "'").setValue(hiddenParams[hiddenParam]);
			}
		}
		Ext.resumeLayouts(true);
	},
	submitMsOfficeServerDetails: function() 
	{
		var checkBoxValues = "";
		var _spoStr = Ext.getCmp('spo').getValue();
		var _exoStr = Ext.getCmp('exo').getValue();
		var _365Str = Ext.getCmp('365').getValue();
		var _sboStr = Ext.getCmp('sbo').getValue();
		var _mtmStr = Ext.getCmp('mtm').getValue();
		var _odbStr = Ext.getCmp('odb').getValue();

		if (_spoStr != null && _spoStr != undefined && _spoStr)
		{
			checkBoxValues = "spo" + ",";
		}
		if (_exoStr != null && _exoStr != undefined && _exoStr)
		{
			checkBoxValues += "exo" + ",";
		}
		if (_365Str != null && _365Str != undefined && _365Str)
		{
			checkBoxValues += "365" + ",";
		}
		if (_sboStr != null && _sboStr != undefined && _sboStr)
		{
			checkBoxValues += "sbo" + ",";
		}
		if (_mtmStr != null && _mtmStr != undefined && _mtmStr)
		{
			checkBoxValues += "mtm" + ",";
		}
		if (_odbStr != null && _odbStr != undefined && _odbStr)
		{
			checkBoxValues += "odb" + ",";
		}

		var checkBoxValuesModify = "";
		var _spoStrModify = Ext.getCmp('spoModify').getValue();
		var _exoStrModify = Ext.getCmp('exoModify').getValue();
		var _365StrModify = Ext.getCmp('365Modify').getValue();
		var _sboStrModify = Ext.getCmp('sboModify').getValue();
		var _mtmStrModify = Ext.getCmp('mtmModify').getValue();
		var _odbStrModify = Ext.getCmp('odbModify').getValue();

		if (_spoStrModify != null && _spoStrModify != undefined && _spoStrModify)
		{
			checkBoxValuesModify = "spoModify" + ",";
		}
		if (_exoStrModify != null && _exoStrModify != undefined && _exoStrModify)
		{
			checkBoxValuesModify += "exoModify" + ",";
		}
		if (_365StrModify != null && _365StrModify != undefined && _365StrModify)
		{
			checkBoxValuesModify += "365Modify" + ",";
		}
		if (_sboStrModify != null && _sboStrModify != undefined && _sboStrModify)
		{
			checkBoxValuesModify += "sboModify" + ",";
		}
		if (_mtmStrModify != null && _mtmStrModify != undefined && _mtmStrModify)
		{
			checkBoxValuesModify += "mtmModify" + ",";
		}
		if (_odbStrModify != null && _odbStrModify != undefined && _odbStrModify)
		{
			checkBoxValuesModify += "odbModify" + ",";
		}

		msOfficeTitle = Ext.getCmp('card-0').title;
		msOfficeTitle = msOfficeTitle.substring(msOfficeTitle.indexOf("Monitor"));

		if ((!Ext.isEmpty(checkBoxValues) && checkBoxValues.length > 0) || (!Ext.isEmpty(checkBoxValuesModify) && checkBoxValuesModify.length > 0))
		{
			if (!Ext.isEmpty(checkBoxValues) && checkBoxValues.length > 0)
			{
				checkBoxValues = checkBoxValues.substring(0,checkBoxValues.length-1);
			}
			if (!Ext.isEmpty(checkBoxValuesModify) && checkBoxValuesModify.length > 0)
			{
				checkBoxValuesModify = checkBoxValuesModify.substring(0,checkBoxValuesModify.length-1);
			}
			appCnt.addSpecificComponent(checkBoxValues,checkBoxValuesModify);
		}
		else
		{
			var thisForm = this.getEgMSOfficeComponents().getForm();
			Ext.Msg.show({
				title: msOfficeTitle,
				width : 450,
				msg: office365Lbl7+".",
				buttons: Ext.Msg.OK,
				//icon: 'iconInformation',
				icon: 'gen-info size32 color-info',
			});
		}
	},
	reenterMsOfficeServerDetails: function(object)
	{
		Ext.suspendLayouts();
		var innerCardObj = Ext.getCmp('card-0');
		innerCardObj.removeAll();
		innerCardObj.monitors = 'Office365';
		innerCardObj.add({
				xtype: 'EgMSOfficeConfigurations'
		});
		Ext.resumeLayouts(true);
		if (!Ext.isEmpty(officeProperties))
		{
			for (var param in officeProperties) 
			{
				var paramObj = Ext.getCmp(param);
				if (!Ext.isEmpty(paramObj))
				{
					paramObj.setValue(officeProperties[param]);
				}
			}
		}
	},
	addSpecificComponent : function (checkboxValues,checkBoxValuesModify)
	{
		var mainObj = this;
		remoteAgent = sessionStorage.getItem("remoteAgent");
		if ((checkboxValues != null && checkboxValues.length > 0) || (checkBoxValuesModify != null && checkBoxValuesModify.length > 0))
		{
			var urlStr = "/final/admin/LimitedAdminHome/data/EgspecificserverpJson.jsp?server=new&serverType=-1&from=addnew&treeViewSrc=null&serverGategory=-1"+"&fromWizard="+fromAction+"&checkBoxValues="+encodeURIComponent(checkboxValues)+"&remoteAgent="+encodeURIComponent(remoteAgent)+"&checkBoxValuesModify="+encodeURIComponent(checkBoxValuesModify);

			var thisForm = this.getEgMSOfficeComponents().getForm();
			if (thisForm.isValid())
			{
				var myMask = new Ext.LoadMask(Ext.getBody(), {msg: 'Updating...'});
				myMask.show();

				this.getEgMSOfficeComponents().submit({
					url: urlStr,
					params: mainObj.encodeFieldParams(thisForm,jsonMsOffice),
					method: 'POST',
					success: function(form, action)
					{
						myMask.hide();
						var resObj  = action.response.responseText;
						publicJSON = Ext.decode(resObj);
						var requestStatusType = publicJSON.errRespType;
						var cType = publicJSON.compType;
						var resMsg = "";
						
						var res_info = publicJSON['Result_info'];
						var hasMoreComponents = publicJSON['hasMoreComponents'];
						var requestStatusTypeSize = publicJSON.resp_type_size;
						var size = parseInt(requestStatusTypeSize);
						if (res_info != null && res_info !== undefined)
						{
							resMsg += res_info;
						}

						var Modified_Result_info = publicJSON['Modified_Result_info'];
						if (!Ext.isEmpty(Modified_Result_info))
						{
							resMsg += Modified_Result_info;
						}

						for (var p=1; p<=size; p++)
						{
							var err_info = publicJSON['Error_Info_'+p];
							if (err_info != null && err_info !== undefined)
							{
								if (p == 1)
								{
									resMsg += publicJSON['Error_Info_'+p]['Error_Msg_A_'+p];
								}
								else
								{
									resMsg += '</br>'+publicJSON['Error_Info_'+p]['Error_Msg_A_'+p];
								}
								var errCodeB = publicJSON['Error_Info_'+p]['Error_Msg_B_'+p];
								if (errCodeB != null && errCodeB !== undefined)
								{
									resMsg += errCodeB;
								}
							}
						}

						var errorMsg = publicJSON.errorMsg;
						if (!Ext.isEmpty(errorMsg))
						{
							Ext.Msg.show({
								title: msOfficeTitle,
								msg: errorMsg,
								width: 500,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									
								}
							});
						}
						else
						{
							Ext.Msg.show({
								title: msOfficeTitle,
								msg: resMsg,
								width:700,
								id: 'compConfirmBox',
								icon: 'gen-info size32 color-info',
								buttons: Ext.Msg.OK,
								fn: function(response) {
									if(response == 'ok' || response == 'yes' || response == 'cancel') 
									{
										if (hasMoreComponents)
										{
											fromAction = "monitors";
											appCnt.gotoAgentlessDiscoveryServers('Office365');
										}
										else
										{
											var svg = d3.select('#dashmenu_model_id');
											var g = svg.append('g');

											d3.selectAll('.menuImgC').classed('pressedC', false);
											d3.select("#svgButton"+1).select('.menuImgC').classed('pressedC', true);
									
											d3.select("#svgButton"+1).select('.imgBgC').attr("fill", "gray").attr('opacity',1);
											d3.select("#svgButton"+1).select('.imgC').attr("x", function (d) { return -21 }).attr("y", '-21px').transition().ease("easeLinear").duration(500).attr('xlink:href', function (d, j) {
												return "/final/images/Light/svg/" + d.menu_iconCls + "Hover.svg";
											});
											
											fromAction = "componentsGlance";  // for refresh handling

											var viewportObj = Ext.getCmp('viewport');
											viewportObj.removeAll();
											viewportObj.add({xtype:'adminwizard'});
											Ext.getCmp('new_ground').layout.setActiveItem(1);
										}
									}
								}
							});
						}
					},
					failure: function(form,action)
					{
						myMask.hide();
						console.log("failure : ", action.response.responseText);
					}
				});
			}
		}
	},
	getConfiguredO365Details : function(event, nickName, value)
	{
		event.stopPropagation();

		var publicServerJSON = jsonMsOffice;
		configuredServerData = publicServerJSON['configuredO365Comps'];
		serverData = configuredServerData[value];

		Ext.create('Ext.window.Window', {
			title: "<span style='text-transform:none;'>'"+nickName+"' Office 365 Components</span>",
			modal:true,
			//ui:'newPopupWindow newplainHeader_border popupWindowBlueHeader', 
			ghost:false,
			closeAction:'destroy',
			height:500,
			width: 900,
			border:true,
			//bodyPadding:0,
			padding:'5 10 10 10',
			bodyPadding:'0 0 10 0',
			header:{
				//padding:'14 0 10 0',
				margin:'5 5 5 5',
			},
			layout: {
				type: 'vbox',
				align: 'center',
				pack: 'start'
			},
			listeners: {
				show: function(h) {
					if (this.modal) {
						var g = Ext.dom.Query.select(".x-mask");
						for (var f in g) {
							this.dom = g[f];
							if (!Ext.isEmpty(this.dom.offsetParent)) {
								if (this.dom.offsetParent.tagName == "BODY") {
									Ext.fly(this.dom).addCls("windowModal");
								}
							}
						}
					}
				},
				hide: function(f) {
					if (this.modal) {
						Ext.fly(this.dom).removeCls("windowModal");
					}
				},
				afterrender: function() {
					Ext.EventManager.onWindowResize(function() {
						var f = this;
						f.center();
					}, this);
				}
			},
			items: [
				{
					xtype: 'container',
					layout: {
						type: 'vbox',
						align: 'stretch'
					},
					flex: 1,
					margin: '10 20 20 20',
					items : [
						{
							xtype: 'dataview',
							id : 'selectedServerListGrid',
							layout: 'fit',
							data: serverData,
							emptyText: '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+emptyMsg+'</div></div>',
							viewConfig: {
								deferEmptyText: false
							},
							flex: 1,
							padding:'0 10 10 0',
							scroll:true,
							autoScroll : true,
							hidden: false,
							tpl: [             
								'<ul>',
									'<tpl for="this.merge(values)">',
										'<tpl for="row">',
											'<li>',
												'<div class="aCurveOuterBorder" style="margin:0px 0px 15px 0px;display:inline-table;width:100%;">',
													'<div class="aContainerHeaderText" style="padding:15px 10px 4px 20px;">{title}</div>',
													'<div style="padding:9px 0px 9px 0px;display:inline-table;width:100%;">',
														'<tpl for="subcat">',
															'<div class="appListDivRow">',
																'<tpl for=".">',
																	
																	'<div class="{[xindex % 2 === 0 ? "aNewLineLeft" : "aNewLineRight"]}" nowrapText" style="float:left;padding:5px 10px 4px 20px;width:50%;" {[this.getqtip(values.displayField)]}> {[this.truncate(values.displayField, 50)]} </div>',
																'</tpl>',
															'</div>',
														'</tpl>',
													'</div>',
												'</div>',
											'</li>',
										'</tpl>',
									'</tpl>',
								'</ul>',
								{
									merge: function(a1)
									{
										var len = a1.length;
										for(var i=0, arr=[]; i<len; i++)
										{
											for(var k=0;k<a1.length;k++)
											{
												if (Ext.Object.getKeys(a1[k])[0] != 'title')
												{
													a1[k].title = Ext.Object.getKeys(a1[k])[0];
													a1[k].value =  Ext.Object.getValues(a1[k])[0];
												}
											}
											var chunks = [];

											a1[i]['value'].forEach(function (item) {
												if (!chunks.length || chunks[chunks.length - 1].length == 2)
													chunks.push([]);
												chunks[chunks.length - 1].push(item);
											});
											a1[i]['subcat'] = chunks;
											arr.push({ row: a1[i] });
										}
										return arr;
									},
									truncate : function (fullStr, strLen, separator) {
										if (fullStr.length <= strLen) return fullStr;
										
										separator = separator || '...';
										
										var sepLen = separator.length,
											charsToShow = strLen - sepLen,
											frontChars = Math.ceil(charsToShow/2),
											backChars = Math.floor(charsToShow/2);
										
										return fullStr.substr(0, frontChars) + separator + fullStr.substr(fullStr.length - backChars);
									},
									getqtip : function(displayField)
									{
										if (!Ext.isEmpty(displayField) && displayField != '&nbsp;')
										{
											return "data-qtip='"+displayField+"'";
										}
										else
										{
											return "";
										}
									}
								}
							]
						},
						{
							xtype: 'container',
							id: 'gridEmptyMsg',
							flex: 1,
							html: '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+emptyMsg+'</div></div>'
						}
					]
				}
			],
			resizable:false,
			layout: 'fit',
		}).show();

		if (!Ext.isEmpty(serverData))
		{
			Ext.getCmp('selectedServerListGrid').show();
			Ext.getCmp('gridEmptyMsg').hide();
		}
		else
		{
			Ext.getCmp('selectedServerListGrid').hide();
			Ext.getCmp('gridEmptyMsg').show();
		}
	},

	loadMonitorsData : function()
	{
		Ext.Ajax.request({
			url : '/final/admin/LimitedAdminHome/data/EgMonitorsJson.jsp?fromAction='+fromAction,
			method: 'POST',
			async: false,
			success: function(response)
			{
				publicMonitorsJSON = Ext.decode(response.responseText);
			}
		});
	},

	gotoDockerMonitors : function(fromAction)
	{
		appCnt.loadMonitorsData();
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0DockerTitle);

		if (!Ext.isEmpty(uid))
		{
			Ext.getCmp('whatNextTextDocker').update(
			'<div class="whatNextHeader">'+howToConfDockerTitle+'</div>'+
			'<div>'+
			'<ol class="listCount">'+
			'<li style="list-style-type:disc;">'+'If you are trying to install the container agent directly on a Docker Host, then run the following command:'+
			'<div style="margin-top:10px;font-weight:500;">docker run -d --network host --pid=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro --env EG_MANAGER='+server+' --env EG_MANAGER_PORT='+port+' --env EG_MANAGER_SSL='+isSSL+' --env EG_AGENT_IDENTIFIER_ID='+uid+' --env JVM_MEMORY=512 eginnovations/716:latest</div>'+
			'</li>'+
			//'<li style="list-style-type:disc;">'+'If you are trying to install the container agent directly on a CRI-O Host, then run the following command:'+
			//'<div style="margin-top:10px;font-weight:500;">runc run --network host --pid=host --ipc=host -v /var/run/crio/crio.sock:/var/run/crio/crio.sock:ro -v /proc/:/host/proc/:ro --env EG_MANAGER='+server+' --env EG_MANAGER_PORT='+port+' --env EG_MANAGER_SSL='+isSSL+' --env EG_AGENT_IDENTIFIER_ID='+uid+' --env JVM_MEMORY=512 eginnovations/716:latest</div>'+
			//'</li>'+
			'<li style="list-style-type:disc;">'+'If you are trying to deploy the container agent in a Kubernetes/OpenShift Cluster, then follow the below steps:'+
				'<ul style="margin:0px 0px 0px 10px">'+
					'<li  style="list-style-type:disc;">Download the eG Agent yaml file (<a class="whatNextLink" href="javascript:void(0)" onclick="javascript:appCnt.egAgentYaml()">https://raw.githubusercontent.com/egmonitoring/container/master/agent.yaml</a>)</li>'+
					'<li style="list-style-type:disc;">Update the required EG_* environment variables as given below:'+
						'<ul style="margin:0px 0px 0px 10px">'+
						'<li style="list-style-type:disc;">'+'EG_MANAGER : '+server+'</li>'+
						'<li style="list-style-type:disc;">'+'EG_MANAGER_PORT: '+port+'</li>'+
						'<li style="list-style-type:disc;">'+'EG_MANAGER_SSL: '+isSSL+'</li>'+
						'<li style="list-style-type:disc;">'+'EG_AGENT_IDENTIFIER_ID: '+uid+'</li>'+
						'</ul>'+
					'</li>'+
					'<li style="list-style-type:disc;">After updating the agent.yaml file,'+
						'<ul style="margin:0px 0px 0px 10px">'+
						'<li style="list-style-type:disc;">For Kubernetes, run <span style="font-weight:500;">kubectl create -f egagent.yaml</span> to deploy the eG agent as a DaemonSet.</li>'+
						'<li style="list-style-type:disc;">For OpenShift, run <span style="font-weight:500;">oc create -f egagent.yaml</span>.</li>'+
						'</ul>'+
					'</li>'+
				'</ul>'+
			'</li>'+
			'</ol>'+
			'</div>');
		}
		else
		{
			Ext.getCmp('whatNextTextDocker').update(
			'<div class="whatNextHeader">'+howToConfDockerTitle+'</div>'+
			'<div>'+
			'<ol class="listCount">'+
			'<li style="list-style-type:disc;">'+'If you are trying to install the container agent directly on a Docker Host, then run the following command:'+
			'<div style="margin-top:10px;font-weight:500;">docker run -d --network host --pid=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock:ro -v /proc/:/host/proc/:ro --env EG_MANAGER='+server+' --env EG_MANAGER_PORT='+port+' --env EG_MANAGER_SSL='+isSSL+' --env JVM_MEMORY=512 eginnovations/716:latest</div>'+
			'</li>'+
			//'<li style="list-style-type:disc;">'+'If you are trying to install the container agent directly on a CRI-O Host, then run the following command:'+
			//'<div style="margin-top:10px;font-weight:500;">runc run --network host --pid=host --ipc=host -v /var/run/crio/crio.sock:/var/run/crio/crio.sock:ro -v /proc/:/host/proc/:ro --env EG_MANAGER='+server+' --env EG_MANAGER_PORT='+port+' --env EG_MANAGER_SSL='+isSSL+' --env JVM_MEMORY=512 eginnovations/716:latest</div>'+
			//'</li>'+
			'<li style="list-style-type:disc;">'+'If you are trying to deploy the container agent in a Kubernetes/OpenShift Cluster, then follow the below steps:'+
				'<ul style="margin:0px 0px 0px 10px">'+
					'<li  style="list-style-type:disc;">Download the eG Agent yaml file (<a class="whatNextLink" href="javascript:void(0)" onclick="javascript:appCnt.egAgentYaml()">https://raw.githubusercontent.com/egmonitoring/container/master/agent.yaml</a>)</li>'+
					'<li style="list-style-type:disc;">Update the required EG_* environment variables as given below:'+
						'<ul style="margin:0px 0px 0px 10px">'+
						'<li style="list-style-type:disc;">'+'EG_MANAGER : '+server+'</li>'+
						'<li style="list-style-type:disc;">'+'EG_MANAGER_PORT: '+port+'</li>'+
						'<li style="list-style-type:disc;">'+'EG_MANAGER_SSL: '+isSSL+'</li>'+
						'</ul>'+
					'</li>'+
					'<li style="list-style-type:disc;">After updating the agent.yaml file,'+
						'<ul style="margin:0px 0px 0px 10px">'+
						'<li style="list-style-type:disc;">For Kubernetes, run <span style="font-weight:500;">kubectl create -f egagent.yaml</span> to deploy the eG agent as a DaemonSet.</li>'+
						'<li style="list-style-type:disc;">For OpenShift, run <span style="font-weight:500;">oc create -f egagent.yaml</span>.</li>'+
						'</ul>'+
					'</li>'+
				'</ul>'+
			'</li>'+
			'</ol>'+
			'</div>');
		}

		//Ext.getCmp('dockMsgForDocker').update('<div class="aNewLineTop" style="display:block;padding:10px 0px 0px 0px"><div class="aInfoMsgContainer"><img src="/final/images/spacer.gif" class="aIconInfo" style="vertical-align:text-top"/> '+dockerLink+', <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.addNewComponent(\''+fromAction+'\',\'Docker_server\')">'+clickhereLink+'</a>. '+crioLink+', <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.gotoComponentsPage(\''+fromAction+'\',\'Crio_server\')">'+clickhereLink+'</a>.</div>');
		Ext.getCmp('dockMsgForDocker').update('<div class="aNewLineTop" style="display:block;padding:10px 0px 0px 0px"><div class="aInfoMsgContainer"><img src="/final/images/spacer.gif" class="aIconInfo" style="vertical-align:text-top"/> '+dockerLink+', <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.addNewComponent(\''+fromAction+'\',\'Docker_server\')">'+clickhereLink+'</a>.</div>');
		Ext.getCmp('dockMsgForDocker').show();
	},

	egAgentYaml : function()
	{
		var win = window.open("https://raw.githubusercontent.com/egmonitoring/container/master/agent.yaml", '_blank');
		win.focus();
	},

	gotoApplicationMonitors : function(monitors)
	{
		appCnt.loadMonitorsData();
		if (!Ext.isEmpty(monitors))
		{
			if (monitors == 'Citrix')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0CitrixTitle);
				Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForCitrix+'.</div>');
				Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder"  id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Internal\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadMsgPart2+'</a> '+downloadMsgPart3+'.</div>');
				Ext.getCmp('dockMsg').update('<div class="aNewLineTop" style="display:block;padding:10px 0px 0px 0px"><div class="aInfoMsgContainer" style="line-height:1.7em;"><img src="/final/images/spacer.gif" class="aIconInfo" style="vertical-align:text-top"/> '+citrixDockMsg1+'. <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder"  id="agentlesslink" onclick="javascript:appCnt.goToAgentLessMonitoring(\'CitrixAgentLess\')">'+dockMsgPart2+'</a> '+citrixDockMsg3+'. <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder"  id="agentlesslink" onclick="javascript:appCnt.goToAgentLessMonitoring(\'CitrixAgentLessDisc\')">'+dockMsgPart2+'</a> '+citrixDockMsg2+'.</div></div>');

				Ext.getCmp('tip').update('<div class="aPanelSmallText"><img src="/final/images/spacer.gif" class="aIconTip" style="vertical-align:middle">'+tipForCitrix+'.</div>');
				Ext.getCmp('tip').show();

				Ext.getCmp('agentbasedMonitorsView').show();
				Ext.Ajax.request({
					url : '/final/admin/LimitedAdminHome/data/EgMonitorsJson.jsp?fromAction='+fromAction+'&monitors='+monitors,
					success: function(response)
					{
						publicMonitorsJSON = Ext.decode(response.responseText);
						var data = publicMonitorsJSON['monitorsCategory'];
						
						Ext.getCmp('tiersView').getStore().loadRawData(data);
						Ext.getCmp('tiersView').show();
					}
				});
			}
			else if (monitors == 'VMware Horizon')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0HorizonTitle);
				Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForVMware+'.</div>');
				Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder"  id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Internal\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadMsgPart2+'</a> '+downloadMsgPart3alias+'.</div>');
				Ext.getCmp('dockMsg').update('<div class="aNewLineTop" style="display:block;padding:10px 0px 0px 0px"><div class="aInfoMsgContainer"><img src="/final/images/spacer.gif" class="aIconInfo" style="vertical-align:text-top"/> '+publicMonitorsJSON.vmwareAgentlessServers+' '+dockMsgPart1+'. <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.goToAgentLessMonitoring(\'VMwareHorizonAgentLess\')">'+dockMsgPart2+'</a> '+dockMsgPart3+'.</div></div>');

				Ext.getCmp('tip').update('<div class="aPanelSmallText"><img src="/final/images/spacer.gif" class="aIconTip" style="vertical-align:middle">'+tipForVMware+'.</div>');
				Ext.getCmp('tip').show();

				Ext.getCmp('agentbasedMonitorsView').show();
				Ext.getCmp('othersMonitorsView').hide();

				Ext.Ajax.request({
					url : '/final/admin/LimitedAdminHome/data/EgMonitorsJson.jsp?fromAction='+fromAction+'&monitors='+monitors,
					success: function(response)
					{
						publicMonitorsJSON = Ext.decode(response.responseText);
						var data = publicMonitorsJSON['monitorsCategory'];
						Ext.getCmp('tiersView').getStore().loadRawData(data);
						Ext.getCmp('tiersView').show();
					}
				});
			}
			else
			{
				if (monitors == 'Hypervisors')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0HypervisorTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForHypervisors+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').update('<div class="aNewLineTop" style="display:block;padding:10px 0px 0px 0px"><div class="aInfoMsgContainer"><img src="/final/images/spacer.gif" class="aIconInfo" style="vertical-align:text-top"/> '+publicMonitorsJSON.hypervisorsagentbasedServers+' '+dockMsgagentbasedPart1+'. <a href="javascript:void(0)" class="aInfoMsgLinkText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.goToDownloadAgents(\'Internal\',\''+monitors+'\')">'+dockMsgagentbasedPart2+'</a> '+dockMsgagentbasedPart3+' '+publicMonitorsJSON.hypervisorsagentbasedServers+' '+dockMsgagentbasedPart4+'.</div>');
				}
				else if (monitors == 'PublicCloud')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0CloudTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForCloud+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
				}
				else if (monitors == 'Kubernetes')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0ContainerTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForContainer+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
				}
				else if (monitors == 'SaaSApp')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0SaasTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForSaas+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
				}
				else if (monitors == 'CitrixAgentLess')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0CitrixALTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForAgentLess1+' '+publicMonitorsJSON.citrixAgentlessServers+'. '+agentTypeRecommendationForAgentLess2+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
				}
				else if (monitors == 'VMwareHorizonAgentLess')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0HorizonALTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForAgentLess1+' '+publicMonitorsJSON.vmwareAgentlessServers+'. '+agentTypeRecommendationForAgentLess2+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'</div>');
					Ext.getCmp('dockMsg').hide();
				}
				else if (monitors == 'CitrixAgentLessDisc')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+citrixdiscTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForAgentLess1+' '+publicMonitorsJSON.citrixAgentlessServersForDisc+'. '+agentTypeRecommendationForAgentLess2+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
				}
				else if (monitors == 'Office365')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForAgentLess1+' '+office365Comp+'. '+agentTypeRecommendationForAgentLess2+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
					Ext.getCmp('addCompButton').hide();
				}
				else if (monitors == 'LogonSimulator')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0LogonSimulatorTitle);
					Ext.getCmp('agentTypeRecommendation').update('<div class="aPanelMsg" style="margin:15px 10px 5px 10px;">'+agentTypeRecommendationForLogonSimulator+'.</div>');
					Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'External\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadExternalAgentMsg+'</a> '+downloadRemoteAgentMsgPart2+'.</div>');
					Ext.getCmp('dockMsg').hide();
				}

				if (monitors == 'LogonSimulator')
				{
					Ext.Ajax.request({
						url: '/final/admin/LimitedAdminHome/data/EgDispExtAgentsJson.jsp?fromAction='+fromAction,
						method: 'POST',
						async: false,
						success: function( response )
						{
							if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
							{
								var jsonText = response.responseText;
								publicJSON = Ext.decode( jsonText );
								
								Ext.getCmp('othersMonitorsView').show();
								Ext.getCmp('agentbasedMonitorsView').hide();

								var value = publicJSON['gridExtAgents'];
								if (value != null && value.length > 0)
								{
									Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'External\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadExternalAgentMsg+'</a></div>');

									Ext.getCmp('remAgentView').store.loadData(publicJSON['gridExtAgents']);
									Ext.getCmp('remAgentEmptyMsg').hide();

									if (value.length == 1)
									{
										var externalAgent = Ext.getCmp('remAgentView').getStore().getAt(0).get("Hostname");
										Ext.getCmp('remAgentMsg').update('<div class="aPanelRegularText">'+remoteAgentMsg1+' <span class="aPanelRegularText">'+value.length+' '+externalAgentMsg+'.</span> <a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.goToDiscoverServers(event,\''+monitors+'\',\''+externalAgent+'\')">'+remoteAgentMsg3+'.</a>');
									}
									else
									{
										Ext.getCmp('remAgentMsg').update('<div class="aPanelRegularText">'+remoteAgentMsg1+' '+value.length+' '+externalAgentMsg1+'. <span class="aPanelHighlightText">'+remoteAgentMsg5+'.</span></div>');
									}
									Ext.getCmp('remAgentMsg').show();
									Ext.getCmp('remAgentView').show();
								}
								else
								{
									Ext.getCmp('remAgentMsg').hide();
									Ext.getCmp('remAgentView').hide();
									Ext.getCmp('remAgentEmptyMsg').show();
									Ext.getCmp('remAgentEmptyMsg').update('<div class="emptyMsgDiv"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+externalAgentEmptyMsg+'.<br/>'+downloadAgentExternalWhatNext+'.</div></div>');
								}
							}
						}
					});
				}
				else
				{
					Ext.Ajax.request({
						url: '/final/admin/LimitedAdminHome/data/EgDispRemoteAgentsJson.jsp?fromAction='+fromAction,
						method: 'POST',
						async: false,
						success: function( response )
						{
							if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
							{
								var jsonText = response.responseText;
								publicJSON = Ext.decode( jsonText );
								if (!Ext.isEmpty(publicJSON.strrmtList))
								{
									var existList = publicJSON.strrmtList;
									rmtListStr = existList.split(',');
									var value = publicJSON['gridRmtAgents'];

									Ext.getCmp('othersMonitorsView').show();
									Ext.getCmp('agentbasedMonitorsView').hide();

									if (value != null && value.length > 0)
									{
										if (monitors == 'Hypervisors' || monitors == 'PublicCloud' || monitors == 'Kubernetes' || monitors == 'SaaSApp' || monitors == 'CitrixAgentLess' ||
										monitors == 'VMwareHorizonAgentLess' ||  monitors == 'CitrixAgentLessDisc' || monitors == 'Office365')
										{
											Ext.getCmp('downloadAgentLink').update('<div class="aPanelRegularText aNewLineBottom" style="margin:10px 10px 0px 10px;padding:0px 0px 7px 0px"><a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="downloadAgentMsg" onclick="javascript:appCnt.goToDownloadAgents(\'Remote\',\''+monitors+'\')">'+downloadMsgPart1+' <img src="/final/images/spacer.gif" class="aIconDownload" style="vertical-align:baseline"/> '+downloadRemoteAgentMsgPart1+'</a></div>');
										}

										Ext.getCmp('remAgentView').store.loadData(publicJSON['gridRmtAgents']);
										Ext.getCmp('remAgentEmptyMsg').hide();
										if (value.length == 1)
										{
											var remoteAgent = Ext.getCmp('remAgentView').getStore().getAt(0).get("Hostname");
											Ext.getCmp('remAgentMsg').update('<div class="aPanelRegularText">'+remoteAgentMsg1+' <span class="aPanelRegularText">'+value.length+' '+remoteAgentMsg2+'.</span> <a href="javascript:void(0)" class="aPanelHighlightText aLinkBottomBorder" id="agentlesslink" onclick="javascript:appCnt.goToDiscoverServers(event,\''+monitors+'\',\''+remoteAgent+'\')">'+remoteAgentMsg3+'.</a>');
										}
										else
										{
											if (monitors == 'Hypervisors' || monitors == 'CitrixAgentLessDisc')
											{
												Ext.getCmp('remAgentMsg').update('<div class="aPanelRegularText">'+remoteAgentMsg1+' '+value.length+' '+remoteAgentMsg6+'. <span class="aPanelHighlightText">'+remoteAgentMsg4+'.</span></div>');
											}
											else if (monitors == 'PublicCloud' || monitors == 'Kubernetes' || monitors == 'SaaSApp' || monitors == 'CitrixAgentLess' || monitors == 'VMwareHorizonAgentLess' || monitors == 'Office365')
											{
												Ext.getCmp('remAgentMsg').update('<div class="aPanelRegularText">'+remoteAgentMsg1+' '+value.length+' '+remoteAgentMsg6+'. <span class="aPanelHighlightText">'+remoteAgentMsg5+'.</span></div>');
											}
										}
										Ext.getCmp('remAgentMsg').show();
										Ext.getCmp('remAgentView').show();
									}
									else
									{
										Ext.getCmp('remAgentMsg').hide();
										Ext.getCmp('remAgentView').hide();
										Ext.getCmp('remAgentEmptyMsg').show();
									}
								}
							}
						}
					});

					if (monitors == 'Kubernetes')
					{
						if (!Ext.isEmpty(comeFrom) && (comeFrom == 'compappmodify' || comeFrom == 'hypervisors'))
						{
							Ext.Msg.show({
								title: card0ContainerTitle,
								msg: gotoCompGlanceAlert2,
								buttons: Ext.Msg.YESNO,
								//icon: 'iconConfirmation',
								icon: 'gen-question size32 color-question',
								fn: function(response) {
									if (response == 'yes')
									{
										comeFrom = "null";
										return false;
									}
									else
									{
										var svg = d3.select('#dashmenu_model_id');
										var g = svg.append('g');

										d3.selectAll('.menuImgC').classed('pressedC', false);
										d3.select("#svgButton"+1).select('.menuImgC').classed('pressedC', true);
								
										d3.select("#svgButton"+1).select('.imgBgC').attr("fill", "gray").attr('opacity',1);
										d3.select("#svgButton"+1).select('.imgC').attr("x", function (d) { return -21 }).attr("y", '-21px').transition().ease("easeLinear").duration(500).attr('xlink:href', function (d, j) {
											return "/final/images/Light/svg/" + d.menu_iconCls + "Hover.svg";
										});
										
										fromAction = "componentsGlance";  // for refresh handling
										Ext.getCmp('new_ground').layout.setActiveItem(1);

										var viewportObj = Ext.getCmp('viewport');
										viewportObj.removeAll();
										viewportObj.add({xtype:'adminwizard'});
									}
								}
							});
						}
					}
				}
				appCnt.agentWidgetWidth(Ext.getCmp('remAgentView'));
				task.start();
			}
		}
	},
	
	getMonitorValue : function()
	{
		var monitors = fromAction.substring(fromAction.indexOf('_')+1);
		return monitors;
	},

	discoverServersClose : function()
	{
		var value = fromAction.substring(fromAction.indexOf('_')+1);
		if (value == 'CitrixAgentLess' || value == 'CitrixAgentLessDisc')
		{
			appCnt.gotoApplicationServers('Citrix');
		}
		else if (value == 'VMwareHorizonAgentLess')
		{
			appCnt.gotoApplicationServers('VMware Horizon');
		}
		else
		{
			Ext.suspendLayouts();
			var viewportObj = Ext.getCmp('viewport');
			viewportObj.removeAll();
			fromAction = "monitors";
			viewportObj.add({xtype:'adminwizard'});
			Ext.resumeLayouts(true);
		}
		if (!Ext.isEmpty(task))
		{
			task.stop();
		}
	},

	goToAgentLessMonitoring : function(agentLessCategory)
	{
		if (!Ext.isEmpty(agentLessCategory))
		{
			appCnt.gotoApplicationServers(agentLessCategory);
		}
	},
	
	goToDiscoverServers : function(event, monitors,remoteAgent)
	{
		event.stopPropagation();
		sessionStorage.setItem("remoteAgent",remoteAgent);
		Ext.suspendLayouts();
		var viewportObj = Ext.getCmp('card-0');
		if (monitors == 'Office365')
		{
			appCnt.gotoAgentlessDiscoveryServers(monitors);
		}
		else if (monitors == 'Kubernetes')
		{
			Ext.suspendLayouts();
			viewportObj.removeAll();
			viewportObj.discover = monitors;
			viewportObj.monitors = monitors;
			viewportObj.add({
					xtype: 'EgConfigureAgentLessServers'
			});
			Ext.resumeLayouts(true);
		}
		else
		{
			viewportObj.removeAll();
			viewportObj.monitors = monitors;
			viewportObj.add({
					xtype: 'EgAgentlessDiscoveryServers'
			});
		}
		Ext.resumeLayouts(true);
	},

	getRemoteAgentDetails : function(event, remoteAgent)
	{
		event.stopPropagation();
		var popupTitle = remAgentDetails;
		var val = fromAction.substring(fromAction.indexOf('_')+1);
		var url = 'LimitedAdminHome/data/EgRemoteAgentsDetailsJson.jsp?eagent='+remoteAgent;
		if (val == 'LogonSimulator')
		{
			popupTitle = extAgentDetails;
			url = 'LimitedAdminHome/data/EgExternalAgentsDetailsJson.jsp?eagent='+remoteAgent;
		}
		
		Ext.Ajax.request({
			url : url,
			success: function(response)
			{
				var publicServerJSON = Ext.decode(response.responseText);
				serverData = publicServerJSON['ManagedHostByThisAgent'];
				
				Ext.create('Ext.window.Window', {
					title: "<span style='text-transform:none;'>"+popupTitle+" - "+remoteAgent+"</span>",
					modal:true,
					//ui:'newPopupWindow newplainHeader_border popupWindowBlueHeader', 
					ghost:false,
					id:'listOfServWindow',
					closeAction:'destroy',
					height:500,
					width: 900,
					border:true,
					padding:'5 10 10 10',
					//bodyPadding:0,
					header:{
						//padding:'14 0 10 0',
						margin:'5 5 5 5',
					},
					layout: {
						type: 'vbox',
						align: 'center',
						pack: 'center'
					},
					listeners: {
						show: function(h) {
							if (this.modal) {
								var g = Ext.dom.Query.select(".x-mask");
								for (var f in g) {
									this.dom = g[f];
									if (!Ext.isEmpty(this.dom.offsetParent)) {
										if (this.dom.offsetParent.tagName == "BODY") {
											Ext.fly(this.dom).addCls("windowModal");
										}
									}
								}
							}
						},
						hide: function(f) {
							if (this.modal) {
								Ext.fly(this.dom).removeCls("windowModal");
							}
						},
						afterrender: function() {
							Ext.EventManager.onWindowResize(function() {
								var f = this;
								f.center();
							}, this);
						}
					},
					items: [
						{
							xtype: 'container',
							layout: {
								type: 'vbox',
								align: 'stretch'
							},
							flex: 1,
							margin: '0 10 20 10',
							items : [
								{
									xtype: 'dataview',
									id : 'selectedServerListGrid',
									layout: 'fit',
									data: serverData,
									emptyText: '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+emptyMsg+'</div></div>',
									viewConfig: {
										deferEmptyText: false
									},
									flex: 1,
									padding:'0 0 10 0',
									scroll:true,
									autoScroll : true,
									hidden: false,
									tpl: [             
										'<ul>',
											'<tpl for="this.merge(values)">',
												'<tpl for="row">',
													'<li>',
														'<div class="aCurveOuterBorder" style="margin:0px 0px 15px 0px;display:inline-table;width:100%;">',
															'<div class="aContainerHeaderText" style="padding:15px 10px 4px 20px;">{title}</div>',
															'<div style="padding:9px 0px 9px 0px;display:inline-table;width:100%;">',
																'<tpl for="subcat">',
																	'<div class="appListDivRow">',
																		'<tpl for=".">',
																			'<div class="aNewLineRight nowrapText" style="float:left;padding:5px 10px 4px 20px;width:33%;" {[this.getqtip(values.displayField)]}> {[this.truncate(values.displayField, 26)]} </div>',
																		'</tpl>',
																	'</div>',
																'</tpl>',
															'</div>',
														'</div>',
													'</li>',
												'</tpl>',
											'</tpl>',
										'</ul>',
										{
											merge: function(a1)
											{
												var len = a1.length;
												for(var i=0, arr=[]; i<len; i++)
												{
													for(var k=0;k<a1.length;k++)
													{
														if (Ext.Object.getKeys(a1[k])[0] != 'title')
														{
															a1[k].title = Ext.Object.getKeys(a1[k])[0];
															a1[k].value =  Ext.Object.getValues(a1[k])[0];
														}
													}
													var chunks = [];

													a1[i]['value'].forEach(function (item) {
														if (!chunks.length || chunks[chunks.length - 1].length == 3)
															chunks.push([]);
														chunks[chunks.length - 1].push(item);
													});
													a1[i]['subcat'] = chunks;
													arr.push({ row: a1[i] });
												}
												return arr;
											},
											truncate : function (fullStr, strLen, separator) {
												if (fullStr.length <= strLen) return fullStr;
												
												separator = separator || '...';
												
												var sepLen = separator.length,
													charsToShow = strLen - sepLen,
													frontChars = Math.ceil(charsToShow/2),
													backChars = Math.floor(charsToShow/2);
												
												return fullStr.substr(0, frontChars) + separator + fullStr.substr(fullStr.length - backChars);
											},
											getqtip : function(displayField)
											{
												if (!Ext.isEmpty(displayField) && displayField != '&nbsp;')
												{
													return "data-qtip='"+displayField+"'";
												}
												else
												{
													return "";
												}
											}
										}
									]
								},
								{
									xtype: 'container',
									id: 'gridEmptyMsg',
									flex: 1,
									html: '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+emptyMsg+'</div></div>'
								}
							]
						}
					],
					dockedItems:[
						{
							xtype:'toolbar',
							dock:'top',
							border:false,
							cls:'windowToolbarBg',
							ui:'dummy',
							items:[
								'->',
								{
									xtype: 'trigger',
									trigger1Cls: 'x-form-clear-trigger',
									trigger2Cls: 'x-form-search-trigger',
									//cls:'whitedropdown_search',
									cls:'aSearch',
									id: 'gridSearch',
									name: 'gridSearch',
									emptyText: searchEmptyText,
									margin:'10 10 10 10',
									getTriggerMarkup: function() {
										var me = this,
											i = 0,
											hideTrigger = (me.readOnly || me.hideTrigger),
											triggerCls,
											triggerBaseCls = me.triggerBaseCls,
											triggerConfigs = [],
											unselectableCls = Ext.dom.Element.unselectableCls,
											style = 'width:' + me.triggerWidth + 'px;' + (hideTrigger ? 'display:none;' : ''),
											cls = me.extraTriggerCls + ' ' + Ext.baseCSSPrefix + 'trigger-cell ' + unselectableCls;
		
										// TODO this trigger<n>Cls API design doesn't feel clean, especially where it butts up against the
										// single triggerCls config. Should rethink this, perhaps something more structured like a list of
										// trigger config objects that hold cls, handler, etc.
										// triggerCls is a synonym for trigger1Cls, so copy it.
										if (!me.trigger1Cls) {
											me.trigger1Cls = me.triggerCls;
										}
		
										// Create as many trigger elements as we have trigger<n>Cls configs, but always at least one
										for (i = 0; (triggerCls = me['trigger' + (i + 1) + 'Cls']) || i < 1; i++) {
											if (i == 0)
											{
												triggerConfigs.push({
													tag: 'td',
													role: 'presentation',
													valign: 'top',
													cls: cls,
													id : 'MyTrigger_'+i,
													style: style + "display:none;",
													cn: {
														cls: [Ext.baseCSSPrefix + 'trigger-index-' + i, triggerBaseCls, triggerCls].join(' '),
														role: 'presentation'
													}
												});
											}
											else
											{
												triggerConfigs.push({
													tag: 'td',
													role: 'presentation',
													valign: 'top',
													cls: cls,
													id : 'MyTrigger_'+i,
													style: style,
													cn: {
														cls: [Ext.baseCSSPrefix + 'trigger-index-' + i, triggerBaseCls, triggerCls].join(' '),
														role: 'presentation'
													}
												});
											}
										}
										triggerConfigs[0].cn.cls += ' ' + triggerBaseCls + '-first';
										return Ext.DomHelper.markup(triggerConfigs);
									},
									onTrigger1Click : function() {
										this.reset();
										Ext.getCmp('selectedServerListGrid').show();
									},
									onTrigger2Click : function() {
										appCnt.mainGridSearch(remoteAgent);
									},
									listeners : {
										change : function()
										{
											appCnt.mainGridSearch(remoteAgent);
										},
										'render': function(cmp) 
										{ 
											cmp.getEl().on('click', function(){
												cmp.focus(200,true)
											}); 
										}
									}
								}
							]

						}
					],
					resizable:false,
					layout: 'fit',
				}).show();

				if (!Ext.isEmpty(serverData))
				{
					Ext.getCmp('selectedServerListGrid').show();
					Ext.getCmp('gridSearch').show();
					Ext.getCmp('gridEmptyMsg').hide();
				}
				else
				{
					Ext.getCmp('selectedServerListGrid').hide();
					Ext.getCmp('gridSearch').hide();
					Ext.getCmp('gridEmptyMsg').show();
				}
			}
		});
	},

	mainGridSearch : function(remoteAgent)
	{
		var gridsearch = Ext.getCmp('gridSearch').getValue();

		if (gridsearch == "" || gridsearch.length == 0)
		{
			Ext.get('MyTrigger_0').setStyle('display','none');
			Ext.get('MyTrigger_1').setStyle('display','block');
		}
		else
		{
			Ext.get('MyTrigger_1').setStyle('display','none');
			Ext.get('MyTrigger_0').setStyle('display','block');
		}

		var selectedServerListGrid = Ext.getCmp('selectedServerListGrid');

		var val = fromAction.substring(fromAction.indexOf('_')+1);
		var url = 'LimitedAdminHome/data/EgRemoteAgentsDetailsJson.jsp?eagent='+remoteAgent+'&keywordsearch='+gridsearch;
		if (val == 'LogonSimulator')
		{
			url = 'LimitedAdminHome/data/EgExternalAgentsDetailsJson.jsp?eagent='+remoteAgent+'&keywordsearch='+gridsearch;
		}

		Ext.Ajax.request({
			url : url,
			success: function(response)
			{
				var publicServerJSON = Ext.decode(response.responseText);
				var selectedServerListGridObj = Ext.getCmp('selectedServerListGrid');
				serverData = publicServerJSON['ManagedHostByThisAgent'];;
				if (!Ext.isEmpty(serverData))
				{
					selectedServerListGridObj.update(serverData);
					selectedServerListGridObj.show();
					Ext.getCmp('gridEmptyMsg').hide();
				}
				else
				{
					selectedServerListGridObj.hide();
					Ext.getCmp('gridEmptyMsg').show();
				}
			}
		});
	},

	gotoAgentlessDiscoveryServers : function(monitors)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var alertTitle = "";
		var alertMessage = "";
		if (!Ext.isEmpty(monitors))
		{
			if (monitors == 'Hypervisors')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0HypervisorInnerTitle+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+agentLessDiscMsg1+'</div>');
				alertTitle = card0HypervisorTitle;
				alertMessage = gotoCompGlanceAlert1;
			}
			else if (monitors == 'PublicCloud')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0CloudInnerTitle+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+agentLessDiscMsg2+'</div>');
				alertTitle = card0CloudTitle;
				alertMessage = gotoCompGlanceAlert2;
			}
			else if (monitors == 'SaaSApp')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0SaasInnerTitle+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+agentLessDiscMsg2saas+'</div>');
				alertTitle = card0SaasTitle;
				alertMessage = gotoCompGlanceAlert2;
				Ext.getCmp('addCompButton').hide();
			}
			else if (monitors == 'CitrixAgentLess')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0CitrixALInnerTitle+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+agentLessDiscMsg3+'</div>');
				alertTitle = card0CitrixALTitle;
				alertMessage = gotoCompGlanceAlert2;
			}
			else if (monitors == 'VMwareHorizonAgentLess')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0HorizonALInnerTitle+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+agentLessDiscMsg4+'</div>');
				alertTitle = card0HorizonALAlertTitle;
				alertMessage = gotoCompGlanceAlert2;
			}
			else if (monitors == 'CitrixAgentLessDisc')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+citrixdiscTitle1+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+citrixdiscMsg+'</div>');
				alertTitle = citrixdiscTitle;
				alertMessage = gotoCompGlanceAlert1;
			}
			else if (monitors == 'LogonSimulator')
			{
				Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentlessDiscoveryServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0LogonSimulatorExtInnerTitle+' '+remoteAgent);
				Ext.getCmp('agentlessservmsg').update('<div class="aPanelRegularText" style="margin:15px 10px 0px 10px;padding:0px 0px 0px 0px;">'+agentLessDiscMsg5+'</div>');
				alertTitle = card0LogonSimulatorTitle;
				alertMessage = gotoCompGlanceAlert2;
			}

			if (monitors == 'Office365')
			{
				fromAction = "monitors_"+monitors+":"+"category";
				var urlStr =  '/final/admin/LimitedAdminHome/data/EgMSOfficeConfigurationJson.jsp?from=adminwizard&fromAction='+fromAction+"&remoteAgent="+encodeURIComponent(remoteAgent);

				Ext.Ajax.request({
					url: urlStr,
					method: 'POST',
					async:false,
					success: function( response )
					{
						if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
						{
							var jsonText = response.responseText;
							jsonMsOffice = Ext.decode( jsonText );

							if (jsonMsOffice.unfinishServerCnt > 0)
							{
								Ext.suspendLayouts();
								var innerCardObj = Ext.getCmp('card-0');
								innerCardObj.removeAll();
								innerCardObj.monitors = monitors;
								innerCardObj.add({
									xtype: 'EgMSOfficeServersView'
								});

								Ext.getCmp('resultPanel').add({
										xtype:'container',
										margin: '10 0 10 0',
										layout: {
											type:'vbox',
											align: 'stretch'
										},
										flex: 1,
										items: [
											{
												xtype: 'dataview',
												id: "msOfficeComponentGlanceView",
												deferInitialRefresh: false,
												store:new Ext.data.Store({
												fields: ['displayField','valueField','imageName','configured', 'unconfigured','highLightCls'],
												data: []
												}),
												boxWidth:320,
												boxHeight:65,
												boxMargin: 10,
												flex: 1,
												tpl: Ext.create(
													"Ext.XTemplate",
													"<ul>",
														'<tpl for=".">',
															'<li class="aBoxParentSimple" id={valueField}>',
																'<div class="aBoxChildSimple"><a href="javascript:void(0)" onclick=\"javascript:appCnt.modifyMSOfficeConfiguration(event,\'{valueField}\')\" class="iePositionFix">',
																	'<div class="plainFrontSimple">',
																		'<div class="iconDiv comp-office365 size42 iconColor"></div>',
																		'<div class="centerDiv">',
																			'<div class="innerText"><div style="line-height:1em">{displayField}</div><div class="aNormalFont" style="line-height:1.5em;{[this.showIp(values)]};">{displayField}</div></div>',
																		'</div>',
																	'</div>',
																	'<div class="infoIconDiv linkHand" onclick=\"javascript:appCnt.getConfiguredO365Details(event,\'{displayField}\',\'' +'{valueField}'+ '\')\"><div class="gen-info" style="font-size:16px;" data-qtip="Office 365 component details"></div></div>',
																'</a></div>',
															'</li>',
														"</tpl>", 
													"</ul>",
												{
													getGroupLabel:function()
													{
														var val = fromAction.substring(fromAction.indexOf('_')+1);
														return val;
													},
													showIp : function(a)
													{
														var hname = a.valueField;
														var hip = a.valueField;
														if (hname.toLowerCase() == hip.toLowerCase())
														{
															return 'display:none';
														}
														else
														{
															return 'display:block';
														}
													}
												},
												'<div class="x-clear"></div>'
											),
											scrollbarVisible: function (view) {
												return view.el.dom.scrollHeight > view.el.dom.clientHeight;
											},
											listeners: {
												refresh: function(view) {
													appCnt.agentWidgetWidth(view);
												},
												resize: function (view, width, height,oldWidth,oldHeight,eOpts) {
													appCnt.agentWidgetWidth(view);
												},
												viewready:function(view){
													Ext.defer(function(){
														view.fireEvent('refresh',view);
													},50);
												}
											},
											itemSelector: "li.aBoxParentSimple"
										},
										{
											xtype: 'container',
											id: 'emptyCompMsg',
											hidden: true,
											flex: 1,
											html: 'Empty Message'
										}
									]
								});
								
								if (office365Model == 'basic')
								{
									Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.discoverServersClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeTitle);
								}
								else
								{
									Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.goToDiscoverServers(event,\''+'SaaSApp'+'\',\''+remoteAgent+'\')"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+msOfficeInnerTitle+' '+remoteAgent);
								}

								Ext.getCmp('pageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+eGenterprisemonitors1+' '+jsonMsOffice.Office365Components+' '+eGenterprisemonitors2+'</div><div class="aPanelMsg aNewLineBottom" style="margin:16px 10px 0px 10px;padding:0px 0px 8px 0px">'+eGenterprisemonitors3+'</div>');

								if (!Ext.isEmpty(Ext.getCmp('addCompButton')))
								{
									Ext.getCmp('addCompButton').hide();
								}
								
								innerCardObj.addTool({
									xtype:'button',
									id:'addCompButton',
									height:24,
									ui:'aButtonSmall',
									text:'Add New',
									margin: '0 0 0 0',
									handler: function()
									{
										appCnt.modifyMSOfficeConfiguration('configured','new');
									}
								});

								Ext.getCmp('emptyCompMsg').hide();
								Ext.getCmp('msOfficeComponentGlanceView').getStore().removeAll();
								Ext.getCmp('msOfficeComponentGlanceView').getStore().loadRawData(jsonMsOffice.unfinishCompTypeSummary);
								Ext.getCmp('msOfficeComponentGlanceView').getStore().loadRawData(jsonMsOffice.unfinishCompTypeSummary);
								Ext.getCmp('msOfficeComponentGlanceView').show();
								Ext.resumeLayouts(true);
								officeProperties = new Object();
							}
							else
							{
								Ext.suspendLayouts();
								var innerCardObj = Ext.getCmp('card-0');
								innerCardObj.removeAll();
								innerCardObj.monitors = monitors;
								innerCardObj.add({
									xtype: 'EgMSOfficeServersView'
								});

								Ext.getCmp('resultPanel').add({
									xtype: 'EgMSOfficeConfigurations',
								});

								Ext.resumeLayouts(true);
								officeProperties = new Object();
								//jsonMsOffice = '';
							}
						}
					}
				});
			}
			else
			{
				Ext.Ajax.request({
					url : '/final/admin/LimitedAdminHome/data/EgMonitorsJson.jsp?fromAction='+fromAction+'&monitors='+monitors,
					success: function(response)
					{
						var publicMonJSON = Ext.decode(response.responseText);
						var data = publicMonJSON['monitorsCategory'];
						Ext.getCmp('agentlessView').getStore().loadRawData(data);
						appCnt.agentWidgetWidth(Ext.getCmp('agentlessView'));
						
						if (!Ext.isEmpty(comeFrom) && (comeFrom == 'compappmodify' || comeFrom == 'hypervisors'))
						{
							Ext.Msg.show({
								title: alertTitle,
								msg: alertMessage,
								buttons: Ext.Msg.YESNO,
								//icon: 'iconConfirmation',
								icon: 'gen-question size32 color-question',
								fn: function(response) {
									if (response == 'yes')
									{
										comeFrom = "null";
										return false;
									}
									else
									{
										var svg = d3.select('#dashmenu_model_id');
										var g = svg.append('g');

										d3.selectAll('.menuImgC').classed('pressedC', false);
										d3.select("#svgButton"+1).select('.menuImgC').classed('pressedC', true);
								
										d3.select("#svgButton"+1).select('.imgBgC').attr("fill", "gray").attr('opacity',1);
										d3.select("#svgButton"+1).select('.imgC').attr("x", function (d) { return -21 }).attr("y", '-21px').transition().ease("easeLinear").duration(500).attr('xlink:href', function (d, j) {
											return "/final/images/Light/svg/" + d.menu_iconCls + "Hover.svg";
										});
										
										fromAction = "componentsGlance";  // for refresh handling
										Ext.getCmp('new_ground').layout.setActiveItem(1);

										var viewportObj = Ext.getCmp('viewport');
										viewportObj.removeAll();
										viewportObj.add({xtype:'adminwizard'});
									}
								}
							});
						}
					}
				});
			}
		}
	},

	agentlessDiscoveryServersClose : function()
	{
		Ext.suspendLayouts();
		var monitors = Ext.getCmp('card-0').monitors;
		var viewportObj = Ext.getCmp('card-0');
		viewportObj.removeAll();
		fromAction = "monitors_"+monitors;
		viewportObj.add({xtype:'EgDiscoverServersView'});
		Ext.resumeLayouts(true);
	},

	agentlessDiscoveryServersCloseForKubernetes : function()
	{
		Ext.suspendLayouts();
		var monitors = Ext.getCmp('card-0').monitors;
		var viewportObj = Ext.getCmp('card-0');
		viewportObj.removeAll();
		viewportObj.closeFrom = 'hypervisors';
		fromAction = "monitors_"+monitors;
		viewportObj.add({xtype:'EgDiscoverServersView'});
		Ext.resumeLayouts(true);
	},

	agentlessComponentConfigClose : function()
	{
		appCnt.gotoAgentlessDiscoveryServers('Office365');
	},

	goToDownloadAgents : function(agentType,monitors)
	{
		Ext.Ajax.request({
			url : 'DownloadAgentPack/data/EgProxyDetailsJson.jsp',
			params: {
				'from' : 'getProxyDetails'
			},
			success: function(response)
			{
				var jsonText = response.responseText;
				var publicProxyJson = Ext.decode(jsonText);
				var isProxySet = publicProxyJson.isProxySet;
				var isEligibleUser = publicProxyJson.isEligibleUser;
				var isSuperOrg = publicProxyJson.isSuperOrg;
				var isSuperUserSuperOrg = publicProxyJson.isSuperUserSuperOrg;
				var superUserNameForProxy = publicProxyJson.superUserNameForProxy;
				var parentproxyEnabled = publicProxyJson.parentproxyEnabled;

				if (!isProxySet && isEligibleUser)
				{
					Ext.create('Ext.window.Window', {
						title: "<span style='text-transform:none;'>"+proxyDetailsTitle+"</span>",
						modal:true,
						//ui:'newPopupWindow newplainHeader_border popupWindowBlueHeader', 
						ghost:false,
						id:'proxyDetailsWin',
						name:'proxyDetailsWin',
						border:true,
						padding:'5 10 10 10',
						header:{
							margin:'5 5 5 5'
						},
						flex: 1,
						closable: true,
						listeners: {
							show: function(h) {
								if (this.modal) {
									var g = Ext.dom.Query.select(".x-mask");
									for (var f in g) {
										this.dom = g[f];
										if (!Ext.isEmpty(this.dom.offsetParent)) {
											if (this.dom.offsetParent.tagName == "BODY") {
												Ext.fly(this.dom).addCls("windowModal");
											}
										}
									}
								}
							},
							hide: function(f) {
								if (this.modal) {
									Ext.fly(this.dom).removeCls("windowModal");
								}
							},
							afterrender: function() {
								Ext.EventManager.onWindowResize(function() {
									var f = this;
									f.center();
								}, this);
							},
							resize: function() {
								this.center();
							}
						},
						resizable:false,
						layout: 'fit',
						items : [
							{
								xtype : 'container',
								layout : {
									type: 'vbox',
									align: 'center'
								},
								margin : 10,
								defaults : {
									labelSeparator: '',
									labelStyle:'font-size: 12px',
									margin: 10,
									width: 700,
									labelWidth: 480
								},
								items : [
									{
										xtype: 'radiogroup',
										columns: 2,
										vertical: false,
										id: 'useProxy',
										name: 'useProxy',
										cls : 'aRadiobt',
										fieldLabel: useProxyLabel+'?',
										items: [
											{
												boxLabel: 'Yes',
												name: 'useProxy',
												id: 'useProxyYes',
												inputValue: 'yes',
												listeners : {
													change: function()
													{
														var useProxyYes = Ext.getCmp('useProxyYes').getGroupValue();
														if (!Ext.isEmpty(useProxyYes) && useProxyYes == 'yes')
														{
															if (!isSuperOrg && !Ext.isEmpty(parentproxyEnabled) && parentproxyEnabled == 'y')
															{
																Ext.getCmp('useParentProxy').show();
																Ext.getCmp('useParentProxyYes').setValue(true);
															}
															else
															{
																Ext.getCmp('useParentProxy').hide();
																Ext.getCmp('useParentProxyNo').setValue(true);
																Ext.getCmp('proxyHost').show();
																Ext.getCmp('proxyPort').show();
																Ext.getCmp('isAuthentication').show();
															}
														}
														else
														{
															Ext.getCmp('useParentProxy').hide();
															Ext.getCmp('useParentProxyNo').setValue(true);
															Ext.getCmp('proxyHost').hide();
															Ext.getCmp('proxyPort').hide();
															Ext.getCmp('isAuthenticationNo').setValue(true);
															Ext.getCmp('isAuthentication').hide();
															Ext.getCmp('proxyUsername').hide();
															Ext.getCmp('proxyPassword').hide();
															Ext.getCmp('proxyCnfPassword').hide();
														}
													}
												}
											},
											{
												boxLabel: 'No',
												name: 'useProxy',
												id: 'useProxyNo',
												checked: true,
												inputValue: 'no'
											}
										]
									},
									{
										xtype: 'radiogroup',
										columns: 2,
										vertical: false,
										id: 'useParentProxy',
										name: 'useParentProxy',
										cls : 'aRadiobt',
										hidden : true,
										fieldLabel: isSuperUserSuperOrg?useParentOrgProxyLabel+" ("+superUserNameForProxy+")?":useParentOrgUnitProxyLabel+" ("+superUserNameForProxy+")?",
										items: [
											{
												boxLabel: 'Yes',
												name: 'useParentProxy',
												id: 'useParentProxyYes',
												inputValue: 'yes',
												listeners : {
													change: function()
													{
														var useParentProxyYes = Ext.getCmp('useParentProxyYes').getGroupValue();
														if (!Ext.isEmpty(useParentProxyYes) && useParentProxyYes == 'yes')
														{
															if (!Ext.isEmpty(parentproxyEnabled) && parentproxyEnabled == 'y')
															{
																var parentproxyHost = publicProxyJson.parentproxyHost;
																var parentproxyPort = publicProxyJson.parentproxyPort;
																Ext.getCmp('proxyHost').setValue(parentproxyHost);
																Ext.getCmp('proxyPort').setValue(parentproxyPort);
																Ext.getCmp('proxyHost').show();
																Ext.getCmp('proxyPort').show();
																Ext.getCmp('proxyHost').setDisabled(true);
																Ext.getCmp('proxyPort').setDisabled(true);
																var parentsetAuthentication = publicProxyJson.parentsetAuthentication;
																Ext.getCmp('isAuthentication').show();
																if (!Ext.isEmpty(parentsetAuthentication) && parentsetAuthentication == 'y')
																{
																	Ext.getCmp('isAuthenticationYes').setValue(true);
																	var parentproxyUsername = publicProxyJson.parentproxyUsername;
																	var parentproxyPassword = publicProxyJson.parentproxyPassword;
																	Ext.getCmp('proxyUsername').setValue(parentproxyUsername);
																	Ext.getCmp('proxyPassword').setValue(parentproxyPassword);
																	Ext.getCmp('proxyCnfPassword').setValue(parentproxyPassword);
																	Ext.getCmp('proxyUsername').show();
																	Ext.getCmp('proxyPassword').show();
																	Ext.getCmp('proxyCnfPassword').show();
																	Ext.getCmp('proxyUsername').setDisabled(true);
																	Ext.getCmp('proxyPassword').setDisabled(true);
																	Ext.getCmp('proxyCnfPassword').setDisabled(true);
																}
																else
																{
																	Ext.getCmp('isAuthenticationNo').setValue(true);
																	Ext.getCmp('proxyUsername').hide();
																	Ext.getCmp('proxyPassword').hide();
																	Ext.getCmp('proxyCnfPassword').hide();
																}
																Ext.getCmp('isAuthentication').setDisabled(true);
															}
															else
															{
																Ext.getCmp('proxyHost').hide();
																Ext.getCmp('proxyPort').hide();
																Ext.getCmp('isAuthenticationNo').setValue(true);
																Ext.getCmp('isAuthentication').hide();
																Ext.getCmp('proxyUsername').hide();
																Ext.getCmp('proxyPassword').hide();
																Ext.getCmp('proxyCnfPassword').hide();
															}
														}
														else
														{
															Ext.getCmp('proxyHost').setValue('');
															Ext.getCmp('proxyPort').setValue('');
															Ext.getCmp('isAuthenticationNo').setValue(true);
															Ext.getCmp('proxyUsername').setValue('');
															Ext.getCmp('proxyPassword').setValue('');
															Ext.getCmp('proxyCnfPassword').setValue('');

															Ext.getCmp('proxyHost').show();
															Ext.getCmp('proxyPort').show();
															Ext.getCmp('isAuthentication').show();
															Ext.getCmp('proxyUsername').hide();
															Ext.getCmp('proxyPassword').hide();
															Ext.getCmp('proxyCnfPassword').hide();

															Ext.getCmp('proxyHost').setDisabled(false);
															Ext.getCmp('proxyPort').setDisabled(false);
															Ext.getCmp('isAuthentication').setDisabled(false);
															Ext.getCmp('proxyUsername').setDisabled(false);
															Ext.getCmp('proxyPassword').setDisabled(false);
															Ext.getCmp('proxyCnfPassword').setDisabled(false);
														}
													}
												}
											},
											{
												boxLabel: 'No',
												name: 'useParentProxy',
												id: 'useParentProxyNo',
												inputValue: 'no'
											}
										]
									},
									{
										xtype: 'textfield',
										id: 'proxyHost',
										name: 'proxyHost',
										cls: 'aTextbox',
										fieldLabel : proxyHostLabel,
										hidden: true
									},
									{
										xtype: 'textfield',
										id: 'proxyPort',
										name: 'proxyPort',
										cls: 'aTextbox',
										fieldLabel : proxyPortLabel,
										hidden: true
									},
									{
										xtype: 'radiogroup',
										columns: 2,
										vertical: false,
										id: 'isAuthentication',
										name: 'isAuthentication',
										cls : 'aRadiobt',
										fieldLabel: isAuthLabel+'?',
										hidden: true,
										items: [
											{
												boxLabel: 'Yes',
												name: 'isAuthentication',
												id: 'isAuthenticationYes',
												inputValue: 'yes',
												listeners : {
													change: function()
													{
														var isAuthenticationYes = Ext.getCmp('isAuthenticationYes').getGroupValue();
														if (!Ext.isEmpty(isAuthenticationYes) && isAuthenticationYes == 'yes')
														{
															Ext.getCmp('proxyUsername').show();
															Ext.getCmp('proxyPassword').show();
															Ext.getCmp('proxyCnfPassword').show();
														}
														else
														{
															Ext.getCmp('proxyUsername').hide();
															Ext.getCmp('proxyPassword').hide();
															Ext.getCmp('proxyCnfPassword').hide();
														}
													}
												}
											},
											{
												boxLabel: 'No',
												name: 'isAuthentication',
												id: 'isAuthenticationNo',
												checked: true,
												inputValue: 'no'
											}
										]
									},
									{
										xtype: 'textfield',
										id: 'proxyUsername',
										name: 'proxyUsername',
										cls: 'aTextbox',
										fieldLabel : proxyUnameLabel,
										hidden: true
									},
									{
										xtype: 'textfield',
										id: 'proxyPassword',
										name: 'proxyPassword',
										cls: 'aTextbox',
										fieldLabel : proxyPwdLabel,
										inputType: 'password',
										hidden: true
									},
									{
										xtype: 'textfield',
										id: 'proxyCnfPassword',
										name: 'proxyCnfPassword',
										cls: 'aTextbox',
										fieldLabel : proxyCnfPwdLabel,
										inputType: 'password',
										hidden: true
									}
								]
							}
						],
						dockedItems:[{
							xtype:'toolbar',
							dock: 'bottom',
							border:false,
							padding : '10 0 10 0',
							layout:{
								type: 'hbox',
								pack: 'center'
							},
							ui:'toolbarBgWithTopBorder',
							items: [
								{
									xtype: 'button',
									ui:'aButtonSmall',
									text: 'Submit',
									id: 'submitProxyDetails',
									listeners : {
										click : function()
										{
											appCnt.submitProxyDetails(agentType,monitors);
										}
									}
								}
							]
						}]
					}).show();
				}
				else
				{
					Ext.suspendLayouts();
					var innerCardObj = Ext.getCmp('card-0');
					innerCardObj.removeAll();
					innerCardObj.monitors = monitors;
					innerCardObj.agentType = agentType;
					innerCardObj.add({
							xtype: 'DownloadAgents'
					});
					Ext.resumeLayouts(true);
				}
			}
		});
	},

	loadAgentsForDownload : function(agentType)
	{
		var monitors = Ext.getCmp('card-0').monitors;
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentDownloadClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0DownloadAgentTitle);
		if (!Ext.isEmpty(agentType))
		{
			fromAgentModel = agentType;
		}
		else
		{
			agentType = fromAgentModel;
		}
		if (!Ext.isEmpty(agentType) && agentType == 'Remote')
		{
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentDownloadClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0DownloadRemAgentTitle);
		}
		else if (!Ext.isEmpty(agentType) && agentType == 'External')
		{
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.agentDownloadClose()"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>'+card0DownloadExtAgentTitle);
		}
		Ext.Ajax.request({
			url : '/final/admin/LimitedAdminHome/data/agentPackDownloadJson.jsp?fromAction='+fromAction+'&agentType='+encodeURIComponent(agentType)+'&monitors='+encodeURIComponent(monitors),
			method: 'POST',
			success: function(response)
			{
				var jsonText = response.responseText;
				publicJSON = Ext.decode(jsonText);
				
				Ext.getCmp('agentView').getStore().clearFilter();
				
				if (!Ext.isEmpty(publicJSON.listOfOS))
				{
					Ext.getCmp('agentView').getStore().loadRawData(publicJSON.listOfOS);
					Ext.getCmp('agentView').getStore().sort('valueField', 'DESC');

					Ext.getCmp('agentView').show();
					if (hideSkip)
					{
						Ext.getCmp('isGoldenImageServerCont').show();
					}
					Ext.getCmp('emptyAgentMsg').hide();
					
					if (agentType == 'Remote' || agentType == 'External')
					{
						Ext.getCmp('agentView').getStore().clearFilter();
						if (monitors == 'LogonSimulator')
						{
							var userFilter = new Ext.util.Filter({
							filterFn: function(item) {
									if (item.get('category').indexOf('Windows') != -1)
									{
										return true;
									}
								}
							});
						}
						else
						{
							var userFilter = new Ext.util.Filter({
								filterFn: function(item) {
									if (item.get('category').indexOf('Windows') != -1 || item.get('displayField').indexOf('Linux') != -1)
									{
										return true;
									}
								}
							});
						}
						Ext.getCmp('agentView').getStore().filter(userFilter);
						Ext.getCmp('agentView').getStore().each(function(rec) {
							Ext.getCmp('agentView').getStore().remove(Ext.getCmp('agentView').getStore().findRecord("folder","VM"));
						});
					}
					else if (agentType == 'VM')
					{
						Ext.getCmp('agentView').getStore().clearFilter();
						var userFilter = new Ext.util.Filter({
							filterFn: function(item) {
								if (item.get('displayField').indexOf('VM') != -1)
								{
									return true
								}
							}
						});
						Ext.getCmp('agentView').getStore().filter(userFilter);
					}
					else
					{
						Ext.getCmp('agentView').getStore().clearFilter();
						Ext.getCmp('agentView').getStore().filter(userFilter);
						Ext.getCmp('agentView').getStore().each(function(rec) {
							Ext.getCmp('agentView').getStore().remove(Ext.getCmp('agentView').getStore().findRecord("folder","VM"));
						});
					}

					if (Ext.isEmpty(Ext.getCmp('agentView').getStore().data.items))
					{
						Ext.getCmp('agentView').hide();
						Ext.getCmp('emptyAgentMsg').update('<div class="emptyMsgDiv"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+downloadAgentEmptyMsg1+'. <br/>'+downloadAgentEmptyMsg2+'.</div></div>');
						Ext.getCmp('emptyAgentMsg').show();
					}
				}
				else
				{
					Ext.getCmp('agentView').hide();
					Ext.getCmp('isGoldenImageServerCont').hide();
					Ext.getCmp('emptyAgentMsg').update('<div class="emptyMsgDiv"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+downloadAgentEmptyMsg1+'. <br/>'+downloadAgentEmptyMsg2+'.</div></div>');
					Ext.getCmp('emptyAgentMsg').show();
				}
			}
		});
	},

	agentDownloadClose : function()
	{
		Ext.suspendLayouts();
		var monitors = Ext.getCmp('card-0').monitors;
		var viewportObj = Ext.getCmp('card-0');
		viewportObj.removeAll();
		fromAction = "monitors_"+monitors;
		viewportObj.add({xtype:'EgDiscoverServersView'});
		Ext.resumeLayouts(true);
	},

	gotoDiscovers : function(discovertype,monitortype)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		if (monitortype == 'Hypervisors' || monitortype == 'CitrixAgentLessDisc')
		{
			var innerCardObj = Ext.getCmp('card-0');
			if (!Ext.isEmpty(discovertype))
			{
				Ext.suspendLayouts();
				innerCardObj.removeAll();
				innerCardObj.discover = discovertype;
				innerCardObj.monitors = monitortype;
				innerCardObj.add({
						xtype: 'EgConfigureServersForDiscovery'
				});
				Ext.resumeLayouts(true);
			}
		}
		else
		{
			if (discovertype == 'Citrix_XcLogon_Emulation' || discovertype == 'Hrzn_Logon_Emulation' || discovertype == 'Xchg_Logon_Emulation' || discovertype == 'Amazon_Logon_Emulation' || discovertype == 'Hrzn_Web_Logon_Emulation')
			{
				var innerCardObj = Ext.getCmp('card-0');
				Ext.suspendLayouts();
				innerCardObj.removeAll();
				innerCardObj.discover = discovertype;
				innerCardObj.monitors = monitortype;
				innerCardObj.add({
						xtype: 'EgLogonSimulatorConfiguration'
				});
				Ext.resumeLayouts(true);
			}
			else if (discovertype == 'Office365')
			{
				remoteAgent = sessionStorage.getItem("remoteAgent");
				appCnt.goToDiscoverServers(event,discovertype,remoteAgent);
			}
			else
			{
				var innerCardObj = Ext.getCmp('card-0');
				Ext.suspendLayouts();
				innerCardObj.removeAll();
				innerCardObj.discover = discovertype;
				innerCardObj.monitors = monitortype;
				innerCardObj.add({
						xtype: 'EgConfigureAgentLessServers'
				});
				Ext.resumeLayouts(true);
			}
		}
	},

	gotoAgentLessConfiguration : function(compType)
	{
		var me = this;
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var monitors = Ext.getCmp('card-0').monitors;
		var title = '';
		if (monitors == 'CitrixAgentLess')
		{
			title = card0CitrixALInnerTitle;
		}
		else if (monitors == 'VMwareHorizonAgentLess')
		{
			title = card0HorizonALInnerTitle;
		}
		else if (monitors == 'PublicCloud')
		{
			title = card0CloudInnerTitle;
		}
		else if (monitors == 'Kubernetes')
		{
			title = card0ContainerInnerTitle;
		}
		else if (monitors == 'SaaSApp')
		{
			title = card0SaasInnerTitle;
		}

		if (compType == 'AWS_EC2_Cloud')
		{
			Ext.getCmp('downloadJson').show();
		}
		else
		{
			Ext.getCmp('downloadJson').hide();
		}

		Ext.Ajax.request({
			url : 'NewComponent/data/EgNewServerJson.jsp?selectedServerGroup=all&server=new&serverType='+compType,
			method: 'POST',
			async: false,
			success: function(response)
			{
				var jsonText = response.responseText;
				publicJSON = Ext.decode(jsonText);
				publicJSONMSOffice = publicJSON;
				var hideHostIP = publicJSON.hideHostIPField;
				var portParam = publicJSON.portParam;

				var agentLessParamPanel = Ext.getCmp('agentLessParamPanel');
				var compInfoSet = Ext.getCmp('compInfoSet');
				var compConfSet = Ext.getCmp('compConfSet');
				var compConfSet1 = Ext.getCmp('compConfSet1');

				var serverTypeDisp = publicJSON.serverTypeDisp+' '+preferencesTitle;
				agentLessParamPanel.setTitle(serverTypeDisp);

				if (monitors == 'Kubernetes')
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.gotoApplicationServers(\'Kubernetes\')"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>Monitor '+publicJSON.serverTypeDisp+' using '+remoteAgent);
				}
				else
				{
					Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.goToDiscoverServers(event,\''+monitors+'\',\''+remoteAgent+'\')"> <img src="/final/images/spacer.gif" class="aIconBackArrow" /> </a>Monitor '+publicJSON.serverTypeDisp+' using '+remoteAgent);
				}
				Ext.getCmp('agentlessMsgRecommendation').update('<div class="aPanelRegularText" style="margin:15px 10px 5px 10px ;">'+recMsg1+' '+publicJSON.serverTypeDisp+' '+recMsg2+':'+'</div>');

				if (!hideHostIP)
				{
					var includeip = {
						xtype: 'textfield',
						id: 'hostipparam',
						name: 'hostipparam',
						fieldLabel: office365HostIPLbl,
						cls: 'aTextbox'
					};
					compInfoSet.add(includeip);
				}

				var nick = {
					xtype: 'textfield',
					id: 'nickparam',
					name: 'nickparam',
					fieldLabel: office365HostNameLbl,
					cls: 'aTextbox',
					maxLength: 32,
					enforceMaxLength: true
				};
				compInfoSet.add(nick);

				if (portParam)
				{
					var includeport = {
						xtype: 'textfield',
						id: 'portparam',
						name: 'portparam',
						fieldLabel: 'PORT',
						cls: 'aTextbox'
					};
					compInfoSet.add(includeport);

					var portValJson = publicJSON.portValue;
					if(portValJson.indexOf(":") > 0)
					{
						portValJson = portValJson.substring(0,portValJson.indexOf(":"));
					}
					Ext.getCmp('portparam').setValue(portValJson);
				}

				Ext.Ajax.request({
					url : '/final/admin/LimitedAdminHome/data/EgConfigureAgentLessServersJson.jsp?fromAction='+fromAction+'&compType='+encodeURIComponent(compType),
					method: 'POST',
					async: false,
					success: function(response)
					{
						var jsonText = response.responseText;
						publicAgentLessJson = Ext.decode(jsonText);

						if (compType == 'CitrixXenMobile')
						{
							Ext.getCmp('compConf').hide();
							Ext.getCmp('compConf1').hide();
							
							var paramNameArray = publicAgentLessJson.paramNameArray;
							if (!Ext.isEmpty(paramNameArray))
							{
								for (var i = 0;i < paramNameArray.length ;i++ )
								{
									var paramNameArr = paramNameArray[i];
									var paramName = paramNameArr.paramName;
									var dispParamName = paramNameArr.dispParamName;
									var testParamControl = paramNameArr.testParamControl;
									var fieldset = paramNameArr.fieldset;
									var fieldSetObj = Ext.getCmp(fieldset);

									if (testParamControl == 'text')
									{
										var includetext = {
											xtype: 'textfield',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											cls: 'aTextbox'
										};
										fieldSetObj.add(includetext);
									}
									else if (testParamControl == 'textarea')
									{
										var includetextarea = {
											xtype: 'textarea',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											cls: 'aTextarea'
										};
										fieldSetObj.add(includetextarea);
									}
									else if (testParamControl == 'password')
									{
										var includepass = {
											xtype: 'textfield',
											inputType: 'password',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											cls: 'aTextbox'
										};
										fieldSetObj.add(includepass);
									}
									else if (testParamControl == 'radio')
									{
										var includeradio = {
											xtype: 'radiogroup',
											cls: 'aRadiobt',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											vertical: false,
											columns: 2,
											items: [
												{ boxLabel: 'Yes', name: paramName, id: paramName+'1',  inputValue: true,checked: false},
												{ boxLabel: 'No', name: paramName, id: paramName+'2',  inputValue: false, checked: true}
											],
											listeners: {
												'change' : function() 
												{
													me.changeValue(this);
												}
											}
										};
										fieldSetObj.add(includeradio);
									}
									else if (testParamControl == 'select')
									{
										var snmpArr = paramNameArr.snmpArr;

										var includeselect = {
											xtype: 'scrollcombo',
											cls: 'dropdown',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											queryMode: 'local',
											displayField: 'displayField',
											valueField: 'valueField',
											editable: false,
											parent:this,
											store:new Ext.data.Store({
												fields: ['displayField','valueField'],
												data: snmpArr
											}),
											listeners: {
												'select' : function() 
												{
													me.changeValue(this);
												}
											}
										};
										fieldSetObj.add(includeselect);
										Ext.getCmp(paramName).setValue(Ext.getCmp(paramName).getStore().getAt(0));
									}
									if (paramName == 'snmpPort')
									{
										Ext.getCmp('snmpPort').setValue('161');
									}
								}
								me.callChangeValue();
							}
							else
							{
								Ext.getCmp('specificConf1').hide();
								Ext.getCmp('specificConf2').hide();
								Ext.getCmp('specificConf3').hide();
								Ext.getCmp('specificConf4').hide();
							}
						}
						else
						{
							Ext.getCmp('specificConf1').hide();
							Ext.getCmp('specificConf2').hide();
							Ext.getCmp('specificConf3').hide();
							Ext.getCmp('specificConf4').hide();

							var paramNameArray = publicAgentLessJson.paramNameArray;
							if (!Ext.isEmpty(paramNameArray))
							{
								Ext.getCmp('compConf').show();

								var isViewEvents = false;

								for (var i = 0;i < paramNameArray.length ;i++ )
								{
									var paramNameArr = paramNameArray[i];
									var paramName = paramNameArr.paramName;
									var dispParamName = paramNameArr.dispParamName;
									var testParamControl = paramNameArr.testParamControl;
									var ViewEvents = paramNameArr.ViewEvents;
									
									if (testParamControl == 'text')
									{
										var includetext = {
											xtype: 'textfield',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											cls: 'aTextbox'
										};
										if (ViewEvents == 'true')
										{
											isViewEvents = true;
											compConfSet1.add(includetext);
										}
										else
										{
											compConfSet.add(includetext);
										}
									}
									else if (testParamControl == 'textarea')
									{
										var includetextarea = {
											xtype: 'textarea',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											cls: 'aTextarea'
										};
										if (ViewEvents == 'true')
										{
											isViewEvents = true;
											compConfSet1.add(includetextarea);
										}
										else
										{
											compConfSet.add(includetextarea);
										}
									}
									else if (testParamControl == 'password')
									{
										var includepass = {
											xtype: 'textfield',
											inputType: 'password',
											id: paramName,
											name: paramName,
											fieldLabel: dispParamName,
											cls: 'aTextbox'
										};
										if (ViewEvents == 'true')
										{
											isViewEvents = true;
											compConfSet1.add(includepass);
										}
										else
										{
											compConfSet.add(includepass);
										}
									}
								}
								if (isViewEvents)
								{
									Ext.getCmp('compConf').setTitle('<div>'+sessionInfoTitle+'</div>');
									Ext.getCmp('compConf1').show();
								}
								else
								{
									Ext.getCmp('compConf').setTitle('<div>'+monitoringInfoTitle+'</div>');
									Ext.getCmp('compConf1').hide();
								}
							}
							else
							{
								Ext.getCmp('compConf').hide();
								Ext.getCmp('compConf1').hide();
							}
						}
					}
				});
			}
		});

		if (compType == 'AWS_EC2_Cloud' || compType == 'Kubernetes')
		{
			if (compType == 'AWS_EC2_Cloud')
			{
				Ext.getCmp('whatNextTextCont').update('<div class="whatNextHeader">'+howToConfTitle+'</div><div><ol class="listCount"><li>'+downloadJsonfile+'</li><li><a class="whatNextLink" href="javascript:void(0)" onclick="javascript:appCnt.fetchHelpDoc()">'+clickHere+'</a>'+' '+awsMsg1+'</li><li>'+awsMsg2+'</li></ol></div>');
				Ext.getCmp('WhatNextObjCont').setHeight(160);
			}
			else if (compType == 'Kubernetes')
			{
				Ext.getCmp('whatNextTextCont').update('<div class="whatNextHeader">'+howToConfTitle+'</div><div><ol class="listCount"><li>'+kuberMsg1+'</li><li>'+kuberMsg2+'<div style="margin-top:10px;font-weight:500;"> kubectl create -f https://raw.githubusercontent.com/egmonitoring/kubernetes/master/eginnovations.yaml</div>'+'</li><li>'+kuberMsg3+' '+kuberMsg4+' "eginnovations-token-xxxxx" <div style="margin-top:10px;font-weight:500;"> kubectl get secrets | grep "eginnovations"</div>'+'</li><li>'+kuberMsg5+' &lt;xxxxx&gt; '+kuberMsg6+'<div style="margin-top:10px;font-weight:500;"> kubectl describe secrets &lt;xxxxx&gt; | grep -I "token:"</div>'+'</li><li>'+kuberMsg7+'</li></ol></div>');
				Ext.getCmp('WhatNextObjCont').setHeight(360);
			}
			Ext.getCmp('agentlessMsgRecommendationHelp').show();
		}
		else
		{
			Ext.getCmp('agentlessMsgRecommendationHelp').hide();
		}
	},

	fetchHelpDoc : function()
	{
		var win = window.open("/final/eghelp/EgA9213.html", '_blank');
		win.focus();
	},

	downloadJSON : function()
	{
		var downloadUtils =  Ext.widget('DownloadUtils');
		var discover = Ext.getCmp('card-0').discover;
		downloadUtils.downloadJson(discover);
	},

	callChangeValue : function()
	{
		if (!Ext.isEmpty(Ext.getCmp('snmpversion')))
		{
			appCnt.changeValue(Ext.getCmp('snmpversion'));
		}
	},

	changeValue : function(obj)
	{
		var objId = obj.id;
		if (objId == 'snmpversion')
		{
			var value = obj.getValue();
			if (value == 'v3')
			{
				Ext.getCmp('snmpCommunity').hide();
				Ext.getCmp('snmpCommunity').setDisabled(true);

				Ext.getCmp('context').show();
				Ext.getCmp('username').show();
				Ext.getCmp('authpass').show();
				Ext.getCmp('authtype').show();
				Ext.getCmp('encryptflag').show();

				Ext.getCmp('context').setDisabled(false);
				Ext.getCmp('username').setDisabled(false);
				Ext.getCmp('authpass').setDisabled(false);
				Ext.getCmp('authtype').setDisabled(false);
				Ext.getCmp('encryptflag').setDisabled(false);

				Ext.getCmp('context').setValue('none');
				Ext.getCmp('username').setValue('none');
				Ext.getCmp('authpass').setValue('none');

				Ext.getCmp('encrypttype').hide();
				Ext.getCmp('encryptpassword').hide();

				Ext.getCmp('encrypttype').setDisabled(true);
				Ext.getCmp('encryptpassword').setDisabled(true);
			}
			else
			{
				Ext.getCmp('snmpCommunity').show();
				Ext.getCmp('snmpCommunity').setDisabled(false);

				Ext.getCmp('context').hide();
				Ext.getCmp('username').hide();
				Ext.getCmp('authpass').hide();
				Ext.getCmp('authtype').hide();
				Ext.getCmp('encryptflag').hide();

				Ext.getCmp('context').setDisabled(true);
				Ext.getCmp('username').setDisabled(true);
				Ext.getCmp('authpass').setDisabled(true);
				Ext.getCmp('authtype').setDisabled(true);
				Ext.getCmp('encryptflag').setDisabled(true);

				Ext.getCmp('encrypttype').hide();
				Ext.getCmp('encryptpassword').hide();

				Ext.getCmp('encrypttype').setDisabled(true);
				Ext.getCmp('encryptpassword').setDisabled(true);
			}
		}
		else if (objId == 'encryptflag')
		{
			var encryptValue = Ext.getCmp('encryptflag1').getGroupValue();
			if (encryptValue == true)
			{
				Ext.getCmp('encrypttype').show();
				Ext.getCmp('encryptpassword').show();

				Ext.getCmp('encryptpassword').setValue('none');

				Ext.getCmp('encrypttype').setDisabled(false);
				Ext.getCmp('encryptpassword').setDisabled(false);
			}
			else
			{
				Ext.getCmp('encrypttype').hide();
				Ext.getCmp('encryptpassword').hide();

				Ext.getCmp('encrypttype').setDisabled(true);
				Ext.getCmp('encryptpassword').setDisabled(true);
			}
		}
	},

	submitAgentLessServerDetails : function()
	{
		var me = this;
		var monitors = Ext.getCmp('card-0').monitors;
		remoteAgent = sessionStorage.getItem("remoteAgent");

		var alertMsgTitle = Ext.getCmp('agentLessParamPanel').title;
		
		var compType = Ext.getCmp('card-0').discover;
		var agentLessform = Ext.getCmp('agentLessParamPanel').getForm();
		
		var compNickObj = Ext.getCmp('nickparam');
		var compNickVal = Ext.getCmp('nickparam').getValue();
		
		var agentLess = true;
		if(isDoubleByteMgr=="false")
		{
			if(!validateSingleByte(compNickVal))
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: alertMsg1,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					//width: 700,
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}

		var hostIpObj = Ext.getCmp('hostipparam');
		if (!Ext.isEmpty(hostIpObj))
		{
			var hostIpVal = Ext.getCmp('hostipparam').getValue();
			if(!publicJSON.hideHostIPField && !checkblank(hostIpVal))
			{
				if (isAllowHostName=='false')
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: alertMsg18,
						width: 300,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								hostIpObj.focus(true);
							}
						}
					});
				}
				else
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: alertMsg19,
						buttons: Ext.Msg.OK,
						width: 300,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								hostIpObj.focus(true);
							}
						}
					});
				}
				return false;
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='false' && validateIpAddressExtjs(hostIpVal) != '0')
			{
				var updateValue = validateIpAddressExtjs(hostIpVal);
				if(updateValue == "1")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "5")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkspaceIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "6")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkAlpha,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "7")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "8")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _valIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "9")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _validateIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "10")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checknum,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && validateHostFieldExtjs(hostIpVal) != '0')
			{
				var updateValue =  validateHostFieldExtjs(hostIpVal);
				if(updateValue == "1")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "5")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkspaceIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "6")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkAlpha,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "7")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "8")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _valIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "9")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _validateIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "10")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checknum,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "11")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _chkIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "12")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _doubleColon,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "13")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _grpIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "14")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _digitIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "15")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _validateIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "16")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkNumberLabel,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "17")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && checkspaceExtjs(hostIpVal) != '0')
			{
				var updateValue = checkspaceExtjs(hostIpVal);
				if(updateValue == "17")
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && checkSpecialExtjs(hostIpVal,"`~!@#$%^&*()+={}[]|\\;\"\'<>,?/") != '0') 
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		if(isAllowHostName=='true' && !this.checkForHostType(compNickVal))
		{
			Ext.Msg.show({
				title: alertMsgTitle,
				msg: alertMsg20 + alertMsg21,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(!checkblank(compNickVal))
		{
			Ext.Msg.show({
				title: alertMsgTitle,
				msg: alertMsg22,
				width:200,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(checkspaceExtjs(compNickVal) != '0')
		{
			Ext.Msg.show({
				title: alertMsgTitle,
				msg: "Space is not allowed",
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(checkSpecialExtjs(compNickVal,"`~!@#$%^&*()+={}[]|\\:;\"\'<>,?/") != '0') 
		{
			Ext.Msg.show({
				title: alertMsgTitle,
				msg: _checkspecial,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(compNickVal.toLowerCase() == "none")
		{
			Ext.Msg.show({
				title: alertMsgTitle,
				msg: "You are not allowed to use eG reserved keyword \'"+compNickVal+"\' as component name",
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if (!this.checkForHostType(compNickVal))
		{
			Ext.Msg.show({
				title: alertMsgTitle,
				msg: alertMsg20 + alertMsg21,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(!this.checkdots(compNickVal))
		{
			compNickObj.focus(true);
			return;
		}
		else if(!this.isValidateHostName(compNickVal)/* && !isAggType*/)
		{
			if (!Ext.isEmpty(hostIpObj))
			{
				var hostIpVal = Ext.getCmp('hostipparam').getValue();

				if(compNickVal != hostIpVal)
				{
					Ext.Msg.show({
						title: alertMsgTitle,
						msg: alertMsg25,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								compNickObj.focus(true);
							}
						}
					});
					return false;
				}
			}
		}
		
		if (agentLess && this.validateHostNameWithRemote(compNickVal))
		{
			//Ext.getCmp("enableRemoteAgent").setValue(false);
			return false;
		}
		if (isDoubleByteMgr=='false')
		{
			if(compNickVal.toLowerCase() == compType.toLowerCase())
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: alertMsg26,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		var portObj = Ext.getCmp('portparam');
		if (!Ext.isEmpty(portObj))
		{
			var portVal = Ext.getCmp('portparam').getValue();
			if(!checkblank(portVal))
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: alertMsg27,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							portObj.focus(true);
						}
					}
				});
				return false;
			}
			else if (!checknumber("+",portVal) && portVal != 'NULL')
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: alertMsg28,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							portObj.focus(true);
						}
					}
				});
				return false;
			}
			else if (!checkfordecimal(portVal))
			{
				portObj.focus(true);
				return false;
			}
			else if (portVal < 1)
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: alertMsg11,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							portObj.focus(true);
						}
					}
				});
				return false;
			}
			else if (portVal > 99999)
			{
				Ext.Msg.show({
					title: alertMsgTitle,
					msg: alertMsg12,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							portObj.focus(true);
						}
					}
				});
				return false;
			}
			else if (!checkspace(portVal))
			{
				portObj.focus(true);
				return false;
			}
		}

		pageName = Ext.getCmp('agentLessParamPanel').title;

		var allowToUpdate = validateParams(compType,agentLessform);

		if (allowToUpdate && agentLessform.isValid())
		{
			var myMask = new Ext.LoadMask(Ext.getBody(), {msg: 'Updating...'});
			myMask.show();

			agentLessform.submit({
				url : '/final/admin/LimitedAdminHome/data/EgConfigureAgentLessServersJsonp.jsp?fromAction='+fromAction+'&remoteAgent='+encodeURIComponent(remoteAgent)+'&compType='+encodeURIComponent(compType),
				method: 'POST',
				params: me.encodeFieldParams(agentLessform,publicAgentLessJson),
				async: false,
				success: function (form, action) 
				{
					myMask.hide();
					var jsonText = action.response.responseText;
					var publicAgentLessJsonp = Ext.decode(jsonText);
					var compTypeDisplay = publicAgentLessJsonp.compTypeDisplay;
					var success = publicAgentLessJsonp.success;
					if (!Ext.isEmpty(success) && success == 'true')
					{
						Ext.Msg.show({
							title: alertMsgTitle,
							msg: compSuccMsg1+' '+compTypeDisplay+' '+compSuccMsg2+'.',
							width: 600,
							buttons: Ext.Msg.OK,
							icon: 'gen-info size32 color-info',
							fn: function() {
								if (monitors == 'Kubernetes')
								{
									me.agentlessDiscoveryServersCloseForKubernetes();
								}
								else
								{
									me.configureServersClose();
								}
							}
						});
					}
					else
					{
						var errorMsg = publicAgentLessJsonp.errorMsg;
						Ext.Msg.show({
							title: alertMsgTitle,
							msg: errorMsg,
							width: 600,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								
							}
						});
					}
				}
			});
		}
	},

	encodeFieldParams: function(thisForm,json)
	{
		var me = this;
		var encodeParams = "";
		var fieldsArr = thisForm.getFields().items;
		var encodeParamList = json['encodeParamList'];
		for(var i in fieldsArr)
		{
			var fieldParamName = fieldsArr[i].name;
			var fieldParamValue = fieldsArr[i].value;
			if(Ext.isEmpty(fieldParamName) || fieldsArr[i].disabled || !me.isExistsParam(encodeParamList,fieldParamName))
			{
				continue;
			}
			Ext.getCmp(fieldsArr[i].id).submitValue = false;
			encodeParams += "&"+fieldParamName+"="+encodeURIComponent(filterEncode(fieldParamValue));
		}
		return encodeParams;
	},
	isExistsParam: function(array, item) 
	{
		var i, ln;
		for (i = 0, ln = array.length; i < ln; i++) 
		{
			if (array[i].toLowerCase() === item.toLowerCase()) 
			{
				return true;
			}
		}
		return false;
	},
	
	updateDiscoveryTree : function(defaultUrl)
	{
		Ext.Ajax.request({
			url : defaultUrl,
			method: 'POST',
			async: false,
			success: function(response)
			{
				var jsonText = response.responseText;
				publicDiscoveryJson = Ext.decode(jsonText);
			}
		});
	},

	updateResultPaanel : function(emptyMessage)
	{
		var resultPanelObj = Ext.getCmp('resultPanel');
		resultPanelObj.removeAll();
		var emptyResultPanel = {
			style : {'text-align':'center'},
			padding : 120,
			border :false,
			html: '<div class = "gen-info size32 color-info" style="margin:0 auto" ></div><div class="commonErrorMsgText">'+emptyMessage+'.</div>'
		};
		resultPanelObj.add(emptyResultPanel);
		resultPanelObj.show();
	},

	getGridPanel : function(gridArray,cols,gridTitle,gridType,configuredObj)
	{
		var fieldstoStore =  new Array();
		var mainColumnsObjArray =  new Array();
		var itemsArray =  new Array();

		for (var key in cols)
		{
			var gridColumn = cols[key];
			fieldstoStore.push(key);
			if(key == 'User')
			{
				mainColumnsObjArray.push({
					header: gridColumn,
					sortable:true,
					tdCls:'wrap-text' ,
					dataIndex: key,
					flex:1
				});
			}
			else if (key == 'Discovery Enabled')
			{
				mainColumnsObjArray.push({
					header: gridColumn,
					sortable:true,
					hidden: true,
					dataIndex: key,
					flex:1
				});
			}
			else
			{
				mainColumnsObjArray.push({
					header: gridColumn,
					sortable:true,
					dataIndex: key,
					flex:1
				});
			}
		}

		mainColumnsObjArray.push({
			xtype: 'actioncolumn',
			width: 36,
			id: 'EditvcenterOver',
			sortable: true,
			renderer: function(value, metaData, record, row, col, store, gridView)
			{
				metaData.tdAttr = "data-qtip='Modify' data-qclass='yellowTip'";
				var hostOrgName = "";
				if (gridType == 'vCenters')
				{
					hostOrgName = record.get('vCenter IP/Host');
				}
				else if (gridType == 'HMCs')
				{
					hostOrgName = record.get('HMC IP');
				}
				else if (gridType == 'RHEV')
				{
					hostOrgName = record.get('RHEV Manager IP/Host');
				}
				else if (gridType == 'Nutanix')
				{
					hostOrgName = record.get('Nutanix IP');
				}
				else if (gridType == 'CtxXenPool')
				{
					hostOrgName = record.get('Citrix XenServer Pool IP/Host');
				}
				else if (gridType == 'OracleVM')
				{
					hostOrgName = record.get('Oracle VM Manager IP/Host');
				}
				else if (gridType == 'EMC')
				{
					hostOrgName = record.get('IP/Host');
				}
				else if (gridType == 'netScalers')
				{
					hostOrgName = record.get('IP/Host');
				}
				return "<div style='cursor:pointer' onclick=\"javascript:appCnt.handleDiscoveryAddModifyClick('modify','"+hostOrgName+"','"+gridType+"')\" class='aIconEdit'></div>";
			}
		});

		mainColumnsObjArray.push({
			xtype: 'actioncolumn',
			width: 36,
			id: 'DeletevcenterOver',
			sortable: true,
			renderer: function(value, metaData, record, row, col, store, gridView)
			{
				var hostOrgName = "";
				var hypervisorType = "";
				if (gridType == 'vCenters')
				{
					hostOrgName = record.get('vCenter IP/Host');
					hypervisorType = 'vCenter';
				}
				else if (gridType == 'HMCs')
				{
					hostOrgName = record.get('HMC IP');
					hypervisorType = 'HMC';
				}
				else if (gridType == 'RHEV')
				{
					hostOrgName = record.get('RHEV Manager IP/Host');
					hypervisorType = 'RHEV';
				}
				else if (gridType == 'Nutanix')
				{
					hostOrgName = record.get('Nutanix IP');
					hypervisorType = 'Nutanix';
				}
				else if (gridType == 'CtxXenPool')
				{
					hostOrgName = record.get('Citrix XenServer Pool IP/Host');
					hypervisorType = 'Citrix XenServer';
				}
				else if (gridType == 'OracleVM')
				{
					hostOrgName = record.get('Oracle VM Manager IP/Host');
					hypervisorType = 'Oracle VM Manager';
				}
				else if (gridType == 'EMC')
				{
					hostOrgName = record.get('IP/Host');
					hypervisorType = 'EMC';
				}
				else if (gridType == 'netScalers')
				{
					hostOrgName = record.get('IP/Host');
					hypervisorType = 'NetScaler';
				}
				if (!Ext.isEmpty(configuredObj) && !Ext.isEmpty(hostOrgName) && configuredObj[hostOrgName])
				{
					return "<div style='opacity:.3;' class='aIconTrash'></div>";
				}
				else
				{
					metaData.tdAttr = "data-qtip='Delete' data-qclass='yellowTip'";
					return "<div style='cursor:pointer' onclick=\"javascript:appCnt.handleDiscoveryDeleteClick('"+hostOrgName+"','"+gridType+"','"+hypervisorType+"')\" class='aIconTrash'></div>";
				}
			}
		});

		var gridpanel = Ext.widget('DiscoveryDetailsGrid',{
			store:new Ext.data.Store({
				fields: fieldstoStore,
				data: gridArray
			}),
			viewConfig: {
				deferEmptyText: true
			},
			emptyText: '<div class="emptyText"><div class="gen-info size32 color-info"></div><div align="center" class="commonErrorMsgText">'+emptyMsg+'</div></div>',
			sortableColumns:true,
			columns:mainColumnsObjArray,
			tools: [
				{
					xtype:'tbfill',
				},
				{
					xtype: 'button',
					ui:'aButtonSmall',
					text: newBtnText,
					margin: 10,
					listeners: {
						click : function()
						{
							var discover = Ext.getCmp('card-0').discover;
							appCnt.handleDiscoveryAddModifyClick("add","",discover);
						}
					}
				},
				{
					xtype: 'trigger',
					//cls:'whitedropdown_search',
					cls:'aSearch',
					trigger1Cls: 'x-form-clear-trigger',
					trigger2Cls: 'x-form-search-trigger',
					id: 'gridvirtualservSearch',
					name: 'gridvirtualservSearch',
					emptyText: searchEmptyText,
					getTriggerMarkup: function() {
						var me = this,
						i = 0,
						hideTrigger = (me.readOnly || me.hideTrigger),
						triggerCls,
						triggerBaseCls = me.triggerBaseCls,
						triggerConfigs = [],
						unselectableCls = Ext.dom.Element.unselectableCls,
						style = 'width:' + me.triggerWidth + 'px;' + (hideTrigger ? 'display:none;' : ''),
						cls = me.extraTriggerCls + ' ' + Ext.baseCSSPrefix + 'trigger-cell ' + unselectableCls;
						// TODO this trigger<n>Cls API design doesn't feel clean, especially where it butts up against the
						// single triggerCls config. Should rethink this, perhaps something more structured like a list of
						// trigger config objects that hold cls, handler, etc.
						// triggerCls is a synonym for trigger1Cls, so copy it.
						if (!me.trigger1Cls) {
							me.trigger1Cls = me.triggerCls;
						}
						// Create as many trigger elements as we have trigger<n>Cls configs, but always at least one
						for (i = 0; (triggerCls = me['trigger' + (i + 1) + 'Cls']) || i < 1; i++) {
							if (i == 0)
							{
								triggerConfigs.push({
									tag: 'td',
									role: 'presentation',
									valign: 'top',
									cls: cls,
									id : 'MyTrigger_'+i,
									style: style + "display:none;",
									cn: {
										cls: [Ext.baseCSSPrefix + 'trigger-index-' + i, triggerBaseCls, triggerCls].join(' '),
										role: 'presentation'
									}
								});
							}
							else
							{
								triggerConfigs.push({
									tag: 'td',
									role: 'presentation',
									valign: 'top',
									cls: cls,
									id : 'MyTrigger_'+i,
									style: style,
									cn: {
										cls: [Ext.baseCSSPrefix + 'trigger-index-' + i, triggerBaseCls, triggerCls].join(' '),
										role: 'presentation'
									}
								 });
							}
						}
						triggerConfigs[0].cn.cls += ' ' + triggerBaseCls + '-first';
						return Ext.DomHelper.markup(triggerConfigs);
					},
					onTrigger1Click : function() {
						this.reset();
					},
					onTrigger2Click : function() {
						appCnt.mainGridVirtualServersSearch(gridType);
					},
					listeners : {
						change : function()
						{
							appCnt.mainGridVirtualServersSearch(gridType);
						}
					}
				}
			],
			title:gridTitle,
			viewConfig: {
				forceFit: true,
				stripeRows : false
			}
		});
		var resultPanelObj = Ext.getCmp('resultPanel');
		resultPanelObj.removeAll();
		resultPanelObj.add(gridpanel);
		resultPanelObj.show();
	},

	mainGridVirtualServersSearch : function(gridTitle)
	{
		var gridObj = Ext.getCmp('DiscoveryDetailsGrid');
		var gridsearch = Ext.getCmp('gridvirtualservSearch').getValue();
		if (gridsearch == "" || gridsearch.length == 0)
		{
			Ext.get('MyTrigger_0').setStyle('display','none');
			Ext.get('MyTrigger_1').setStyle('display','block');
		}
		else
		{
			Ext.get('MyTrigger_1').setStyle('display','none');
			Ext.get('MyTrigger_0').setStyle('display','block');
		}

		var columnName = "";

		if (gridTitle == 'vCenters')
		{
			columnName = 'vCenter IP/Host';
		}
		else if (gridTitle == 'HMCs')
		{
			columnName = 'HMC IP';
		}
		else if (gridTitle == 'RHEV')
		{
			columnName = 'RHEV Manager IP/Host';
		}
		else if (gridTitle == 'Nutanix')
		{
			columnName = 'Nutanix IP';
		}
		else if (gridTitle == 'CtxXenPool')
		{
			columnName = 'Citrix XenServer Pool IP/Host';
		}
		else if (gridTitle == 'OracleVM')
		{
			columnName = 'Oracle VM Manager IP/Host';
		}
		else if (gridTitle == 'EMC')
		{
			columnName = 'IP/Host';
		}
		else if (gridTitle == 'netScalers')
		{
			columnName = 'IP/Host';
		}

		if (gridsearch == "" || gridsearch.length == 0)
		{
			gridObj.store.clearFilter();
		}
		else
		{
			gridObj.store.clearFilter();
			var filterLogic = new Ext.util.Filter({
				filterFn: function(item) {
					var testName = item.get(columnName);
					var dispName = testName;
					if (dispName.toLowerCase().indexOf(gridsearch.toLowerCase()) != -1)
					{
						return true
					}
				}
			});
			gridObj.store.filter(filterLogic);
		}
		gridObj.doLayout();
	},

	gotoSpecificDiscoveryServers : function(discoverType)
	{
		if (discoverType == 'vCenters')
		{
			appCnt.gotoVcenterDiscovers(true);
		}
		else if (discoverType == 'HMCs')
		{
			appCnt.gotoHMCDetails(true);
		}
		else if (discoverType == 'RHEV')
		{
			appCnt.gotoRHEVDetails(true);
		}
		else if (discoverType == 'Nutanix')
		{
			appCnt.gotoNutanixDetails(true);
		}
		else if (discoverType == 'CtxXenPool')
		{
			appCnt.gotoCtxXenPoolDetails(true);
		}
		else if (discoverType == 'OracleVM')
		{
			appCnt.gotoOracleVMDetails(true);
		}
		else if (discoverType == 'EMC')
		{
			appCnt.gotoEMCDetails(true);
		}
		else if (discoverType == 'netScalers')
		{
			appCnt.gotoCtxNetScalerDetails(true);
		}
	},

	configureServersClose : function()
	{
		comeFrom = "hypervisors";
		Ext.suspendLayouts();
		var monitors = Ext.getCmp('card-0').monitors;
		var viewportObj = Ext.getCmp('card-0');
		viewportObj.removeAll();
		fromAction = "monitors_"+monitors+":"+"category";
		viewportObj.add({xtype:'EgAgentlessDiscoveryServers'});
		Ext.resumeLayouts(true);
	},

	gotoVcenterDiscovers : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=vCentersView&remoteAgent="+remoteAgent;
		appCnt.updateDiscoveryTree(url);
		var vCenters = publicDiscoveryJson['vCenterDetails']['vCenterServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['vCenterDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['vCenterDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['vCenterDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(vCenters))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+vCenterGridMsg+'.</div>');
			var cols = publicDiscoveryJson['vCenterDetails']['columns'];
			var vCenterConfiguredObj = publicDiscoveryJson['vCenterConfiguredObj'];
			me.getGridPanel(vCenters,cols,gridTitle,'vCenters',vCenterConfiguredObj);
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+vCenterConfigureMsg+'.</div>');

				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"vCenters");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();

				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var vCenterLabels = publicDiscoveryJson['vCenterLabels'];
				appCnt.setIntnlLabels(vCenterLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},

	gotoHMCDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=HMCsView&remoteAgent="+remoteAgent;
		this.updateDiscoveryTree(url);
		var hmcServers = publicDiscoveryJson['hmcDetails']['hmcServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['hmcDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['hmcDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['hmcDetails']['prefTitle'];

		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(hmcServers))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+hmcGridMsg+'.</div>');
			var cols = publicDiscoveryJson['hmcDetails']['columns'];
			var hmcConfiguredObj = publicDiscoveryJson['hmcConfiguredObj'];
			me.getGridPanel(hmcServers,cols,gridTitle,'HMCs',hmcConfiguredObj);
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+hmcConfigureMsg+'.</div>');

				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"HMCs");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				Ext.getCmp('hName').hide();
				Ext.getCmp('webport').hide();

				var HMCLabels = publicDiscoveryJson['HMCLabels'];
				appCnt.setIntnlLabels(HMCLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},

	gotoRHEVDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=RHEVView&remoteAgent="+remoteAgent;
		this.updateDiscoveryTree(url);
		var rhevDetails = publicDiscoveryJson['rhevDetails']['rhevManagers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['rhevDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['rhevDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['rhevDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(rhevDetails))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+rhevGridMsg+'.</div>');
			var cols = publicDiscoveryJson['rhevDetails']['columns'];
			var rhevConfiguredObj = publicDiscoveryJson['rhevConfiguredObj'];
			me.getGridPanel(rhevDetails,cols,gridTitle,'RHEV',rhevConfiguredObj);
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+rhevConfigureMsg+'.</div>');
				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"RHEV");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				Ext.getCmp('domain').show();

				var RHEVLabels = publicDiscoveryJson['RHEVLabels'];
				appCnt.setIntnlLabels(RHEVLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},

	gotoNutanixDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=NutanixView&remoteAgent="+remoteAgent;
		this.updateDiscoveryTree(url);
		var nutanixDetails = publicDiscoveryJson['nutanixDetails']['nutanixServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['nutanixDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['nutanixDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['nutanixDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(nutanixDetails))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+nutanixGridMsg+'.</div>');
			var cols = publicDiscoveryJson['nutanixDetails']['columns'];
			var nutanixConfiguredObj = publicDiscoveryJson['nutanixConfiguredObj'];
			me.getGridPanel(nutanixDetails,cols,gridTitle,'Nutanix',nutanixConfiguredObj);
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+nutanixConfigureMsg+'.</div>');
				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});
				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('webport').setValue("9440");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"Nutanix");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var NutanixLabels = publicDiscoveryJson['NutanixLabels'];
				appCnt.setIntnlLabels(NutanixLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},

	gotoCtxXenPoolDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=CtxXenPoolView&remoteAgent="+remoteAgent;
		appCnt.updateDiscoveryTree(url);
		var CtxXenPoolDetails = publicDiscoveryJson['CtxXenPoolDetails']['CtxXenPoolServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['CtxXenPoolDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['CtxXenPoolDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['CtxXenPoolDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(CtxXenPoolDetails))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+ctxxenGridMsg+'.</div>');
			var cols = publicDiscoveryJson['CtxXenPoolDetails']['columns'];
			me.getGridPanel(CtxXenPoolDetails,cols,gridTitle,"CtxXenPool");
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+ctxxenConfigureMsg+'.</div>');
				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"CtxXenPool");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var CtxXenPoolLabels = publicDiscoveryJson['CtxXenPoolLabels'];
				appCnt.setIntnlLabels(CtxXenPoolLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},
	
	gotoOracleVMDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=OracleVMView&remoteAgent="+remoteAgent;
		appCnt.updateDiscoveryTree(url);
		var OracleVMDetails = publicDiscoveryJson['OracleVMDetails']['OracleVMServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['OracleVMDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['OracleVMDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['OracleVMDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(OracleVMDetails))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+oraclevmGridMsg+'.</div>');
			var cols = publicDiscoveryJson['OracleVMDetails']['columns'];
			me.getGridPanel(OracleVMDetails,cols,gridTitle,"OracleVM");
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+oraclevmConfigureMsg+'.</div>');
				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('webport').setValue("7002");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"OracleVM");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var OracleVMLabels = publicDiscoveryJson['OracleVMLabels'];
				appCnt.setIntnlLabels(OracleVMLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},
	
	gotoEMCDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=EMCView&remoteAgent="+remoteAgent;
		appCnt.updateDiscoveryTree(url);
		var EMCDetails = publicDiscoveryJson['EMCDetails']['EMCServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['EMCDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['EMCDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['EMCDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(EMCDetails))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+emcGridMsg+'.</div>');
			var cols = publicDiscoveryJson['EMCDetails']['columns'];
			me.getGridPanel(EMCDetails,cols,gridTitle,"EMC");
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+emcConfigureMsg+'.</div>');
				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"EMC");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				Ext.getCmp('webport').hide();

				var EMCLabels = publicDiscoveryJson['EMCLabels'];
				appCnt.setIntnlLabels(EMCLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},
	
	gotoCtxNetScalerDetails : function(flag)
	{
		remoteAgent = sessionStorage.getItem("remoteAgent");
		var me = this;
		var resultPanelObj = Ext.getCmp('resultPanel');
		var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=viewNetScalers&remoteAgent="+remoteAgent;
		appCnt.updateDiscoveryTree(url);
		var netScalersDetails = publicDiscoveryJson['netScalersDetails']['netScalersServers'];
		resultPanelObj.show();
		resultPanelObj.removeAll();
		var pageTitle = publicDiscoveryJson['netScalersDetails']['pageTitle'];
		var gridTitle = publicDiscoveryJson['netScalersDetails']['gridTitle'];
		var prefTitle = publicDiscoveryJson['netScalersDetails']['prefTitle'];
		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+pageTitle+' '+remoteAgent);
		
		if (!Ext.isEmpty(netScalersDetails))
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+netScalersGridMsg+'.</div>');
			var cols = publicDiscoveryJson['netScalersDetails']['columns'];
			me.getGridPanel(netScalersDetails,cols,gridTitle,"netScalers");
		}
		else
		{
			if (flag)
			{
				Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+netScalersConfigureMsg+'.</div>');
				resultPanelObj.add({
					xtype: 'EgDiscoveryVirtualForm'
				});

				Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
				Ext.getCmp('EgDiscoveryVirtualForm').tools.close.toolEl.dom.hidden = true;
				var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
				var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
				Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
				Ext.getCmp('ssl').setValue("true");
				Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
				Ext.getCmp('isDiscovery').setValue("yes");
				Ext.getCmp('hypervisoraction').setValue("add"+"netScalers");
				
				Ext.getCmp('ipAdd').show();
				Ext.getCmp('ipModify').hide();
				Ext.getCmp('webport').hide();

				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var netScalersLabels = publicDiscoveryJson['netScalersLabels'];
				appCnt.setIntnlLabels(netScalersLabels);
			}
			else
			{
				appCnt.configureServersClose();
			}
		}
	},

	handleDiscoveryAddModifyClick : function(actionPerform,hostName,discoveryType)
	{
		var resultPanelObj = Ext.getCmp('resultPanel');
		resultPanelObj.removeAll();
		resultPanelObj.show();
		resultPanelObj.add({
			xtype: 'EgDiscoveryVirtualForm'
		});
		var SSLTemplate = publicDiscoveryJson['SSLTemplate'];
		var DiscoveryTemplate = publicDiscoveryJson['DiscoveryTemplate'];
		Ext.getCmp('ssl').getStore().loadRawData(SSLTemplate);
		Ext.getCmp('ssl').setValue("true");
		Ext.getCmp('isDiscovery').getStore().loadRawData(DiscoveryTemplate);
		Ext.getCmp('isDiscovery').setValue("yes");

		Ext.getCmp('hypervisoraction').setValue(actionPerform+discoveryType);
		var actiontoPerform = actionPerform+discoveryType;
		if (actiontoPerform == 'addvCenters')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+vCenterConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=vCentersView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['vCenterDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);
			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			if (publicDiscoveryJson['showValidateButton'])
			{
				Ext.getCmp('validateVC').show();
			}
			var vCenterLabels = publicJSON['vCenterLabels'];
			appCnt.setIntnlLabels(vCenterLabels);
		}
		else if (actiontoPerform == 'modifyvCenters')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+vCenterConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=vCentersView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['vCenterDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();
			if (publicDiscoveryJson['showValidateButton'])
			{
				Ext.getCmp('validateVC').show();
			}
			var vCenters = publicDiscoveryJson['vCenterIpDetails']['vCenterServersIp'];
			if (!Ext.isEmpty(vCenters))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(vCenters);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);

				var vCenterLabels = publicDiscoveryJson['vCenterLabels'];
				appCnt.setIntnlLabels(vCenterLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getVcenterDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var webport = publicDiscoveryJson.webport;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
				Ext.getCmp("webport").setValue(webport);
			}
			else
			{
				//var emptyMessage = publicDiscoveryJson['emptyMessage'];
				//me.updateResultPaanel(emptyMessage);
			}
		}
		else if (actiontoPerform == 'addHMCs')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+hmcConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=HMCsView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['hmcDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			Ext.getCmp('hName').hide();
			Ext.getCmp('webport').hide();

			var HMCLabels = publicDiscoveryJson['HMCLabels'];
			appCnt.setIntnlLabels(HMCLabels);
			Ext.resumeLayouts(true);
		}
		else if (actiontoPerform == 'modifyHMCs')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+hmcConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=HMCsView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['hmcDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();
			Ext.getCmp('hName').hide();
			Ext.getCmp('webport').hide();
			var hmc = publicDiscoveryJson['hmcIpDetails']['hmcServersIp'];
			if (!Ext.isEmpty(hmc))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(hmc);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);

				var HMCLabels = publicDiscoveryJson['HMCLabels'];
				appCnt.setIntnlLabels(HMCLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=gethmcDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
			}
			else
			{
				//var emptyMessage = publicDiscoveryJson['emptyMessage'];
				//me.updateResultPaanel(emptyMessage);
			}
		}
		else if (actiontoPerform == 'addRHEV')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+rhevConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=RHEVView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['rhevDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			Ext.getCmp('domain').show();

			var RHEVLabels = publicDiscoveryJson['RHEVLabels'];
			appCnt.setIntnlLabels(RHEVLabels);
		}
		else if (actiontoPerform == 'modifyRHEV')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+rhevConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=RHEVView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['rhevDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();
			Ext.getCmp('domain').show();

			var rhev = publicDiscoveryJson['rhevIpDetails']['rhevServersIp'];
			if (!Ext.isEmpty(rhev))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(rhev);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);

				var RHEVLabels = publicDiscoveryJson['RHEVLabels'];
				appCnt.setIntnlLabels(RHEVLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getRHEVDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var webport = publicDiscoveryJson.webport;
				var confpasswd = publicDiscoveryJson.confpasswd;
				var domain = publicDiscoveryJson.domain;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
				Ext.getCmp("webport").setValue(webport);
				Ext.getCmp("domain").setValue(domain);
			}
			else
			{
				//var emptyMessage = publicDiscoveryJson['emptyMessage'];
				//me.updateResultPaanel(emptyMessage);
			}
		}
		else if (actiontoPerform == 'addNutanix')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+nutanixConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=NutanixView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['nutanixDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			Ext.getCmp('webport').setValue("9440");
			if (publicDiscoveryJson['showValidateButton'])
			{
				Ext.getCmp('validateVC').show();
			}
			var NutanixLabels = publicDiscoveryJson['NutanixLabels'];
			appCnt.setIntnlLabels(NutanixLabels);
		}
		else if (actiontoPerform == 'modifyNutanix')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+nutanixConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=NutanixView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['nutanixDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();

			var Nutanix = publicDiscoveryJson['nutanixIpDetails']['nutanixServersIp'];
			if (!Ext.isEmpty(Nutanix))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(Nutanix);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);
				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}
				var NutanixLabels = publicDiscoveryJson['NutanixLabels'];
				appCnt.setIntnlLabels(NutanixLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getNutanixDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var webport = publicDiscoveryJson.webport;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
				Ext.getCmp("webport").setValue(webport);
			}
			else
			{
				//var emptyMessage = publicDiscoveryJson['emptyMessage'];
				//me.updateResultPaanel(emptyMessage);
			}
		}
		else if (actiontoPerform == 'addCtxXenPool')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+ctxxenConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=CtxXenPoolView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['CtxXenPoolDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			if (publicDiscoveryJson['showValidateButton'])
			{
				Ext.getCmp('validateVC').show();
			}
			var CtxXenPoolLabels = publicDiscoveryJson['CtxXenPoolLabels'];
			appCnt.setIntnlLabels(CtxXenPoolLabels);
		}
		else if (actiontoPerform == 'modifyCtxXenPool')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+ctxxenConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=CtxXenPoolView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['CtxXenPoolDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();

			var CtxXenPool = publicDiscoveryJson['CtxXenPoolIpDetails']['CtxXenPoolServersIp'];
			if (!Ext.isEmpty(CtxXenPool))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(CtxXenPool);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);
				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var CtxXenPoolLabels = publicDiscoveryJson['CtxXenPoolLabels'];
				appCnt.setIntnlLabels(CtxXenPoolLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getCtxXenPoolDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var webport = publicDiscoveryJson.webport;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
				Ext.getCmp("webport").setValue(webport);
			}
			else
			{
				//var emptyMessage = publicDiscoveryJson['emptyMessage'];
				//me.updateResultPaanel(emptyMessage);
			}
		}
		else if (actiontoPerform == 'addOracleVM')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+oraclevmConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=OracleVMView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['OracleVMDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			Ext.getCmp('webport').setValue("7002");
			if (publicDiscoveryJson['showValidateButton'])
			{
				Ext.getCmp('validateVC').show();
			}
			var OracleVMLabels = publicDiscoveryJson['OracleVMLabels'];
			appCnt.setIntnlLabels(OracleVMLabels);
		}
		else if (actiontoPerform == 'modifyOracleVM')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+oraclevmConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=OracleVMView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['OracleVMDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();

			var OracleVM = publicDiscoveryJson['OracleVMIpDetails']['OracleVMServersIp'];
			if (!Ext.isEmpty(OracleVM))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(OracleVM);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);
				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var OracleVMLabels = publicDiscoveryJson['OracleVMLabels'];
				appCnt.setIntnlLabels(OracleVMLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getOracleVMDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var webport = publicDiscoveryJson.webport;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
				Ext.getCmp("webport").setValue(webport);
			}
			else
			{
				//var emptyMessage = publicDiscoveryJson['emptyMessage'];
				//me.updateResultPaanel(emptyMessage);
			}
		}
		else if (actiontoPerform == 'addEMC')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+emcConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=EMCView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['EMCDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			Ext.getCmp('webport').hide();
			var EMCLabels = publicDiscoveryJson['EMCLabels'];
			appCnt.setIntnlLabels(EMCLabels);
		}
		else if (actiontoPerform == 'modifyEMC')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+emcConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=EMCView&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['EMCDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();
			Ext.getCmp('webport').hide();

			var EMCDetails = publicDiscoveryJson['EMCIpDetails']['EMCServersIp'];
			if (!Ext.isEmpty(EMCDetails))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(EMCDetails);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);

				var EMCLabels = publicDiscoveryJson['EMCLabels'];
				appCnt.setIntnlLabels(EMCLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getEMCDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
			}
		}
		else if (actiontoPerform == 'addnetScalers')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+netScalersConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=viewNetScalers&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['netScalersDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').show();
			Ext.getCmp('ipModify').hide();
			Ext.getCmp('webport').hide();

			if (publicDiscoveryJson['showValidateButton'])
			{
				Ext.getCmp('validateVC').show();
			}

			var EMCLabels = publicDiscoveryJson['netScalersLabels'];
			appCnt.setIntnlLabels(EMCLabels);
		}
		else if (actiontoPerform == 'modifynetScalers')
		{
			Ext.getCmp('configureServersMsg').update('<div class="aPanelRegularText" style="margin:15px 10px 3px 10px;">'+netScalersConfigureMsg+'.</div>');

			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+"&from=viewNetScalers&remoteAgent="+remoteAgent;
			appCnt.updateDiscoveryTree(url);

			var prefTitle = publicDiscoveryJson['netScalersDetails']['prefTitle'];
			Ext.getCmp('EgDiscoveryVirtualForm').setTitle(prefTitle);

			Ext.getCmp('ipAdd').hide();
			Ext.getCmp('ipModify').show();
			Ext.getCmp('webport').hide();

			var netScalersDetails = publicDiscoveryJson['netScalersIpDetails']['netScalersServersIp'];
			if (!Ext.isEmpty(netScalersDetails))
			{
				Ext.getCmp('ipModify').getStore().loadRawData(netScalersDetails);
				Ext.getCmp('ipModify').setValue(hostName);
				Ext.getCmp('ipModify').setDisabled(true);

				if (publicDiscoveryJson['showValidateButton'])
				{
					Ext.getCmp('validateVC').show();
				}

				var netScalersLabels = publicDiscoveryJson['netScalersLabels'];
				appCnt.setIntnlLabels(netScalersLabels);

				var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJson.jsp?fromAction="+fromAction+'&from=getnetScalersDetails&ipAdd='+encodeURIComponent(hostName)+"&remoteAgent="+remoteAgent;
				this.updateDiscoveryTree(url);

				var isSSL = publicDiscoveryJson.isSSLSelected;
				var isDiscovery = publicDiscoveryJson.isDiscoverySelected;
				var uname = publicDiscoveryJson.uname;
				var pass = publicDiscoveryJson.pass;
				var confpasswd = publicDiscoveryJson.confpasswd;

				if (isSSL == "selected")
				{
					Ext.getCmp('ssl').setValue("true");
				}
				else
				{
					Ext.getCmp('ssl').setValue("false");
				}

				if (isDiscovery == "selected")
				{
					Ext.getCmp('isDiscovery').setValue("yes");
				}
				else
				{
					Ext.getCmp('isDiscovery').setValue("no");
				}
				Ext.getCmp("uname").setValue(uname);
				Ext.getCmp("pass").setValue(pass);
				Ext.getCmp("confpasswd").setValue(confpasswd);
			}
		}
		else
		{
			//var emptyMessage = publicDiscoveryJson['emptyMessage'];
			//me.updateResultPaanel(emptyMessage);
		}
	},

	sslOnChange : function(obj)
	{
		var hypervisoraction = Ext.getCmp('hypervisoraction').getValue();
		if (!Ext.isEmpty(hypervisoraction) && hypervisoraction.indexOf("Nutanix") == -1 && hypervisoraction.indexOf("OracleVM") == -1)
		{
			var sslVal = obj.getValue().toLowerCase();
			var port = (sslVal == "yes" || sslVal == "true") ? "443" : "80";
			Ext.getCmp("webport").setValue(port);
		}
	},
	
	setIntnlLabels : function(setIntnlLabels)
	{
		for (var key in setIntnlLabels)
		{
			var tmpObj = Ext.getCmp(key);
			if (tmpObj == null || tmpObj == "undefined")
			{
				continue;
			}
			tmpObj.setFieldLabel(setIntnlLabels[key]);
		}
	},

	clearForm : function()
	{
		Ext.getCmp('ipAdd').setValue("");
		Ext.getCmp('uname').setValue("");
		Ext.getCmp('pass').setValue("");
		Ext.getCmp('confpasswd').setValue("");
	},

	validateMSOffDetails : function()
	{
		var isValid = this.addComponentValidation(false);
		if (!isValid)
		{
			return;
		}
		else
		{

			var me = this;
			var validationLoadingMsg2 = "<table border='0' style='width:100%;height:170px;'><tr><td align='center' valign='bottom'><img src=/final/monitor/eg_images/indicator_medium.gif></td></tr><tr><td align=center valign=middle>Trying to get validation information from the agent...<br>This may take a few minutes...</td></tr></table>";

			var validationMsOffURL="LimitedAdminHome/data/validateApplicationServerCredentails.jsp?action=pickAgentToValidate&taskName=MS_Office_365&componentType=MS_Office_365&remoteAgent="+encodeURIComponent(remoteAgent);

			if (!Ext.isEmpty(office365Model) && office365Model == 'basic')
			{
				me.validateCredentialsBasic(validationMsOffURL);

				Ext.widget('window',{
					extend:'Ext.panel.Panel',
					//ui:'newPopupWindow newplainHeader_border', 
					title : validationTitleForMsOff+' using '+remoteAgent,
					listeners : {
						afterrender : function()
						{
							var agentSelected = remoteAgent;
							Ext.getCmp('resultContainerStr').show();
							Ext.getCmp('resultContainerStr').update(validationLoadingMsg2);
							var paramWithValue = "-host:"+Ext.getCmp('hostip').getValue();
							paramWithValue = paramWithValue + "|#|-o365_user_name:"+Ext.getCmp('O365_User_Name').getValue();
							paramWithValue = paramWithValue + "|#|-o365_password:"+Ext.getCmp('O365_Password').getValue();
							paramWithValue = paramWithValue + "|#|-domain_user_name:"+Ext.getCmp('Domain_User_Name').getValue();
							paramWithValue = paramWithValue + "|#|-domain_password:"+Ext.getCmp('Domain_Password').getValue();
							paramWithValue = paramWithValue + "|#|-domain_name:"+Ext.getCmp('Domain_Name').getValue();
							paramWithValue = paramWithValue + "|#|-proxy_host:"+Ext.getCmp('Proxy_Host').getValue();
							paramWithValue = paramWithValue + "|#|-proxy_port:"+Ext.getCmp('Proxy_Port').getValue();
							paramWithValue = paramWithValue + "|#|-proxy_user_name:"+Ext.getCmp('Proxy_User_Name').getValue();
							paramWithValue = paramWithValue + "|#|-proxy_password:"+Ext.getCmp('Proxy_Password').getValue();
							
							var uri = "LimitedAdminHome/data/validateApplicationServerCredentails.jsp?valForValidation="+encodeURIComponent(filterEncode(paramWithValue))+"&selectedAgent="+encodeURIComponent(agentSelected)+paramsForURLVC+"&action=validate";
							me.validateCredentialsBasic(uri);
						}
					},
					closeAction: 'destory',
					id : 'validateVcenterServerBasic',
					align : 'center',
					width:650,
					padding:'5 10 10 10',
					header:{
						//padding:'14 0 10 0',
						margin:'5 5 5 5',
					},
					modal: true,
					autoScroll : true,
					scroll : true,
					doClose: function() {
						this.destroy();
					},
					items : [
						{
							id : 'resultContainerStr',
							border : false,
							style:{'text-align':'center'},
							html:validationLoadingMsg2
						}
					]
				});
			}
			else
			{
				Ext.widget('window',{
					extend:'Ext.panel.Panel',
					//ui:'newPopupWindow newplainHeader_border', 
					title : validationTitleForMsOff,
					listeners : {
						afterrender : function()
						{
							me.validateCredentials(validationMsOffURL);
						}
					},
					closeAction: 'destory',
					id : 'validateVcenterServer',
					align : 'center',
					width:650,
					padding:'5 10 10 10',
					header:{
						//padding:'14 0 10 0',
						margin:'5 5 5 5',
					},
					modal: true,
					autoScroll : true,
					scroll : true,
					doClose: function() {
						this.destroy();
					},
					items : [
						{
							id : 'resultContainerStr',
							border : false,
							style:{'text-align':'center'},
							html:validationLoadingMsg2
						},
						{
							
							xtype : 'container',
							id : 'agentDropList',
							padding : 30,
							hidden : true,
							layout : {
								type : 'hbox',
								align : 'center',
								pack : 'center',
							},
							items : [
								{
									xtype:'scrollcombo',
									id: 'agentList',
									name: 'agentList',
									cls: 'dropdown',
									editable :false,
									labelAlign: 'top',
									labelSeparator: '',
									fieldLabel : selectAgntLabel,
									store: new Ext.data.Store({
										fields : ['displayField', 'valueField'],
										data : []
									}),
									displayField : 'displayField',
									valueField : 'valueField',
									queryMode : 'local',
									width: 300
								},
								{
									xtype :'tbspacer',
									width : 15,
								},
								{
									xtype : 'button',
									ui:'aButtonSmall',
									text : 'Go',
									margin: '20 0 0 0',
									handler : function()
									{
										var agentSelected = Ext.getCmp('agentList').getValue();

										if(agentSelected!=null && agentSelected == "-1")
										{
											Ext.Msg.show ({
												title: validationTitleForMsOff,
												msg: selectAgnt,
												buttons: Ext.MessageBox.OK,
												icon: 'gen-warning size32 color-warning',
											});
											return;
										}
										Ext.getCmp('resultContainerStr').show();
										Ext.getCmp('resultContainerStr').update(validationLoadingMsg2);
										Ext.getCmp('agentDropList').hide();

										var paramWithValue = "-host:"+Ext.getCmp('hostip').getValue();
										paramWithValue = paramWithValue + "|#|-o365_user_name:"+Ext.getCmp('O365_User_Name').getValue();
										paramWithValue = paramWithValue + "|#|-o365_password:"+Ext.getCmp('O365_Password').getValue();
										paramWithValue = paramWithValue + "|#|-domain_user_name:"+Ext.getCmp('Domain_User_Name').getValue();
										paramWithValue = paramWithValue + "|#|-domain_password:"+Ext.getCmp('Domain_Password').getValue();
										paramWithValue = paramWithValue + "|#|-domain_name:"+Ext.getCmp('Domain_Name').getValue();
										paramWithValue = paramWithValue + "|#|-proxy_host:"+Ext.getCmp('Proxy_Host').getValue();
										paramWithValue = paramWithValue + "|#|-proxy_port:"+Ext.getCmp('Proxy_Port').getValue();
										paramWithValue = paramWithValue + "|#|-proxy_user_name:"+Ext.getCmp('Proxy_User_Name').getValue();
										paramWithValue = paramWithValue + "|#|-proxy_password:"+Ext.getCmp('Proxy_Password').getValue();
										
										var uri = "LimitedAdminHome/data/validateApplicationServerCredentails.jsp?valForValidation="+encodeURIComponent(filterEncode(paramWithValue))+"&selectedAgent="+encodeURIComponent(agentSelected)+paramsForURLVC+"&action=validate";
										me.validateCredentials(uri);
									}
								}
							]
						}
					]
				}).show();
			}
		}
	},

	validateVCenterDetails :  function()
	{
		var validationStatus = false;
		var selectedAction = Ext.getCmp('hypervisoraction').getValue();
		if (selectedAction == "addvCenters" || selectedAction == "modifyvCenters")
		{
			validationStatus = appCnt.validateFormVC(selectedAction);
		}
		else if (selectedAction == "addNutanix" || selectedAction == "modifyNutanix")
		{
			validationStatus = this.validateFormNutanix(selectedAction);
		}
		else if (selectedAction == "addCtxXenPool" || selectedAction == "modifyCtxXenPool")
		{
			validationStatus = this.validateCtxXenPoolForm(selectedAction);
		}
		else if (selectedAction == "addOracleVM" || selectedAction == "modifyOracleVM")
		{
			validationStatus = this.validateOracleVMForm(selectedAction);
		}
		else if (selectedAction == "addnetScalers" || selectedAction == "modifynetScalers")
		{
			validationStatus = this.validateFormNetScaler(selectedAction);
		}

		if (validationStatus == true)
		{
			var validationURL = '';
			var me = this;
			var paramWithValue = "-:";
			var validationTitleStr = '';

			var validationLoadingMsg2 = "<table border='0' style='width:100%;height:170px;'><tr><td align='center' valign='bottom'><img src=/final/monitor/eg_images/indicator_medium.gif></td></tr><tr><td align='center' valign='middle'>Trying to get validation information from the agent...<br>This may take a few minutes...</td></tr></table>";

			var hostIP = "";
			if (selectedAction.indexOf("add") != -1)
			{
				hostIP = Ext.getCmp('ipAdd').getValue();
			}
			else
			{
				hostIP = Ext.getCmp('ipModify').getValue();
			}

			if (selectedAction == "addvCenters" || selectedAction == "modifyvCenters")
			{
				validationTitleStr = validationTitle;
				validationURL="LimitedAdminHome/data/validateApplicationServerCredentails.jsp?action=pickAgentToValidate&taskName=VmEsx_i_server&componentType=VmEsx_i_server&remoteAgent="+encodeURIComponent(remoteAgent);
			}
			else if (selectedAction == "addNutanix" || selectedAction == "modifyNutanix")
			{
				validationTitleStr = validationNutanixTitle;
				validationURL="LimitedAdminHome/data/validateApplicationServerCredentails.jsp?action=pickAgentToValidate&taskName=Nutanix_Acropolis&componentType=Nutanix_Acropolis&remoteAgent="+encodeURIComponent(remoteAgent);
			}
			else if (selectedAction == "addCtxXenPool" || selectedAction == "modifyCtxXenPool")
			{
				validationTitleStr = validationXenserverTitle;
				validationURL="LimitedAdminHome/data/validateApplicationServerCredentails.jsp?action=pickAgentToValidate&taskName=Xen_virtual_server&componentType=Xen_virtual_server&remoteAgent="+encodeURIComponent(remoteAgent);
			}
			else if (selectedAction == "addOracleVM" || selectedAction == "modifyOracleVM")
			{
				validationTitleStr = validationOracleVMTitle;
				validationURL="LimitedAdminHome/data/validateApplicationServerCredentails.jsp?action=pickAgentToValidate&taskName=Oracle_vm_mgr&componentType=Oracle_vm_mgr&remoteAgent="+encodeURIComponent(remoteAgent);
			}
			else if (selectedAction == "addnetScalers" || selectedAction == "modifynetScalers")
			{
				validationTitleStr = validationNetScalerTitle;
				validationURL="LimitedAdminHome/data/validateApplicationServerCredentails.jsp?action=pickAgentToValidate&taskName=Citrix_NetScaler&componentType=Citrix_NetScaler&remoteAgent="+encodeURIComponent(remoteAgent);
			}

			Ext.widget('window',{
				extend:'Ext.panel.Panel',
				//ui:'newPopupWindow newplainHeader_border', 
				title : validationTitleStr,
				closeAction: 'destory',
				id : 'validateVcenterServer',
				align : 'center',
				width:650,
				padding:'5 10 10 10',
				header:{
					//padding:'14 0 10 0',
					margin:'5 5 5 5',
				},
				modal: true,
				autoScroll : true,
				scroll : true,
				doClose: function() {
					this.destroy();
				},
				listeners : {
					afterrender : function()
					{
						me.validateCredentials(validationURL);
					}
				},
				items : [
					{
						id : 'resultContainerStr',
						border : false,
						style:{'text-align':'center'},
						html:validationLoadingMsg2,
					},
					{
						xtype : 'container',
						id : 'agentDropList',
						padding : 30,
						hidden : true,
						layout : {
							type : 'hbox',
							align : 'center',
							pack : 'center',
						},
						items : [
							{
								xtype:'scrollcombo',
								id: 'agentList',
								name: 'agentList',
								cls: 'dropdown',
								editable :false,
								labelAlign: 'top',
								labelSeparator: '',
								fieldLabel : selectAgntLabel,
								store: new Ext.data.Store({
									fields : ['displayField', 'valueField'],
									data : []
								}),
								displayField : 'displayField',
								valueField : 'valueField',
								queryMode : 'local',
								width: 300
							},
							{
								xtype :'tbspacer',
								width : 15,
							},
							{
								xtype : 'button',
								ui:'aButtonSmall',
								text : 'Go',
								margin: '20 0 0 0',
								handler : function()
								{
									var agentSelected = Ext.getCmp('agentList').getValue();

									if(agentSelected!=null && agentSelected == "-1")
									{
										Ext.Msg.show ({
											title: validationTitleStr,
											msg: selectAgnt,
											buttons: Ext.MessageBox.OK,
											icon: 'gen-warning size32 color-warning',
										});
										return;
									}
									Ext.getCmp('resultContainerStr').show();
									Ext.getCmp('resultContainerStr').update(validationLoadingMsg2);
									Ext.getCmp('agentDropList').hide();

									paramWithValue = paramWithValue + agentSelected;
									paramWithValue = paramWithValue + "|#|-host:"+hostIP;
									if (selectedAction == "addvCenters" || selectedAction == "modifyvCenters")
									{
										paramWithValue = paramWithValue + "|#|-virtual_center:"+hostIP;
										paramWithValue = paramWithValue + "|#|-ssl:"+Ext.getCmp('ssl').getValue();
										paramWithValue = paramWithValue + "|#|-webport:"+Ext.getCmp('webport').getValue();
										paramWithValue = paramWithValue + "|#|-esx_user:"+Ext.getCmp('uname').getValue();
										paramWithValue = paramWithValue + "|#|-esx_password:"+Ext.getCmp('pass').getValue();
									}
									else if (selectedAction == "addNutanix" || selectedAction == "modifyNutanix")
									{
										paramWithValue = paramWithValue + "|#|-Prism_IP:"+hostIP;
										paramWithValue = paramWithValue + "|#|-ssl:"+Ext.getCmp('ssl').getValue();
										paramWithValue = paramWithValue + "|#|-webport:"+Ext.getCmp('webport').getValue();
										paramWithValue = paramWithValue + "|#|-Prism_user:"+Ext.getCmp('uname').getValue();
										paramWithValue = paramWithValue + "|#|-Prism_password:"+Ext.getCmp('pass').getValue();
									}
									else if (selectedAction == "addCtxXenPool" || selectedAction == "modifyCtxXenPool")
									{
										paramWithValue = paramWithValue + "|#|-ssl:"+Ext.getCmp('ssl').getValue();
										paramWithValue = paramWithValue + "|#|-webport:"+Ext.getCmp('webport').getValue();
										paramWithValue = paramWithValue + "|#|-Xen_user:"+Ext.getCmp('uname').getValue();
										paramWithValue = paramWithValue + "|#|-Xen_password:"+Ext.getCmp('pass').getValue();
									}
									else if (selectedAction == "addOracleVM" || selectedAction == "modifyOracleVM")
									{
										paramWithValue = paramWithValue + "|#|-Oracle_vm_mgr:"+hostIP;
										paramWithValue = paramWithValue + "|#|-ssl:"+Ext.getCmp('ssl').getValue();
										paramWithValue = paramWithValue + "|#|-webport:"+Ext.getCmp('webport').getValue();
										paramWithValue = paramWithValue + "|#|-Oracle_vm_mgr_user:"+Ext.getCmp('uname').getValue();
										paramWithValue = paramWithValue + "|#|-Oracle_vm_mgr_pass:"+Ext.getCmp('pass').getValue();
									}
									else if (selectedAction == "addnetScalers" || selectedAction == "modifynetScalers")
									{
										paramWithValue = paramWithValue + "|#|-Citrix_NetScaler:"+hostIP;
										paramWithValue = paramWithValue + "|#|-ssl:"+Ext.getCmp('ssl').getValue();
										paramWithValue = paramWithValue + "|#|-NetScaler_username:"+Ext.getCmp('uname').getValue();
										paramWithValue = paramWithValue + "|#|-NetScaler_password:"+Ext.getCmp('pass').getValue();
									}
									
									var uri = "LimitedAdminHome/data/validateApplicationServerCredentails.jsp?valForValidation="+encodeURIComponent(filterEncode(paramWithValue))+"&selectedAgent="+encodeURIComponent(agentSelected)+paramsForURLVC+"&multiUserMode=false&fromPage=descovery";
									me.validateCredentials(uri);
								}
							}
						]
					}
				]
			}).show();
		}
	},
	
	validateCredentials : function(url_string)
	{
		var tmpData = '';
		Ext.Ajax.request({
			url : url_string,
			method: 'POST',
			timeout : 7200000,
			success: function(response)
			{
				var tmpText = response.responseText;
				if (tmpText.indexOf("<div class=") == -1 && tmpText != "")
				{
					tmpData = Ext.decode(response.responseText);
					var agentListObj = Ext.getCmp('agentList');
					if (tmpData.isAgentsAvailable == true)
					{
						Ext.getCmp('resultContainerStr').hide();
						Ext.getCmp('resultContainerStr').update("");
						Ext.getCmp('agentDropList').show();

						agentListObj.getStore().loadRawData(tmpData.tmpListArr);

						var selectedAgentForValidation = tmpData.selectedAgentForValidation;

						if (!Ext.isEmpty(selectedAgentForValidation))
						{
							agentListObj.setValue(selectedAgentForValidation);
						}
						else
						{
							agentListObj.setValue(agentListObj.getStore().getAt(0).get("valueField"));
						}
						paramsForURLVC = tmpData.paramsForURL;
					}
					else
					{
						var tmpMessage = validationMsg80;
						if (tmpData.validationMessage != null && tmpData.validationMessage != 'undefined')
						{
							tmpMessage = tmpData.validationMessage;
						}
						Ext.getCmp('resultContainerStr').show();
						Ext.getCmp('agentDropList').hide();
						agentListObj.hide();
						var html = "<table border='0' height='170px' align='center'><tr><td align='center' valign='top'><div class = 'gen-info size32 color-info' style='margin:26% auto 0 auto;'></div><div>"+tmpMessage+"</div></td></tr></table>";
						Ext.getCmp('resultContainerStr').update(html);
					}
				}
				else
				{
					if (!Ext.isEmpty(Ext.getCmp('resultContainerStr')))
					{
						Ext.getCmp('resultContainerStr').show();
						Ext.getCmp('resultContainerStr').update(tmpText);
					}
				}
			}
		});
	},

	validateCredentialsBasic : function(url_string)
	{
		var tmpData = '';
		Ext.Ajax.request({
			url : url_string,
			method: 'POST',
			timeout : 7200000,
			success: function(response)
			{
				var tmpText = response.responseText;
				Ext.getCmp('validateVcenterServerBasic').show();
				if (tmpText.indexOf("<div class=") == -1 && tmpText != "")
				{
					tmpData = Ext.decode(response.responseText);
					var selectedAgentForValidation = tmpData.selectedAgentForValidation;
					if (tmpData.isAgentsAvailable == true && !Ext.isEmpty(selectedAgentForValidation))
					{
						paramsForURLVC = tmpData.paramsForURL;
					}
					else
					{
						var tmpMessage = validationMsg80;
						if (tmpData.validationMessage != null && tmpData.validationMessage != 'undefined')
						{
							tmpMessage = tmpData.validationMessage;
						}
						var html = "<table border='0' height='170px' align='center'><tr><td align='center' valign='top'><div class = 'gen-info size32 color-info' style='margin:26% auto 0 auto;'></div><div>"+tmpMessage+"</div></td></tr></table>";
						Ext.getCmp('resultContainerStr').update(html);
					}
				}
				else
				{
					if (!Ext.isEmpty(Ext.getCmp('resultContainerStr')))
					{
						Ext.getCmp('resultContainerStr').show();
						Ext.getCmp('resultContainerStr').update(tmpText);
					}
				}
			}
		});
	},

	submitServerDetails : function()
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var hypervisoraction = Ext.getCmp('hypervisoraction').getValue();

		var validationStatus = false;
		
		if (hypervisoraction == 'addvCenters' || hypervisoraction == 'modifyvCenters')
		{
			validationStatus = this.validateFormVC(hypervisoraction);
		}
		else if (hypervisoraction == 'addHMCs' || hypervisoraction == 'modifyHMCs')
		{
			validationStatus = this.validateFormHMC(hypervisoraction);
		}
		else if (hypervisoraction == 'addRHEV' || hypervisoraction == 'modifyRHEV')
		{
			validationStatus = this.validateRHEVForm(hypervisoraction);
		}
		else if (hypervisoraction == 'addNutanix' || hypervisoraction == 'modifyNutanix')
		{
			validationStatus = this.validateFormNutanix(hypervisoraction);
		}
		else if (hypervisoraction == 'addCtxXenPool' || hypervisoraction == 'modifyCtxXenPool')
		{
			validationStatus = this.validateCtxXenPoolForm(hypervisoraction);
		}
		else if (hypervisoraction == 'addOracleVM' || hypervisoraction == 'modifyOracleVM')
		{
			validationStatus = this.validateOracleVMForm(hypervisoraction);
		}
		else if (hypervisoraction == 'addEMC' || hypervisoraction == 'modifyEMC')
		{
			validationStatus = this.validateFormStoragePlatform(hypervisoraction);
		}
		else if (hypervisoraction == 'addnetScalers' || hypervisoraction == 'modifynetScalers')
		{
			validationStatus = this.validateFormNetScaler(hypervisoraction);
		}

		if (validationStatus == true)
		{
			var url = "LimitedAdminHome/data/EgAgentLessDiscoveryJsonp.jsp?fromAction="+fromAction+"&from="+hypervisoraction+"&remoteAgent="+remoteAgent;
			
			var reqParams = '';
			
			var ipAdd = '';
			if (hypervisoraction.indexOf('add') != -1)
			{
				ipAdd = Ext.getCmp('ipAdd').getValue();
			}
			else
			{
				ipAdd = Ext.getCmp('ipModify').getValue();
			}

			var ssl = Ext.getCmp('ssl').getValue();
			var isDiscovery = Ext.getCmp('isDiscovery').getValue();
			var uname = Ext.getCmp('uname').getValue();
			var pass = Ext.getCmp('pass').getValue();

			if (hypervisoraction == 'addvCenters' || hypervisoraction == 'modifyvCenters' ||
				hypervisoraction == 'addNutanix' || hypervisoraction == 'modifyNutanix' ||
				hypervisoraction == 'addCtxXenPool' || hypervisoraction == 'modifyCtxXenPool' ||
				hypervisoraction == 'addOracleVM' || hypervisoraction == 'modifyOracleVM')
			{
				var webport = Ext.getCmp('webport').getValue();

				reqParams = {
					'ipAdd' : ipAdd,
					'ssl' : ssl,
					'webport' : webport,
					'isDiscovery' : isDiscovery,
					'uname' : uname,
					'pass' : pass
				};
			}
			else if (hypervisoraction == 'addHMCs' || hypervisoraction == 'modifyHMCs')
			{
				var hName = Ext.getCmp('hName').getValue();

				reqParams = {
					'ipAdd' : ipAdd,
					'ssl' : ssl,
					'hName' : hName,
					'isDiscovery' : isDiscovery,
					'uname' : uname,
					'pass' : pass
				};
			}
			else if (hypervisoraction == 'addRHEV' || hypervisoraction == 'modifyRHEV')
			{
				var webport = Ext.getCmp('webport').getValue();
				var domain = Ext.getCmp('domain').getValue();

				reqParams = {
					'ipAdd' : ipAdd,
					'ssl' : ssl,
					'webport' : webport,
					'isDiscovery' : isDiscovery,
					'uname' : uname,
					'pass' : pass,
					'domain' : domain
				};
			}
			else if (hypervisoraction == 'addEMC' || hypervisoraction == 'modifyEMC' || 
					hypervisoraction == 'addnetScalers' || hypervisoraction == 'modifynetScalers')
			{
				reqParams = {
					'ipAdd' : ipAdd,
					'ssl' : ssl,
					'isDiscovery' : isDiscovery,
					'uname' : uname,
					'pass' : pass
				};
			}

			var myMask = new Ext.LoadMask(Ext.getBody(), {msg: 'Updating...'});
			myMask.show();

			Ext.Ajax.request({
				url: url,
				method: 'POST',
				params: reqParams,
				success: function(response)
				{
					myMask.hide();
					var resultObj = Ext.decode(response.responseText);
					var requestStatus = resultObj.requestStatus;
					
					if (requestStatus == 'success')
					{
						var tmpObj = resultObj.result;
						Ext.Msg.show({
							title: alertMsgTitle,
							msg: tmpObj.message1 + ".",
							buttons: Ext.Msg.OK,
							width : 300,
							//icon: 'iconInformation',
							icon: 'gen-info size32 color-info', 
							fn : function()
							{
								if (hypervisoraction == 'addvCenters' || hypervisoraction == 'modifyvCenters')
								{
									appCnt.gotoVcenterDiscovers(true);
								}
								else if (hypervisoraction == 'addHMCs' || hypervisoraction == 'modifyHMCs')
								{
									appCnt.gotoHMCDetails(true);
								}
								else if (hypervisoraction == 'addRHEV' || hypervisoraction == 'modifyRHEV')
								{
									appCnt.gotoRHEVDetails(true);
								}
								else if (hypervisoraction == 'addNutanix' || hypervisoraction == 'modifyNutanix')
								{
									appCnt.gotoNutanixDetails(true);
								}
								else if (hypervisoraction == 'addCtxXenPool' || hypervisoraction == 'modifyCtxXenPool')
								{
									appCnt.gotoCtxXenPoolDetails(true);
								}
								else if (hypervisoraction == 'addOracleVM' || hypervisoraction == 'modifyOracleVM')
								{
									appCnt.gotoOracleVMDetails(true);
								}
								else if (hypervisoraction == 'addEMC' || hypervisoraction == 'modifyEMC')
								{
									appCnt.gotoEMCDetails(true);
								}
								else if (hypervisoraction == 'addnetScalers' || hypervisoraction == 'modifynetScalers')
								{
									appCnt.gotoCtxNetScalerDetails(true);
								}
							}
						});
					}
					else
					{
						var tmpObj = resultObj.error;
						Ext.Msg.show({
							title: alertMsgTitle,
							msg: tmpObj.message1 + ".",
							buttons: Ext.Msg.OK,
							width : 300,
							icon: 'gen-warning size32 color-warning'
						});
					}
				},
				failure: function(response)
				{
					myMask.hide();
				}
			});
		}
	},

	validateFormVC : function(urlFrom)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var me = this;
		var ipAdd;
		if (urlFrom.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}

		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var webport = Ext.getCmp('webport');
		var confpasswd = Ext.getCmp('confpasswd');
		var ipVal = ipAdd.getValue();
		var userVal = uname.getValue();

		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";
		var webPortValue = webport.getValue();
		if(ipVal == 'Choose vCenter')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg35,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				}
			});
			ipAdd.focus(true);
			return false;
		}
		if(!checkblank(ipVal) || ipVal == 'none'||ipVal == 'None'||ipVal == 'other'||ipVal == 'Other')
		{
			if (urlFrom.indexOf("add") != -1)
			{
				Ext.Msg.alert(alertMsgTitle,intnlLabel21,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				ipAdd.focus(true);
			}
			else
			{
				Ext.Msg.alert(alertMsgTitle,validationMsg35,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				ipAdd.focus(true);
			}
			return false;
		}
		var ChkipOrhname = validateHostFieldExtjs(ipVal)//New IP Validation Starts here
		if(ChkipOrhname == "1")
		{ 
				Ext.Msg.alert(alertMsgTitle,_checkIp,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		else if(ChkipOrhname == "5")
		{
				Ext.Msg.alert(alertMsgTitle,_checkspaceIp,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		else if(ChkipOrhname == "7")
		{
				Ext.Msg.alert(alertMsgTitle,_checkspecial,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		else if(ChkipOrhname == "8")
		{
				Ext.Msg.alert(alertMsgTitle,_valIp,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		else if(ChkipOrhname == "9")
		{
				Ext.Msg.alert(alertMsgTitle,_validateHostDot,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		else if(ChkipOrhname == "10")
		{
				Ext.Msg.alert(alertMsgTitle,_checknum,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		else if(ChkipOrhname == "16")
		{
				Ext.Msg.alert(alertMsgTitle,_checkNumberLabel,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}//New IP Validation ends here
		
		if(!checkblank(webport.getValue()))//flow changed here
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg42,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(checkspaceExtjs(webport.getValue()) != '0')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg2,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if (webport.getValue() > 99999)
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg43,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkcomma(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg10,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				}
			});
			return false;
		}
		else if (((!checknumber("+",webport.getValue()) && webPortValue.indexOf(',') == -1) || webPortValue == 0 || webPortValue.indexOf('.') > -1) && (webPortValue == 'NULL') || (webPortValue.indexOf(',') > -1))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg12,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecialnomess(webport.getValue(),splChar) && (webPortValue != 'NULL'))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}//flow change ends here
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		//else if(!checkspecial(userVal,"@#$%^&*+={}|:;\"\'<>,\/"))
		else if(checkSpecialExtjs(userVal,"#=|\"\'<>,\/") != '0')//replaced checkspecial by checkSpecialExtjs fn
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			pass.focus(true);
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		return true;
	},

	validateFormHMC : function(fromURL)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var ipAdd;
		if (fromURL.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var confpasswd = Ext.getCmp('confpasswd');
		var ipVal = ipAdd.getValue();
		var userVal = uname.getValue();

		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";
		if(ipVal == 'Choose HMC IP address')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg44,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if(!checkblank(ipVal) || ipVal == 'none' || ipVal == 'None' || ipVal == 'other' || ipVal == 'Other')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg45,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if (fromURL.indexOf("add") != -1)
		{
			var validateIpAddRetVal = validateHostFieldExtjs(ipVal);//New IP Validation Starts here
			if(validateIpAddRetVal == "1")
			{
				Ext.Msg.alert(alertMsgTitle,_checkIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(validateIpAddRetVal == "5")
			{
				Ext.Msg.alert(alertMsgTitle,_checkspaceIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(validateIpAddRetVal == "7")
			{
				Ext.Msg.alert(alertMsgTitle,_checkspecial,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(validateIpAddRetVal == "8")
			{
				Ext.Msg.alert(alertMsgTitle,_valIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(validateIpAddRetVal == "9")
			{
					Ext.Msg.alert(alertMsgTitle,_validateHostDot,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(validateIpAddRetVal == "10")
			{
				Ext.Msg.alert(alertMsgTitle,_checknum,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(validateIpAddRetVal == "16")
			{
					Ext.Msg.alert(alertMsgTitle,_checkNumberLabel,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}//New IP Validation ends here
		}

		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(checkSpecialExtjs(userVal,"	@#$%^&*+={}|:;\"\'<>,\/") != '0')//replaced checkspecial by checkSpecialExtjs fn
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		return true;
	},

	validateRHEVForm : function(fromURL)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var ipAdd;
		if (fromURL.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var webport = Ext.getCmp('webport');
		var confpasswd = Ext.getCmp('confpasswd');
		var domain = Ext.getCmp('domain');
		var ipVal = ipAdd.getValue();
		var userVal = uname.getValue();
		var domainVal = domain.getValue();

		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";
		var webPortValue = webport.getValue();
		if(ipVal == 'Choose RHEV Manager')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg47,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if(!checkblank(ipVal)||ipVal == 'none'||ipVal == 'None'||ipVal == 'other'||ipVal == 'Other')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg48,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if (fromURL.indexOf("add") != -1)
		{			
			var ChkipOrhname = validateHostFieldExtjs(ipVal)//New IP Validation Starts here
			if(ChkipOrhname == "1")
			{ 
					Ext.Msg.alert(alertMsgTitle,_checkIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "5")
			{
					Ext.Msg.alert(alertMsgTitle,_checkspaceIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "7")
			{
					Ext.Msg.alert(alertMsgTitle,_checkspecial,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "8")
			{
					Ext.Msg.alert(alertMsgTitle,_valIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "9")
			{
					Ext.Msg.alert(alertMsgTitle,_validateHostDot,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "10")
			{
					Ext.Msg.alert(alertMsgTitle,_checknum,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "16")
			{
					Ext.Msg.alert(alertMsgTitle,_checkNumberLabel,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}//New IP Validation ends here
		}
		
		if(!checkblank(webport.getValue()))//WEBPORT FLOW CHANGED HERE
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg42,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(checkspaceExtjs(webport.getValue()) != '0')//replaced checkspace by checkspaceExtjs fn
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if (webport.getValue() > 99999)
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg43,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkcomma(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg10,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if (((!checknumber("+",webport.getValue()) && webPortValue.indexOf(',') == -1) || webPortValue == 0 || webPortValue.indexOf('.') > -1) && (webPortValue == 'NULL') || (webPortValue.indexOf(',') > -1))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg12,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecialnomess(webport.getValue(),splChar) && (webPortValue != 'NULL'))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}//WEBPORT FLOW CHANGE ENDS HERE
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(checkSpecialExtjs(userVal,"	@#$%^&*+={}|:;\"\'<>,\/") != '0')//replaced checkspecial by checkSpecialExtjs fn
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		
		if(!checkblank(domainVal))
		{
			Ext.Msg.alert(alertMsgTitle,domainValidationMsg,function(btn){
				if (btn == 'ok'){
					domain.focus(true);
				 }
			});
			return false;
		}

		return true;
	},

	validateFormNutanix : function(fromURL)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var ipAdd;
		if (fromURL.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var webport = Ext.getCmp('webport');
		var confpasswd = Ext.getCmp('confpasswd');
		var ipVal = ipAdd.getValue();
		var userVal = uname.getValue();

		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";
		var webPortValue = webport.getValue();
		if(ipVal == 'Choose Nutanix Prism')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg97,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if(!checkblank(ipVal))
		{
			Ext.Msg.alert(alertMsgTitle,intnlLabel39,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if (fromURL.indexOf("add") != -1)
		{
			var ChkipOrhname = validateHostFieldExtjs(ipVal)//New IP Validation Starts here
			if(ChkipOrhname == "1")
			{ 
					Ext.Msg.alert(alertMsgTitle,_checkIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "5")
			{
					Ext.Msg.alert(alertMsgTitle,_checkspaceIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "7")
			{
					Ext.Msg.alert(alertMsgTitle,_checkspecial,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "8")
			{
					Ext.Msg.alert(alertMsgTitle,_valIp,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "9")
			{
					Ext.Msg.alert(alertMsgTitle,_validateHostDot,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "10")
			{
					Ext.Msg.alert(alertMsgTitle,_checknum,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}
			else if(ChkipOrhname == "16")
			{
					Ext.Msg.alert(alertMsgTitle,_checkNumberLabel,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				return false;
			}//New IP Validation ends here
		}
		if(!checkblank(webport.getValue()))//webport validation included
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg42,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(checkspaceExtjs(webport.getValue()) != '0')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg2,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if (webport.getValue() > 99999)
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg43,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkcomma(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg10,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				}
			});
			return false;
		}
		else if (((!checknumber("+",webport.getValue()) && webPortValue.indexOf(',') == -1) || webPortValue == 0 || webPortValue.indexOf('.') > -1) && (webPortValue == 'NULL') || (webPortValue.indexOf(',') > -1))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg12,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecialnomess(webport.getValue(),splChar) && (webPortValue != 'NULL'))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}//webport validation ends here
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(checkSpecialExtjs(userVal,"	*+=|:;\"\'<>,\/[]?") != '0')//replaced checkspecial by checkSpecialExtjs fn
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		return true;
	},
	
	validateCtxXenPoolForm : function(fromURL)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var ipAdd;
		if (fromURL.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var webport = Ext.getCmp('webport');
		var confpasswd = Ext.getCmp('confpasswd');
		var ipVal = ipAdd.getValue();
		var userVal = uname.getValue();
		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";

		var webPortValue = Ext.getCmp('webport').getValue();
		if(ipVal == '-1')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg100,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if(!checkblank(ipVal)||ipVal == 'none'||ipVal == 'None'||ipVal == 'other'||ipVal == 'Other')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg101,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if (fromURL.indexOf("add") != -1)
		{
			if(!validateIpOrHName(ipVal))
			{
				ipAdd.focus(true);
				return false;
			}
		}
	
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecial(userVal,"	@#$%^&*+={}|:;\"\'<>,\/"))
		{
			uname.focus(true);
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(!checkblank(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg42,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspace(webport.getValue()))
		{
			webport.focus(true);
			return false;
		}
		else if (webport.getValue() > 99999)
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg43,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkcomma(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg10,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if (((!checknumber("+",webport.getValue()) && webPortValue.indexOf(',') == -1) || webPortValue == 0 || webPortValue.indexOf('.') > -1) && (webPortValue == 'NULL') || (webPortValue.indexOf(',') > -1))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg12,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecialnomess(webport.getValue(),splChar) && (webPortValue != 'NULL'))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		return true;
	},

	validateOracleVMForm : function(fromURL)//Oracle VM Manager
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var ipAdd;
		if (fromURL.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var webport = Ext.getCmp('webport');
		var confpasswd = Ext.getCmp('confpasswd');
		var ipVal = ipAdd.getValue();
		var userVal = uname.getValue();
		var splChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~!@#$%^&*()-_+=[]{}|\\:;\"\'<>.?\/";

		var webPortValue = Ext.getCmp('webport').getValue();
		if(ipVal == '-1')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg116,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if(!checkblank(ipVal)||ipVal == 'none'||ipVal == 'None'||ipVal == 'other'||ipVal == 'Other')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg117,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				 }
			});
			return false;
		}
		if (fromURL.indexOf("add") != -1)
		{
			if(!validateIpOrHName(ipVal))
			{
				ipAdd.focus(true);
				return false;
			}
		}
	
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecial(userVal,"	@#$%^&*+={}|:;\"\'<>,\/"))
		{
			uname.focus(true);
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			return false;
		}
		else if(!checkblank(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg42,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspace(webport.getValue()))
		{
			webport.focus(true);
			return false;
		}
		else if (webport.getValue() > 99999)
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg43,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkcomma(webport.getValue()))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg10,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if (((!checknumber("+",webport.getValue()) && webPortValue.indexOf(',') == -1) || webPortValue == 0 || webPortValue.indexOf('.') > -1) && (webPortValue == 'NULL') || (webPortValue.indexOf(',') > -1))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg12,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		else if(!checkspecialnomess(webport.getValue(),splChar) && (webPortValue != 'NULL'))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg13,function(btn){
				if (btn == 'ok'){
					webport.focus(true);
				 }
			});
			return false;
		}
		return true;
	},

	validateFormStoragePlatform : function(urlFrom)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var me = this;
		var ipAdd;
		if (urlFrom.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var ssl = Ext.getCmp('ssl');
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var confpasswd = Ext.getCmp('confpasswd');

		var ipVal = ipAdd.getValue();
		
		if(ipVal == '-1')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg109,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				}
			});
			ipAdd.focus(true);
			return false;
		}
		if(!checkblank(ipVal) || ipVal == 'none'||ipVal == 'None'||ipVal == 'other'||ipVal == 'Other')
		{
			if (urlFrom.indexOf("add") != -1)
			{
				Ext.Msg.alert(alertMsgTitle,intnlLabel49,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				ipAdd.focus(true);
			}
			else
			{
				Ext.Msg.alert(alertMsgTitle,validationMsg109,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				ipAdd.focus(true);
			}
			return false;
		}
		if(!validateIpOrHName(ipVal))
		{
			ipAdd.focus(true);
			return false;
		}
		//if(urlFrom.indexOf("add") != -1)
		//{
			////if(!me.validateStoragePlatformIP(ipAdd.getValue()))
			////{
				////Ext.Msg.alert(alertMsgTitle,validationMsg95,function(btn){
					////if (btn == 'ok'){
						////ipAdd.focus(true);
					 ////}
				////});
				////return false;
			////}
		//}
		
		var userVal = uname.getValue();
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			uname.focus(true);
			return false;
		}
		//else if(!checkspecial(userVal,"@#$%^&*+={}|:;\"\'<>,\/"))
		else if(!checkspecial(userVal,"#=|\"\'<>,\/"))
		{
			uname.focus(true);
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			pass.focus(true);
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		return true;
	},

	validateFormNetScaler : function(urlFrom)
	{
		var alertMsgTitle = Ext.getCmp('EgDiscoveryVirtualForm').title;
		var me = this;
		var ipAdd;
		if (urlFrom.indexOf("add") != -1)
		{
			ipAdd = Ext.getCmp('ipAdd');
		}
		else
		{
			ipAdd = Ext.getCmp('ipModify');
		}
		var ssl = Ext.getCmp('ssl');
		var discover = Ext.getCmp('isDiscovery');
		var uname = Ext.getCmp('uname');
		var pass = Ext.getCmp('pass');
		var confpasswd = Ext.getCmp('confpasswd');

		var ipVal = ipAdd.getValue();
		
		if(ipVal == '-1')
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg91,function(btn){
				if (btn == 'ok'){
					ipAdd.focus(true);
				}
			});
			ipAdd.focus(true);
			return false;
		}
		if(!checkblank(ipVal) || ipVal == 'none'||ipVal == 'None'||ipVal == 'other'||ipVal == 'Other')
		{
			if (urlFrom.indexOf("add") != -1)
			{
				Ext.Msg.alert(alertMsgTitle,intnlLabel38,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				ipAdd.focus(true);
			}
			else
			{
				Ext.Msg.alert(alertMsgTitle,validationMsg91,function(btn){
					if (btn == 'ok'){
						ipAdd.focus(true);
					 }
				});
				ipAdd.focus(true);
			}
			return false;
		}
		if(!validateIpOrHName(ipVal))
		{
			ipAdd.focus(true);
			return false;
		}
		//if (urlFrom.indexOf("add") != -1)
		//{
			//if(!me.validateNetScalerIP(ipAdd.getValue()))
			//{
				//Ext.Msg.alert(alertMsgTitle,validationMsg95,function(btn){
					//if (btn == 'ok'){
						//ipAdd.focus(true);
					 //}
				//});
				//return false;
			//}
		//}

		var userVal = uname.getValue();
		if(!checkblank(userVal))
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg37,function(btn){
				if (btn == 'ok'){
					uname.focus(true);
				 }
			});
			uname.focus(true);
			return false;
		}
		//else if(!checkspecial(userVal,"@#$%^&*+={}|:;\"\'<>,\/"))
		else if(!checkspecial(userVal,"#=|\"\'<>,\/"))
		{
			uname.focus(true);
			return false;
		}
		else if(!checkHyphenText(userVal,"uname"))
		{
			uname.focus(true);
			return false;
		}

		if(pass.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg38,function(btn){
				if (btn == 'ok'){
					pass.focus(true);
				 }
			});
			pass.focus(true);
			return false;
		}
		else if(!checkForPassValidity(pass.getValue()))
		{
			pass.focus(true);
			return false;
		}
		else if(confpasswd.getValue() == "")
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg40,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		else if(pass.getValue() != confpasswd.getValue())
		{
			Ext.Msg.alert(alertMsgTitle,validationMsg41,function(btn){
				if (btn == 'ok'){
					confpasswd.focus(true);
				 }
			});
			confpasswd.focus(true);
			return false;
		}
		return true;
	},

	handleDiscoveryDeleteClick : function(hostName,discoveryType,hypervisorType)
	{
		var alertMsgTitle = Ext.getCmp('DiscoveryDetailsGrid').title;
		var me = this;
		var strFrom = "delete"+discoveryType;
		Ext.Msg.show(
		{
			title : alertMsgTitle,
			msg : delConfirmMsg+" "+hypervisorType+" '"+hostName+"'?",
			//icon : 'iconConfirmation',
			width : 300,			
			icon : 'gen-question size32 color-question',
			buttons : Ext.Msg.YESNO,
			fn : function(buttonText)
			{
				if(buttonText == "yes")
				{
					Ext.Ajax.request({
						url : "/final/admin/LimitedAdminHome/data/EgAgentLessDiscoveryJsonp.jsp?fromAction="+fromAction+"&from="+strFrom+"&remoteAgent="+remoteAgent+'&ipAdd='+hostName,
						method: 'POST',
						success: function(response)
						{
							var rootJson = Ext.decode(response.responseText);
							if (rootJson.requestStatus == 'success')
							{
								Ext.Msg.show({
									title: alertMsgTitle,
									msg: hypervisorType+" '"+hostName+"' "+hypervisorDeleteMsg+".",
									buttons: Ext.Msg.OK,
									width : 300,
								//	icon: 'iconInformation',
									icon: 'gen-info size32 color-info',
									fn : function()
									{
										if (strFrom == 'deletevCenters')
										{
											appCnt.gotoVcenterDiscovers(true);
										}
										else if (strFrom == 'deleteHMCs')
										{
											appCnt.gotoHMCDetails(true);
										}
										else if (strFrom == 'deleteRHEV')
										{
											appCnt.gotoRHEVDetails(true);
										}
										else if (strFrom == 'deleteNutanix')
										{
											appCnt.gotoNutanixDetails(true);
										}
										else if (strFrom == 'deleteCtxXenPool')
										{
											appCnt.gotoCtxXenPoolDetails(true);
										}
										else if (strFrom == 'deleteOracleVM')
										{
											appCnt.gotoOracleVMDetails(true);
										}
										else if (strFrom == 'deleteEMC')
										{
											appCnt.gotoEMCDetails(true);
										}
										else if (strFrom == 'deletenetScalers')
										{
											appCnt.gotoCtxNetScalerDetails(true);
										}
									}
								});
							}
						}
					});
				}
			}
		});
	},

	loadManageInfrastructure : function(obj)
	{
		if (!Ext.isEmpty(obj))
		{
			Ext.Ajax.request({
				url : '/final/admin/LimitedAdminHome/data/EgMenuItems.jsp?from=manageInfraItems&fromAction='+fromAction,
				method: 'POST',
				success: function(response)
				{
					var jsonText = response.responseText;
					publicJSON = Ext.decode(jsonText);
					Ext.getCmp('manageInfraItems').getStore().loadRawData(publicJSON.manageInfraItems);

					if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
					{
						Ext.getCmp('WhatNextObj').destroy();
					}

					Ext.getCmp('card-3').add({
						xtype: 'WhatNext',
						id:'WhatNextObj',
					});

					if (!hideDownloadInstaller)
					{
						Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div><ol class="listDefault"><li>'+manageInfraWhatNextPhoenix+'.</li></ol></div>');
						Ext.getCmp('WhatNextObj').setWidth(250);
						Ext.getCmp('WhatNextObj').setHeight(110);
					}
					else
					{
						Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div><ol class="listDefault"><li>'+manageInfraWhatNext+'.</li></ol></div>');
						Ext.getCmp('WhatNextObj').setWidth(250);
						Ext.getCmp('WhatNextObj').setHeight(95);
					}
					Ext.getCmp('WhatNextObj').show();
				}
			});
		}
	},

	loadRefineConfig : function(obj)
	{
		if (!Ext.isEmpty(obj))
		{
			Ext.Ajax.request({
				url : '/final/admin/LimitedAdminHome/data/EgMenuItems.jsp?from=refineConfigItems&fromAction='+fromAction,
				method: 'POST',
				success: function(response)
				{
					var jsonText = response.responseText;
					publicJSON = Ext.decode(jsonText);
					Ext.getCmp('refineConfigItems').getStore().loadRawData(publicJSON.refineConfigItems);

					if (!Ext.isEmpty(Ext.getCmp('WhatNextObj')))
					{
						Ext.getCmp('WhatNextObj').destroy();
					}

					Ext.getCmp('card-2').add({
						xtype: 'WhatNext',
						id:'WhatNextObj',
					});
					Ext.getCmp('whatNextText').update('<div class="whatNextHeader">'+whatNextTitle+'</div><div><ol class="listDefault"><li>'+manageConfigWhatNext+'.</li></ol></div>');
					Ext.getCmp('WhatNextObj').setWidth(250);
					Ext.getCmp('WhatNextObj').setHeight(120);
					Ext.getCmp('WhatNextObj').show();
				}
			});
		}
	},

	downloadAgentPack : function(osname,folder,agentVersion,displayField)
	{
		var AgentToBeConfigured = '';
		if (fromAgentModel == null || Ext.isEmpty(fromAgentModel))
		{
			AgentToBeConfigured = 'Internal';
		}
		else if (fromAgentModel == 'VM')
		{
			AgentToBeConfigured = 'Internal';
		}
		else
		{
			AgentToBeConfigured = fromAgentModel;
		}
		var isGoldenImageServer = Ext.getCmp('isGoldenImageServer').getValue();
		if (Ext.isEmpty(isGoldenImageServer))
		{
			isGoldenImageServer = 'false';
		}
		var downloadUtils =  Ext.widget('DownloadUtils');
		var urlStr = '/final/servlet/com.eg.AgentDownloadServlet?from='+encodeURIComponent(AgentToBeConfigured)+'&os='+encodeURIComponent(osname)+'&folder='+encodeURIComponent(folder)+'&agentVersion='+encodeURIComponent(agentVersion)+'&unzipit=false&issueUID=yes&isGoldenImageServer='+encodeURIComponent(isGoldenImageServer);
		
		var monitors = Ext.getCmp('card-0').monitors;
		if (!Ext.isEmpty(monitors) && monitors == 'LogonSimulator')
		{
			urlStr += '&isCliEmu=true';
		}
		downloadUtils.download(urlStr,displayField,AgentToBeConfigured,false);
	},

	downloadAgentInstaller : function()
	{
		Ext.Ajax.request({
			url : 'LimitedAdminHome/data/EgProxyDetailsJson.jsp',
			params: {
				'from' : 'getProxyDetails'
			},
			success: function(response)
			{
				var jsonText = response.responseText;
				var publicProxyJson = Ext.decode(jsonText);
				var isProxySet = publicProxyJson.isProxySet;
				var isSuperOrg = publicProxyJson.isSuperOrg;
				if (!isProxySet && isSuperOrg)
				{
					Ext.create('Ext.window.Window', {
						title: "<span style='text-transform:none;'>"+proxyDetailsTitle+"</span>",
						modal:true,
						//ui:'newPopupWindow newplainHeader_border popupWindowBlueHeader', 
						ghost:false,
						id:'proxyDetailsWinForProxy',
						name:'proxyDetailsWinForProxy',
						border:true,
						padding:'5 10 10 10',
						header:{
							margin:'5 5 5 5'
						},
						flex: 1,
						closable: true,
						listeners: {
							show: function(h) {
								if (this.modal) {
									var g = Ext.dom.Query.select(".x-mask");
									for (var f in g) {
										this.dom = g[f];
										if (!Ext.isEmpty(this.dom.offsetParent)) {
											if (this.dom.offsetParent.tagName == "BODY") {
												Ext.fly(this.dom).addCls("windowModal");
											}
										}
									}
								}
							},
							hide: function(f) {
								if (this.modal) {
									Ext.fly(this.dom).removeCls("windowModal");
								}
							},
							afterrender: function() {
								Ext.EventManager.onWindowResize(function() {
									var f = this;
									f.center();
								}, this);
							},
							resize: function() {
								this.center();
							}
						},
						resizable:false,
						layout: 'fit',
						items : [
							{
								xtype : 'container',
								layout : {
									type: 'vbox',
									align: 'center'
								},
								margin : 10,
								defaults : {
									labelSeparator: '',
									labelStyle:'font-size: 12px',
									margin: 10,
									width: 700,
									labelWidth: 480
								},
								items : [
									{
										xtype: 'radiogroup',
										columns: 2,
										vertical: false,
										id: 'useProxy',
										name: 'useProxy',
										cls : 'aRadiobt',
										fieldLabel: useProxyLabel+'?',
										items: [
											{
												boxLabel: 'Yes',
												name: 'useProxy',
												id: 'useProxyYes',
												inputValue: 'yes',
												listeners : {
													change: function()
													{
														var useProxyYes = Ext.getCmp('useProxyYes').getGroupValue();
														if (!Ext.isEmpty(useProxyYes) && useProxyYes == 'yes')
														{
															Ext.getCmp('proxyHost').show();
															Ext.getCmp('proxyPort').show();
															Ext.getCmp('isAuthentication').show();
														}
														else
														{
															Ext.getCmp('proxyHost').hide();
															Ext.getCmp('proxyPort').hide();
															Ext.getCmp('isAuthenticationNo').setValue(true);
															Ext.getCmp('isAuthentication').hide();
															Ext.getCmp('proxyUsername').hide();
															Ext.getCmp('proxyPassword').hide();
															Ext.getCmp('proxyCnfPassword').hide();
														}
													}
												}
											},
											{
												boxLabel: 'No',
												name: 'useProxy',
												id: 'useProxyNo',
												checked: true,
												inputValue: 'no'
											}
										]
									},
									{
										xtype: 'textfield',
										id: 'proxyHost',
										name: 'proxyHost',
										cls: 'aTextbox',
										fieldLabel : proxyHostLabel,
										hidden: true
									},
									{
										xtype: 'textfield',
										id: 'proxyPort',
										name: 'proxyPort',
										cls: 'aTextbox',
										fieldLabel : proxyPortLabel,
										hidden: true
									},
									{
										xtype: 'radiogroup',
										columns: 2,
										vertical: false,
										id: 'isAuthentication',
										name: 'isAuthentication',
										cls : 'aRadiobt',
										fieldLabel: isAuthLabel+'?',
										hidden: true,
										items: [
											{
												boxLabel: 'Yes',
												name: 'isAuthentication',
												id: 'isAuthenticationYes',
												inputValue: 'yes',
												listeners : {
													change: function()
													{
														var isAuthenticationYes = Ext.getCmp('isAuthenticationYes').getGroupValue();
														if (!Ext.isEmpty(isAuthenticationYes) && isAuthenticationYes == 'yes')
														{
															Ext.getCmp('proxyUsername').show();
															Ext.getCmp('proxyPassword').show();
															Ext.getCmp('proxyCnfPassword').show();
														}
														else
														{
															Ext.getCmp('proxyUsername').hide();
															Ext.getCmp('proxyPassword').hide();
															Ext.getCmp('proxyCnfPassword').hide();
														}
													}
												}
											},
											{
												boxLabel: 'No',
												name: 'isAuthentication',
												id: 'isAuthenticationNo',
												checked: true,
												inputValue: 'no'
											}
										]
									},
									{
										xtype: 'textfield',
										id: 'proxyUsername',
										name: 'proxyUsername',
										cls: 'aTextbox',
										fieldLabel : proxyUnameLabel,
										hidden: true
									},
									{
										xtype: 'textfield',
										id: 'proxyPassword',
										name: 'proxyPassword',
										cls: 'aTextbox',
										fieldLabel : proxyPwdLabel,
										inputType: 'password',
										hidden: true
									},
									{
										xtype: 'textfield',
										id: 'proxyCnfPassword',
										name: 'proxyCnfPassword',
										cls: 'aTextbox',
										fieldLabel : proxyCnfPwdLabel,
										inputType: 'password',
										hidden: true
									}
								]
							}
						],
						dockedItems:[{
							xtype:'toolbar',
							dock: 'bottom',
							border:false,
							padding : '10 0 10 0',
							layout:{
								type: 'hbox',
								pack: 'center'
							},
							ui:'toolbarBgWithTopBorder',
							items: [
								{
									xtype: 'button',
									ui:'aButtonSmall',
									text: 'Submit',
									id: 'submitProxyDetails',
									listeners : {
										click : function()
										{
											appCnt.submitProxyDetails("","");
										}
									}
								}
							]
						}]
					}).show();
				}
				else
				{
					var downloadUtils =  Ext.widget('DownloadUtils');
					var urlStr = '/final/servlet/com.eg.AgentInstallerDownloadServlet';
					downloadUtils.download(urlStr,'','Internal',false);
				}
			}
		});
	},

	submitProxyDetails : function(agentType,monitors)
	{
		var useParentProxyNo = '';
		if (!Ext.isEmpty(Ext.getCmp('useParentProxyNo')))
		{
			useParentProxyNo = Ext.getCmp('useParentProxyNo').getGroupValue();
		}
		var useProxyYes = Ext.getCmp('useProxyYes').getGroupValue();
		var proxyHost = '';
		var proxyPort = '';
		var isAuthenticationYes = '';
		var proxyUsername = '';
		var proxyPassword = '';
		var proxyCnfPassword = '';
		if (!Ext.isEmpty(useProxyYes) && useProxyYes == 'yes' && (Ext.isEmpty(useParentProxyNo) || (!Ext.isEmpty(useParentProxyNo) && useParentProxyNo == 'no')))
		{
			proxyHost = Ext.getCmp('proxyHost').getValue();
			proxyPort = Ext.getCmp('proxyPort').getValue();

			if (Ext.isEmpty(proxyHost))
			{
				Ext.Msg.show({
					title : proxyDetailsTitle,
					msg : enterProxyHostMsg,
					icon : 'gen-warning size32 color-warning',
					buttons : Ext.Msg.OK,
					fn : function(btn){
						Ext.getCmp('proxyHost').focus(true,true);
					}
				});
				return false;
			}

			var alphabets = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
			var checkCharacter = "";
			var temp = false;
			for(var m=0; m<proxyHost.length; m++)
			{
				checkCharacter = alphabets.indexOf(proxyHost.charAt(m))
				//Returns value 1 if thecharacter listed is found
				if(checkCharacter >= 0)
				{
					temp = true;
					break;
				}
			}

			if(temp)
			{
				//Hostname should not have space
				if(checkspaceExtjs(proxyHost) != '0')
				{
					Ext.Msg.show({
						title: proxyDetailsTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							Ext.getCmp('proxyHost').focus(true,true);
						}
					});
					return false;
				}
				else if(this.isCheckEgKeywords(proxyHost))
				{
					Ext.Msg.show({
						title: proxyDetailsTitle,
						msg: _tcKeyword,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							Ext.getCmp('proxyHost').focus(true,true);
						}
					});
					return false;
				}
				//Checks for dots before & after hostname as well as dots in consecutive positions.
				if (!checkdots(proxyHost))
				{
					Ext.Msg.show({
						title: proxyDetailsTitle,
						msg: _checkHost,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							Ext.getCmp('proxyHost').focus(true,true);
						}
					});
					return false;
				}
				if(!checkspecialnomess(proxyHost,"`~!@#%^&*()+={}[]|\\;\"\'<>,?"))
				{
					Ext.Msg.show({
						title: proxyDetailsTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							Ext.getCmp('proxyHost').focus(true,true);
						}
					});
					return false;
				}
			}
			else 
			{
				var errMsg = validateIpWithMsg(proxyHost);
				if(!Ext.isEmpty(errMsg))
				{
					Ext.Msg.show({
						title: proxyDetailsTitle,
						msg: errMsg,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							Ext.getCmp('proxyHost').focus(true,true);
						}
					});
					return false;
				}
			}

			if (Ext.isEmpty(proxyPort))
			{
				Ext.Msg.show({
					title : proxyDetailsTitle,
					msg : enterProxyPortMsg,
					icon : 'gen-warning size32 color-warning',
					buttons : Ext.Msg.OK,
					fn : function(btn){
						Ext.getCmp('proxyPort').focus(true,true);
					}
				});
				return false;
			}
			else if ((!checknumber("+",proxyPort) || proxyPort == 0) && (proxyPort != "none"))
			{
				Ext.Msg.show({
					title: proxyDetailsTitle,
					msg: _checkproxy,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						Ext.getCmp('proxyPort').focus(true,true);
					}
				});
				return false;
			}

			var errMsg = checkDecimalExtJs(proxyPort);
			if (!Ext.isEmpty(errMsg))
			{
				Ext.Msg.show({
					title: proxyDetailsTitle,
					msg: errMsg,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(btn) {
						Ext.getCmp('proxyPort').focus(true,true);
					}
				});
				return false;
			}

			isAuthenticationYes = Ext.getCmp('isAuthenticationYes').getGroupValue();
			if (!Ext.isEmpty(isAuthenticationYes) && isAuthenticationYes == 'yes')
			{
				proxyUsername = Ext.getCmp('proxyUsername').getValue();
				proxyPassword = Ext.getCmp('proxyPassword').getValue();
				proxyCnfPassword = Ext.getCmp('proxyCnfPassword').getValue();

				if (Ext.isEmpty(proxyUsername))
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : enterProxyUsernameMsg,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyUsername').focus(true,true);
						}
					});
					return false;
				}
				var splChars = "|:;\"\'<>,\/[]?";

				if(this.isCheckEgKeywords(proxyUsername))
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : _tcKeyword,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyUsername').focus(true,true);
						}
					});
					return false;
				}
				else if (checkSpecialExtjs(proxyUsername,splChars) != '0')
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : validationMsg13,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyUsername').focus(true,true);
						}
					});
					return false;
				}
				else if(proxyUsername.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : _checkdots,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyUsername').focus(true,true);
						}
					});
					return false;
				}
				else if(proxyUsername.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : _checkSpaces,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyUsername').focus(true,true);
						}
					});
					return false;
				}

				if (Ext.isEmpty(proxyPassword))
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : enterProxyPwdMsg,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyPassword').focus(true,true);
						}
					});
					return false;
				}
				else if(checkspaceExtjs(proxyPassword) != '0')
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : _checkblank,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyPassword').focus(true,true);
						}
					});
					return false;
				}
				else if(this.isCheckEgKeywords(proxyPassword))
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : _tcKeyword,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyPassword').focus(true,true);
						}
					});
					return false;
				}
				else if (Ext.isEmpty(proxyCnfPassword))
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : enterProxyCnfPwdMsg,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyCnfPassword').focus(true,true);
						}
					});
					return false;
				}
				else if (proxyPassword != proxyCnfPassword)
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : pwdMatchMsg,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							Ext.getCmp('proxyCnfPassword').focus(true,true);
						}
					});
					return false;
				}
			}
		}

		Ext.Ajax.request({
			url : 'LimitedAdminHome/data/EgProxyDetailsJson.jsp',
			params: {
				'from' : 'updateProxyDetails',
				'useParentProxyNo' : encodeURIComponent(useParentProxyNo),
				'useProxyYes' : encodeURIComponent(useProxyYes),
				'proxyHost' : encodeURIComponent(proxyHost),
				'proxyPort' : encodeURIComponent(proxyPort),
				'isAuthenticationYes' : encodeURIComponent(isAuthenticationYes),
				'proxyUsername' : encodeURIComponent(proxyUsername),
				'proxyPassword' : encodeURIComponent(proxyPassword)
			},
			success: function(response)
			{
				var jsonText = response.responseText;
				var publicProxyJson = Ext.decode(jsonText);
				if (publicProxyJson.success)
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : proxypdateSuccessMsg,
						icon : 'gen-info size32 color-info',
						buttons : Ext.Msg.OK,
						fn : function(btn){
							if (hideDownloadInstaller)
							{
								Ext.getCmp('proxyDetailsWin').close();
								Ext.suspendLayouts();
								var innerCardObj = Ext.getCmp('card-0');
								innerCardObj.removeAll();
								innerCardObj.monitors = monitors;
								innerCardObj.agentType = agentType;
								innerCardObj.add({
										xtype: 'DownloadAgents'
								});
								Ext.resumeLayouts(true);
							}
							else
							{
								Ext.getCmp('proxyDetailsWinForProxy').close();
								var downloadUtils =  Ext.widget('DownloadUtils');
								var urlStr = '/final/servlet/com.eg.AgentInstallerDownloadServlet';
								downloadUtils.download(urlStr,'','Internal',false);
							}
						}
					});
				}
				else
				{
					Ext.Msg.show({
						title : proxyDetailsTitle,
						msg : proxyUpdateErrorMsg,
						icon : 'gen-warning size32 color-warning',
						buttons : Ext.Msg.OK
					});
				}
			}
		});
	},

	tabChange: function(tab)
	{
		var selectedTab = tab;
		var tabPanel = Ext.getCmp('mainTab');
		if(selectedTab.toLowerCase() == "tab1")
		{
			thisController.getServerDetails();
			tabPanel.child('#tab1').tab.show();
		}
		if(selectedTab.toLowerCase() == "tab2")
		{
			thisController.getUnConfCompDetails();
			tabPanel.child('#tab2').tab.show();
		}
	},

	
	agentWidgetWidth : function(view){
		viewWidth = view.getWidth() - (view.scrollbarVisible(view) ? Ext.getScrollbarSize().width : 0);
		viewHeight = view.getHeight();
		defaultBoxSize = view.boxWidth;
		defaultBoxHeight = view.boxHeight;
		margin = view.boxMargin;
		selector = Ext.select(view.itemSelector);
		selectorElement = Ext.select(view.itemSelector).elements;
		domLength = selectorElement.length;
		dynamicColumns = Math.round(viewWidth / defaultBoxSize);
		
		dynamicRows = Math.round(defaultBoxHeight / defaultBoxHeight);
		finalBoxWidth = ((viewWidth / dynamicColumns) - (margin * 2));
		
		if(defaultBoxSize >  finalBoxWidth){
			finalBoxWidth = ((viewWidth / (dynamicColumns -1)) - (margin * 2));
		}
		Ext.suspendLayouts();
		selectorElement.forEach(function (el, i) {
			Ext.fly(el).setStyle({
				"width":  finalBoxWidth + 'px',
				"height": defaultBoxHeight + 'px',
				"margin": margin + 'px'
			});
		});
		Ext.resumeLayouts(true);
	},
	
	addMultiSource: function(btn) 
	{
		var discover = Ext.getCmp('card-0').discover;
		if (discover == 'Xchg_Logon_Emulation')
		{
			addExchangeMultiSourceContact();
		}
		else if (discover == 'Amazon_Logon_Emulation')
		{
			addAmazonMultiSourceContact();
		}
		else if (discover == 'Hrzn_Web_Logon_Emulation')
		{
			addHorizonMultiSourceContact();
		}
		else
		{
			addMultiSourceContact();
		}
	},

	getPopUpView : function(ResourceId)
	{
		if (Ext.getCmp('egconfigureresource') != undefined)
		{
			Ext.getCmp('egconfigureresource').removeAll();
			Ext.getCmp('backupmultirescontainer').removeAll();
			Ext.getCmp('backupmultirescontainer').doLayout();
		}
		
		var resValue = Ext.getCmp(ResourceId).getValue();
		inputs = 1;
		popUpWin = Ext.create('Ext.Window', {
			layout: 'fit',
			border: false,
			//ui:'newPopupWindow newplainHeader_border popupWindowBlueHeader', 
			ghost:false,
			closeAction:'destroy',
			padding:'5 10 10 10',
			bodyPadding:'0 0 10 0',
			header:{
				//padding:'14 0 10 0',
				margin:'5 5 5 5',
			},
			title: pubResourceToolTip,
			id: 'egconfigureresource',
			width: 700,
			height: 350,
			//padding:'0 10 10 10',
			autoScroll: true,
			modal: true,
			layout: {
				type: 'auto',
				pack: 'start',
				align: 'stretch'
			},
			dockedItems: [
				{
					dock: 'bottom',
					xtype:'toolbar',
					layout:{
						type:'hbox',
						align:'stretch',
						pack:'center'
					},
					ui:'toolbarBgWithTopBorder',
					border:false,
					padding : '10 0 10 0',
					items: [
						{
							xtype: 'button',
							ui: 'aButtonSmall',
							id: 'addMultiresbtn',
							width: 80,
							text: 'Add More',
							listeners : 
							{
								'click' : function()
								{
									addMultiResourceContact();
								}
							}
						},
						{
							xtype: 'button',
							ui: 'aButtonSmall',
							text: 'Update',
							width: 80,
							id: 'updateMultires',
							name: 'updateMultires',
							margin: '0 0 0 10',
							listeners : 
							{
								'click' : function()
								{
									appCnt.updateMultiResourceContact(ResourceId);
								}
							}
						},
						{
							xtype: 'button',
							ui: 'aButtonSmall',
							text: 'Clear',
							width: 80,
							id: 'clearMultires',
							name: 'clearMultires',
							margin: '0 0 0 10',
							listeners : 
							{
								'click' : function()
								{
									appCnt.clearMultiResourceContact();
								}
							}
						}
					]
				}
			],
			items: [
				{
					xtype: 'container',
					id: 'backupmultirescontainer',
					layout: {
						type: 'vbox',
						pack: 'center',
						align: 'stretch'
					}
				},
				{
					xtype: 'container',
					id: 'NoMultiResPattern',
					hidden: true,
					layout: {
						type: 'hbox',
						pack: 'center',
						align: 'center'
					},
					border:true,
					margin: '5 10 5 10',
					flex:1,
					columnWidth:1,
					items: [
						{
							xtype: 'label',
							html: '<table border="0px" height="230"><tr><td align="center"><table><tr><td align="center"><div class="gen-info size32 color-info"></div><div class="commonErrorMsgText">'+noDataMessage+'</div></td></tr></table></td></tr></table>'
						}
					]
				}
			]
		});
		popUpWin.show();
		var multidom = '';
		var splitresValue = resValue.split(",");
		if (resValue != null || resValue != undefined)
		{
			var val = splitresValue.length-1;
			for (var k =0;k<=splitresValue.length-1;k++ )
			{
				addMultiResourceContact();
			}
			for (multidom=1;multidom<splitresValue.length+1;multidom++)
			{
				if (splitresValue[multidom-1].indexOf("\\") != -1)
				{
					var folderName = splitresValue[multidom-1].split("\\");
					Ext.getCmp('folderName'+multidom).setValue(splitresValue[multidom-1].split('\\')[0]);
					if (splitresValue[multidom-1].split('\\')[1].indexOf(":") != -1)
					{
						var temp = splitresValue[multidom-1].split('\\')[1];
						Ext.getCmp('resourceName'+multidom).setValue(temp.split(':')[0]);
						Ext.getCmp('winTitle'+multidom).setValue(temp.split(':')[1]);
					}
					else
					{
						Ext.getCmp('resourceName'+multidom).setValue(splitresValue[multidom-1].split('\\')[1]);
						Ext.getCmp('winTitle'+multidom).setValue('none');
					}
				}
				else
				{
					if (splitresValue[multidom-1].indexOf(":") != -1)
					{
						Ext.getCmp('folderName'+multidom).setValue('none');
						Ext.getCmp('resourceName'+multidom).setValue(splitresValue[multidom-1].split(':')[0]);
						Ext.getCmp('winTitle'+multidom).setValue(splitresValue[multidom-1].split(':')[1]);
					}
					else
					{
						Ext.getCmp('folderName'+multidom).setValue('none');
						Ext.getCmp('resourceName'+multidom).setValue(splitresValue[multidom-1]);
						Ext.getCmp('winTitle'+multidom).setValue('none');
					}
				}
				
			}
		}
	},

	updateMultiResourceContact : function(resourceId)
	{
		var multiinputs = inputs;
		var publishResource = "";
		for (var mul=1;mul<=multiinputs-1;mul++)
		{
			if (Ext.getCmp('folderName'+mul) == undefined)
			{
				continue;
			}
			var folderName = Ext.getCmp('folderName'+mul).getValue();
			var resourceName = Ext.getCmp('resourceName'+mul).getValue();
			var winTitle = Ext.getCmp('winTitle'+mul).getValue();
			if (!checkblank(folderName))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterFolderName,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('folderName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (folderName.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('folderName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (!checkspecialExt(folderName,"`*=#.|;:\"\'<>,\/[]{}()?\\"))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function()
					{
						Ext.getCmp('folderName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (trim(folderName) == "")
			{
				Ext.getCmp('folderName'+mul).focus();
				return;
			}
			else if (folderName.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('folderName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (folderName.indexOf("  ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkSpaces,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('folderName'+mul).focus(true,true);
					}
				});
				return;
			}

			if (!checkblank(resourceName))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterResourceName,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('resourceName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (resourceName.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('resourceName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (resourceName.indexOf("none") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: validResourceName,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('resourceName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (!checkspecialExt(resourceName,"`*=#.|;:\"\'<>,\/[]?\\"))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function()
					{
						Ext.getCmp('resourceName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (trim(resourceName) == "")
			{
				Ext.getCmp('resourceName'+mul).focus();
				return;
			}
			else if (resourceName.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('resourceName'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (resourceName.indexOf("  ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkSpaces,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('resourceName'+mul).focus(true,true);
					}
				});
				return;
			}

			if (!checkblank(winTitle))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterwinTitle,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('winTitle'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (winTitle.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('winTitle'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (!checkspecialExt(winTitle,"`*=#.|;:\"\'<>,\/[]{}()?\\"))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function()
					{
						Ext.getCmp('winTitle'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (trim(winTitle) == "")
			{
				Ext.getCmp('winTitle'+mul).focus();
				return;
			}
			else if (winTitle.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('winTitle'+mul).focus(true,true);
					}
				});
				return;
			}
			else if (winTitle.indexOf("  ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkSpaces,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('winTitle'+mul).focus(true,true);
					}
				});
				return;
			}
			if (folderName != 'none' && winTitle != 'none')
			{
				publishResource += folderName+"\\"+resourceName+":"+winTitle; 
			}
			else if (folderName == 'none' && winTitle != 'none')
			{
				publishResource += resourceName+":"+winTitle;
			}
			else if (folderName != 'none' && winTitle == 'none')
			{
				publishResource += folderName+"\\"+resourceName;
			}
			else if (folderName == 'none' && winTitle == 'none')
			{
				publishResource += resourceName;
			}
			publishResource += ",";
		}
		publishResource = publishResource.substring(0,publishResource.lastIndexOf(","));
		Ext.getCmp(resourceId).setValue(publishResource);
		Ext.getCmp('egconfigureresource').close();
	},

	ClearMultiConfigSource: function() 
	{
		var discover = Ext.getCmp('card-0').discover;
		if (discover == 'Xchg_Logon_Emulation')
		{
			var backupmulticontainer = Ext.getCmp('backupmulticontainer1');
			backupmulticontainer.removeAll();
			if (Ext.getCmp('excconmulti_1') != null || Ext.getCmp('excconmulti_1') != undefined)
			{
				ismultisrc = 'true';
				Ext.getCmp('excconmulti_1').removeAll();
				Ext.getCmp('excconmulti_1').hide();
			}
			
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
			Ext.getCmp('NoMultiUsrPattern1').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
		}
		else if (discover == 'Amazon_Logon_Emulation')
		{
			var backupmulticontainer = Ext.getCmp('amazonbackupmulticontainer');
			backupmulticontainer.removeAll();
			if (Ext.getCmp('amazonconmulti_1') != null || Ext.getCmp('amazonconmulti_1') != undefined)
			{
				ismultisrc = 'true';
				Ext.getCmp('amazonconmulti_1').removeAll();
				Ext.getCmp('amazonconmulti_1').hide();
			}
			
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
			Ext.getCmp('amazonNoMultiUsrPattern').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
		}
		else if (discover == 'Hrzn_Web_Logon_Emulation')
		{
			var backupmulticontainer = Ext.getCmp('horizonbackupmulticontainer');
			backupmulticontainer.removeAll();
			if (Ext.getCmp('horizonconmulti_1') != null || Ext.getCmp('horizonconmulti_1') != undefined)
			{
				ismultisrc = 'true';
				Ext.getCmp('horizonconmulti_1').removeAll();
				Ext.getCmp('horizonconmulti_1').hide();
			}
			
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
			Ext.getCmp('horizonNoMultiUsrPattern').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
		}
		else
		{
			var backupmulticontainer = Ext.getCmp('backupmulticontainer');
			backupmulticontainer.removeAll();
			if (Ext.getCmp('conmulti_1') != null || Ext.getCmp('conmulti_1') != undefined)
			{
				ismultisrc = 'true';
				Ext.getCmp('conmulti_1').removeAll();
				Ext.getCmp('conmulti_1').hide();
			}
			
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
			Ext.getCmp('NoMultiUsrPattern').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
		}
	},
	
	clearMultiResourceContact : function()
	{
		var backupmulticontainer = Ext.getCmp('backupmultirescontainer');
		backupmulticontainer.removeAll();
		inputs = 1;
		addMultiResourceContact();
	},

	gotoLogonSimulatorConfiguration : function()
	{
		var compType = fromAction.substring(fromAction.indexOf(":")+1);

		Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+card0LogonSimulatorExtInnerTitle+' '+remoteAgent);

		if (compType!=null && compType=="Citrix_XcLogon_Emulation")
		{
			Ext.getCmp('noteCont').hide();
			Ext.getCmp('ctxCloudWrkSpace').show();

			Ext.getCmp('publisresource1').setReadOnly(true);
			Ext.getCmp('publisresource1').columnWidth = '0.97';
			Ext.getCmp('confpublisresource1').setVisible(true);
			Ext.getCmp('lspageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+ctxlogonSimulatorLbl+':</div>');
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+card0CtxLogonSimulatorExtInnerTitle+' '+remoteAgent);
			Ext.getCmp('lsadditionalParams1').hide();
			Ext.getCmp('lsadditionalParams').show();
			Ext.getCmp('lsamazonWSParams').hide();
			Ext.getCmp('lshorizonWSParams').hide();
		}
		else if (compType!=null && compType=="Hrzn_Logon_Emulation")
		{
			Ext.getCmp('noteCont').show();
			Ext.getCmp('ctxCloudWrkSpace').hide();

			Ext.getCmp('publisresource1').setReadOnly(false);
			Ext.getCmp('publisresource1').columnWidth = '1';
			Ext.getCmp('confpublisresource1').setVisible(false);
			Ext.getCmp('lspageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+hrznlogonSimulatorLbl+':</div>');
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+card0HrznLogonSimulatorExtInnerTitle+' '+remoteAgent);
			Ext.getCmp('lsadditionalParams1').hide();
			Ext.getCmp('lsadditionalParams').show();
			Ext.getCmp('lsamazonWSParams').hide();
			Ext.getCmp('lshorizonWSParams').hide();
		}
		else if (compType!=null && compType=="Xchg_Logon_Emulation")
		{
			Ext.getCmp('lspageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+exclogonSimulatorLbl+':</div>');
			Ext.getCmp('lsadditionalParams').hide();
			Ext.getCmp('lsadditionalParams1').show();

			Ext.getCmp('exchangeServType').setValue("1");

			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+card0ExchLogonSimulatorExtInnerTitle+' '+remoteAgent);
			Ext.getCmp('lsamazonWSParams').hide();
			Ext.getCmp('lshorizonWSParams').hide();
		}
		else if (compType!=null && compType=="Amazon_Logon_Emulation")
		{
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+card0AmazonWSSimulatorExtInnerTitle+' '+remoteAgent);
			Ext.getCmp('lspageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+amazonWSSimulatorLbl+':</div>');

			Ext.getCmp('lsadditionalParams').hide();
			Ext.getCmp('lsadditionalParams1').hide();
			Ext.getCmp('lsamazonWSParams').show();
			Ext.getCmp('lshorizonWSParams').hide();
		}
		else if (compType!=null && compType=="Hrzn_Web_Logon_Emulation")
		{
			Ext.getCmp('card-0').setTitle('<a href="javascript:void(0)" onclick="javascript:appCnt.configureServersClose()">'+'<img src="/final/images/spacer.gif" class="aIconBackArrow"></a> '+card0HrznWSSimulatorExtInnerTitle+' '+remoteAgent);
			Ext.getCmp('lspageMsgRecommendation').update('<div class="aPanelMsg" style="margin:16px 10px 5px 10px;">'+hrznWSSimulatorLbl+':</div>');

			Ext.getCmp('lsadditionalParams').hide();
			Ext.getCmp('lsadditionalParams1').hide();
			Ext.getCmp('lsamazonWSParams').hide();
			Ext.getCmp('lshorizonWSParams').show();
		}

		var urlStr = 'NewComponent/data/EgNewServerJson.jsp?&serverType='+encodeURIComponent(compType)+'&selectedServerGroup='+'all'+'&server=new';

		Ext.Ajax.request(
		{
			url: urlStr,
			method: 'POST',
			async:false,
			success: function( response )
			{
				if ( response.status == 200 && !Ext.isEmpty( response.responseText ) )
				{
					var jsonText = response.responseText;
					publicJSON = Ext.decode(jsonText);
					publicJSONMSOffice = publicJSON;
					var hideHostIP = publicJSON.hideHostIPField;
					if (!hideHostIP)
					{
						Ext.getCmp('hostipname').show();
					}
					else
					{
						Ext.getCmp('hostipname').hide();
					}
				}
			}
		});
	},

	UpdateMultiConfigSource: function() 
	{
		var multiinputs = inputsmultisrc;

		var compType = fromAction.substring(fromAction.indexOf(":")+1);
		
		var compNickObj = Ext.getCmp('nickname');
		var compNickVal = compNickObj.getValue();

		alertMsgSrcTitle = Ext.getCmp('card-0').title;
		alertMsgSrcTitle = alertMsgSrcTitle.substring(alertMsgSrcTitle.indexOf("Monitor"));

		var hostIpObj = Ext.getCmp('hostipname');
		if (!Ext.isEmpty(hostIpObj))
		{
			var hostIpVal = Ext.getCmp('hostipname').getValue();
			if(!publicJSON.hideHostIPField && !checkblank(hostIpVal))
			{
				if (isAllowHostName=='false')
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: alertMsg18,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								hostIpObj.focus(true);
							}
						}
					});
				}
				else
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: alertMsg19,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(response) {
							if(response == 'ok') {
								hostIpObj.focus(true);
							}
						}
					});
				}
				return false;
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='false' && validateIpAddressExtjs(hostIpVal) != '0')
			{
				var updateValue = validateIpAddressExtjs(hostIpVal);
				if(updateValue == "1")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "5")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspaceIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "6")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkAlpha,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "7")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "8")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _valIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "9")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _validateIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "10")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checknum,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && validateHostFieldExtjs(hostIpVal) != '0')
			{
				var updateValue =  validateHostFieldExtjs(hostIpVal);
				if(updateValue == "1")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "5")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspaceIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "6")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkAlpha,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "7")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "8")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _valIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "9")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _validateIp,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "10")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checknum,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "11")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _chkIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "12")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _doubleColon,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "13")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _grpIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "14")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _digitIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "15")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _validateIpv6,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "16")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkNumberLabel,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
				else if(updateValue == "17")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && checkspaceExtjs(hostIpVal) != '0')
			{
				var updateValue = checkspaceExtjs(hostIpVal);
				if(updateValue == "17")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkblank,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function(btn) {
							if (btn == 'ok'){
								hostIpObj.focus(true);
							}
						}
					});
					return false;
				}
			}
			else if(!publicJSON.hideHostIPField && isAllowHostName=='true' && checkSpecialExtjs(hostIpVal,"`~!@#$%^&*()+={}[]|\\;\"\'<>,?/") != '0') 
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkspecial,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							hostIpObj.focus(true);
						}
					}
				});
				return false;
			}
		}
		
		if(isDoubleByteMgr=="false")
		{
			if(!validateSingleByte(compNickVal))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: alertMsg1,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}

		if(isAllowHostName=='true' && !this.checkForHostType(compNickVal))
		{
			Ext.Msg.show({
				title: alertMsgSrcTitle,
				msg: alertMsg20 + alertMsg21,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(!checkblank(compNickVal))
		{	
			Ext.Msg.show({
				title: alertMsgSrcTitle,
				msg: alertMsg22,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(checkspaceExtjs(compNickVal) != '0')
		{
			Ext.Msg.show({
				title: alertMsgSrcTitle,
				msg: "Space is not allowed",
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(checkSpecialExtjs(compNickVal,"`~!@#$%^&*()+={}[]|\\:;\"\'<>,?/") != '0') 
		{
			Ext.Msg.show({
				title: alertMsgSrcTitle,
				msg: _checkspecial,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(compNickVal.toLowerCase() == "none")
		{
			Ext.Msg.show({
				title: alertMsgSrcTitle,
				msg: "You are not allowed to use eG reserved keyword \'"+compNickVal+"\' as component name",
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if (!this.checkForHostType(compNickVal))
		{
			Ext.Msg.show({
				title: alertMsgSrcTitle,
				msg: alertMsg20 + alertMsg21,
				buttons: Ext.Msg.OK,
				icon: 'gen-warning size32 color-warning',
				fn: function(response) {
					if(response == 'ok') {
						compNickObj.focus(true);
					}
				}
			});
			return false;
		}
		else if(!this.checkdots(compNickVal))
		{
			compNickObj.focus(true);
			return;
		}
		else if(!this.isValidateHostName(compNickVal))
		{
			if(compNickVal != hostIpVal)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: alertMsg25,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}

		if (isDoubleByteMgr=='false')
		{
			if(compNickVal.toLowerCase() == compType.toLowerCase())
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: alertMsg26,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function(response) {
						if(response == 'ok') {
							compNickObj.focus(true);
						}
					}
				});
				return false;
			}
		}

		var discover = Ext.getCmp('card-0').discover;
		if (discover == 'Xchg_Logon_Emulation')
		{
			var rdCnt = 0;
			var setEmailId = "";
			var setPassword = "";
			var arrEmailIds = new Array();

			var exchangeServType = Ext.getCmp('exchangeServType').getValue();
			var exchangeUrl = Ext.getCmp('exchangeUrl').getValue();

			if (!checkblank(exchangeUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterexchnageUrl,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('exchangeUrl').focus(true,true);
					}
				});
				return;
			}
			else if (exchangeUrl.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('exchangeUrl').focus(true,true);
					}
				});
				return;
			}
			else if (exchangeUrl.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('exchangeUrl').focus(true,true);
					}
				});
				return;
			}
			else if (!validateUrl(exchangeUrl,exchangeUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlInValidMsg,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('exchangeUrl').focus(true,true);
					}
				});
				return;
			}

			for (var mul=1;mul<=multiinputs-1;mul++)
			{
				if (Ext.getCmp('excemailid'+mul) == undefined)
				{
					continue;
				}
				emailID = Ext.getCmp('excemailid'+mul).getValue();
				pass = Ext.getCmp('excpwd'+mul).getValue();
				confpass = Ext.getCmp('excconfirmpwd'+mul).getValue();

				if(emailID!=null)
				{
					var result = validateEmail(emailID);
					rdCnt++;
					if(!checkblank(emailID) || (emailID == "$unconfigured" ))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: mailRcv_valid,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('excemailid'+mul).focus(true,true);
							}
						});
						return;
					}
					else if(!validateSingleByte(emailID))
					{
						Ext.Msg.show(
						{
							title : alertMsgSrcTitle,
							msg : mailIDDBL+'.',
							icon: 'gen-warning size32 color-warning',
							buttons : Ext.Msg.OK,
							fn : function(btn){
								Ext.getCmp('excemailid'+mul).focus(true,true);
							}
						});
						return;
					}
					else if(result == null || result == undefined || result == false)
					{
						Ext.Msg.show({
							title : alertMsgSrcTitle,
							msg : mailRcv_valid+'.',
							icon: 'gen-warning size32 color-warning',
							buttons : Ext.Msg.OK,
							fn : function(btn){
								Ext.getCmp('excemailid'+mul).focus(true,true);
							}
						});
						return;
					}
					else if (emailID.indexOf(',') != -1)
					{
						Ext.Msg.show({
							title : alertMsgSrcTitle,
							msg : mail_valid+'.',
							icon: 'gen-warning size32 color-warning',
							buttons : Ext.Msg.OK,
							fn : function(btn){
								Ext.getCmp('excemailid'+mul).focus(true,true);
							}
						});
						return;
					}

					var x_idx = arrEmailIds.indexOf(emailID);
					if (x_idx != -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: duplicateMailId,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('excemailid'+mul).focus(true,true);
							}
						});
						return;
					}
					arrEmailIds[mul] = emailID;
				}

				if(pass!=null)
				{
					if(pass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('excpwd'+mul).focus(true,true);
							}
						});
						return;
					}
					else if (pass.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('excpwd'+mul).focus(true,true);
							}
						});
						return;
					}
					else if(!checkForPassValidity(pass))
					{
						Ext.getCmp('excpwd'+mul).focus();
						sub = false;
						return;
					}
					else if(confpass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterCnfPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('excconfirmpwd'+mul).focus(true,true);
							}
						});
						return;
					}
					else if(pass != confpass)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: matchPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('excconfirmpwd'+mul).focus(true,true);
							}
						});
						return;
					}
				}

				setEmailId += emailID+"|";
				setPassword += pass+"#~#";
			}

			setEmailId = setEmailId.substring(0,setEmailId.length-1);
			setPassword = setPassword.substring(0,setPassword.length-3);

			var lsUrl = '/final/admin/LimitedAdminHome/data/EgLogonSimulatorJsonp.jsp?hostname='+encodeURIComponent(compNickVal)+'&compType='+encodeURIComponent(compType)+'&Exchange_server_type='+encodeURIComponent(exchangeServType)+'&Exchange_site_url='+encodeURIComponent(exchangeUrl)+'&Email_id='+encodeURIComponent(setEmailId)+'&Email_password='+encodeURIComponent(setPassword);
		}
		else if (discover == 'Amazon_Logon_Emulation')
		{
			var siteUrl = Ext.getCmp('amazonsiteUrl').getValue();
			if (!checkblank(siteUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterUrl,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('amazonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('amazonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('amazonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf(" ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlSpace,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('amazonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("  ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkSpaces,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('amazonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (!validateSingleUrl(siteUrl,siteUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlInValidMsg,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('amazonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			
			var totalRules = multiinputs;
			for(var j=1; j<totalRules; j++)
			{
				if (Ext.getCmp('amazonpublisresource'+j) == undefined)
				{
					continue;
				}

				var pubresource = Ext.getCmp('amazonpublisresource'+j).getValue();
				var regcode = Ext.getCmp('amazonregcode'+j).getValue();
				var domain = Ext.getCmp('amazondomainmultiusr'+j).getValue();
				var uname = Ext.getCmp('amazonusermultiusr'+j).getValue();
				var pass = Ext.getCmp('amazonpwdmultiusr'+j).getValue();
				var confpass = Ext.getCmp('amazonconfpwdmultiusr'+j).getValue();

				if (!checkblank(pubresource))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterPubRsrc,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (pubresource.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (!checkspecialExt(pubresource,"`*+=#.|;\"\'<>\/[]{}()?:"))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function()
						{
							Ext.getCmp('amazonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (trim(pubresource) == "")
				{
					Ext.getCmp('amazonpublisresource'+j).focus();
					return;
				}
				else if(!checkHyphenText(pubresource,pubresource))
				{
					Ext.getCmp('amazonpublisresource'+j).focus();
					return;
				}
				else if (pubresource.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (pubresource.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkSpaces,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}

				if(!checkblank(regcode))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterRegcode,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+j).focus(true,true);
						}
					});
					return;
				}
				else if (regcode.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+j).focus(true,true);
						}
					});
					return;
				}
				else if (regcode.indexOf(",") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+j).focus(true,true);
						}
					});
					return;
				}
				else if (regcode.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+j).focus(true,true);
						}
					});
					return;
				}

				if(!checkblank(domain))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterDomain,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+j).focus(true,true);
						}
					});
					return;
				}
				else if (domain.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+j).focus(true,true);
						}
					});
					return;
				}

				if (!checkDomain(domain,"true"))
				{
					Ext.getCmp('amazondomainmultiusr'+j).focus(true,true);
					return;
				}
				else if (domain.indexOf(",") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+j).focus(true,true);
						}
					});
					return;
				}
				else if(!checkHyphenText(domain,domain))
				{
					Ext.getCmp('amazondomainmultiusr'+j).focus();
					return;
				}
				else if (domain.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+j).focus(true,true);
						}
					});
					return;
				}

				if (!checkblank(uname))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterUsrId,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonusermultiusr'+j).focus(true,true);
						}
					});
					return;
				}
				else if (uname.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonusermultiusr'+j).focus(true,true);
						}
					});
					return;
				}
				else if (!checkspecialExt(uname,"*+=|:;\"\'<>\/[]?,"))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function()
						{
							Ext.getCmp('amazonusermultiusr'+j).focus(true,true);
						}
					});
					return;
				}
				else if (trim(uname) == "")
				{
					Ext.getCmp('amazonusermultiusr'+j).focus();
					return;
				}
				else if(!checkHyphenText(uname,uname))
				{
					Ext.getCmp('amazonusermultiusr'+j).focus();
					return;
				}
				else if (uname.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonusermultiusr'+j).focus(true,true);
						}
					});
					return;
				}
				else if (uname.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkSpaces,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonusermultiusr'+j).focus(true,true);
						}
					});
					return;
				}

				if(pass!=null)
				{
					if(pass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpwdmultiusr'+j).focus(true,true);
							}
						});
						return;
					}
					else if (pass.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpwdmultiusr'+j).focus(true,true);
							}
						});
						return;
					}
					else if(!checkForPassValidity(pass))
					{
						Ext.getCmp('amazonpwdmultiusr'+j).focus();
						sub = false;
						return;
					}
					else if(confpass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterCnfPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonconfpwdmultiusr'+j).focus(true,true);
							}
						});
						return;
					}
					else if(pass != confpass)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: matchPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonconfpwdmultiusr'+j).focus(true,true);
							}
						});
						return;
					}
				}
			}

			var multiPublishSrcVal = "";
			var hiddenPublishSrcVal = "";
			var multiRegCodeVal = "";
			var multiDomainVal = "";
			var multiUsrVal = "";
			var multiUsrpassVal = "";
			var multiUsrdisclaimVal = "";
			var multi2FAuthVal = "";

			for(var multi=1; multi<totalRules; multi++)
			{
				if (Ext.getCmp('amazonpublisresource'+multi) == undefined)
				{
					continue;
				}

				var multiSrcPublis = Ext.getCmp('amazonpublisresource'+multi).getValue();
				if(multiSrcPublis!=null)
				{
					if(!checkblank(multiSrcPublis))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPubRsrc,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkspecialExt(multiSrcPublis,"`*+=#.|;\"\'<>\/[]{}()?:"))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function()
							{
								Ext.getCmp('amazonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(trim(multiSrcPublis) == "")
					{
						Ext.getCmp('amazonpublisresource'+multi).focus();
						return;
					}
					else if (multiSrcPublis.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf("  ") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkSpaces,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkHyphenText(multiSrcPublis,multiSrcPublis))
					{
						Ext.getCmp('amazonpublisresource'+multi).focus();
						return;
					}
				}

				var multiRegCode = Ext.getCmp('amazonregcode'+multi).getValue();
				if(!checkblank(multiRegCode))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterRegcode,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+multi).focus(true,true);
						}
					});
					return;
				}
				else if (multiRegCode.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+multi).focus(true,true);
						}
					});
					return;
				}
				
				if (multiRegCode.indexOf(",") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+multi).focus(true,true);
						}
					});
					return;
				}
				else if (multiRegCode.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazonregcode'+multi).focus(true,true);
						}
					});
					return;
				}

				var multiDomain = Ext.getCmp('amazondomainmultiusr'+multi).getValue();
				if(!checkblank(multiDomain))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterDomain,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+multi).focus(true,true);
						}
					});
					return;
				}
				else if (multiDomain.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+multi).focus(true,true);
						}
					});
					return;
				}
				else if (!checkDomain(multiDomain,"true"))
				{
					Ext.getCmp('amazondomainmultiusr'+multi).focus(true,true);
					return;
				}
				else if (multiDomain.indexOf(",") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+multi).focus(true,true);
						}
					});
					return;
				}
				else if(!checkHyphenText(multiDomain,multiDomain))
				{
					Ext.getCmp('amazondomainmultiusr'+multi).focus();
					return;
				}
				else if (multiDomain.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('amazondomainmultiusr'+multi).focus(true,true);
						}
					});
					return;
				}

				var multiUname = Ext.getCmp('amazonusermultiusr'+multi).getValue();
				if(multiUname!=null)
				{
					if(!checkblank(multiUname))
					{

						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterUsrId,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonusermultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiUname.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonusermultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkspecialExt(multiUname,"*+=|:;\"\'<>\/[]?,"))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function()
							{
								Ext.getCmp('amazonusermultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(trim(multiUname) == "")
					{
						Ext.getCmp('amazonusermultiusr'+multi).focus();
						return;
					}
					else if (multiUname.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonusermultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiUname.indexOf("  ") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkSpaces,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonusermultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkHyphenText(multiUname,multiUname))
					{
						Ext.getCmp('amazonusermultiusr'+multi).focus();
						return;
					}
				}

				var multipass = Ext.getCmp('amazonpwdmultiusr'+multi).getValue();
				var multiconfpasswd = Ext.getCmp('amazonconfpwdmultiusr'+multi).getValue();
				if(multipass!=null && multiconfpasswd!=null )
				{
					if (multipass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpwdmultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multipass.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpwdmultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(multipass.indexOf("#~#")>-1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkHashTildeHash,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonpwdmultiusr'+multi).focus(true,true);
							}
						});
						sub = false;
						return;
					}
					else if(!checkForPassValidity(multipass))
					{
						Ext.getCmp('amazonpwdmultiusr'+multi).focus();
						sub = false;
						return;
					}
					else if(multiconfpasswd == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterCnfPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonconfpwdmultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiconfpasswd.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonconfpwdmultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(multipass != multiconfpasswd)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: matchPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('amazonconfpwdmultiusr'+multi).focus(true,true);
							}
						});
						return;
					}
				}
				
				if (multiPublishSrcVal != null && 
					multiRegCode != null && 
					multiDomain != null && 
					multiUname!=null && 
					multipass!=null && 
					multiconfpasswd!=null )
				{
					var tempRegCode = Ext.getCmp('amazonregcode'+multi).getValue();
					multiRegCodeVal+=tempRegCode+"#~#";

					var tempmultiSrcPublis = Ext.getCmp('amazonpublisresource'+multi).getValue();
					var tmpHiddenPublishSrc = tempmultiSrcPublis;
					if (!Ext.isEmpty(tmpHiddenPublishSrc) && tmpHiddenPublishSrc.indexOf(",") != -1)
					{
						tmpHiddenPublishSrc = tmpHiddenPublishSrc.replace(/,/g,'~#~');
					}
					multiPublishSrcVal+=tempmultiSrcPublis+",";
					hiddenPublishSrcVal+=tmpHiddenPublishSrc+"|";

					var tempDomain = Ext.getCmp('amazondomainmultiusr'+multi).getValue();
					multiDomainVal+=tempDomain+"|";

					var tempmultiUsr = Ext.getCmp('amazonusermultiusr'+multi).getValue();
					multiUsrVal+=tempmultiUsr+"|";

					var tempmultiUsrPass = Ext.getCmp('amazonpwdmultiusr'+multi).getValue();
					multiUsrpassVal+=tempmultiUsrPass+"#~#";
				}
			}

			multiPublishSrcVal = multiPublishSrcVal.substring(0,multiPublishSrcVal.length-1);

			hiddenPublishSrcVal = hiddenPublishSrcVal.substring(0,hiddenPublishSrcVal.length-1);

			multiRegCodeVal = multiRegCodeVal.substring(0,multiRegCodeVal.length-3);

			multiDomainVal = multiDomainVal.substring(0,multiDomainVal.length-1);

			multiUsrVal = multiUsrVal.substring(0,multiUsrVal.length-1);

			multiUsrpassVal = multiUsrpassVal.substring(0,multiUsrpassVal.length-3);

			var lsUrl = '/final/admin/LimitedAdminHome/data/EgLogonSimulatorJsonp.jsp?hostname='+encodeURIComponent(compNickVal)+'&compType='+encodeURIComponent(compType)+'&Site_url='+encodeURIComponent(siteUrl)+'&Published_resources='+encodeURIComponent(hiddenPublishSrcVal)+'&Domain='+encodeURIComponent(multiDomainVal)+'&Username='+encodeURIComponent(multiUsrVal)+'&Password='+encodeURIComponent(multiUsrpassVal)+'&Registration_code='+encodeURIComponent(multiRegCodeVal);

		}
		else if (discover == 'Hrzn_Web_Logon_Emulation')
		{
			var siteUrl = Ext.getCmp('horizonsiteUrl').getValue();
			if (!checkblank(siteUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterUrl,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('horizonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('horizonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('horizonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf(" ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlSpace,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('horizonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("  ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkSpaces,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('horizonsiteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (!validateSingleUrl(siteUrl,siteUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlInValidMsg,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('horizonsiteUrl').focus(true,true);
					}
				});
				return;
			}

			var totalRules = multiinputs;
			for(var j=1; j<totalRules; j++)
			{
				if (Ext.getCmp('horizonpublisresource'+j) == undefined)
				{
					continue;
				}

				pubresource = Ext.getCmp('horizonpublisresource'+j).getValue();
				uname = Ext.getCmp('horizonusername'+j).getValue();
				pass = Ext.getCmp('horizonpwd'+j).getValue();
				confpass = Ext.getCmp('horizonconfpwd'+j).getValue();

				var twoFactAuth = Ext.getCmp('horizontwofacttoken'+j).getValue();
				var twofa = Ext.getCmp('horizontwofact'+j).getChecked()[0];
				var istwofaenabled = twofa.getGroupValue();

				if (!checkblank(pubresource))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterPubRsrc,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (pubresource.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (!checkspecialExt(pubresource,"`*+=#.|;\"\'<>\/[]{}()?:"))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function()
						{
							Ext.getCmp('horizonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (trim(pubresource) == "")
				{
					Ext.getCmp('horizonpublisresource'+j).focus();
					return;
				}
				else if(!checkHyphenText(pubresource,pubresource))
				{
					Ext.getCmp('horizonpublisresource'+j).focus();
					return;
				}
				else if (pubresource.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}
				else if (pubresource.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkSpaces,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonpublisresource'+j).focus(true,true);
						}
					});
					return;
				}

				if (!checkblank(uname))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterUsrId,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonusername'+j).focus(true,true);
						}
					});
					return;
				}
				else if (uname.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonusername'+j).focus(true,true);
						}
					});
					return;
				}
				else if (!checkspecialExt(uname,"*+=|:;\"\'<>\/[]?,"))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function()
						{
							Ext.getCmp('horizonusername'+j).focus(true,true);
						}
					});
					return;
				}
				else if (trim(uname) == "")
				{
					Ext.getCmp('horizonusername'+j).focus();
					return;
				}
				else if(!checkHyphenText(uname,uname))
				{
					Ext.getCmp('horizonusername'+j).focus();
					return;
				}
				else if (uname.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonusername'+j).focus(true,true);
						}
					});
					return;
				}
				else if (uname.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkSpaces,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('horizonusername'+j).focus(true,true);
						}
					});
					return;
				}

				if(pass!=null)
				{
					if(pass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpwd'+j).focus(true,true);
							}
						});
						return;
					}
					else if (pass.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpwd'+j).focus(true,true);
							}
						});
						return;
					}
					else if(!checkForPassValidity(pass))
					{
						Ext.getCmp('horizonpwd'+j).focus();
						sub = false;
						return;
					}
					else if(confpass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterCnfPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonconfpwd'+j).focus(true,true);
							}
						});
						return;
					}
					else if(pass != confpass)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: matchPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonconfpwd'+j).focus(true,true);
							}
						});
						return;
					}
				}

				if (istwofaenabled == 'true')
				{
					if(!checkblank(twoFactAuth))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enter2FAToken,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizontwofacttoken'+j).focus(true,true);
							}
						});
						return;
					}
					else if (twoFactAuth.indexOf(",") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizontwofacttoken'+j).focus(true,true);
							}
						});
						return;
					}
					else if (twoFactAuth.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizontwofacttoken'+j).focus(true,true);
							}
						});
						return;
					}
				}
				else
				{
					twoFactAuth = 'none';
				}
			}

			var multiPublishSrcVal = "";
			var hiddenPublishSrcVal = "";
			var multiUsrVal = "";
			var multiUsrpassVal = "";
			var multiUsrdisclaimVal = "";
			var multi2FAuthVal = "";

			for(var multi=1; multi<totalRules; multi++)
			{
				if (Ext.getCmp('horizonpublisresource'+multi) == undefined)
				{
					continue;
				}

				var multiSrcPublis = Ext.getCmp('horizonpublisresource'+multi).getValue();
				if(multiSrcPublis!=null)
				{
					if(!checkblank(multiSrcPublis))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPubRsrc,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkspecialExt(multiSrcPublis,"`*+=#.|;\"\'<>\/[]{}()?:"))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function()
							{
								Ext.getCmp('horizonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(trim(multiSrcPublis) == "")
					{
						Ext.getCmp('horizonpublisresource'+multi).focus();
						return;
					}
					else if (multiSrcPublis.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf("  ") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkSpaces,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpublisresource'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkHyphenText(multiSrcPublis,multiSrcPublis))
					{
						Ext.getCmp('horizonpublisresource'+multi).focus();
						return;
					}
				}

				var multiUname = Ext.getCmp('horizonusername'+multi).getValue();
				if(multiUname!=null)
				{
					if(!checkblank(multiUname))
					{

						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterUsrId,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonusername'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiUname.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonusername'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkspecialExt(multiUname,"*+=|:;\"\'<>\/[]?,"))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function()
							{
								Ext.getCmp('horizonusername'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(trim(multiUname) == "")
					{
						Ext.getCmp('horizonusername'+multi).focus();
						return;
					}
					else if (multiUname.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonusername'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiUname.indexOf("  ") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkSpaces,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonusername'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(!checkHyphenText(multiUname,multiUname))
					{
						Ext.getCmp('horizonusername'+multi).focus();
						return;
					}
				}

				var multipass = Ext.getCmp('horizonpwd'+multi).getValue();
				var multiconfpasswd = Ext.getCmp('horizonconfpwd'+multi).getValue();
				if(multipass!=null && multiconfpasswd!=null )
				{
					if (multipass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpwd'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multipass.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpwd'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(multipass.indexOf("#~#")>-1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkHashTildeHash,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonpwd'+multi).focus(true,true);
							}
						});
						sub = false;
						return;
					}
					else if(!checkForPassValidity(multipass))
					{
						Ext.getCmp('horizonpwd'+multi).focus();
						sub = false;
						return;
					}
					else if(multiconfpasswd == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterCnfPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonconfpwd'+multi).focus(true,true);
							}
						});
						return;
					}
					else if (multiconfpasswd.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonconfpwd'+multi).focus(true,true);
							}
						});
						return;
					}
					else if(multipass != multiconfpasswd)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: matchPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('horizonconfpwd'+multi).focus(true,true);
							}
						});
						return;
					}
				}

				var multidisclaimer= Ext.getCmp('horizondisclaimermultiusr'+multi+'_1').getValue();
				if(multidisclaimer == null) continue;

				var multi2FAuth= Ext.getCmp('horizontwofacttoken'+multi).getValue();
				var multitwofa = Ext.getCmp('horizontwofact'+multi).getChecked()[0];
				var ismultitwofaenabled = multitwofa.getGroupValue()
				if(multi2FAuth == null) continue;
				if(multi2FAuth != null)
				{
					if (ismultitwofaenabled == 'true')
					{
						if(!checkblank(multi2FAuth))
						{
							Ext.Msg.show({
								title: alertMsgSrcTitle,
								msg: enter2FAToken,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('horizontwofacttoken'+multi).focus(true,true);
								}
							});
							return;
						}
						else if (multi2FAuth.indexOf(",") > -1)
						{
							Ext.Msg.show({
								title: alertMsgSrcTitle,
								msg: _checkspecial,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('horizontwofacttoken'+multi).focus(true,true);
								}
							});
							return;
						}
						else if (multi2FAuth.indexOf("..") > -1)
						{
							Ext.Msg.show({
								title: alertMsgSrcTitle,
								msg: _checkdots,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('horizontwofacttoken'+multi).focus(true,true);
								}
							});
							return;
						}
					}
					else
					{
						multi2FAuth = 'none';
					}
				}

				if(multiPublishSrcVal != null && multiUname!=null && multipass!=null && multiconfpasswd!=null && multi2FAuth != null && multidisclaimer!=null)
				{
					var tempmultiUsrdisclaim = Ext.getCmp('horizondisclaimermultiusr'+multi+'_1').getValue();
					var strdisclaimValue = 'false';
					if (tempmultiUsrdisclaim)
					{
						strdisclaimValue = 'true';
					}
					multiUsrdisclaimVal+=strdisclaimValue+"|";

					var tempmulti2FA = Ext.getCmp('horizontwofacttoken'+multi).getValue();
					var multi2FA = Ext.getCmp('horizontwofact'+multi).getChecked()[0];
					var tempismulti2FA = multi2FA.getGroupValue();
					if (tempismulti2FA == 'false')
					{
						tempmulti2FA = 'none';
					}
					multi2FAuthVal+=tempmulti2FA+"#~#";

					var tempmultiSrcPublis = Ext.getCmp('horizonpublisresource'+multi).getValue();
					var tmpHiddenPublishSrc = tempmultiSrcPublis;
					if (!Ext.isEmpty(tmpHiddenPublishSrc) && tmpHiddenPublishSrc.indexOf(",") != -1)
					{
						tmpHiddenPublishSrc = tmpHiddenPublishSrc.replace(/,/g,'~#~');
					}
					multiPublishSrcVal+=tempmultiSrcPublis+",";
					hiddenPublishSrcVal+=tmpHiddenPublishSrc+"|";

					var tempmultiUsr = Ext.getCmp('horizonusername'+multi).getValue();
					multiUsrVal+=tempmultiUsr+"|";

					var tempmultiUsrPass = Ext.getCmp('horizonpwd'+multi).getValue();
					multiUsrpassVal+=tempmultiUsrPass+"#~#";
				}
			}

			multiPublishSrcVal = multiPublishSrcVal.substring(0,multiPublishSrcVal.length-1);

			hiddenPublishSrcVal = hiddenPublishSrcVal.substring(0,hiddenPublishSrcVal.length-1);

			multiUsrVal = multiUsrVal.substring(0,multiUsrVal.length-1);

			multiUsrpassVal = multiUsrpassVal.substring(0,multiUsrpassVal.length-3);

			multi2FAuthVal = multi2FAuthVal.substring(0,multi2FAuthVal.length-3);

			multiUsrdisclaimVal = multiUsrdisclaimVal.substring(0,multiUsrdisclaimVal.length-1);

			var lsUrl = '/final/admin/LimitedAdminHome/data/EgLogonSimulatorJsonp.jsp?hostname='+encodeURIComponent(compNickVal)+'&compType='+encodeURIComponent(compType)+'&Site_url='+encodeURIComponent(siteUrl)+'&Published_resources='+encodeURIComponent(hiddenPublishSrcVal)+'&User_id='+encodeURIComponent(multiUsrVal)+'&Password='+encodeURIComponent(multiUsrpassVal)+'&Two_factor_auth_password='+encodeURIComponent(multi2FAuthVal)+'&Disclaimer='+encodeURIComponent(multiUsrdisclaimVal);
		}
		else
		{
			var siteUrl = Ext.getCmp('siteUrl').getValue();
			if (!checkblank(siteUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: enterUrl,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('siteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("$unconfigured") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: donotSpecifyKey,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('siteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("..") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkdots,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('siteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf(" ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlSpace,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('siteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (siteUrl.indexOf("  ") > -1)
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: _checkSpaces,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('siteUrl').focus(true,true);
					}
				});
				return;
			}
			else if (!validateSingleUrl(siteUrl,siteUrl))
			{
				Ext.Msg.show({
					title: alertMsgSrcTitle,
					msg: urlInValidMsg,
					buttons: Ext.Msg.OK,
					icon: 'gen-warning size32 color-warning',
					fn: function() {
						Ext.getCmp('siteUrl').focus(true,true);
					}
				});
				return;
			}

			for (var mul=1;mul<multiinputs-1;mul++)
			{
				if (Ext.getCmp('domainmultiusr'+mul) == undefined)
				{
					continue;
				}
				
				var publishResource = Ext.getCmp('publisresource'+mul).getValue();
				var twoFactAuth = Ext.getCmp('twofacttoken'+mul).getValue();
				var domain = Ext.getCmp('domainmultiusr'+mul).getValue();
				var uname = Ext.getCmp('usermultiusr'+mul).getValue();
				var pass = Ext.getCmp('pwdmultiusr'+mul).getValue();
				var confpasswd = Ext.getCmp('confpwdmultiusr'+mul).getValue();

				var twofa = Ext.getCmp('twofact'+mul).getChecked()[0];
				var istwofaenabled = twofa.getGroupValue();
				
				if (!checkblank(publishResource))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterPubRsrc,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('publisresource'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (publishResource.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('publisresource'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (!checkspecialExt(publishResource,"`*=#.|;\"\'<>\/[]?"))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function()
						{
							Ext.getCmp('publisresource'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (trim(publishResource) == "")
				{
					Ext.getCmp('publisresource'+mul).focus();
					return;
				}
				else if (publishResource.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('publisresource'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (publishResource.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkSpaces,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('publisresource'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (publishResource.indexOf(":") > -1)
				{
					var val = publishResource;
					if (val.indexOf(",") != -1)
					{
						var values = val.split(",");
						for(var v=0;v < values.length;v++)
						{
							var tmpVal = values[v];
							if(tmpVal.charAt(0) == ':' || tmpVal.charAt(tmpVal.length - 1) == ':')
							{
								Ext.Msg.show ({
									title: alertMsgSrcTitle,
									msg: "Published resource should not start or end with a colon",
									buttons: Ext.Msg.OK,
									icon: 'gen-warning size32 color-warning',
									fn: function() {
										Ext.getCmp('publisresource'+mul).focus(true,true);
									}
								});
								return;
							}
							else
							{
								var moreColons = new Array();
								for(var k=0;k < tmpVal.length;k++)
								{
									if (tmpVal.charAt(k) == ':')
									{
										moreColons.push(k);
									}

									if(tmpVal.charAt(k) == ':' && tmpVal.charAt(k + 1) == ':')
									{
										Ext.Msg.show ({
											title: pageName,
											msg: "Cannot have ':' in consecutive positions",
											buttons: Ext.Msg.OK,
											icon: 'gen-warning size32 color-warning',
											fn: function() {
												Ext.getCmp('publisresource'+mul).focus(true,true);
											}
										});
										moreColons = new Array();
										return;
									}
									else
									{
										continue;
									}
								}

								if (moreColons.length > 1)
								{
									Ext.Msg.show ({
										title: alertMsgSrcTitle,
										msg: "Please enter the application/desktop name in this format ApplicationOrDesktop[:WindowTitle].",
										buttons: Ext.Msg.OK,
										icon: 'gen-warning size32 color-warning',
										fn: function() {
											Ext.getCmp('publisresource'+mul).focus(true,true);
										}
									});
									moreColons = new Array();
									return;
								}
							}
						}
					}
					else
					{
						if(val.charAt(0) == ':' || val.charAt(val.length - 1) == ':')
						{
							Ext.Msg.show ({
								title: alertMsgSrcTitle,
								msg: "Published resource should not start or end with a colon",
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('publisresource'+mul).focus(true,true);
								}
							});
							return;
						}
						else
						{
							var moreColons = new Array();
							for(var k=0;k < val.length;k++)
							{
								if (val.charAt(k) == ':')
								{
									moreColons.push(k);
								}

								if(val.charAt(k) == ':' && val.charAt(k + 1) == ':')
								{
									Ext.Msg.show ({
										title: alertMsgSrcTitle,
										msg: "Cannot have ':' in consecutive positions",
										buttons: Ext.Msg.OK,
										icon: 'gen-warning size32 color-warning',
										fn: function() {
											Ext.getCmp('publisresource'+mul).focus(true,true);
										}
									});
									moreColons = new Array();
									return ;
								}
								else
								{
									continue;
								}
							}

							if (moreColons.length > 1)
							{
								Ext.Msg.show ({
									title: alertMsgSrcTitle,
									msg: "Please enter the application/desktop name in this format ApplicationOrDesktop[:WindowTitle].",
									buttons: Ext.Msg.OK,
									icon: 'gen-warning size32 color-warning',
									fn: function() {
										Ext.getCmp('publisresource'+mul).focus(true,true);
									}
								});
								moreColons = new Array();
								return;
							}
						}
					}
				}
				
				if (istwofaenabled == 'true')
				{
					if(!checkblank(twoFactAuth))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enter2FAToken,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('twofacttoken'+mul).focus(true,true);
							}
						});
						return;
					}
					else if (twoFactAuth.indexOf(",") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('twofacttoken'+mul).focus(true,true);
							}
						});
						return;
					}
					else if (twoFactAuth.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('twofacttoken'+mul).focus(true,true);
							}
						});
						return;
					}
				}
				else
				{
					twoFactAuth = 'none';
				}
				
				if(!checkblank(domain))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterDomain,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('domainmultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (domain.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('domainmultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (!checkDomain(domain,"true"))
				{
					Ext.getCmp('domainmultiusr'+mul).focus(true,true);
					return;
				}
				else if (domain.indexOf(",") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('domainmultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if(!checkHyphenText(domain,domain))
				{
					Ext.getCmp('domainmultiusr'+mul).focus();
					return;
				}
				else if (domain.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('domainmultiusr'+mul).focus(true,true);
						}
					});
					return;
				}

				if (!checkblank(uname))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterUsrId,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('usermultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (uname.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('usermultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (!checkspecial(uname,"*+=|:;\"\'<>\/[]?,"))
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkspecial,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function()
						{
							Ext.getCmp('usermultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (trim(uname) == "")
				{
					Ext.getCmp('usermultiusr'+mul).focus();
					return;
				}
				else if(!checkHyphenText(uname,uname))
				{
					Ext.getCmp('usermultiusr'+mul).focus();
					return;
				}
				else if (uname.indexOf("..") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkdots,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('usermultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if (uname.indexOf("  ") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkSpaces,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('usermultiusr'+mul).focus(true,true);
						}
					});
					return;
				}

				if(pass == "")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterPwd,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('pwdmultiusr'+mul).focus(true,true);
						}
					});
					sub = false;
					return;
				}
				else if (pass.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('pwdmultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if(pass.indexOf("#~#")>-1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: _checkHashTildeHash,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('pwdmultiusr'+mul).focus(true,true);
						}
					});
					sub = false;
					return;
				}
				else if(!checkForPassValidity(pass))
				{
					Ext.getCmp('pwdmultiusr'+mul).focus();
					sub = false;
					return;
				}
				else if(confpasswd == "")
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: enterCnfPwd,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('confpwdmultiusr'+mul).focus(true,true);
						}
					});
					sub = false;
					return;
				}
				else if (confpasswd.indexOf("$unconfigured") > -1)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: donotSpecifyKey,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('confpwdmultiusr'+mul).focus(true,true);
						}
					});
					return;
				}
				else if(pass != confpasswd)
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: matchPwd,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							Ext.getCmp('confpwdmultiusr'+mul).focus(true,true);
						}
					});
					sub = false;
					return;
				}
			}

			var multiPublishSrcVal = "";
			var hiddenPublishSrcVal = "";
			var multiUsrdomainVal = "";
			var multiUsrVal = "";
			var multiUsrpassVal = "";
			var multi2FAuthVal = "";
			var multiUsrdisclaimVal = "";

			for(var mulusr=1; mulusr<multiinputs; mulusr++)
			{
				if (Ext.getCmp('domainmultiusr'+mulusr) == undefined)
				{
					continue;
				}

				var multiSrcPublis = Ext.getCmp('publisresource'+mulusr).getValue();
				if(multiSrcPublis!=null)
				{
					if(!checkblank(multiSrcPublis))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPubRsrc,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('publisresource'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('publisresource'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(!checkspecialExt(multiSrcPublis,"`*=#.|;\"\'<>\/[]?"))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function()
							{
								Ext.getCmp('publisresource'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(trim(multiSrcPublis) == "")
					{
						Ext.getCmp('publisresource'+mulusr).focus();
						return;
					}
					else if (multiSrcPublis.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('publisresource'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf("  ") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkSpaces,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('publisresource'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multiSrcPublis.indexOf(":") > -1)
					{
						var val = multiSrcPublis;
						if (val.indexOf(",") != -1)
						{
							var values = val.split(",");
							for(var v=0;v < values.length;v++)
							{
								var tmpVal = values[v];
								if(tmpVal.charAt(0) == ':' || tmpVal.charAt(tmpVal.length - 1) == ':')
								{
									Ext.Msg.show ({
										title: alertMsgSrcTitle,
										msg: "Published resource should not start or end with a colon",
										buttons: Ext.Msg.OK,
										icon: 'gen-warning size32 color-warning',
										fn: function() {
											Ext.getCmp('publisresource'+mulusr).focus(true,true);
										}
									});
									return;
								}
								else
								{
									var moreColons = new Array();
									for(var k=0;k < tmpVal.length;k++)
									{
										if (tmpVal.charAt(k) == ':')
										{
											moreColons.push(k);
										}
										if(tmpVal.charAt(k) == ':' && tmpVal.charAt(k + 1) == ':')
										{
											Ext.Msg.show ({
												title: alertMsgSrcTitle,
												msg: "Cannot have ':' in consecutive positions",
												buttons: Ext.Msg.OK,
												icon: 'gen-warning size32 color-warning',
												fn: function() {
													Ext.getCmp('publisresource'+mulusr).focus(true,true);
												}
											});
											moreColons = new Array();
											return;
										}
										else
										{
											continue;
										}
									}

									if (moreColons.length > 1)
									{
										Ext.Msg.show ({
											title: alertMsgSrcTitle,
											msg: "Please enter the application/desktop name in this format ApplicationOrDesktop[:WindowTitle].",
											buttons: Ext.Msg.OK,
											icon: 'gen-warning size32 color-warning',
											fn: function() {
												Ext.getCmp('publisresource'+mulusr).focus(true,true);
											}
										});
										moreColons = new Array();
										return;
									}

								}
							}
						}
						else
						{
							if(val.charAt(0) == ':' || val.charAt(val.length - 1) == ':')
							{
								Ext.Msg.show ({
									title: alertMsgSrcTitle,
									msg: "Published resource should not start or end with a colon",
									buttons: Ext.Msg.OK,
									icon: 'gen-warning size32 color-warning',
									fn: function() {
										Ext.getCmp('publisresource'+mulusr).focus(true,true);
									}
								});
								return;
							}
							else
							{
								var moreColons = new Array();
								for(var k=0;k < val.length;k++)
								{
									if (val.charAt(k) == ':')
									{
										moreColons.push(k);
									}

									if(val.charAt(k) == ':' && val.charAt(k + 1) == ':')
									{
										Ext.Msg.show ({
											title: alertMsgSrcTitle,
											msg: "Cannot have ':' in consecutive positions",
											buttons: Ext.Msg.OK,
											icon: 'gen-warning size32 color-warning',
											fn: function() {
												Ext.getCmp('publisresource'+mulusr).focus(true,true);
											}
										});
										moreColons = new Array();
										return ;
									}
									else
									{
										continue;
									}
								}

								if (moreColons.length > 1)
								{
									Ext.Msg.show ({
										title: alertMsgSrcTitle,
										msg: "Please enter the application/desktop name in this format ApplicationOrDesktop[:WindowTitle].",
										buttons: Ext.Msg.OK,
										icon: 'gen-warning size32 color-warning',
										fn: function() {
											Ext.getCmp('publisresource'+mulusr).focus(true,true);
										}
									});
									moreColons = new Array();
									return;
								}
							}
						}
					}
				}

				var multidisclaimer= Ext.getCmp('disclaimermultiusr'+mulusr+'_1').getValue();
				if(multidisclaimer == null) continue;
				
				var multi2FAuth= Ext.getCmp('twofacttoken'+mulusr).getValue();
				var multitwofa = Ext.getCmp('twofact'+mulusr).getChecked()[0];
				var ismultitwofaenabled = multitwofa.getGroupValue()
				if(multi2FAuth == null) continue;
				if(multi2FAuth != null)
				{
					if (ismultitwofaenabled == 'true')
					{
						if(!checkblank(multi2FAuth))
						{
							Ext.Msg.show({
								title: alertMsgSrcTitle,
								msg: enter2FAToken,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('twofacttoken'+mul).focus(true,true);
								}
							});
							return;
						}
						if (multi2FAuth.indexOf(",") > -1)
						{
							Ext.Msg.show({
								title: alertMsgSrcTitle,
								msg: _checkspecial,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('twofacttoken'+mulusr).focus(true,true);
								}
							});
							return;
						}
						else if (multi2FAuth.indexOf("..") > -1)
						{
							Ext.Msg.show({
								title: alertMsgSrcTitle,
								msg: _checkdots,
								buttons: Ext.Msg.OK,
								icon: 'gen-warning size32 color-warning',
								fn: function() {
									Ext.getCmp('twofacttoken'+mulusr).focus(true,true);
								}
							});
							return;
						}
					}
					else
					{
						multi2FAuth = 'none';
					}
				}

				var multidomain= Ext.getCmp('domainmultiusr'+mulusr).getValue();
				if(multidomain == null) continue;
				if(multidomain != null)
				{
					if (!checkblank(multidomain))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterDomain,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('domainmultiusr'+mul).focus(true,true);
							}
						});
						return;
					}
					else if (multidomain.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('domainmultiusr'+mul).focus(true,true);
							}
						});
						return;
					}
					else if (!checkDomain(multidomain,"true"))
					{
						Ext.getCmp('domainmultiusr'+mulusr).focus(true,true);
						return;
					}
					else if (multidomain.indexOf(",") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('domainmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multidomain.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('domainmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(!checkHyphenText(multidomain,multidomain))
					{
						Ext.getCmp('domainmultiusr'+mulusr).focus();
						return;
					}
				}

				var multiUname = Ext.getCmp('usermultiusr'+mulusr).getValue();
				if(multiUname!=null)
				{
					if(!checkblank(multiUname))
					{

						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterUsrId,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('usermultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multiUname.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('usermultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(!checkspecial(multiUname,"*+=|:;\"\'<>\/[]?,"))
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkspecial,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function()
							{
								Ext.getCmp('usermultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(trim(multiUname) == "")
					{
						Ext.getCmp('usermultiusr'+mulusr).focus();
						return;
					}
					else if (multiUname.indexOf("..") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkdots,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('usermultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multiUname.indexOf("  ") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkSpaces,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('usermultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(!checkHyphenText(multiUname,multiUname))
					{
						Ext.getCmp('usermultiusr'+mulusr).focus();
						return;
					}
				}

				var multipass = Ext.getCmp('pwdmultiusr'+mulusr).getValue();
				var multiconfpasswd = Ext.getCmp('confpwdmultiusr'+mulusr).getValue();
				if(multipass!=null && multiconfpasswd!=null )
				{
					if (multipass == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('pwdmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multipass.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('pwdmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(multipass.indexOf("#~#")>-1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: _checkHashTildeHash,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('pwdmultiusr'+mulusr).focus(true,true);
							}
						});
						sub = false;
						return;
					}
					else if(!checkForPassValidity(multipass))
					{
						Ext.getCmp('pwdmultiusr'+mulusr).focus();
						sub = false;
						return;
					}
					else if(multiconfpasswd == "")
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: enterCnfPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('confpwdmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if (multiconfpasswd.indexOf("$unconfigured") > -1)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: donotSpecifyKey,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('confpwdmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
					else if(multipass != multiconfpasswd)
					{
						Ext.Msg.show({
							title: alertMsgSrcTitle,
							msg: matchPwd,
							buttons: Ext.Msg.OK,
							icon: 'gen-warning size32 color-warning',
							fn: function() {
								Ext.getCmp('confpwdmultiusr'+mulusr).focus(true,true);
							}
						});
						return;
					}
				}

				if(multiPublishSrcVal != null && multi2FAuth != null && multidomain!=null && multidisclaimer!=null && multiUname!=null && multipass!=null && multiconfpasswd!=null )
				{
					var tempmultiUsrdoma = Ext.getCmp('domainmultiusr'+mulusr).getValue();
					multiUsrdomainVal+=tempmultiUsrdoma+"|";
					
					var tempmultiUsrdisclaim = Ext.getCmp('disclaimermultiusr'+mulusr+'_1').getValue();
					var strdisclaimValue = 'false';
					if (tempmultiUsrdisclaim)
					{
						strdisclaimValue = 'true';
					}
					multiUsrdisclaimVal+=strdisclaimValue+"|";

					var tempmulti2FA = Ext.getCmp('twofacttoken'+mulusr).getValue();
					var multi2FA = Ext.getCmp('twofact'+mulusr).getChecked()[0];
					var tempismulti2FA = multi2FA.getGroupValue();
					if (tempismulti2FA == 'false')
					{
						tempmulti2FA = 'none';
					}
					multi2FAuthVal+=tempmulti2FA+"#~#";

					var tempmultiSrcPublis = Ext.getCmp('publisresource'+mulusr).getValue();
					var tmpHiddenPublishSrc = tempmultiSrcPublis;
					if (!Ext.isEmpty(tmpHiddenPublishSrc) && tmpHiddenPublishSrc.indexOf(",") != -1)
					{
						tmpHiddenPublishSrc = tmpHiddenPublishSrc.replace(/,/g,'~#~');
					}
					multiPublishSrcVal+=tempmultiSrcPublis+",";
					hiddenPublishSrcVal+=tmpHiddenPublishSrc+"|";

					var tempmultiUsr = Ext.getCmp('usermultiusr'+mulusr).getValue();
					multiUsrVal+=tempmultiUsr+"|";

					var tempmultiUsrPass = Ext.getCmp('pwdmultiusr'+mulusr).getValue();
					multiUsrpassVal+=tempmultiUsrPass+"#~#";
				}
			}
			multiPublishSrcVal = multiPublishSrcVal.substring(0,multiPublishSrcVal.length-1);

			hiddenPublishSrcVal = hiddenPublishSrcVal.substring(0,hiddenPublishSrcVal.length-1);

			multi2FAuthVal = multi2FAuthVal.substring(0,multi2FAuthVal.length-3);

			multiUsrdomainVal = multiUsrdomainVal.substring(0,multiUsrdomainVal.length-1);

			multiUsrdisclaimVal = multiUsrdisclaimVal.substring(0,multiUsrdisclaimVal.length-1);

			multiUsrVal = multiUsrVal.substring(0,multiUsrVal.length-1);

			multiUsrpassVal = multiUsrpassVal.substring(0,multiUsrpassVal.length-3);

			var ctxCloudWrkSpace = Ext.getCmp('ctxCloudWrkSpace1_1').getValue();

			if (Ext.isEmpty(ctxCloudWrkSpace))
			{
				ctxCloudWrkSpace = 'false';
			}

			var lsUrl = '/final/admin/LimitedAdminHome/data/EgLogonSimulatorJsonp.jsp?hostname='+encodeURIComponent(compNickVal)+'&compType='+encodeURIComponent(compType)+'&Site_url='+encodeURIComponent(siteUrl)+'&Published_resources='+encodeURIComponent(hiddenPublishSrcVal)+'&Domain='+encodeURIComponent(multiUsrdomainVal)+'&Username='+encodeURIComponent(multiUsrVal)+'&Password='+encodeURIComponent(multiUsrpassVal)+'&Two_factor_auth_password='+encodeURIComponent(multi2FAuthVal)+'&Disclaimer='+encodeURIComponent(multiUsrdisclaimVal)+'&Citrix_cloud_workspace='+encodeURIComponent(ctxCloudWrkSpace);
		}

		var hostIpObj = Ext.getCmp('hostipname');
		if (!Ext.isEmpty(hostIpObj))
		{
			var hostip = hostIpObj.getValue();
			lsUrl = lsUrl + '&hostip='+encodeURIComponent(hostip);
		}

		remoteAgent = sessionStorage.getItem("remoteAgent");

		var myMask = new Ext.LoadMask(Ext.getBody(), {msg: 'Loading...', maskCls:'modalWhiteBg'});
		myMask.show();

		var me = this;

		Ext.Ajax.request({
			url:lsUrl+'&extAgent='+encodeURIComponent(remoteAgent),
			method:'POST',
			success: function(response)
			{
				myMask.hide();
				var jsonText = response.responseText;
				var publicJson = Ext.decode(jsonText);
				var compTypeDisplay = publicJson.compTypeDisplay;
				var success = publicJson.success;
				if (!Ext.isEmpty(success) && success == 'true')
				{
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: compTypeDisplay+' '+compSuccessMsg,
						width: 500,
						buttons: Ext.Msg.OK,
						icon: 'gen-info size32 color-info',
						fn: function() {
							me.configureServersClose();
						}
					});
				}
				else
				{
					var errorMsg = publicJson.errorMsg;
					Ext.Msg.show({
						title: alertMsgSrcTitle,
						msg: errorMsg,
						width: 500,
						buttons: Ext.Msg.OK,
						icon: 'gen-warning size32 color-warning',
						fn: function() {
							
						}
					});
				}
			},
			failure : function(response)
			{
				myMask.hide();
			}
		});
	}
});

function loadURL(activity, actionType,rowIndex,store)
{
	if (activity == "component")
	{
		if (actionType == "agg")
		{
			var server = Ext.getCmp('aggView').getStore().getAt(rowIndex).get("hiddenColumn");
			window.location.href = "/final/admin/EgAggregateTree.jsp?qctr=1&server="+encodeURIComponent(server)+"&reqfrom=home";
		}
		else
		{
			var server = Ext.getCmp('componentView').getStore().getAt(rowIndex).get("hiddenColumn");
			window.location.href = "/final/admin/EgDispServer.jsp?comptype="+encodeURIComponent(server)+"&category=-1&reqfrom=home";
		}
	}
	else if (activity == "tests")
	{
		var componentType = Ext.getCmp('unconfiguredTestsSummary').getStore().getAt(rowIndex).get("hiddenColumn");
		var uri ="/final/admin/EgUnconfiguredTestsSummary.jsp?fromPage=unConfiguredSummary&componentType="+encodeURIComponent(componentType)+"&showTestType="+actionType;
		window.location.href = uri;
	}
}

function validateIpWithMsg(fieldvalue)
{
	var s_val = fieldvalue;
	var dot_count = 0;

	var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	var isIpv6=false;
	var result=false;
	if(s_val.indexOf(":")>-1)
		isIpv6=true;
	
	if(isIpv6)
	{
		
		result = checkIPv6(s_val);
		return result;
	}
	else
	{

		for(var m=0; m<s_val.length; m++)
		{
			check_char = alpha.indexOf(s_val.charAt(m))
			//Returns value 1 if the special character listed in splChar is found
			if(check_char >= 0)
			{
				return _checkAlpha;
			}
		}
		for(var k=0;k < s_val.length;k++)
		{
			if(s_val.charAt(k) == '.' && s_val.charAt(k + 1) == '.')
			{
				return _checkIp;
			}
			else
			{
				continue;
			}
		}
		for(var i=0;i < s_val.length;i++)
		{
			if(s_val.charAt(i) == '.')
			{
				dot_count = dot_count + 1;
			}
			else
			{
				continue;
			}
		}
		if(dot_count != 3)
		{
			return _valIp;
		}
		if(s_val.charAt(0) == '.' || s_val.charAt(s_val.length - 1) == '.')
		{
			return _validateIp;
		}
		for(var j = 0; j < s_val.length; j++)
		{
			if(s_val.charAt(j) == ' ')
			{
				return _checkSpaceIp;
			}
		}

		var splChar = "`~!@#$%^&*()-_+={}[]|\\:;\"\'<>,?\/";
		for(var k=0; k<s_val.length; k++)
		{
			check_char = splChar.indexOf(s_val.charAt(k))
			//Returns value 1 if the special character listed in splChar is found
			if(check_char != -1)
			{
				return _checkspecial;
			}
		}

		if(s_val.indexOf('.') > -1 && dot_count > 2)
		{
			var number_bet_dots = s_val.split('.');

			for(var l=0;l < number_bet_dots.length;l++)
			{
				if(number_bet_dots[l] < 0 || number_bet_dots[l] > 255)
				{
					return _checknum;
				}
			}
		}
		return '';
	}
}

function checkIPv6(s_val)
{
	/** IPv6 Validation Starts
	 * 
	 */
	
	if(!checkspecialnomess(s_val,"`~!@#%^&*()+={}[]|\\;\"\'<>,?"))
	{
		return _checkspecial;
	}
	if(!checkspace(s_val))
	{
		return false;
	}
	var regD1= /[\.]{2,}/;
	var regD2= /(^(\.){1,})|((\.){1,}$)/gi;
	var regD3= /(\.\:){1,}|(\:\.){1,}/;
	if(s_val.match(regD1) != null || s_val.match(regD3) != null  )
	{
		return _checkIpv6;
	}
	
	if(s_val.match(regD2) != null)
	{
		return _validateIp;
	}
	var reg1= /[\:]{2,}/g;
	var reg1Res = s_val.match(reg1); 
	
	if( reg1Res != null &&  reg1Res != "::" )
	{
		return _doubleColon;
	}
	
	var regCntRes = s_val.split(":");
	var regColonLen = regCntRes.length;
	regColonLen--;
	var strV4, strV6;
	strV6 = s_val;
	
	if( regCntRes.length <= 7 && s_val.indexOf(".") != -1 )
	{
		var regDRes = s_val.split(".");
		var regDLength = regDRes.length;
		regDLength--;
		
		strV4 = s_val.substring((s_val.lastIndexOf(":")+1));
		strV6 = s_val.substring(0,(s_val.lastIndexOf(":")));
		
		var regIp4 = /[0-9]{1,3}(\.){1}[0-9]{1,3}(\.){1}[0-9]{1,3}(\.){1}[0-9]{1,3}((\/){1}[0-9]{1,3})*$/gi;
		regIp4Res = s_val.match(regIp4);
			
		if(regIp4Res  == null || regIp4Res != strV4 )
		{
			return _valiIp;
		}
		if(strV6.indexOf(".") != -1)
		{
			return _checkIp;
		}
		if((regDLength > 3) || (regDLength != 3))
		{
			return _valIp;
		}
		var arr = strV4.split("/");
		strV4 = arr[0];
		var number_bet_dots = strV4.split('.');

		for(var l=0;l < number_bet_dots.length;l++)
		{
			if(number_bet_dots[l] < 0 || number_bet_dots[l] > 255)
			{
				return _checknum;
			}
		}
	}
	else if(regColonLen > 7)
	{
		return _grpIpv6;
	}
	
	var arr = strV6.split("/");
	strV6 = arr[0];
	
	var regPartRes2 = "";
	var regPart = /^(([a-z0-9(::)]{0,4}(\:){1,2}[a-z0-9]{0,4}){1}((\:){1,2}[a-z0-9]{0,4}){1,})|(([a-z0-9(::)]{0,4}(\:){1,2}[a-z0-9]{0,4}){1})$/gi;
	var regPartRes1 = strV6.match(regPart);
	regPart = /^[a-f0-9]{0,4}$/gi;
	
	if(strV6.indexOf(":") == -1)
	{
		regPartRes2 = strV6.match(regPart);
	}
	if( ( (regPartRes1 == null) || (regPartRes1 != strV6) ) && (regPartRes2 != strV6) )
	{
		return _digitIpv6;
	}

	var regC = /(::){0,1}([a-f0-9(::)(\.)]*[\:]{1})+[a-f(::)(\.)0-9]*((\/){0,1}[0-9]{1,3})*/ig; // Right 1
	var regCRes = s_val.match(regC);

	if( regCRes == null ||  regCRes != s_val )
	{
		return _validateIpv6;
	}
	return '';	
}

function checkDecimalExtJs(field)
{
	var num = '';
	if(typeof(field) == 'object')
	{
		num = field.value;
	}
	else
	{
		num = field;
	}

	if(num.indexOf(".") > -1)
	{
		return _checkfordecimal;
	}
	return '';
}

function removeMultiSrc(containerID) 
{
	ismultisrc = false;
	var backupcontainer = Ext.getCmp('backupmulticontainer');
	var mainContainer = Ext.getCmp('conmulti_1');
	backupcontainer.remove(containerID);
	var bckitemsmultiLen = backupcontainer.items.length;
	if (containerID == 'conmulti_1')
	{
		ismultisrc = 'true';
		Ext.getCmp('conmulti_1').removeAll();
		Ext.getCmp('conmulti_1').hide();
		Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
	}
	if (bckitemsmultiLen == 0)
	{
		if (mainContainer.items.length == 0)
		{
			ismultisrc = 'true';
			inputsmultisrc = 1;
		}
		if (ismultisrc == 'true')
		{
			Ext.getCmp('NoMultiUsrPattern').show();
			Ext.getCmp('noteCont').hide();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
		}
	}
}

function removeExcMultiSrc(containerID)
{
	ismultisrc = false;
	var backupcontainer = Ext.getCmp('backupmulticontainer1');
	var mainContainer = Ext.getCmp('excconmulti_1');
	backupcontainer.remove(containerID);
	var bckitemsmultiLen = backupcontainer.items.length;
	if (containerID == 'excconmulti_1')
	{
		ismultisrc = 'true';
		Ext.getCmp('excconmulti_1').removeAll();
		Ext.getCmp('excconmulti_1').hide();
		Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
	}
	if (bckitemsmultiLen == 0)
	{
		if (mainContainer.items.length == 0)
		{
			ismultisrc = 'true';
			inputsmultisrc = 1;
		}
		if (ismultisrc == 'true')
		{
			Ext.getCmp('NoMultiUsrPattern1').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
		}
	}
}

function removeAmazonMultiSrc(containerID)
{
	ismultisrc = false;
	var backupcontainer = Ext.getCmp('amazonbackupmulticontainer');
	var mainContainer = Ext.getCmp('amazonconmulti_1');
	backupcontainer.remove(containerID);
	var bckitemsmultiLen = backupcontainer.items.length;
	if (containerID == 'amazonconmulti_1')
	{
		ismultisrc = 'true';
		Ext.getCmp('amazonconmulti_1').removeAll();
		Ext.getCmp('amazonconmulti_1').hide();
		Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
	}
	if (bckitemsmultiLen == 0)
	{
		if (mainContainer.items.length == 0)
		{
			ismultisrc = 'true';
			inputsmultisrc = 1;
		}
		if (ismultisrc == 'true')
		{
			Ext.getCmp('amazonNoMultiUsrPattern').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
		}
	}
}

function removeHorizonMultiSrc(containerID)
{
	ismultisrc = false;
	var backupcontainer = Ext.getCmp('horizonbackupmulticontainer');
	var mainContainer = Ext.getCmp('horizonconmulti_1');
	backupcontainer.remove(containerID);
	var bckitemsmultiLen = backupcontainer.items.length;
	if (containerID == 'horizonconmulti_1')
	{
		ismultisrc = 'true';
		Ext.getCmp('horizonconmulti_1').removeAll();
		Ext.getCmp('horizonconmulti_1').hide();
		Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
	}
	if (bckitemsmultiLen == 0)
	{
		if (mainContainer.items.length == 0)
		{
			ismultisrc = 'true';
			inputsmultisrc = 1;
		}
		if (ismultisrc == 'true')
		{
			Ext.getCmp('horizonNoMultiUsrPattern').show();
			Ext.getCmp('updateMultiConfSrc').disable();
			Ext.getCmp('clearMultiConfSrc').disable();
			Ext.getCmp('addMultiSrcbtn').setText(addBtnText);
		}
	}
}

function addMultiSourceContact()
{
	var mainForm = Ext.getCmp('EgLogonSimulatorConfiguration');
	var backupmulticontainer = Ext.getCmp('backupmulticontainer');

	var compType = fromAction.substring(fromAction.indexOf(":")+1);
	
	var conIdMulti = "con_"+inputsmultisrc
	var tmpMultiContainer = {
		xtype : 'fieldset',
		id : conIdMulti,
		style: {
			'background' : '#ffffff',
			'border' : '1px solid lightGrey',
			'box-shadow':'none'
		},
		items: [
			
			{
				xtype: 'container',
				layout: 'column',
				defaults: {
					margin: 5,
					labelSeparator:' ',
					labelWidth:140
				},
				items: [
					{
						xtype: 'fieldcontainer',
						layout: 'column',
						defaults: {
							labelSeparator:' ',
							labelWidth: 140
						},
						columnWidth: 1,
						margin: '2 5 4 5',
						items: [
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								fieldLabel: appNameLabel,
								style:{'white-space':'nowrap'},
								id:'publisresource'+inputsmultisrc,
								columnWidth: 0.97,
								enableKeyEvents : true,
								readOnly : true
							},
							{
								xtype: 'button',
								columnWidth: 0.03,
								tooltip: pubResourceToolTip,
								id:'confpublisresource'+inputsmultisrc,
								iconCls : 'iconConfigure',
								style : {
									background : 'none',
									border : '0px'
								},
								margin: '10 0 0 2',
								listeners: {
									click: function() {
										var resId = this.getId().replace("confpublisresource","publisresource");
										appCnt.getPopUpView(resId);
									}
								}
							}
						]
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: domainLabel,
						style:{'white-space':'nowrap'},
						id:'domainmultiusr'+inputsmultisrc,
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: userLabel,
						style:{'white-space':'nowrap'},
						id:'usermultiusr'+inputsmultisrc,
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: passwordLabel,
						style:{'white-space':'nowrap'},
						id:'pwdmultiusr'+inputsmultisrc,
						inputType: 'password',
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: cnfPasswordLabel,
						style:{'white-space':'nowrap'},
						id:'confpwdmultiusr'+inputsmultisrc,
						inputType: 'password',
						columnWidth: 0.5
					},
					{
						xtype: 'fieldcontainer',
						id: 'twofaCont'+inputsmultisrc,
						fieldLabel: twofaLabel+'?',
						columnWidth: 0.5,
						layout: 'column',
						margin: '5 5 0 5',
						items : [
							{
								xtype: 'radiogroup',
								columnWidth: 0.6,
								cls: 'aRadiobt',
								id: 'twofact'+inputsmultisrc,
								vertical: false,
								columns: 2,
								items: [
									{ boxLabel: 'Yes', name: 'twofactlabel'+inputsmultisrc, id: 'twofactlabel'+inputsmultisrc+'_1',  inputValue: 'true'},
									{ boxLabel: 'No', name: 'twofactlabel'+inputsmultisrc, id: 'twofactlabel'+inputsmultisrc+'_2',  inputValue: 'false', checked: true}
								],
								listeners : {
									'change' : function(obj, value)
									{
										var value = this.getChecked()[0];
										var twofa = this.getId().replace("twofact","twofacttoken");
										if (value.getGroupValue() == 'false')
										{
											Ext.getCmp(twofa).setVisible(false);
										}
										else
										{
											Ext.getCmp(twofa).setVisible(true);
										}
									}
								}
							},
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								style:{'white-space':'nowrap'},
								id:'twofacttoken'+inputsmultisrc,
								inputType: 'password',
								margin:'0 0 0 5',
								hidden: true,
								columnWidth: 0.4
							}
						]
					},
					{
						xtype: 'radiogroup',
						columnWidth: 0.5,
						cls: 'aRadiobt',
						id: 'disclaimer_radioGrp'+inputsmultisrc,
						fieldLabel: disclaimerLabel+'?',
						vertical: false,
						columns: 2,
						margin: '5 5 0 5',
						items: [
							{ boxLabel: 'Yes', name: 'disclaimermultiusr'+inputsmultisrc, id: 'disclaimermultiusr'+inputsmultisrc+'_1',  inputValue: 'true'},
							{ boxLabel: 'No', name: 'disclaimermultiusr'+inputsmultisrc, id: 'disclaimermultiusr'+inputsmultisrc+'_2',  inputValue: 'false', checked: true}
						]
					},
					{
						xtype: 'container',
						style:{
							'position':'absolute',
							'top':'2px',
							'right':'2px',
							'width':'20px',
							'height':'20px'
						},
						margin:'0 0 0 0',
						items : [
							{
								xtype : 'button',
								iconCls : 'fieldsetClose',
								tooltip : '<b>'+removeTooltip+'</b>',
								style : {
									background : 'none',
									border : '0px'
								},
								handler: function()
								{
									removeMultiSrc(conIdMulti);
								}
							}
						]
					}
				]
			}
		]
	}
	
	backupmulticontainer.add(tmpMultiContainer);
	mainForm.doLayout();
	
	var compType = fromAction.substring(fromAction.indexOf(":")+1);
	if (compType!=null && compType=="Citrix_XcLogon_Emulation")
	{
		Ext.getCmp('publisresource'+inputsmultisrc).setReadOnly(true);
		Ext.getCmp('publisresource'+inputsmultisrc).columnWidth = '0.97';
		Ext.getCmp('confpublisresource'+inputsmultisrc).setVisible(true);
		Ext.getCmp('noteCont').hide();
		Ext.getCmp('ctxCloudWrkSpace').show();
	}
	else if (compType!=null && compType=="Hrzn_Logon_Emulation")
	{
		Ext.getCmp('publisresource'+inputsmultisrc).setReadOnly(false);
		Ext.getCmp('publisresource'+inputsmultisrc).columnWidth = '1';
		Ext.getCmp('confpublisresource'+inputsmultisrc).setVisible(false);
		Ext.getCmp('noteCont').show();
		Ext.getCmp('ctxCloudWrkSpace').hide();
	}
	
	Ext.getCmp('publisresource'+inputsmultisrc).focus(true);

	Ext.getCmp('addMultiSrcbtn').setText(addMoreBtnText);
	Ext.getCmp('updateMultiConfSrc').enable();
	Ext.getCmp('clearMultiConfSrc').enable();
	Ext.getCmp('NoMultiUsrPattern').hide();

	inputsmultisrc++;
}

function addExchangeMultiSourceContact()
{
	var mainForm = Ext.getCmp('EgLogonSimulatorConfiguration');
	var backupmulticontainer = Ext.getCmp('backupmulticontainer1');

	var compType = fromAction.substring(fromAction.indexOf(":")+1);
	
	var conIdMulti = "exccon_"+inputsmultisrc;

	var tmpMultiContainer = {
		xtype : 'fieldset',
		id : conIdMulti,
		style: {
			'background' : '#ffffff',
			'border' : '1px solid lightGrey',
			'box-shadow':'none'
		},
		items: [
			{
				xtype: 'container',
				layout: 'column',
				defaults: {
					margin: 5,
					labelSeparator:' ',
					labelWidth:140
				},
				items: [
					{
						xtype: 'fieldcontainer',
						layout: 'column',
						defaults: {
							labelSeparator:' ',
							labelAlign: 'top'
						},
						columnWidth: 1,
						//margin: '2 5 4 5',
						items: [
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								style:{'white-space':'nowrap'},
								id:'excemailid'+inputsmultisrc,
								fieldLabel: exchangeemail,
								columnWidth: 0.33
							},
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								inputType : 'password',
								style:{'white-space':'nowrap'},
								fieldLabel: passwordLabel,
								id:'excpwd'+inputsmultisrc,
								columnWidth: 0.34,
								margin: '0 0 0 10'
							},
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								inputType : 'password',
								style:{'white-space':'nowrap'},
								fieldLabel: cnfPasswordLabel,
								id:'excconfirmpwd'+inputsmultisrc,
								columnWidth: 0.33,
								margin: '0 0 0 10'
							}
						]
					},
					{
						xtype: 'container',
						style:{
							'position':'absolute',
							'top':'2px',
							'right':'2px',
							'width':'20px',
							'height':'20px'
						},
						margin:'0 0 0 0',
						items : [
							{
								xtype : 'button',
								iconCls : 'fieldsetClose',
								tooltip : '<b>'+removeTooltip+'</b>',
								style : {
									background : 'none',
									border : '0px'
								},
								handler: function()
								{
									removeExcMultiSrc(conIdMulti);
								}
							}
						]
					}
				]
			}
		]
	}

	backupmulticontainer.add(tmpMultiContainer);
	mainForm.doLayout();

	Ext.getCmp('excemailid'+inputsmultisrc).focus(true);

	Ext.getCmp('addMultiSrcbtn').setText(addMoreBtnText);
	Ext.getCmp('updateMultiConfSrc').enable();
	Ext.getCmp('clearMultiConfSrc').enable();
	Ext.getCmp('NoMultiUsrPattern1').hide();

	inputsmultisrc++;
}

function addAmazonMultiSourceContact()
{
	var mainForm = Ext.getCmp('EgLogonSimulatorConfiguration');
	var backupmulticontainer = Ext.getCmp('amazonbackupmulticontainer');

	var compType = fromAction.substring(fromAction.indexOf(":")+1);
	
	var conIdMulti = "amazoncon_"+inputsmultisrc;

		var tmpMultiContainer = {
		xtype : 'fieldset',
		id : conIdMulti,
		style: {
			'background' : '#ffffff',
			'border' : '1px solid lightGrey',
			'box-shadow':'none'
		},
		items: [
			{
				xtype: 'container',
				layout: 'column',
				defaults: {
					margin: 5,
					labelSeparator:' ',
					labelWidth:140
				},
				items: [
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: appNameLabel,
						id:'amazonpublisresource'+inputsmultisrc,
						columnWidth: 0.5,
						enableKeyEvents : true
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: registrationCode,
						inputType: 'password',
						style:{'white-space':'nowrap'},
						id:'amazonregcode'+inputsmultisrc,
						columnWidth: 0.5,
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: domainLabel,
						style:{'white-space':'nowrap'},
						id:'amazondomainmultiusr'+inputsmultisrc,
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: userLabel,
						style:{'white-space':'nowrap'},
						id:'amazonusermultiusr'+inputsmultisrc,
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: passwordLabel,
						style:{'white-space':'nowrap'},
						id:'amazonpwdmultiusr'+inputsmultisrc,
						inputType: 'password',
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: cnfPasswordLabel,
						style:{'white-space':'nowrap'},
						id:'amazonconfpwdmultiusr'+inputsmultisrc,
						inputType: 'password',
						columnWidth: 0.5
					},
					{
						xtype: 'container',
						style:{
							'position':'absolute',
							'top':'2px',
							'right':'2px',
							'width':'20px',
							'height':'20px'
						},
						margin:'0 0 0 0',
						items : [
							{
								xtype : 'button',
								iconCls : 'fieldsetClose',
								tooltip : '<b>'+removeTooltip+'</b>',
								style : {
									background : 'none',
									border : '0px'
								},
								handler: function()
								{
									removeAmazonMultiSrc(conIdMulti);
								}
							}
						]
					}
				]
			}
		]
	}

	backupmulticontainer.add(tmpMultiContainer);
	mainForm.doLayout();

	Ext.getCmp('amazonpublisresource'+inputsmultisrc).focus(true);

	Ext.getCmp('addMultiSrcbtn').setText(addMoreBtnText);
	Ext.getCmp('updateMultiConfSrc').enable();
	Ext.getCmp('clearMultiConfSrc').enable();
	Ext.getCmp('amazonNoMultiUsrPattern').hide();

	inputsmultisrc++;
}

function addHorizonMultiSourceContact()
{
	var mainForm = Ext.getCmp('EgLogonSimulatorConfiguration');
	var backupmulticontainer = Ext.getCmp('horizonbackupmulticontainer');

	var compType = fromAction.substring(fromAction.indexOf(":")+1);
	
	var conIdMulti = "horizoncon_"+inputsmultisrc;

		var tmpMultiContainer = {
		xtype : 'fieldset',
		id : conIdMulti,
		style: {
			'background' : '#ffffff',
			'border' : '1px solid lightGrey',
			'box-shadow':'none'
		},
		items: [
			{
				xtype: 'container',
				layout: 'column',
				defaults: {
					margin: 5,
					labelSeparator:' ',
					labelWidth:140
				},
				items: [
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: appNameLabel,
						id:'horizonpublisresource'+inputsmultisrc,
						columnWidth: 0.5,
						enableKeyEvents : true
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: userLabel,
						style:{'white-space':'nowrap'},
						id:'horizonusername'+inputsmultisrc,
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: passwordLabel,
						style:{'white-space':'nowrap'},
						id:'horizonpwd'+inputsmultisrc,
						inputType: 'password',
						columnWidth: 0.5
					},
					{
						xtype: 'textfield',
						cls: 'aTextbox',
						fieldLabel: cnfPasswordLabel,
						style:{'white-space':'nowrap'},
						id:'horizonconfpwd'+inputsmultisrc,
						inputType: 'password',
						columnWidth: 0.5
					},
					{
						xtype: 'fieldcontainer',
						id: 'horizontwofaCont'+inputsmultisrc,
						fieldLabel: twofaLabel+'?',
						columnWidth: 0.5,
						layout: 'column',
						margin: '5 5 0 5',
						items : [
							{
								xtype: 'radiogroup',
								columnWidth: 0.6,
								cls: 'aRadiobt',
								id: 'horizontwofact'+inputsmultisrc,
								vertical: false,
								columns: 2,
								items: [
									{ boxLabel: 'Yes', name: 'horizontwofactlabel'+inputsmultisrc, id: 'horizontwofactlabel'+inputsmultisrc+'_1',  inputValue: 'true'},
									{ boxLabel: 'No', name: 'horizontwofactlabel'+inputsmultisrc, id: 'horizontwofactlabel'+inputsmultisrc+'_2',  inputValue: 'false', checked: true}
								],
								listeners : {
									'change' : function(obj, value)
									{
										var value = this.getChecked()[0];
										var twofa = this.getId().replace("horizontwofact","horizontwofacttoken");
										if (value.getGroupValue() == 'false')
										{
											Ext.getCmp(twofa).setVisible(false);
										}
										else
										{
											Ext.getCmp(twofa).setVisible(true);
										}
									}
								}
							},
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								style:{'white-space':'nowrap'},
								id:'horizontwofacttoken'+inputsmultisrc,
								inputType: 'password',
								margin: '0 0 0 5',
								columnWidth: 0.4,
								hidden: true,
								enableKeyEvents : true
							}
						]
					},
					{
						xtype: 'radiogroup',
						columnWidth: 0.5,
						cls: 'aRadiobt',
						id: 'horizondisclaimer_radioGrp'+inputsmultisrc,
						fieldLabel: disclaimerLabel+'?',
						vertical: false,
						columns: 2,
						margin: '5 5 0 5',
						items: [
							{ boxLabel: 'Yes', name: 'horizondisclaimermultiusr'+inputsmultisrc, id: 'horizondisclaimermultiusr'+inputsmultisrc+'_1',  inputValue: 'true'},
							{ boxLabel: 'No', name: 'horizondisclaimermultiusr'+inputsmultisrc, id: 'horizondisclaimermultiusr'+inputsmultisrc+'_2',  inputValue: 'false', checked: true}
						]
					},
					{
						xtype: 'container',
						style:{
							'position':'absolute',
							'top':'2px',
							'right':'2px',
							'width':'20px',
							'height':'20px'
						},
						margin:'0 0 0 0',
						items : [
							{
								xtype : 'button',
								iconCls : 'fieldsetClose',
								tooltip : '<b>'+removeTooltip+'</b>',
								style : {
									background : 'none',
									border : '0px'
								},
								handler: function()
								{
									removeHorizonMultiSrc(conIdMulti);
								}
							}
						]
					}
				]
			}
		]
	}

	backupmulticontainer.add(tmpMultiContainer);
	mainForm.doLayout();

	Ext.getCmp('horizonpublisresource'+inputsmultisrc).focus(true);

	Ext.getCmp('addMultiSrcbtn').setText(addMoreBtnText);
	Ext.getCmp('updateMultiConfSrc').enable();
	Ext.getCmp('clearMultiConfSrc').enable();
	Ext.getCmp('horizonNoMultiUsrPattern').hide();

	inputsmultisrc++;
}

function addMultiResourceContact()
{
	var mainForm = Ext.getCmp('egconfigureresource');
	var backupmulticontainer = Ext.getCmp('backupmultirescontainer');
	var conIdRes = "conRes_"+inputs
	var tmpMultiContainer = {
		xtype : 'fieldset',
		id : conIdRes,
		style: {
			'background' : '#ffffff',
			'border' : '1px solid lightGrey',
			'box-shadow':'none'
		},
		padding:'10 0 10 10',
		margin: '10 10 0 10',
		items: [
			{
				xtype: 'container',
				layout: 'column',
				defaults: {
					labelSeparator:' ',
					labelWidth:150
				},
				items: [
					{
						xtype: 'fieldcontainer',
						layout: 'column',
						columnWidth: 1,
						defaults: {
							labelSeparator:' ',
							labelAlign: 'top',
						},
						items: [
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								style:{'white-space':'nowrap'},
								id:'folderName'+inputs,
								fieldLabel: tabnameLabel,
								value: 'none',
								columnWidth: 0.33
							},
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								style:{'white-space':'nowrap'},
								fieldLabel: appNameLabel,
								id:'resourceName'+inputs,
								columnWidth: 0.34,
								margin: '0 0 0 10'
							},
							{
								xtype: 'textfield',
								cls: 'aTextbox',
								style:{'white-space':'nowrap'},
								fieldLabel: winTitleLabel,
								id:'winTitle'+inputs,
								value: 'none',
								columnWidth: 0.33,
								margin: '0 0 0 10'
							}
						]
					},
					{
						xtype: 'container',
						style:{
							'position':'absolute',
							'top':'2px',
							'right':'2px',
							'width':'20px',
							'height':'20px'
						},
						margin:'0 0 0 0',
						items : [
							{
								xtype : 'button',
								iconCls : 'fieldsetClose',
								tooltip : '<b>'+removeTooltip+'</b>',
								style : {
									background : 'none',
									border : '0px'
								},
								handler: function()
								{
									removeMultiResource(conIdRes);
								}
							}
						]
					}
				]
			}
		]
	}
	backupmulticontainer.add(tmpMultiContainer);
	mainForm.doLayout();

	Ext.getCmp('addMultiresbtn').setText(addMoreBtnText);
	Ext.getCmp('updateMultires').enable();
	Ext.getCmp('clearMultires').enable();
	Ext.getCmp('NoMultiResPattern').hide();

	inputs++;
}

function removeMultiResource(containerID)
{
	var backupcontainer = Ext.getCmp('backupmultirescontainer');
	backupcontainer.remove(containerID);
	var bckitemsmultiLen = backupcontainer.items.length;
	if (bckitemsmultiLen == 0)
	{
		inputs = 1;
		Ext.getCmp('NoMultiResPattern').show();
		Ext.getCmp('updateMultires').disable();
		Ext.getCmp('clearMultires').disable();
		Ext.getCmp('addMultiresbtn').setText(addBtnText);
	}
}

function checkspecialExt(field,s_spl)
{
	if (typeof(field)=='object')
	{
		obj_val = field.value;
	}
	else
	{
		obj_val = field;
	}
	for(var i=0; i<obj_val.length; i++)
	{
		check_char = s_spl.indexOf(obj_val.charAt(i))
		//Returns value 1 if the special character listed in splChar is found
		if(check_char >= 0)
		{
			return false;
		}
	}
	return true;
}




