package ibase.e12ria.client;

import java.util.HashMap;
import java.util.Map;

import com.google.gwt.core.client.Callback;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.Overflow;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.BlurEvent;
import com.google.gwt.event.dom.client.BlurHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.FocusEvent;
import com.google.gwt.event.dom.client.FocusHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.event.logical.shared.AttachEvent.Handler;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.http.client.Request;
import com.google.gwt.http.client.RequestBuilder;
import com.google.gwt.http.client.RequestCallback;
import com.google.gwt.http.client.RequestException;
import com.google.gwt.http.client.Response;
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.storage.client.Storage;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DisclosurePanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasAlignment;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
//import com.google.gwt.event.dom.client.TouchStartEvent;
//import com.google.gwt.event.dom.client.TouchStartHandler;

import ibase.e12ria.client.E12CustomPlugin.CallBack;
import ibase.e12ria.client.E12SlideMenuPanel.CustomPopUp;
import ibase.e12ria.client.resources.Resources;
import ibase.e12ria.client.resources_Android.Resources_Android;
import ibase.e12ria.client.resources_iOS7.Resources_iOS7;
import ibase.e12ria.e12widgets.client.E12ApplicationsPanel;
import ibase.e12ria.e12widgets.client.E12PopupPanel;
import ibase.e12ria.e12widgets.client.E12TextBox;
import ibase.e12ria.e12widgets.client.TouchWidget;
import ibase.e12ria.e12widgets.client.WebSocketConnection;
import ibase.e12ria.e12widgets.shared.E12CommonUtils.DeviceMajorVersion;
import ibase.e12ria.e12widgets.shared.E12CommonUtils.DeviceOS;
import ibase.e12ria.e12widgets.shared.E12CommonUtils.DeviceType;
import ibase.e12ria.e12widgets.shared.E12Storage;
import ibase.e12ria.e12widgets.shared.SHA256;
import ibase.e12ria.social.client.plugins.ContentPlugin;
import ibase.e12ria.social.client.plugins.ContentPlugin.DoneEvent;
import ibase.e12ria.social.client.plugins.ContentPlugin.DoneHandler;
import ibase.e12ria.social.client.plugins.misc.MetadataKey;
import ibase.e12ria.social.client.plugins.misc.MetadataValue;
import ibase.e12ria.social.client.plugins.misc.PluginMetadata;
import ibase.e12ria.utility.client.E12DownloadInfo;

public class E12UserInfo
{
	private Command command;
	private	Image userImageHB; //user image on header bar
	private int xPosition = 10;
	private static ImageResource USER_IMG ; //White shadow image with transparent background
	private static String callerInterface = "MOBILE";
	/**
	 * @return the callerInterface
	 */
	public static String getCallerInterface() {
		return callerInterface;
	}

	protected String userImgPath = "";
	private SimplePanel imageContainer;
	private TouchWidget touchWidget = null;
	private final I18NConstants constants = GWT.create( I18NConstants.class );
	//Added by sunny soni for getting toggle click [Start]
	private HashMap<String,String> bluetoothToggleValHashMap = new HashMap<>();
	private boolean isTgleClick = false;
	//Added by sunny soni for getting toggle click [End]
	private FlowPanel e12AngularComponentFlowPnl = null;
	//Added By Savita on 8-04-2015[for ChangePassword UI]-Start
	private static final String PASSWORD_PATTERN = "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).*$";
    private static final String PASS_PATTERN="^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])[a-zA-Z0-9 ]*$";  //For allowing space in password pattern
	HTML passLengthCondition = new HTML();
	HTML passNotSameAsEmpCdCondition = new HTML();
	HTML wordPasswordCondition = new HTML();
	HTML passUpperLowerCondition = new HTML();
	LocaleInfo localeInfo = LocaleInfo.getCurrentLocale();
    String localeName = localeInfo.getLocaleName();
    private int pwdLength = getMinPwdLen();
    String empFirstName = "";
    String empMiddleName = "" ;
    String empLastName = "";
    String empCode = "" ;
    E12TextBox oldPasswordPwd;
    E12TextBox newPasswordPwd;
    E12TextBox confirmPasswordPwd;
    Label newPassImg ;
	Label confirmPassImg ;
	String newPass = "";
	//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[start]
    String userCode = "";
    String userName = "";
    String userType = "";
    //Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]

    //Added By Savita on 8-04-2015[for ChangePassword UI]-End
    //Added by Shrutika on 28-05-18 [Start] for set Userinfo object when login.
	static E12UserInfo e12UsrInfo = null;
	static public E12UserInfo getE12UsrInfo() {
		return e12UsrInfo;
	}
	public void setE12UsrInfo(E12UserInfo e12UsrInfo) {
		this.e12UsrInfo = e12UsrInfo;
	}
	//Added by Shrutika on 28-05-18 [End] for set Userinfo object when login.
	public E12UserInfo(String callerInterface)
	{
		this.callerInterface = callerInterface;
		initE12UserInfo();
	}

	public E12UserInfo()
	{
		initE12UserInfo();
	}

	public void initE12UserInfo()
	{
		try
		{
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] Start
			if ( E12Global.getInstance().getDeviceMajorVersion() == DeviceMajorVersion.iOS7 )
			{
				USER_IMG = Resources_iOS7.INSTANCE.userImage();
			}
			else /*if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )*/
			{
				USER_IMG = Resources_Android.INSTANCE.userImage();
			}
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] End

//			if( E12Global.getInstance().isHostedMode() )
//			{
//				userImgPath =  E12Global.getHostUrl() + "/ibase/resource/images/users/"+ E12Constants.userID + ".png";
//			}
//			else
//			{
//				userImgPath = E12Global.getInstance().getUserImgPath();
//				if( "".equalsIgnoreCase(userImgPath) || userImgPath == "" )
//				{
//					userImgPath = E12Global.getHostUrl() + "/ibase/resource/images/users/" + E12Constants.userID +".kg";
//				}
//			}
			//Added By Vikas Lagad on 30-08-19[To download user image]Start
			E12CommonUtils.printOnConsole( "E12UserInfo :: initE12UserInfo : userImgPath["+userImgPath+"]" );
			userImageHB = new Image();
			userImageHB.getElement().setId("userImageHbId_initE12userInfo");
			// userImageHB.setUrl(userImgPath);
			if (!E12Global.getInstance().isHostedMode())
			{
				userImgPath = E12Global.getInstance().getCurDevicePath() + "/" + E12Constants.userID + ".png";
			}
			else
			{
				userImgPath =  E12Global.getHostUrl() + "/ibase/resource/images/users/"+ E12Constants.userID + ".png";
			}

			userImageHB.addAttachHandler(new Handler() {
				@Override
				public void onAttachOrDetach(AttachEvent event) {
					if (event.isAttached()) {
						String randomStr = Math.random() + "";
						userImageHB.setUrl(userImgPath + "?" + randomStr);
					}
				}
			});
			//Added By Vikas Lagad on 30-08-19[To download user image]End
			//userImage = new Image( );
			//Window.alert("user image path ["+userImage.getUrl()+"]");
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] Start

			imageContainer = new SimplePanel();
			imageContainer.add(userImageHB);
			imageContainer.setWidth( "40px" );
			if ( E12Global.getInstance().getDeviceMajorVersion() != DeviceMajorVersion.iOS7 )
			{
				userImageHB.setHeight("28px");
			}
			else /*if ( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )*/
			{
				userImageHB.setHeight("30px");
			}
			//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] End
			//Commented By Prajyot on 30-APR-2013
			//userImage.getElement().getStyle().setMarginRight(15, Unit.PX);
			touchWidget = new TouchWidget( imageContainer );

			userImageHB.getElement().getStyle().setCursor(Cursor.POINTER);
			userImageHB.setStyleName("userImage");
			/*userImage.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					xPosition = userImage.getAbsoluteLeft();
					E12CommonUtils.printOnConsole( " When click on User Image then get xPossition ["+xPosition+"] random["+Math.random()+"]" );

				}
			});*/

			userImageHB.addErrorHandler(new ErrorHandler() {
				@Override
				public void onError(ErrorEvent event) {
					userImageHB.setResource( USER_IMG );
					String width = "24px" , height = "24px";
					//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] Start
					if( E12Global.getInstance().getDeviceMajorVersion() == DeviceMajorVersion.iOS7 )
					{
						width = "38px";
						height = "38px";
					}
					else /*if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )*/
					{
						width = "28px";
						height = "28px";
					}
					userImageHB.setStyleName( "userImage" );
					userImageHB.setSize( width, height );
					String style = userImageHB.getElement().getAttribute( "style" );
					//Added by Bhupendra M for Ui realted changes in App on 11-10-17 Start
					/*style = style + "; background-size: "+width+"  "+height+";right:17px;" ;*/
					style = style + "; background-size: "+width+"  "+height+";right:6px;" ;
					//Added by Bhupendra M for Ui realted changes in App on 11-10-17 End
					userImageHB.getElement().setAttribute( "style" , style );
					//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] End
				}
			});
			command = new Command() {
				@Override
				public void execute() {
					//xPosition = userImage.getAbsoluteLeft();
					xPosition = ( imageContainer.getAbsoluteLeft() + 10 );
					E12CommonUtils.printOnConsole( " Execute command and to draw info. popup panel ["+Math.random()+"]" );
					clickOnUserImage( xPosition );
				}
			};
		}
		catch (Throwable e)
		{
		     Window.alert( "While building user information "+e.getMessage() );
		}
	}

	public Command getCommand()
	{
		return command;
	}

	public Widget getUserImage()
	{
		//return imageContainer;
		return touchWidget;
	}

	PopupPanel welcomepopupPnl = null ;
	public void clickOnUserImage( final int xPosOfUserImg )
	{
		if(welcomepopupPnl != null && welcomepopupPnl.isShowing())
		{
			return;
		}
		welcomepopupPnl = new PopupPanel( );
		final VerticalPanel welcomeVertPanel = new VerticalPanel();
		userType = E12Constants.userType;//Added by sanket on 04-08-17 for getting user type if user is not employee
		welcomepopupPnl.setStyleName("poupPanel");
		//welcomepopupPnl.getElement().getFirstChildElement().getStyle().setPaddingLeft( 13, Unit.PX );
		welcomepopupPnl.getElement().getFirstChildElement().getStyle().setPaddingLeft( 11, Unit.PX );
		welcomepopupPnl.setWidth("260px") ;
		welcomeVertPanel.addStyleName("bubbleboxinfo");
		welcomeVertPanel.getElement().setAttribute("style", "background:#fff !important");
		if( E12Global.getInstance().getDeviceType() == DeviceType.Tablet && !"BROWSER".equalsIgnoreCase(callerInterface) )
		{
			welcomeVertPanel.addStyleName("topTablet");
		}
		else
		{
			welcomeVertPanel.addStyleName("top");
		}

		welcomepopupPnl.setAnimationEnabled( false );
		welcomepopupPnl.setGlassEnabled( true );
		welcomepopupPnl.setGlassStyleName( "bgGlass" );

		//Added by Dnyaneshwar on 2-AUG-13 [The position set fixed  and z-index set 1 ] Start
		welcomepopupPnl.addAttachHandler( new AttachEvent.Handler()
		{
			@Override
			public void onAttachOrDetach(AttachEvent event)
			{
				String style = "position : fixed; z-index :4;";
				welcomepopupPnl.getElement().setAttribute( "style", style );
		}
		});
		//Added by Dnyaneshwar on 2-AUG-13 [The position set fixed  and z-index set 1 ] End

		//Added by Sandeep S. on 21-Apr-17 [To display version of Mobile] Start
		final HTML buildVersion = new HTML("<div id='versionLabel' style='opacity:0.5;font-size:12px;'>&nbsp;" + E12Constants.BUILD_VERSION + "​</div>");
		buildVersion.setStyleName( "buildVersion" );

		final HTML htmlData = new HTML();
		final HTML space = new HTML("<div style='height:7px'/>");
		final HTML space1 = new HTML("<div style='height:7px'/>");
		final HTML space2 = new HTML("<div style='height:7px'/>");

		Label close=new Label( "x" );
		close.setStyleName( "close" );
		close.getElement().setId("Logout_Close");

		TouchWidget closeLbl = new TouchWidget( close );

		HorizontalPanel userInforHeaderHPnl = new HorizontalPanel();
		userInforHeaderHPnl.setStyleName("changePasswordHeader");
		userInforHeaderHPnl.setVerticalAlignment( HasVerticalAlignment.ALIGN_TOP );
		userInforHeaderHPnl.add( closeLbl );

		//changed by nikita on 03-05-17 [css changes for button]start

		HorizontalPanel button = new HorizontalPanel();

		final Label changePasswordLbl=new Label( E12Constants.constants.setChangePasswordLbl() );
		changePasswordLbl.addStyleName("large");
		changePasswordLbl.addStyleName("userinfo-blue");
		changePasswordLbl.addStyleName("userinfo-awesome");
		changePasswordLbl.setWidth("103px");
		changePasswordLbl.getElement().setId("Change_Password");
		final TouchWidget changePassword = new TouchWidget( changePasswordLbl );
		final Label generatePinLbl=new Label( "Generate PIN" );
		generatePinLbl.setWidth("105px");
		generatePinLbl.addStyleName("large");
		generatePinLbl.addStyleName("userinfo-blue");
		generatePinLbl.addStyleName("userinfo-awesome");
		generatePinLbl.addStyleName("generate-pin-label");
		generatePinLbl.getElement().setId("Generate_Pin");
		//generatePinLbl.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		final TouchWidget generatePin = new TouchWidget( generatePinLbl );
		button.add(changePassword);
		button.setSpacing(8);
		//button.add(generatePin);

		//Added By Samadhan on 08-Jan-2018 [ To display my places(place time and entity) ] Start
		HorizontalPanel myPlacesHPanel = new HorizontalPanel();
		myPlacesHPanel.setWidth("100%");

		final Label myPlacesIcon = new Label("");
		/*myPlacesHPanel.addStyleName("myPlacesPnl");*/
		final Label myPlacesLbl = new Label( E12Constants.constants.setMyPlaces() );
		if(!E12Global.getInstance().isHostedMode())
		{
			myPlacesHPanel.getElement().getStyle().setMarginBottom(3, Unit.PX);
			myPlacesIcon.setStyleName("myPlacesIcon");
			myPlacesIcon.getElement().setId("myPlaces_Button_Icon");
			myPlacesLbl.addStyleName("newMyPlacesCSS");
			myPlacesLbl.addStyleName("userinfo-myplaces-new");
		}
		else
		{
			myPlacesIcon.getElement().getStyle().setMarginLeft(67, Unit.PX);
			myPlacesIcon.setStyleName("myPlacesIcon");
			myPlacesLbl.addStyleName("userinfo-myplaces");
		}
		myPlacesLbl.getElement().setId("my_places");

		final TouchWidget myPlaces = new TouchWidget( myPlacesLbl );

		myPlacesLbl.addClickHandler( new ClickHandler()
		{
			public void onClick( ClickEvent event )
			{
				welcomepopupPnl.hide();
				//Bug fixing in IOS keyboard popup: Prasad[START]
				if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
				{
					Window.scrollTo(0, 0);
					Element contents =  DOM.getElementById( "MobileContents" );
					if( contents != null )
					{
						E12CommonUtils.printOnConsole("Bhudroid contents 421");
						contents.setScrollTop(0);
					}
				}
				//Bug fixing in IOS keyboard popup: Prasad[END]
				showMyPlaces();
			}
		});

		myPlacesHPanel.add(myPlacesIcon);
		myPlacesHPanel.add(myPlaces);
		//Added By Samadhan on 08-Jan-2018 [ To display my places(place time and entity) ] End


		//Added by priyanka b on 27-Aug-2019 start

		E12CommonUtils.printOnConsole("inside myActivityPanel  start");
		HorizontalPanel myActivityPanel = new HorizontalPanel();
		myActivityPanel.setWidth("100%");
		final Label myActivityIcon = new Label("");
		/*myPlacesHPanel.addStyleName("myPlacesPnl");*/
		final Label myActivityLbl = new Label( E12Constants.constants.setActivities() );

		if(!E12Global.getInstance().isHostedMode())
		{
			myActivityPanel.getElement().getStyle().setMarginBottom(3, Unit.PX);
			myActivityIcon.setStyleName("myActivityIcon");
			myActivityIcon.getElement().setId("myPlaces_Button_Icon");
			myActivityLbl.addStyleName("newMyPlacesCSS");
			myActivityLbl.addStyleName("userinfo-myplaces-new");
		}
		else
		{
			myActivityIcon.getElement().getStyle().setMarginLeft(67, Unit.PX);
			myActivityIcon.setStyleName("myActivityIcon");
			myActivityLbl.addStyleName("userinfo-myplaces");
		}
		myActivityLbl.getElement().setId("my_activities");

		final TouchWidget myActivities = new TouchWidget( myActivityLbl );

		myActivityLbl.addClickHandler( new ClickHandler()
		{
			public void onClick( ClickEvent event )
			{
				welcomepopupPnl.hide();
				//Bug fixing in IOS keyboard popup: Prasad[START]
				if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
				{
					Window.scrollTo(0, 0);
					Element contents =  DOM.getElementById( "MobileContents" );
					if( contents != null )
					{
						E12CommonUtils.printOnConsole("Bhudroid contents 421");
						contents.setScrollTop(0);
					}
				}
				//Bug fixing in IOS keyboard popup: Prasad[END]
				showMyActivities();
				E12CommonUtils.printOnConsole("inside myActivityPanel  2");
			}
		});

		myActivityPanel.add(myActivityIcon);
		myActivityPanel.add(myActivities);
		E12CommonUtils.printOnConsole("inside myActivityPanel  end");

		//Added by priyanka b on 27-Aug-2019 end

		//added by Bhupendra to display Vision Assistant Start
		HorizontalPanel assistantHPanel = new HorizontalPanel();
		assistantHPanel.setWidth("100%");

		final Label assistantIcon = new Label("");
		assistantIcon.setStyleName("assistantIcon");
		assistantIcon.getElement().setId("assistant_button_icon");

		final Label assistantLbl = new Label( E12Constants.constants.setAssistant() );
		assistantLbl.addStyleName("assistantLbl");
		final TouchWidget assistantLblWigt = new TouchWidget( assistantLbl );

		assistantLbl.addClickHandler( new ClickHandler()
		{
			public void onClick( ClickEvent event )
			{
				welcomepopupPnl.hide();
				if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
				{
					Window.scrollTo(0, 0);
					Element contents =  DOM.getElementById( "MobileContents" );
					if( contents != null )
					{
						E12CommonUtils.printOnConsole("Bhudroid contents 421");
						contents.setScrollTop(0);
					}
				}
				//Added by sainath T. on 29-AUG-2019 [To process assistant push notification data]
				showAssistantComponent("");
			}
		});

		//if(!E12Global.getInstance().isHostedMode()){
			myPlacesHPanel.add(assistantIcon);
			myPlacesHPanel.add(assistantLblWigt);
		//}
		//added by Bhupendra to display Vision Assistant End

		//Added by sunny soni on 25-May-18 for adding setting button[end]
		//Added by sunny soni for pin on 17-NOV-16 start
		final Label changePinLbl=new Label( "Change PIN" );
		changePinLbl.setWidth("105px");
		changePinLbl.addStyleName("large");
		changePinLbl.addStyleName("userinfo-blue");
		changePinLbl.addStyleName("userinfo-awesome");
		changePinLbl.getElement().setId("Change_Pin");

		changePinLbl.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		final TouchWidget changePin = new TouchWidget( changePinLbl );
		// changePinLbl.setCellHorizontalAlignment(changePin, HasHorizontalAlignment.ALIGN_CENTER);
		//Added by sunny soni for pin on 17-NOV-16 end
		//changed by nikita on 03-05-17 [css changes for button] End
		//Added by sunny soni for generating pin on 18-NOV-16 start
		HorizontalPanel logoutpnl= new HorizontalPanel();

		//Added by sunny soni on 25-May-18 for adding setting button[start]
		final Label settingIcon = new Label("");
		settingIcon.setStyleName("settingIcon");
		settingIcon.getElement().setId("Setting_Button_Icon");

		final Label settingLbl = new Label( E12Constants.constants.setSettingBtn() );
		settingLbl.addStyleName("settingLblCSS");
		/*settingLbl.addStyleName("large");
		settingLbl.addStyleName("userinfo-awesome");*/
		final TouchWidget setting = new TouchWidget( settingLbl );

		settingLbl.addClickHandler( new ClickHandler()
		{
			public void onClick( ClickEvent event )
			{
				welcomepopupPnl.hide();
				getBleDevicesInfo(new Callback<String, String>() {
					@Override
					public void onSuccess(String result)
					{
						showBluetoothSetting(result);
					}
					@Override
					public void onFailure(String reason)
					{
						E12CommonUtils.printOnConsole("@@@@onFailure:: [ "+reason+" ]");
					}
				});
			}
		});

		final Label logouticon = new Label("");
		logouticon.setStyleName("logouticon");
		logouticon.getElement().setId("Logout_Button_Icon");
		final Label logoutLbl = new Label( E12Constants.constants.setLogoutLbl());
		logoutLbl.addStyleName("large");
		logoutLbl.addStyleName("userinfo-red");
		logoutLbl.addStyleName("userinfo-awesome");
		logoutLbl.getElement().setId("Logout_Button");
	//	logoutLbl.getElement().setAttribute("style", "paddi");
	//	logoutLbl.setWidth("115px");
		final TouchWidget logout = new TouchWidget( logoutLbl );
		logoutpnl.add(logouticon);
		logoutpnl.add(logout);
		logoutpnl.add(settingIcon);
		logoutpnl.add(setting);
		//Added by sunny soni for generating pin on 18-NOV-16 end

		/*final Label logoutLbl = new Label( E12Constants.constants.setLogoutLbl());
		logoutLbl.addStyleName("large");
		logoutLbl.addStyleName("red");
		logoutLbl.addStyleName("awesome");

		final TouchWidget logout = new TouchWidget( logoutLbl );
		*/
		// Added by Dnyaneshwar Chavan on 18-MAR-15 [Download the all forms data for off-line mode ] Start
//		final Label syncLbl=new Label( "Sync" );
//		syncLbl.addStyleName("large");
//		syncLbl.addStyleName("blue");
//		syncLbl.addStyleName("awesome");
//		final TouchWidget syncBtn = new TouchWidget( syncLbl );
		// Added by Dnyaneshwar Chavan on 18-MAR-15 [Download the all forms data for off-line mode ] End
//		  final Label agreedCOC = new Label( "Global Code of Conduct" );
//		  agreedCOC.addStyleName("large");
//		  agreedCOC.addStyleName("blue");
//		  agreedCOC.addStyleName("awesome");

		welcomeVertPanel.setSpacing ( 6 );

	//	HTML html = new HTML("<hr  style=\"width:100%;\" />");
		final Label horizontalLine = new Label();
		//horizontalLine.setStyleName("horizontalStraightLine");
		horizontalLine.addStyleName("horizontalStraightLine");

		if( E12Global.getInstance().isOffline() )
		{
			//horizontalLine.getElement().setAttribute("style", "top: 130px;");
			//added by nikita.S on  27-04-17 start
			horizontalLine.addStyleName("horizontalStraightLine");
		}

		if( "BROWSER".equalsIgnoreCase(callerInterface) )
		{
		    //htmlData.setHTML( "<html> <body> <table ><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setUserNameLbl()+" :</span> <span class='userHtmlContent'>  " + E12Constants.empName + "(" + E12Constants.empCode + ")</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setDesignationLbl()+" :</span><span class='userHtmlContent'> " + E12Constants.empDesignation + "</span></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setDivisionLbl()+" : </span><span class='userHtmlContent'>" + E12Constants.empDivision + " </span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'> "+E12Constants.constants.setHeadQuarterLbl()+" :</span><span class='userHtmlContent'> " + E12Constants.empHeadQuat + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'> "+E12Constants.constants.setDOJLbl()+" : </span> <span class='userHtmlContent'>" + E12Constants.empDOJ + "</span></div></td></tr></table> </body> </html>" );
		    htmlData.setHTML( "<html> <body> <table ><tr><td > <div class='userHtmlData' id='Logout_EMP_UserName'><span class='userHtmlContent'> " + E12Constants.empName + "(" + E12Constants.empCode + ") </span></div></td></tr><tr><td height='12px'></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_Designation'><span class='userHtmlinfo'>"+E12Constants.constants.setDesignationLbl() + " : " + E12Constants.empDesignation + "</span></div></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_Division'><span class='userHtmlinfo'>"+E12Constants.constants.setDivisionLbl()+ " : " + E12Constants.empDivision + "</span></div></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_HeadQuater'><span class='userHtmlinfo'>"+E12Constants.constants.setHeadQuarterLbl()+ " : "+ E12Constants.empHeadQuat + "</span></div></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_DOJ'><span class='userHtmlinfo'>"+E12Constants.constants.setDOJLbl()+ " : " + E12Constants.empDOJ + "</span></div></td></tr><tr><td height='15px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle' id='Logout_EMP_CONNECTION_TO'>"+E12Constants.constants.setTitleSiteLbl() +"</span></div></td></tr> <tr align='center'><td><div class='userHtmlData'><span class='userloginsite'>" + E12Constants.siteDescr+" ("+E12Constants.siteCode+") </span></div></td></tr></table> </body> </html>" );

		}
		else if( E12Global.getInstance().isOffline() )
		{
			//htmlData.setHTML( "<html><body> <table class='userHtmlData' ><tr><td> <div class='userHtmlData'><span class='userHtmlContent'>  " +E12Constants.empName + "(" + E12Constants.empCode + ") </span></div></td></tr><tr><td> <div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setDesignationLbl()+" : </span><span class='userHtmlContent'>" + E12Constants.empDesignation + "</span> </div></td></tr><tr><td><div class='userHtmlData'> <span class='userHtmlTitle'>"+E12Constants.constants.setDivisionLbl()+" :</span><span class = 'userHtmlContent'> " + E12Constants.empDivision + "</span> </div> </td></tr><tr><td> <div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setHeadQuarterLbl() + E12Constants.empHeadQuat + " </span></div></td></tr><tr><td> <div class='userHtmlData'><span class='userHtmlTitle'> "+E12Constants.constants.setDOJLbl()+" : </span><span class='userHtmlContent'> " + E12Constants.empDOJ + " </span></div></td></tr></table> </body></html>" );
			//htmlData.setHTML( "<html> <body> <table ><tr><td > <div class='userHtmlData'><span class='userHtmlContent'> " + E12Constants.empName + "(" + E12Constants.empCode + ") </span></div></td></tr><tr><td><div class='userHtmlData'><span class='userdesg'>" + E12Constants.empDesignation + "/</span><span class='userdiv'> " + E12Constants.empDivision + "</span></div></td></tr><tr><td height='14px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setHeadQuarterLbl()+ " : "+ E12Constants.empHeadQuat + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setDOJLbl()+ " : "+ E12Constants.empDOJ + "</span></div></td></tr><tr><td height='27px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setTitleSiteLbl() +"</span></div></td></tr> <tr><td><div class='userHtmlData'><span class='userloginsite'>" + E12Constants.siteDescr+" ("+E12Constants.siteCode+") </span></div></td></tr></table> </body> </html>" );
			htmlData.setHTML( "<html> <body> <table ><tr><td > <div class='userHtmlData' id='Logout_EMP_UserName'><span class='userHtmlContent'> " + E12Constants.empName + "(" + E12Constants.empCode + ") </span></div></td></tr><tr><td height='12px'></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_Designation'><span class='userHtmlinfo'>"+E12Constants.constants.setDesignationLbl() + " : " + E12Constants.empDesignation + "</span></div></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_Division'><span class='userHtmlinfo'>"+E12Constants.constants.setDivisionLbl()+ " : " + E12Constants.empDivision + "</span></div></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_HeadQuater'><span class='userHtmlinfo'>"+E12Constants.constants.setHeadQuarterLbl()+ " : "+ E12Constants.empHeadQuat + "</span></div></td></tr><tr><td><div class='userHtmlData' id='Logout_EMP_DOJ'><span class='userHtmlinfo'>"+E12Constants.constants.setDOJLbl()+ " : " + E12Constants.empDOJ + "</span></div></td></tr><tr><td height='15px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle' id='Logout_EMP_CONNECTION_TO'>"+E12Constants.constants.setTitleSiteLbl() +"</span></div></td></tr> <tr align='center'><td><div class='userHtmlData'><span class='userloginsite'>" + E12Constants.siteDescr+" ("+E12Constants.siteCode+") </span></div></td></tr></table> </body> </html>" );
			changePassword.setVisible( false );
		}
		else
		{
			//htmlData.setHTML( "<html> <body> <table ><tr><td > <div class='userHtmlData'><span class='userHtmlContent'> " + E12Constants.empName + "(" + E12Constants.empCode + ") </span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'><span class='userHtmlinfo'>" + E12Constants.empDesignation + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setDivisionLbl()+" :</span><span class='userHtmlContent'> " + E12Constants.empDivision + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setHeadQuarterLbl()+ E12Constants.empHeadQuat + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setDOJLbl()+ E12Constants.empDOJ + "</span></div></td></tr> <tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setTitleSiteLbl()+ "</span></div></td></tr><tr><td><div class='userHtmlDdta'><span class='userloginsite'>"+E12Constants.siteDescr+" ("+E12Constants.siteCode+") </span></div></td></tr> </table> </body> </html>" );
			//Changed by Sanket on 04/08/17for getting user type if user is not employee[start]
			//htmlData.setHTML( "<html> <body> <table ><tr><td > <div class='userHtmlData'><span class='userHtmlContent'> " + E12Constants.empName + "(" + E12Constants.empCode + ") </span></div></td></tr><tr><td height='12px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setDesignationLbl() + " : " + E12Constants.empDesignation + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setDivisionLbl()+ " : " + E12Constants.empDivision + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setHeadQuarterLbl()+ " : "+ E12Constants.empHeadQuat + "</span></div></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlinfo'>"+E12Constants.constants.setDOJLbl()+ " : " + E12Constants.empDOJ + "</span></div></td></tr><tr><td height='15px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setTitleSiteLbl() +"</span></div></td></tr> <tr align='center'><td><div class='userHtmlData'><span class='userloginsite'>" + E12Constants.siteDescr+" ("+E12Constants.siteCode+") </span></div></td></tr></table> </body> </html>" );
			//Changed by Pooja S on 20-NOV-2019 [Show the designation,division,HQ in userInfo of the about ] start
			/*if(userType.equalsIgnoreCase("E"))
			{*/
				String empName = E12CommonUtils.checkNull(E12Constants.empName);
				String empCode = E12CommonUtils.checkNull(E12Constants.empCode);
				String designation = E12CommonUtils.checkNull(E12Constants.empDesignation);
				String division = E12CommonUtils.checkNull(E12Constants.empDivision);
				String headQuarter = E12CommonUtils.checkNull(E12Constants.empHeadQuat);
				String dOJ = E12CommonUtils.checkNull(E12Constants.empDOJ);
				String siteDescr = E12CommonUtils.checkNull(E12Constants.siteDescr);
				String siteCode = E12CommonUtils.checkNull(E12Constants.siteCode);
				String userName = E12CommonUtils.checkNull(E12Constants.userName);
				String userCode = E12CommonUtils.checkNull(E12Constants.userID);

				String userNameLbl = "";
				String userNameLblHtml = "";
				String empLbl = "";
				String desigLbl = "";
				String desigLblHtml = "";
				String divisionLbl = "";
				String divisionLblHtml = "";
				String headQuarterLbl = "";
				String headQuarterhtml = "";
				String dOJLbl = "";
				String dOJHtml = "";
				String siteDescrLbl = "";

				if(userType.equalsIgnoreCase("E"))
				{
					if(empName.length() > 0 && empCode.length() > 0)
					{
						empLbl = empName+ "("+ empCode + ")";
						userNameLblHtml = "<tr><td><div class='userHtmlData' id='Logout_EMP_UserName'><span class='userHtmlContent'>"+ empLbl + "</span></div></td></tr>";
					}
				}
				else
				{
					if(userName.length() > 0 || userCode.length() > 0  )
					{
						userNameLbl = userName + "(" + userCode + ")";
						userNameLblHtml = "<tr><td><div class='userHtmlData'><span class='userHtmlContent'>"+ userNameLbl + "</span></div></td></tr>";
					}
				}
				if( designation.length() > 0 )
				{
					desigLbl = E12Constants.constants.setDesignationLbl() + " : " + designation ;
					desigLblHtml = "<tr><td><div class='userHtmlData' id='Logout_EMP_Designation'><span class='userHtmlinfo'>"+ desigLbl + "</span></div></td></tr>";
				}
				if( division.length() > 0 )
				{
					divisionLbl = E12Constants.constants.setDivisionLbl()+ " : " + division;
					divisionLblHtml = "<tr><td><div class='userHtmlData' id='Logout_EMP_Division'><span class='userHtmlinfo'>"+ divisionLbl + "</span></div></td></tr>";
				}
				if( headQuarter.length() > 0 )
				{
					headQuarterLbl = E12Constants.constants.setHeadQuarterLbl() + " : " + headQuarter ;
					headQuarterhtml = "<tr><td><div class='userHtmlData' id='Logout_EMP_HeadQuater'><span class='userHtmlinfo'>"+ headQuarterLbl + "</span></div></td></tr>";
				}
				if(dOJ.length() > 0 )
				{
					dOJLbl = E12Constants.constants.setDOJLbl() + " : " + dOJ;
					dOJHtml = "<tr><td><div class='userHtmlData' id='Logout_EMP_DOJ' ><span class='userHtmlinfo'>"+ dOJLbl + "</span></div></td></tr>";
				}
				if( siteDescr.length() > 0 || siteCode.length() > 0)
				{
					siteDescrLbl = "<tr><td height='15px'></td></tr>"
							+ "<tr><td>"
							+ "<div class='userHtmlData' id='Logout_Connected_To' >"
							+ "<span class='userHtmlTitle'>" + E12Constants.constants.setTitleSiteLbl() + "</span>"
							+ "</div>"
							+ "</td></tr>"
							+ "<tr align='center'><td>"
							+ "<div class='userHtmlData' id='Logout_Site_Descr' >"
							+ "<span class='userloginsite'>" + siteDescr + " </span>" //Change by sadique shaikh 27-02-2020 [removed site code]
							+ "</div>"
							+ "</td></tr>";
				}
				htmlData.setHTML("<html> <body> <table >" + userNameLblHtml +"<tr><td height='12px'></td></tr>" + desigLblHtml + divisionLblHtml + headQuarterhtml + dOJHtml + siteDescrLbl + "</table> </body> </html>");
			//}//+ "<span class='userloginsite'>" + siteDescr + " (" + siteCode + ")" + " </span>"
			/*else
			{
				String userName = E12CommonUtils.checkNull(E12Constants.userName);
				String userCode = E12CommonUtils.checkNull(E12Constants.userID);
				String siteDescr = E12CommonUtils.checkNull(E12Constants.siteDescr);
				String siteCode = E12CommonUtils.checkNull(E12Constants.siteCode);

				String userNameLbl = "";
				String userNameLblHtml = "";
				String siteDescrLbl = "";

				if(userName.length() > 0 || userCode.length() > 0  )
				{
					userNameLbl = userName + "(" + userCode + ")";
					userNameLblHtml = "<tr><td><div class='userHtmlData'><span class='userHtmlContent'>"+ userNameLbl + "</span></div></td></tr>";
				}
				if( siteDescr.length() > 0 || siteCode.length() > 0)
				{
					siteDescrLbl = "<tr><td height='15px'></td></tr><tr><td><div class='userHtmlData'><span class='userHtmlTitle'>"+E12Constants.constants.setTitleSiteLbl()+ "</span></div></td></tr>"+"<tr align='center'><td><div class='userHtmlData'><span class='userloginsite'>"+ siteDescr + "(" + siteCode+ ")"+" </span></div></td></tr>";
				}
				htmlData.setHTML("<html> <body> <table >"+ userNameLblHtml +"<tr><td height='12px'></td></tr>" + siteDescrLbl + "</table> </body> </html>" );
			}*/
			//Changed by Pooja S on 20-NOV-2019 [Show the designation,division,HQ in userInfo of the about ] End
			//Changed by sanket on 04/08/17for getting user type if user is not employee[End]
		}
		// Added by Dnyaneshwar Chavan on 18-MAR-15 [Download the all forms data for off-line mode ] Start
//		syncLbl.addClickHandler( new ClickHandler() {
//
//			@Override
//			public void onClick(ClickEvent event) {
//				new E12Sync().buildFrmDownloadInfo();
//
//			}
//		});
		// Added by Dnyaneshwar Chavan on 18-MAR-15 [Download the all forms data for off-line mode ] End

		close.addClickHandler( new ClickHandler()
		{
			@Override
			public void onClick( ClickEvent event )
			{
				setBlurClass( false );
				welcomepopupPnl.hide();
			}
		});

		logoutLbl.addClickHandler( new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {

				logoutUser();
				setBlurClass( false );
				welcomepopupPnl.hide();

				//Added by Saiprasad G on 4-Sep-18 [Closing web socket] START
				WebSocketConnection.closeConnection();
				//Added by Saiprasad G on 4-Sep-18 [Closing web socket] END
			}
		});

		// Added by Dnyaneshwar Chavan on 31-AUG-13 [Implement touch event] START
		//Commented by Ajinkya Gopalkar on 13-APR-15 [ disable touch event handle by fastclick.js ]
		/*close.addDomHandler(new TouchStartHandler()
		{
			@Override
			public void onTouchStart(TouchStartEvent event) {
				setBlurClass( false );
				welcomepopupPnl.hide();

			}
		}, TouchStartEvent.getType() );

		logoutLbl.addDomHandler(new TouchStartHandler()
		{
			@Override
			public void onTouchStart(TouchStartEvent event)
			{
				logoutUser();
				setBlurClass( false );
				welcomepopupPnl.hide();
			}
		}, TouchStartEvent.getType() );*/
		// Added by Dnyaneshwar Chavan on 31-AUG-13 [Implement touch event] END

		//Commented by Ajinkya Gopalkar on 13-APR-15 [ disable touch event handle by fastclick.js ]
		final Image userImage = new Image();
		userImage.setUrl( userImageHB.getUrl() );
		userImage.getElement().setId("userImage_clickUserImg");
		//changed by nikita on 27-APR-17 [size of user image]
		userImage.setPixelSize(104, 104);
		//Added by Nikita.S [for userimage  css] start
		if(E12Global.getInstance().getDeviceOS() == DeviceOS.iOS)
		{
		 userImage.getElement().getStyle().setLeft(15, Unit.PX);
		}
		//Added by Nikita.S [for userimage  css] end

		userImage.setStyleName("profileImage");
		userImage.addStyleName("userImage");
		//added by NIKITA on 23 march 2017 for upload image
		Label indicatorLbl = new Label();
		indicatorLbl.getElement().setId("Logout_Upload_Image");
		//indicatorLbl.setStyleName("uploadimageicon");
		//Added by Nikita.S [for icon of upload image] start
		if(E12Global.getInstance().getDeviceOS() == DeviceOS.iOS)
		{
			indicatorLbl.setStyleName("uploadImageIconIos");
		}
		else
		{
			indicatorLbl.setStyleName("uploadimageicon");
		}
		//Added by Nikita.S [for icon of upload image] End
		VerticalPanel profileImgContainer = new VerticalPanel();
		profileImgContainer.add( userImage );
		profileImgContainer.setCellHorizontalAlignment(userImage, HasHorizontalAlignment.ALIGN_CENTER);
		if(!E12Global.getInstance().isOffline())
		{
			profileImgContainer.add( indicatorLbl );
			indicatorLbl.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event)
				{
					//openProfileWindow( userImageHB,userImage );
					// Added Amol S. on 20-01-17[Req Id : W16JJOH002 ] START
					changeProfileImg(userImage);
					// Added Amol S. on 20-01-17[Req Id : W16JJOH002 ] END
				}
			});

			userImage.addClickHandler(new ClickHandler()
			{

				@Override
				public void onClick(ClickEvent event)
				{
					//openProfileWindow( userImageHB,userImage );
					//Added Amol S. on 20-01-17[Req Id : W16JJOH002 ] START
					changeProfileImg(userImage);
					//Added Amol S. on 20-01-17[Req Id : W16JJOH002 ] END
				}
			});
		}

		userImage.addErrorHandler(new ErrorHandler() {
			@Override
			public void onError(ErrorEvent event) {
				//userImage.setResource( USER_IMG );
				userImage.setHeight("88px");
				userImage.setWidth("90px");
				//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] Start
				if( ( E12Global.getInstance().getDeviceMajorVersion() == DeviceMajorVersion.iOS7 )
						|| ( E12Global.getInstance().getDeviceOS() == DeviceOS.Android ) )
				{
					String style = userImage.getElement().getAttribute( "style" );
					style = style + "; background-size: 65px 65px; border: 1px solid gray;";
					userImage.getElement().setAttribute( "style" , style );
				}
				//Added by Dnyaneshwar chavan on 4-FEB-14 [DC3JSUN002][Change the look and feel for iOS 7] End
			}
		});
		//Added by Ajinkya Gopalkar on 17-Feb-15 [Change profile image ] End
		//welcomeVertPanel.add( userImage );
	//	welcomeVertPanel.setSpacing(6);
		welcomeVertPanel.add( profileImgContainer );
		welcomeVertPanel.setSpacing ( 6 );
		//welcomeVertPanel.add(horizontalLine);
		welcomeVertPanel.setSpacing ( 4 );
		welcomeVertPanel.add( htmlData );
		welcomeVertPanel.setCellHorizontalAlignment(htmlData, HasHorizontalAlignment.ALIGN_CENTER);//CHANGED BY NIKITA
		final DisclosurePanel disclosurePnl = new DisclosurePanel("Global Code Of Conduct");
		if( "Y".equals( E12Constants.isTNCInitiated ) )
		{
			VerticalPanel listOfCode = E12TermsNCondition.getInstance().getListOfTNC( welcomepopupPnl );
			disclosurePnl.add( listOfCode );
			welcomeVertPanel.add( disclosurePnl );
			//welcomeVertPanel.add( space2 );
		}

//		welcomeVertPanel.add( syncBtn );

	// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] Start
		if( Storage.isSupported() == true)
		{
			//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] start
			E12CommonUtils.printOnConsole(" E12Storage.getItem(counter)" + E12Storage.getItemLocalStorage("counter"));
			String cntConnection = E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("counter"));
			E12Constants.isPasswordStore =  E12CommonUtils.checkNull(E12Constants.isPasswordStore);

			if ( "1".equalsIgnoreCase(cntConnection) && "1".equalsIgnoreCase(E12Constants.isPasswordStore))
			{
				E12CommonUtils.printOnConsole("E12UserInfo :: clickOnUserImage() : cntConnection [" +cntConnection+"] E12Constants.isPasswordStore [" + E12Constants.isPasswordStore +"]");

				logout.setVisible(true);
			}
		}
	// Added by Sandesh on 23.02.2016 [Reqest Id:S15KBAS001] End
		//welcomeVertPanel.add( changePassword );

		//Added by sunny soni for displaying change pin button start
		//Change done by Sandeep S. on 20-04-17 Start
		if(E12CommonUtils.checkNull(E12Storage.getItemLocalStorage("iPin_"+E12Constants.userID)).length()>0)
		{
			if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
			{
				welcomeVertPanel.add( space2 );
			}
		         	//welcomeVertPanel.add(generatePin );
			if( !E12Global.getInstance().isHostedMode() )
			{
				button.add(changePin);
			}
			       //Added by sunny soni for pin on 10-NOV-16
		}
		else
		{
			/*if(!(E12Global.getInstance().isHostedMode()))
			{*/
				if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
				{
					welcomeVertPanel.add( space2 );
				}
				if( !E12Global.getInstance().isHostedMode() )
				{
					button.add(generatePin);
				}
				//welcomeVertPanel.setCellHorizontalAlignment(logoutpnl, HasHorizontalAlignment.ALIGN_LEFT);
		}

		//Changed by Pooja on 14/09/19 [remove assistant from userInfo panel]
		//welcomeVertPanel.add(myPlacesHPanel);//Added by samadhan for my places

		//Added by priyanka b on 27-Aug-2019 start
		welcomeVertPanel.add(myActivityPanel);
		//Added by priyanka b on 27-Aug-2019 end

		welcomeVertPanel.add(button);
		welcomeVertPanel.setSpacing ( 4 );
		welcomeVertPanel.add(horizontalLine);
		welcomeVertPanel.add( logoutpnl );
		//Change done by Sandeep S. on 20-04-17 End
		//}
		//Added by sunny soni for displaying change pin button end

		//welcomeVertPanel.add( space );
		//welcomeVertPanel.add( logout );
		welcomeVertPanel.setCellHorizontalAlignment(changePassword, HasHorizontalAlignment.ALIGN_LEFT);
		welcomeVertPanel.setCellHorizontalAlignment(generatePin, HasHorizontalAlignment.ALIGN_LEFT);
		//welcomeVertPanel.add( space1 );
		welcomeVertPanel.add( buildVersion );
		//Added by Sandeep S. on 21-Apr-17 [To display version of Mobile] End
		welcomeVertPanel.setCellHorizontalAlignment(profileImgContainer, HasHorizontalAlignment.ALIGN_CENTER);
	//	welcomeVertPanel.setCellHorizontalAlignment(userImage, HasHorizontalAlignment.ALIGN_RIGHT);
		//welcomeVertPanel.add( changePasswordFrame );
		welcomeVertPanel.add( closeLbl );
		welcomepopupPnl.add( welcomeVertPanel );

		welcomepopupPnl.setPopupPositionAndShow(new PopupPanel.PositionCallback() {

			public void setPosition(int offsetWidth, int offsetHeight) {
				//Window.alert(" call to setPosition method for show the popup panel ["+Math.random()+"]");
				E12CommonUtils.printOnConsole( " call to setPosition method for show the popup panel ["+Math.random()+"]" );
				//int left = ( ( xPosOfUserImg - offsetWidth ) + 27) ;
				int left = ( ( xPosOfUserImg - offsetWidth ) + 26) ;
				if( E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
				{
					//welcomepopupPnl.setPopupPosition( ( xPosOfUserImg / 4 ), 45 );
					//welcomepopupPnl.setPopupPosition( ( xPosOfUserImg / 4 ), 32 );
					welcomepopupPnl.setPopupPosition( ( xPosOfUserImg / 4 ), 29 );
				}
				else
				{
					//welcomepopupPnl.setPopupPosition( ( left  ), 45 );
					//welcomepopupPnl.setPopupPosition( ( left  ), 32 );
					  //welcomepopupPnl.setPopupPosition( ( left  ), 29 );
					//Added by sunny soni for iphone11 ui related change i.e notch design in ios ui change[Start]
					  if(DeviceOS.iOS == E12Global.getInstance().getDeviceOS())
					  {
						  if(Window.Navigator.getPlatform().equalsIgnoreCase("iphone"))
						  {
							  if(Window.getClientHeight() > 800 && Window.getClientWidth() > 370){
								  welcomepopupPnl.setPopupPosition( ( left  ), 49 );						
							  }
							  else
							  {
								  welcomepopupPnl.setPopupPosition( ( left  ), 29 );
							  }
						  }
						  else
						  {
							  welcomepopupPnl.setPopupPosition( ( left  ), 29 );
						  }
					  }
					  else
					  {
						  welcomepopupPnl.setPopupPosition( ( left  ), 29 );
					  }
					//Added by sunny soni for iphone11 ui related change i.e notch design in ios ui change[End]
					//welcomepopupPnl.setPopupPosition( ( xPosOfUserImg / 4 ), 29 );
				}
			}
		});

		/**
		 * When click the change password button then display the change password form
		 *
		 * */
		changePasswordLbl.addClickHandler( new ClickHandler(){
			public void onClick( ClickEvent event ) {

				welcomeVertPanel.remove( htmlData );
				welcomeVertPanel.remove( space1 );
				welcomeVertPanel.remove( buildVersion );
				welcomeVertPanel.remove( changePassword );
				welcomeVertPanel.remove( logout );
				welcomeVertPanel.remove( space );
				welcomeVertPanel.remove( disclosurePnl );
				//changePasswordFrame.setVisible(true);
				addChangePasswordUI();
			}
		});

		//Added by sunny soni on 17-NOV-16 for change pin start
		changePinLbl.addClickHandler( new ClickHandler(){
			public void onClick( ClickEvent event ) {

				welcomeVertPanel.remove( htmlData );
				welcomeVertPanel.remove( space1 );
				//welcomeVertPanel.remove( buildVersion );
				welcomeVertPanel.remove( changePassword );
				welcomeVertPanel.remove( logout );
				welcomeVertPanel.remove( space );
				welcomeVertPanel.remove( disclosurePnl );
				welcomeVertPanel.remove( changePin );
				//changePasswordFrame.setVisible(true);
				//addChangePinUI();
				//addOldPinVerification();
				displayPinUI(changePinLbl.getText());
			}
		});
				//Added by sunny soni on 17-NOV-16 for change pin end

		generatePinLbl.addClickHandler( new ClickHandler(){
			public void onClick( ClickEvent event ) {

				welcomeVertPanel.remove( htmlData );
				welcomeVertPanel.remove( space1 );
				//welcomeVertPanel.remove( buildVersion );
				welcomeVertPanel.remove( changePassword );
				welcomeVertPanel.remove( logout );
				welcomeVertPanel.remove( space );
				welcomeVertPanel.remove( disclosurePnl );
				welcomeVertPanel.remove( changePin );
				//changePasswordFrame.setVisible(true);
				//addChangePinUI();
				//generatePinUI();
				displayPinUI(generatePinLbl.getText());
			}
		});

		//Added by sunny soni on 17-NOV-16 for change pin end

		// Added by Dnyaneshwar Chavan on 31-AUG-13 [Implement touch event] START
		//Commented by Ajinkya Gopalkar on 13-APR-15 [ disable touch event handle by fastclick.js ]
		/*changePasswordLbl.addDomHandler(new TouchStartHandler()
		{
			@Override
			public void onTouchStart(TouchStartEvent event)
			{
				welcomeVertPanel.remove( htmlData );
				welcomeVertPanel.remove( space1 );
				welcomeVertPanel.remove( buildVersion );
				welcomeVertPanel.remove( changePassword );
				welcomeVertPanel.remove( logout );
				welcomeVertPanel.remove( space );
				welcomeVertPanel.remove( disclosurePnl );
				//changePasswordFrame.setVisible(true);
				addChangePasswordUI();
			}
		}, TouchStartEvent.getType() ); */
		// Added by Dnyaneshwar Chavan on 31-AUG-13 [Implement touch event] END
		setBlurClass( true );
	}

	public void logoutUser()
	{
		if( "BROWSER".equalsIgnoreCase(callerInterface) )
		{

		}
		else
		{
			//Added by Sandesh Shinde [App resume redirect and notification redirect] 16-Jun-16 Start
			E12Global.getInstance().resetRedirectPath();
			//Added by Sandesh Shinde [App resume redirect and notification redirect] 16-Jun-16 End
			E12DownloadInfo.destroInstance();
			//Added by Bhupendra M for Logout Related Changes Starts
			E12CustomPlugin.checkBandwidth(new CallBack()
			{
				@Override
				public void onSuccess(String result)
				{
					E12CommonUtils.printOnConsole("In E12UserInfo logoutUser checkBandwidth on Success"+result);
					if( result.indexOf("POOR") != -1 )
					{
						//Commented by Suraj to remove offline connection mode
						//E12Global.getInstance().setOffline( false );
						E12Global.getInstance().setAuthenticated(false);
						if( MELogin.serverStatus == true )
						{
							new MELogin( "Login:True" );
						}
						else
						{
							new MELogin( "Login:False" );
						}
						MELogin.isLogOut = true;		//Change by Sandeep S. on25-SEP-17 [To resolve Proteus vision related issue of relogin]
					}
					else
					{
						//Changes by Prajyot [To send new request each time]
						//String path = E12Global.getHostUrl() + "/ibase/InstanceRemoveServlet?ACTION=LOGOUT";
						// Added by Pankaj R on 10-Jan-18 to get Battery status of device on logout[START]
						//Commented by trushant for handling session expired issue start
//						String path = E12Global.getHostUrl() + "/ibase/InstanceRemoveServlet?ACTION=LOGOUT" + "&CURRENT_GEO_POS=" +E12Constants.currentGeoPos + "&dummyInt=" + Math.random() +"&BATTERY_STATUS=" +E12Global.getInstance().getBatteryStatus();
						// Added by Pankaj R on 10-Jan-18 to get Battery status of device on logout[START]
						//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] Statr
//						E12RequestBuilder requestBuilder = new E12RequestBuilder( RequestBuilder.GET, path);
						try
						{

//							requestBuilder.sendRequest( "", new RequestCallback()
//							{
//								public void onError( Request request, Throwable exception )
//								{
//									Window.alert( E12Constants.constants.setErrInLogoutProcess() );    //Changes by Raju 19-02-14 for I18N
//								}
//								public void onResponseReceived( Request request, Response response )
//								{
//									if ( "true".equals( response.getText() ) )
//									{
							//Commented by trushant for handling session expired issue end
										//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17
										E12ApplicationsPanel.isAuthenticated = false;
										E12Global.getInstance().setAuthenticated(false);

										E12CommonUtils.printOnConsole("MELogin.serverStatus["+MELogin.serverStatus+"]");
										if( MELogin.serverStatus == true )
										{
											new MELogin( "Login:True" );
										}
										else
										{
											new MELogin( "Login:False" );
										}
										//Change by Sandeep S. on25-SEP-17 [To resolve Proteus vision related issue of relogin]
										MELogin.isLogOut = true;
//									}
//								}
//							});

						}
//						catch ( RequestException ex )
						catch ( Exception ex )
						{
							Window.alert( "RequestException" + ex.getMessage() + "]" );
							System.out.println( "RequestException : " + ex.getMessage() );
						}
					}
				}

				@Override
				public void onError(String error) {
					//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue Start
					error = E12Global.checkNull( error );
					//E12CustomPlugin.showToastMessage( error , "long" , "bottom" );		//Commented by Sagar B. for offline related changes[09-Feb-19]
					E12CommonUtils.printOnConsole("In E12UserInfo logoutUser checkBandwidth onError"+error);
					logoutUser();
					//Added by Bhupendra M on 10-05-18 for checkBandwidth Plugin Related Issue End
				}
			});
			//Added by Bhupendra M for Logout Related Changes End
			/*if( E12Global.getInstance().isOffline() )
			{
				//Commented by Suraj to remove offline connection mode
				//E12Global.getInstance().setOffline( false );
				E12Global.getInstance().setAuthenticated(false);
				if( MELogin.serverStatus == true )
				{
					new MELogin( "Login:True" );
				}
				else
				{
					new MELogin( "Login:False" );
				}
				MELogin.isLogOut = true;		//Change by Sandeep S. on25-SEP-17 [To resolve Proteus vision related issue of relogin]
			}
			else
			{
				//Changes by Prajyot [To send new request each time]
				//String path = E12Global.getHostUrl() + "/ibase/InstanceRemoveServlet?ACTION=LOGOUT";
				// Added by Pankaj R on 10-Jan-18 to get Battery status of device on logout[START]
				String path = E12Global.getHostUrl() + "/ibase/InstanceRemoveServlet?ACTION=LOGOUT" + "&CURRENT_GEO_POS=" +E12Constants.currentGeoPos + "&dummyInt=" + Math.random() +"&BATTERY_STATUS=" +E12Global.getInstance().getBatteryStatus();
				// Added by Pankaj R on 10-Jan-18 to get Battery status of device on logout[START]
				//Added by Dnyaneshwar on 27-JUN-13 [Check network is available or not ] Statr
				E12RequestBuilder requestBuilder = new E12RequestBuilder( RequestBuilder.GET, path);
				try
				{

					requestBuilder.sendRequest( "", new RequestCallback()
					{
						public void onError( Request request, Throwable exception )
						{
							Window.alert( E12Constants.constants.setErrInLogoutProcess() );    //Changes by Raju 19-02-14 for I18N
						}
						public void onResponseReceived( Request request, Response response )
						{
							if ( "true".equals( response.getText() ) )
							{
								//Added by Sandesh Shinde [App resume redirect and notification redirect when APP is in Kill state] 25-MAY-17
								E12ApplicationsPanel.isAuthenticated = false;
								E12Global.getInstance().setAuthenticated(false);

								if( MELogin.serverStatus == true )
								{
									new MELogin( "Login:True" );
								}
								else
								{
									new MELogin( "Login:False" );
								}
								//Change by Sandeep S. on25-SEP-17 [To resolve Proteus vision related issue of relogin]
								MELogin.isLogOut = true;
							}
						}
					});

				}
				catch ( RequestException ex )
				{
					Window.alert( "RequestException" + ex.getMessage() + "]" );
					System.out.println( "RequestException : " + ex.getMessage() );
				}
			}*/
		}

	}

	private void setBlurClass( boolean isBlurClass )
	{
		 try
		 {
			if(  E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
			{

				if( isBlurClass )
				{
					DOM.getElementById( "MenuComponetContents" ).addClassName( "blur" );
					DOM.getElementById( "MenuComponetFooter" ).addClassName( "blur" );

					DOM.getElementById( "PageComponentHeader" ).addClassName( "blur" );
					DOM.getElementById( "PageComponentContents" ).addClassName( "blur" );
					DOM.getElementById( "PageComponentFooter" ).addClassName( "blur" );

				}
				else
				{
					DOM.getElementById( "MenuComponetContents" ).removeClassName( "blur" );
					DOM.getElementById( "MenuComponetFooter" ).removeClassName( "blur" );

					DOM.getElementById( "PageComponentHeader" ).removeClassName( "blur" );
					DOM.getElementById( "PageComponentContents" ).removeClassName( "blur" );
					DOM.getElementById( "PageComponentFooter" ).removeClassName( "blur" );
				}
			}
			else
			{
				Element contents =  DOM.getElementById( "MobileContents" );
				Element footer = DOM.getElementById( "MobileFooter" );
				if( contents != null && footer != null )
				{
					if( isBlurClass )
					{
						contents.addClassName( "blur" );
						footer.addClassName( "blur" );
					}
					else
					{
						contents.removeClassName( "blur" );
						footer.removeClassName( "blur" );
					}
				}
			}
		} catch (Throwable e)
		{
			E12CommonUtils.printOnConsole( "Exception :: setBlurClass "+e.getMessage() );
		}
	}

	// Added by Sonam K on 10/09/18 [change user password] START
	/**
	 * To generate popup panel for change password.
	 */
	private void addChangePasswordUI()
	{
		try
		{
			welcomepopupPnl.hide();

			float winWidth = Window.getClientWidth() * 75 / 100;
			float winHeight = Window.getClientHeight() * 80 / 100;

			if(winWidth > 400)
			{
				winWidth = 400;
			}

			if(winHeight > 400)
			{
				winHeight = 400;
			}

			final E12PopupPanel e12PopupPanel = new E12PopupPanel(true, false, "", true);
			e12PopupPanel.getElement().getStyle().setZIndex(2);
			e12PopupPanel.setAnimationEnabled(false);
			e12PopupPanel.setGlassEnabled(true);
			e12PopupPanel.setGlassStyleName("bgGlass");
			e12PopupPanel.setStyleName("changePasswordPanel");
			e12PopupPanel.setWidth(winWidth + "px");
			e12PopupPanel.setHeight(winHeight + "px");

			final String compId = "changePasswordAngContainer";
			final VerticalPanel containerChangePasswordUI = new VerticalPanel();
			SimplePanel angCompContainer = new SimplePanel();
			angCompContainer.getElement().setId(compId);
			angCompContainer.addAttachHandler(new Handler() {
				private HandlerRegistration handlerRegistration = null;
				@Override
				public void onAttachOrDetach(AttachEvent event)
				{
					if (event.isAttached())
					{
						containerChangePasswordUI.getParent().getParent().getElement().getStyle().setOverflow(Overflow.HIDDEN);

						handlerRegistration = Window.addResizeHandler(new ResizeHandler()
						{
							/**
							 * To resize the change password popup panel
							 *
							 *  @param event : instance of ResizeEvent
							 */
							@Override
							public void onResize(ResizeEvent event)
							{
								float winWidth = Window.getClientWidth() * 75 / 100;
								float winHeight = Window.getClientHeight() * 80 / 100;

								if(winWidth > 400)
								{
									winWidth = 400;
								}
								if(winHeight > 400)
								{
									winHeight = 400;
								}
								e12PopupPanel.setWidth(winWidth + "px");
								e12PopupPanel.setHeight(winHeight + "px");
								e12PopupPanel.center();
							}
						});
						loadChangePasswordComponent(compId, e12PopupPanel);
					}
					else
					{
						if (handlerRegistration != null)
						{
							handlerRegistration.removeHandler();
						}
					}
				}
			});
			containerChangePasswordUI.add(angCompContainer);
			e12PopupPanel.setWidget(containerChangePasswordUI);
			e12PopupPanel.setAnimationEnabled(false);
			e12PopupPanel.center();
		}
		catch(Exception ex)
		{
			E12CommonUtils.printOnConsole("Exception in E12UserInfo :: addChangePasswordUI() : " + ex);
		}
	}

	/**
	 * To load Change Password Component on click of change password.
	 *
	 * @param componentId : The target element id for loading angular component
	 * @param e12PopupPanel : Popup panel instance
	 */
	private native void loadChangePasswordComponent(String componentId, PopupPanel e12PopupPanel) /*-{

		var self = this;

		var empName = @ibase.e12ria.client.E12Constants::empName;
		var empCode = @ibase.e12ria.client.E12Constants::empCode;
		var currPwd = @ibase.e12ria.client.E12Constants::passwordSha256;
		var minPwdLen = @ibase.e12ria.client.E12Constants::minPwdLen;
		var fname = self.@ibase.e12ria.client.E12UserInfo::empFirstName;
		var mname = self.@ibase.e12ria.client.E12UserInfo::empMiddleName;
		var lname = self.@ibase.e12ria.client.E12UserInfo::empLastName;
		var userType = @ibase.e12ria.client.E12Constants::userType;
		var userCode = @ibase.e12ria.client.E12Constants::userID;
		var userName = @ibase.e12ria.client.E12Constants::userName;
		var userLanguage = @ibase.e12ria.client.E12Constants::userLanguage;
		var compId = componentId;

		var object = {
			"componentName" : "change-password",
			"targetId" : compId,
			"empName" : empName,
			"empCode" : empCode,
			"userCode": userCode,
			"currPwd": currPwd,
			"fname" : fname,
			"mname": mname,
			"lname": lname,
			"userType": userType,
			"userName": userName,
			"userLanguage": userLanguage,
			"minPwdLen" : minPwdLen,
			"statusHeight": "80"
		};

		$wnd.userType = userType;

		if ("E" == userType) {
			$wnd.empCode = empCode;
			$wnd.fname = fname;
			$wnd.mname = mname;
			$wnd.lname = lname;
	  	}

		$wnd.userCode = userCode;
		$wnd.userName = userName;
		$wnd.currPwd = currPwd;
		$wnd.userLanguage = userLanguage;
		$wnd.minPwdLen = minPwdLen;

		$wnd.loadComponent (
			componentId,
			JSON.stringify(object),
			function(data) {
				var response = data._body;
				var constants = @ibase.e12ria.client.E12Constants::constants;

				if("UPDATED" === response) {
					self.@ibase.e12ria.client.E12UserInfo::onPasswordChanged(*)(e12PopupPanel);
				} else if("PWD_EXIST" === response) {
					var pwdExists = constants.@ibase.e12ria.client.I18NConstants::setExitsPwdMessage()();
					$wnd.alert(pwdExists);
				}
				//Added By Pankaj T. on 04-06-2020 for sun vulnerabilities added server side validation of old & new password - start
				else if ("INCORRECT_OLD_PWD" === response ) {
					var message = constants.@ibase.e12ria.client.I18NConstants::setIncorrectOldPwdMessage()();
					$wnd.alert(message); // Display GWT(custom) alert box
				}
				else if ("INVALID_PWD" === response ) {
					var message = constants.@ibase.e12ria.client.I18NConstants::setInvalidPwdMessage()();
					$wnd.alert(message); // Display GWT(custom) alert box
				}
				//Added By Pankaj T. on 04-06-2020 for sun vulnerabilities added server side validation of old & new password - end
			 }
		);
	}-*/;


	/**
	 * To logout user when password gets updated successfully.
	 *
	 * @param e12PopupPanel : Popup panel instance
	 */
	private void onPasswordChanged(E12PopupPanel e12PopupPanel) {
		e12PopupPanel.hide();
		//Added By Pankaj T. on 11-12-19 for on change password open main login screen instead of logout screen (from logout screen unable to login shows "Password did not matched" alert due to key not present in cache) - start  
		E12Storage.clearIDBData(new Callback<String, String>() {
			
			@Override
			public void onSuccess(String result) {
				E12CommonUtils.printOnConsole("In E12UserInfo onPasswordChanged clearIDBData result:["+result+"]" );
				E12Storage.clear();
				logoutUser();
			}
			
			@Override
			public void onFailure(String reason) {
				
			}
		});
		//Added By Pankaj T. on 11-12-19 for on change password open main login screen instead of logout screen (from logout screen unable to login shows "Password did not matched" alert due to key not present in cache) - end
	}

	/**
	 * To destroy Change Password Component.
	 */
	private native void destroyChangePasswordComponent() /*-{
	    $wnd.destroyComponent("change-password");

	}-*/;
	// Added by Sonam K on 10/09/18 [change user password] END


	private void setPasswordBasedOnConditions()
	{
		oldPasswordPwd.addKeyUpHandler(new KeyUpHandler()
		{
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				String oldvalue = oldPasswordPwd.getText();
				if (event.getNativeKeyCode() != KeyCodes.KEY_BACKSPACE)
				{
					if (oldvalue.length() == 0 && oldvalue.isEmpty())
					{
						newPasswordPwd.setEnabled(false);
						confirmPasswordPwd.setEnabled(false);
					}
					else
					{
						if (!newPasswordPwd.getText().isEmpty() && !confirmPasswordPwd.getText().isEmpty())
						{
							newPasswordPwd.setEnabled(true);
							confirmPasswordPwd.setEnabled(true);
						}
						else
						{
							newPasswordPwd.setEnabled(true);
							confirmPasswordPwd.setEnabled(false);
						}
					}
				}
				else
				{
					newPasswordPwd.setEnabled(false);
					confirmPasswordPwd.setEnabled(false);
				}
			}
		});

		newPasswordPwd.addKeyUpHandler(new KeyUpHandler()
		{
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				//Changed By Sanket J on 04/08/17 for getting userType if employee is not present for password change[Start]
				if(userType.equalsIgnoreCase("E"))
				{
					String[] splitEmpName;
					String empName = E12Constants.empName;
					splitEmpName = empName.split(" ");
					empFirstName = splitEmpName[0];
					empMiddleName = splitEmpName[1];
					empLastName = splitEmpName[2];

					if (empFirstName == null || empFirstName == "undefined")
					{
						empFirstName = "";
					}
					else if (empMiddleName == null || empMiddleName == "undefined")
					{
						empMiddleName = "";
					}
					else if (empLastName == null || empLastName == "undefined")
					{
						empLastName = "";
					}
				}
				//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]
				newPass = newPasswordPwd.getText();
				empCode = E12Constants.empCode;
				empFirstName = empFirstName.trim().toLowerCase();
				empMiddleName = empMiddleName.trim().toLowerCase();
				empLastName = empLastName.trim().toLowerCase();
				empCode = empCode.trim().toLowerCase();
				//Added By Sanket J on 04/08/17 Checking fname,lname,mname if usertype is employee[Start]
				userCode = E12CommonUtils.checkNull(E12Constants.userID).toLowerCase();
				userName = E12CommonUtils.checkNull(E12Constants.userName).toLowerCase();
				userType = E12Constants.userType;
				//Added By Sanket J on 04/08/17 Checking fname,lname,mname if usertype is employee[End]

				if (newPasswordPwd.getValue() != "")
				{
					if (newPass.toLowerCase().indexOf("password") == -1)
					{
						if (newPass.length() < pwdLength)
						{
							newPassImg.setStyleName("wrongPass");
							confirmPasswordPwd.setEnabled(false);
						}
						else
						{
							//Changed By Sanket J on 04/08/17 for getting userType if employee is not present for password change[Start]
							if(userType.equalsIgnoreCase("E"))
							{
								if (empFirstName == "" || empFirstName.isEmpty())
								{
									if (newPass.toLowerCase().indexOf(empMiddleName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empLastName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empCode) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else
									{
										setCorrectPassword();
									}
								}
								else if (empMiddleName == ""|| empMiddleName.isEmpty())
								{
									if (newPass.toLowerCase().indexOf(empFirstName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empLastName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empCode) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else
									{
										setCorrectPassword();
									}
								}
								else if (empLastName == "" || empLastName.isEmpty())
								{
									if (newPass.toLowerCase().indexOf(empFirstName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empMiddleName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empCode) != -1) {
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else
									{
										setCorrectPassword();
									}
								}
								else
								{
									if (newPass.toLowerCase().indexOf(empFirstName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empMiddleName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empLastName) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else if (newPass.toLowerCase().indexOf(empCode) != -1)
									{
										newPassImg.setStyleName("wrongPass");
										confirmPasswordPwd.setEnabled(false);
									}
									else
									{
										setCorrectPassword();
									}
								}
							}
							//Changed By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]
							//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]
							else
							{
								//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[Start]
								E12CommonUtils.printOnConsole("inside else if usertype ["+userType+"]---username---["+userName+"]---usrcode---["+userCode+"]");
								if (newPass.toLowerCase().indexOf(userName) != -1)
								{
									newPassImg.setStyleName("wrongPass");
									confirmPasswordPwd.setEnabled(false);
								}
								else if (newPass.toLowerCase().indexOf(userCode) != -1)
								{
									newPassImg.setStyleName("wrongPass");
									confirmPasswordPwd.setEnabled(false);
								}
								else
								{
									setCorrectPassword();
								}
							}
						}
						//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]
					}
					else
					{
						newPassImg.setStyleName("wrongPass");
						confirmPasswordPwd.setEnabled(false);
					}
				}
				else
				{
					confirmPasswordPwd.setText("");
					confirmPasswordPwd.setEnabled(false);
					confirmPassImg.removeStyleName("confirmRightPass");
					confirmPassImg.removeStyleName("confirmWrongPass");
					newPassImg.removeStyleName("rightPass");
					newPassImg.removeStyleName("wrongPass");
				}
			}
		});

		confirmPasswordPwd.addKeyUpHandler(new KeyUpHandler()
		{
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				String newpassval = newPasswordPwd.getText();
				String confirmpassval = confirmPasswordPwd.getText();
				if (confirmPasswordPwd.getValue() != "")
				{
					if (newpassval.length() != 0 && confirmpassval.equals(newpassval))
					{
						confirmPassImg.setStyleName("confirmRightPass");
					}
					else
					{
						confirmPassImg.setStyleName("confirmWrongPass");
					}
				}
				else
				{
					confirmPasswordPwd.setEnabled(true);
					confirmPassImg.removeStyleName("confirmRightPass");
					confirmPassImg.removeStyleName("confirmWrongPass");
				}
			}
		});
	}

	private void setCorrectPassword()
	{
		if (localeName.equals("ru"))
		{
			if (newPass.length() == 0 && newPass.isEmpty())
			{
				newPassImg.setStyleName("wrongPass");
				confirmPasswordPwd.setEnabled(false);
			}
			else
			{
				newPassImg.setStyleName("rightPass");
				confirmPasswordPwd.setEnabled(true);
			}
		}
		else
		{
			if (newPass.matches(PASSWORD_PATTERN))
			{
				newPassImg.setStyleName("rightPass");
				confirmPasswordPwd.setEnabled(true);
			}
			else if (newPass.matches(PASS_PATTERN))
			{
				newPassImg.setStyleName("rightPass");
				confirmPasswordPwd.setEnabled(true);
			}
			else
			{
				newPassImg.setStyleName("wrongPass");
				confirmPasswordPwd.setEnabled(false);
			}
		}
	}

	public static native boolean passValid(String currPass, String newPass, String confirmPass )
	/*-{
			var empName = @ibase.e12ria.client.E12Constants::empName;
			var empCode = @ibase.e12ria.client.E12Constants::empCode;
			var currPwd = @ibase.e12ria.client.E12Constants::passwordSha256;
			var minPwdLen = @ibase.e12ria.client.E12Constants::minPwdLen;

			//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[Start]
			var userType = @ibase.e12ria.client.E12Constants::userType;
			var userCode = @ibase.e12ria.client.E12Constants::userID;
			var userName = @ibase.e12ria.client.E12Constants::userName;
			//Added By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]

			var fname = "", mname = "", lname = "";
//			Changed by Savita yadav -Start
//			if( empName.indexOf(".") !== -1 )
//			{
//				empNameSlipt = empName.split(".");
//				fname = empNameSlipt[0];
//				mname = empNameSlipt[1];
//				lname = empNameSlipt[2];
//			}
			//Changed By Sanket J on 04/08/17 for getting userType if employee is not present for password change[Start]
			$wnd.userType = userType;

			if("E" == userType)
			{
				empNameSlipt = empName.split(" ");
				fname = empNameSlipt[0];
				mname = empNameSlipt[1];
				lname = empNameSlipt[2];
//				Changed by Savita yadav -End
				$wnd.empCode = empCode;
				$wnd.fname = fname;
				$wnd.mname = mname;
				$wnd.lname = lname;
			}

			$wnd.userCode = userCode;
			$wnd.userName = userName;
			//Changed By Sanket J on 04/08/17 for getting userType if employee is not present for password change[End]
			$wnd.currPwd = currPwd;
			//	$wnd.minPwdLen = 8;
			$wnd.minPwdLen = minPwdLen;  		//Added by Savita Yadav
			return $wnd.isPassVaild(currPass, newPass, confirmPass);

	}-*/;


	//Commented by Amol S on 24-Jan-17 [To crop & upload profile image]
	//Added by Ajinkya Gopalkar on 17-Feb-15 [Change profile image ] Start
	/**
	 * This method open profile image change window<BR>
	 * for capture the image from device camera or<BR>
	 * select the image from device gallery.
	 *
	 * @param userImageHB the displaying on header bar.
	 * @param userImage the displaying on user popup window.
	 */
	/*public void openProfileWindow( Image userImageHB, Image userImage )
	{
		//profile popup will draw on hosted mode or mobile interface
//		if( !E12Global.getInstance().isHostedMode() )
		{
			E12ChangeProfileImage changeProfileImage = new E12ChangeProfileImage( userImageHB, userImage );
			changeProfileImage.profilePopupUI();
		}
	}*/
	//Added by Ajinkya Gopalkar on 17-Feb-15 [Change profile image ] End
	//Added By Savita on 8-04-2015 [To get password length]-Start

		public static native int getMinPwdLen( )
		/*-{
			 var minPwdLen = @ibase.e12ria.client.E12Constants::minPwdLen;
			 return minPwdLen;
		}-*/;

		//Added By Savita on 8-04-2015 [To get password length ]-End

	//Added by sunny soni for show pin UI on 10-NOV-16 start
	private void addOldPinVerification()
	{
		final String iPin = E12Storage.getItemLocalStorage("iPin_"+E12Constants.userID);
		welcomepopupPnl.hide();
		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",true);

		HorizontalPanel oldPassPanel = new HorizontalPanel();
		oldPassPanel.setWidth("100%");
		oldPassPanel.getElement().getStyle().setMarginTop(5, Unit.PX);

		HorizontalPanel oldLblPanel = new HorizontalPanel();
		newPassImg = new Label();
		confirmPassImg = new Label();

		final VerticalPanel containerChangePasswordUI = new VerticalPanel();

		final Label changePasswordLbl = new Label( "Change Pin" );
		changePasswordLbl.setStyleName( "changePasswordHeading" );

		Label oldPinLbl = new Label( "Enter Old PIN" );
		//New Added by sunny soni showing error instead of pop panel[Start]
		final HorizontalPanel horzPinErrPanel = new HorizontalPanel();
		Label errspace= new Label();
		errspace.getElement().getStyle().setHeight(10, Unit.PX);
		final Label errorPinLbl = new Label();
		errorPinLbl.getElement().getStyle().setColor("red");
		errorPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		horzPinErrPanel.setVisible(false);
		horzPinErrPanel.add(errspace);
		horzPinErrPanel.add(errorPinLbl);
		//New Added by sunny soni showing error instead of pop panel[End]

		final E12TextBox oldpinText = new E12TextBox("number");
		final E12TextBox oldpinText1 = new E12TextBox("number");
		final E12TextBox oldpinText2 = new E12TextBox("number");
		final E12TextBox oldpinText3 = new E12TextBox("number");

		oldpinText.getElement().setId("oldpinText_1");

		oldpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);

		oldpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);

		oldpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		oldpinText.setStyleName( "pinTextstylecss loginTextcss" );
		oldpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		oldpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		oldpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		final Button changeLbl = new Button( "Next" );
		changeLbl.addStyleName("pinButton");
		changeLbl.getElement().setId("E12USerInfo_Change_Pin_Next_Button");
		final Button resetLbl = new Button( E12Constants.constants.setresetLbl() );
		resetLbl.addStyleName("pinButton");
		resetLbl.getElement().setId("E12USerInfo_Change_Pin_Reset_Button");

		HorizontalPanel btnContainer = new HorizontalPanel();
		btnContainer.setWidth( "100%" );
		btnContainer.add( resetLbl );
		btnContainer.add( changeLbl );
		btnContainer.setCellHorizontalAlignment( changeLbl, HasHorizontalAlignment.ALIGN_RIGHT );

		Label space1 = new Label();
		space1.setStyleName( "space1" );

		Label space2 = new Label();
		space2.setStyleName( "space" );

		Label oldLblSpace = new Label();
		oldLblSpace.setWidth("20px");

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {
		@Override
		  public void execute() {
		   int width = e12PopupPanel.getOffsetWidth();
		   int lblwidth = width-28;
		   changePasswordLbl.setWidth(Integer.toString(lblwidth) +"px");
		   oldpinText.setFocus(true);
		  }
		});
		//Added by sunny soni for getting focus on textbox [Start]
		(new Timer() {
			   @Override
			   public void run() {
				   oldpinText.setFocus(true);
			   }
			}).schedule(500);
		//Added by sunny soni for getting focus on textbox [End]
		e12PopupPanel.addStyleName("adjustPopup");//Added by sunny soni for adjusting pin popup panel.

		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");


		if( E12Global.getInstance().getDeviceType() == DeviceType.Mobile )							 //for Mobile Device
		{
			oldPassPanel.add(oldpinText);
			oldPassPanel.add(oldpinText1);
			oldPassPanel.add(oldpinText2);
			oldPassPanel.add(oldpinText3);

			if(localeName.equals("ru"))
			{
				resetLbl.addStyleName("redPassRuBtn");
				changeLbl.addStyleName("greenPassRuBtn");
			}
			else
			{
				resetLbl.addStyleName("redPinBtn");
				changeLbl.addStyleName("greenPinBtn");
			}
			space1.setHeight("21px");

			containerChangePasswordUI.add( changePasswordLbl );
			containerChangePasswordUI.add( space1 );
			containerChangePasswordUI.add( oldPinLbl);

			containerChangePasswordUI.add( oldPassPanel);

			containerChangePasswordUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

			containerChangePasswordUI.add( space2 );
			containerChangePasswordUI.add( btnContainer );
		}
		else if( E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
		 {
			oldPassPanel.add(oldpinText);
			oldPassPanel.add(oldpinText1);
			oldPassPanel.add(oldpinText2);
			oldPassPanel.add(oldpinText3);

			if(localeName.equals("ru"))
			{
				resetLbl.addStyleName("redPassRuBtn");
				changeLbl.addStyleName("greenPassRuBtn");
			}
			else
			{
				resetLbl.addStyleName("redPinBtn");
				changeLbl.addStyleName("greenPinBtn");
			}
			space1.setHeight("21px");

			containerChangePasswordUI.add( changePasswordLbl );
			containerChangePasswordUI.add( space1 );
			containerChangePasswordUI.add( oldPinLbl);

			containerChangePasswordUI.add( oldPassPanel);

			containerChangePasswordUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

			containerChangePasswordUI.add( space2 );
			containerChangePasswordUI.add( btnContainer );
		 }
		oldpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
				{
					//oldpinText.setText(oldpinText.getText().substring(0, 1));
					oldpinText.getElement().setPropertyString("type", "password");
					oldpinText.setText(oldpinText.getText().substring(oldpinText.getText().length()-1, oldpinText.getText().length()));
					horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.setFocus(true);
					}
					else
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setFocus(true);
					}
				}
				if( oldpinText.getText().length() == 0 )
				{
					oldpinText.setText("".trim());
					return;
				}
			}
		});
		oldpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
				{
					oldpinText1.getElement().setPropertyString("type", "password");
					//oldpinText1.setText(oldpinText1.getText().substring(0, 1));
					oldpinText2.setText(oldpinText2.getText().substring(oldpinText2.getText().length()-1, oldpinText2.getText().length()));
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.setFocus(true);
					}
					else
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setFocus(true);
					}
				}
				if( oldpinText1.getText().length() == 0 )
				{
					oldpinText1.setText("".trim());
					return;
				}
			}
		});
		oldpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
				{
					oldpinText2.getElement().setPropertyString("type", "password");
					//oldpinText2.setText(oldpinText2.getText().substring(0, 1));
					oldpinText2.setText(oldpinText2.getText().substring(oldpinText2.getText().length()-1, oldpinText2.getText().length()));
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.setFocus(true);
					}
					else
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setFocus(true);
					}
				}
				if( oldpinText2.getText().length() == 0 )
				{
					oldpinText2.setText("".trim());
					return;
				}
			}
		});
		oldpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
				{
					/*oldpinText3.getElement().setPropertyString("type", "password");
					oldpinText3.setText(oldpinText3.getText().substring(0, 1));*/
					/*if( !(oldpinText3.getValue().isEmpty()) )
					{
						changeLbl.setFocus(true);
					}*/
					//final String iPin = E12Storage.getItem("iPin_"+E12Constants.userID);
					oldpinText3.getElement().setPropertyString("type", "password");
					oldpinText3.setText(oldpinText3.getText().substring(oldpinText3.getText().length()-1, oldpinText3.getText().length()));

					String pinValues = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();

					if(pinValues.length() == 4)
					{
						final String ipinVal = SHA256.toSha256(pinValues);

						if(iPin.equalsIgnoreCase(ipinVal))
						{
							/*oldpinText3.getElement().setPropertyString("type", "password");
							oldpinText3.setText(oldpinText3.getText().substring(0, 1));*/
							changeLbl.setFocus(true);
						}
						else
						{
							oldpinText3.getElement().setPropertyString("type", "number");
							oldpinText3.setFocus(false);
							//Added by sunny soni for showing error message [Start]
							errorPinLbl.setText("Incorrect PIN.");
							horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzPinErrPanel.setVisible(true);
							oldpinText.getElement().setPropertyString("type", "number");
							oldpinText.setText("".trim());
							oldpinText1.setText("".trim());
							oldpinText2.setText("".trim());
							oldpinText3.setText("".trim());
							oldpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]

							/*final PopupPanel msgPopPanel = new PopupPanel();
							VerticalPanel vertMsgPanel = new VerticalPanel();
							vertMsgPanel.setWidth("100%");
							Label msg = new Label("Incorrect PIN.");

							final Button okBtn = new Button("OK");
							TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
							okBtn.setWidth("40%");
							okBtn.addStyleName("okpopButton");

							vertMsgPanel.add(msg);
							vertMsgPanel.add(nextBtnTouchWidget);

							vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
							vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

							//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
							if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
							{
								msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
							}
							else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
							{
								msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
							}
							msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
							msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
							msgPopPanel.add(vertMsgPanel);
							msgPopPanel.setGlassEnabled(true);
							msgPopPanel.getElement().getStyle().setZIndex(2);
							msgPopPanel.center();

							okBtn.addClickHandler(new ClickHandler() {

								@Override
								public void onClick(ClickEvent event) {
									msgPopPanel.hide();
									oldpinText.getElement().setPropertyString("type", "number");
									oldpinText.setText("".trim());
									oldpinText1.setText("".trim());
									oldpinText2.setText("".trim());
									oldpinText3.setText("".trim());
									oldpinText.setFocus(true);
								}
							});*/
						}
					}
					else
					{
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Please Enter 4-Digit PIN.");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setText("".trim());
						oldpinText1.setText("".trim());
						oldpinText2.setText("".trim());
						oldpinText3.setText("".trim());
						oldpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]

						/*final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Please Enter 4-Digit Pin.");
						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");

						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

						//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
						if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
						{
							msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()-180, Unit.PX);
						}
						else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
						{
							msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
						}
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								oldpinText.getElement().setPropertyString("type", "number");
								oldpinText.setText("".trim());
								oldpinText1.setText("".trim());
								oldpinText2.setText("".trim());
								oldpinText3.setText("".trim());
								oldpinText.setFocus(true);
							}
						});*/
					}

				}
				if( oldpinText3.getText().length() == 0 )
				{
					oldpinText3.setText("".trim());
					return;
				}
			}
		});

		oldpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
					{
						oldpinText.setText(oldpinText.getText().substring(0, 1));
						oldpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		oldpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText1.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
					{
						oldpinText1.getElement().setPropertyString("type", "password");
						oldpinText1.setText(oldpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		oldpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText2.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
					{
						oldpinText2.getElement().setPropertyString("type", "password");
						oldpinText2.setText(oldpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		oldpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText3.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
					{
						oldpinText3.getElement().setPropertyString("type", "password");
						oldpinText3.setText(oldpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		oldpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText.getValue().isEmpty()))
				{
					oldpinText.getElement().setPropertyString("type", "number");
					oldpinText.setCursorPos(oldpinText.getValue().length());
					if(!(oldpinText.getValue().equalsIgnoreCase("")))
					{
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setText(oldpinText.getText().substring(0, 1));
						oldpinText.setFocus(true);
					}
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText1.getValue().isEmpty()))
				{
					oldpinText1.getElement().setPropertyString("type", "number");
					oldpinText1.setCursorPos(oldpinText1.getValue().length());
					if(!(oldpinText1.getValue().equalsIgnoreCase("")))
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setText(oldpinText1.getText().substring(0, 1));
						oldpinText1.setFocus(true);
					}
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText2.getValue().isEmpty()))
				{
					oldpinText2.getElement().setPropertyString("type", "number");
					oldpinText2.setCursorPos(oldpinText2.getValue().length());
					if(!(oldpinText2.getValue().equalsIgnoreCase("")))
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setText(oldpinText2.getText().substring(0, 1));
						oldpinText2.setFocus(true);
					}
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText3.getValue().isEmpty()))
				{
					oldpinText3.getElement().setPropertyString("type", "number");
					oldpinText3.setCursorPos(oldpinText3.getValue().length());
					if(!(oldpinText3.getValue().equalsIgnoreCase("")))
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setText(oldpinText3.getText().substring(0, 1));
						oldpinText3.setFocus(true);
					}
				}
			}
		});

		oldpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				oldpinText.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText1.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText2.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText3.getElement().setPropertyString("type", "number");
			}
		});

		changeLbl.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				final String iPin = E12Storage.getItemLocalStorage("iPin_"+E12Constants.userID);
				E12CommonUtils.printOnConsole("Ipin In E12Application:::: [ "+iPin+" ]");
				String pinValues = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();
				final String ipinVal = SHA256.toSha256(pinValues);


				if(pinValues.length() == 4)
				{
					if(iPin.equalsIgnoreCase(ipinVal))
					{
						e12PopupPanel.hide();
						addChangePinUI();
					}
					else
					{
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Incorrect PIN.");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setText("".trim());
						oldpinText1.setText("".trim());
						oldpinText2.setText("".trim());
						oldpinText3.setText("".trim());
						oldpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]

						/*final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Incorrect PIN.");

						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");

						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

						msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								oldpinText.getElement().setPropertyString("type", "number");
								oldpinText.setText("".trim());
								oldpinText1.setText("".trim());
								oldpinText2.setText("".trim());
								oldpinText3.setText("".trim());
								oldpinText.setFocus(true);
							}
						});*/
					}
				}
			}
		});

		resetLbl.addClickHandler( new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				oldpinText.getElement().setPropertyString("type", "number");
				oldpinText.setText( "" );
				oldpinText1.setText( "" );
				oldpinText2.setText( "" );
				oldpinText3.setText( "" );
				oldpinText.setFocus(true);

				newPassImg.removeStyleName("rightPass");
				newPassImg.removeStyleName("wrongPass");
				confirmPassImg.removeStyleName("confirmRightPass");
				confirmPassImg.removeStyleName("confirmWrongPass");
			}
		});
    	e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerChangePasswordUI );
		e12PopupPanel.setAnimationEnabled(false);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
        ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();
	}
	private void addChangePinUI()
	{
		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",true);
		HorizontalPanel newPassPanel= new HorizontalPanel();
		HorizontalPanel confirmPassPanel = new HorizontalPanel();
		HorizontalPanel newLblPanel = new HorizontalPanel();
		newLblPanel.setWidth("150px");
		HorizontalPanel confirmLblPanel = new HorizontalPanel();
		confirmLblPanel.setWidth("150px");

		newPassImg = new Label();
		confirmPassImg = new Label();

		final VerticalPanel containerChangePasswordUI = new VerticalPanel();

		final Label changePasswordLbl = new Label( "Change Pin" );
		changePasswordLbl.setStyleName( "changePasswordHeading" );

		Label newPinLbl = new Label( "Enter New PIN" );
		Label confirmPinLbl = new Label( "Confirm PIN" );

		final E12TextBox newpinText = new E12TextBox("number");
		final E12TextBox newpinText1 = new E12TextBox("number");
		final E12TextBox newpinText2 = new E12TextBox("number");
		final E12TextBox newpinText3 = new E12TextBox("number");

		newpinText.getElement().setId("newpinText_1");

		newpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		newpinText.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		final E12TextBox confirmpinText = new E12TextBox("number");
		final E12TextBox confirmpinText1 = new E12TextBox("number");
		final E12TextBox confirmpinText2 = new E12TextBox("number");
		final E12TextBox confirmpinText3 = new E12TextBox("number");

		confirmpinText.getElement().setId("confirmpinText_1");

		confirmpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText3.getElement().getStyle().setMarginLeft(14, Unit.PX);

		confirmpinText.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		confirmpinText.setEnabled(false);
		confirmpinText1.setEnabled(false);
		confirmpinText2.setEnabled(false);
		confirmpinText3.setEnabled(false);

		final Button changeLbl = new Button( E12Constants.constants.setchangeLbl() );
		changeLbl.addStyleName("pinButton");
		changeLbl.getElement().setId("E12UserInfo_Change_Pin_Button");
		final Button resetLbl = new Button( E12Constants.constants.setresetLbl() );
		resetLbl.addStyleName("pinButton");
		resetLbl.getElement().setId("E12UserInfo_Reset_Pin_Button");

		//Added by sunny soni for getting focus on textbox [Start]
		(new Timer() {
			   @Override
			   public void run() {
				   newpinText.setFocus(true);
			   }
			}).schedule(500);
		//Added by sunny soni for getting focus on textbox [End]
		//New Added by sunny soni showing error instead of pop panel[Start]
		final HorizontalPanel horzPinErrPanel = new HorizontalPanel();
		Label errspace= new Label();
		errspace.getElement().getStyle().setHeight(10, Unit.PX);
		final Label errorPinLbl = new Label();
		errorPinLbl.getElement().getStyle().setColor("red");
		errorPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		horzPinErrPanel.setVisible(false);
		horzPinErrPanel.add(errspace);
		horzPinErrPanel.add(errorPinLbl);
		//New Added by sunny soni showing error instead of pop panel[End]

		changeLbl.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				String newPin = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
				if(newPin.length() == 4)
				{
					e12PopupPanel.hide(true);
					showMessagePanel(newPin).center();
				}
			}
		});

		resetLbl.addClickHandler( new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				newpinText.getElement().setPropertyString("type", "number");
				newpinText.setText( "" );
				newpinText1.setText( "" );
				newpinText2.setText( "" );
				newpinText3.setText( "" );

				confirmpinText.setText( "" );
				confirmpinText1.setText( "" );
				confirmpinText2.setText( "" );
				confirmpinText3.setText( "" );

				newpinText.setFocus(true);

				confirmpinText.setEnabled(false);
				confirmpinText1.setEnabled(false);
				confirmpinText2.setEnabled(false);
				confirmpinText3.setEnabled(false);

				newPassImg.removeStyleName("rightPass");
				newPassImg.removeStyleName("wrongPass");
				confirmPassImg.removeStyleName("confirmRightPass");
				confirmPassImg.removeStyleName("confirmWrongPass");
			}
		});

		HorizontalPanel btnContainer = new HorizontalPanel();
		btnContainer.setWidth( "100%" );
		btnContainer.add( resetLbl );
		btnContainer.add( changeLbl );
		btnContainer.setCellHorizontalAlignment( changeLbl, HasHorizontalAlignment.ALIGN_RIGHT );

		Label space1 = new Label();

		space1.setStyleName( "space1" );
		Label space2 = new Label();
		space2.setStyleName( "space" );
		Label space3 = new Label();
		space3.setStyleName( "space" );
		Label space4 = new Label();
		space4.setStyleName( "changePasswordSpace" );

		Label oldLblSpace = new Label();
		oldLblSpace.setWidth("20px");
		Label newLblSpace = new Label();
		newLblSpace.setWidth("20px");
		Label confirmLblSpace = new Label();
		confirmLblSpace.setWidth("20px");
		Label space5= new Label();
		space5.setStyleName("buttonSpace");

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		  @Override
		  public void execute() {
			  newpinText.setFocus(true);
		   int width = e12PopupPanel.getOffsetWidth();
		   int lblwidth = width-28;
		   changePasswordLbl.setWidth(Integer.toString(lblwidth) +"px");
		  }
		});
		e12PopupPanel.addStyleName("adjustPopup");//Added by sunny soni for adjusting pin popup panel.
		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("closeAdjust close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");

		if( E12Global.getInstance().getDeviceType() == DeviceType.Mobile )							 //for Mobile Device
		{
			newPassPanel.add(newpinText);
			newPassPanel.add(newpinText1);
			newPassPanel.add(newpinText2);
			newPassPanel.add(newpinText3);

			confirmPassPanel.add(confirmpinText);
			confirmPassPanel.add(confirmpinText1);
			confirmPassPanel.add(confirmpinText2);
			confirmPassPanel.add(confirmpinText3);
			newPassPanel.add(newPassImg);
			confirmPassPanel.add(confirmPassImg);
			if(localeName.equals("ru"))
			{
				resetLbl.addStyleName("redPassRuBtn");
				changeLbl.addStyleName("greenPassRuBtn");
			}
			else
			{
				resetLbl.addStyleName("redPinBtn");
				changeLbl.addStyleName("greenPinBtn");
			}

			confirmPinLbl.getElement().getStyle().setMarginTop(7, Unit.PX);

			space1.setHeight("21px");
			containerChangePasswordUI.add( changePasswordLbl );
			containerChangePasswordUI.add( space1 );
			containerChangePasswordUI.add( newPinLbl );
			containerChangePasswordUI.add( newPassPanel );
			containerChangePasswordUI.add( space3 );
			containerChangePasswordUI.add( confirmPinLbl );
			containerChangePasswordUI.add( confirmPassPanel );

			containerChangePasswordUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

			containerChangePasswordUI.add( space4 );
			containerChangePasswordUI.add( btnContainer );

		}
		else if( E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
		 {
			newPassPanel.add(newpinText);
			newPassPanel.add(newpinText1);
			newPassPanel.add(newpinText2);
			newPassPanel.add(newpinText3);

			confirmPassPanel.add(confirmpinText);
			confirmPassPanel.add(confirmpinText1);
			confirmPassPanel.add(confirmpinText2);
			confirmPassPanel.add(confirmpinText3);
			newPassPanel.add(newPassImg);
			confirmPassPanel.add(confirmPassImg);
			if(localeName.equals("ru"))
			{
				resetLbl.addStyleName("redPassRuBtn");
				changeLbl.addStyleName("greenPassRuBtn");
			}
			else
			{
				resetLbl.addStyleName("redPinBtn");
				changeLbl.addStyleName("greenPinBtn");
			}

			confirmPinLbl.getElement().getStyle().setMarginTop(7, Unit.PX);

			space1.setHeight("21px");
			containerChangePasswordUI.add( changePasswordLbl );
			containerChangePasswordUI.add( space1 );
			containerChangePasswordUI.add( newPinLbl );
			containerChangePasswordUI.add( newPassPanel );
			containerChangePasswordUI.add( space3 );
			containerChangePasswordUI.add( confirmPinLbl );
			containerChangePasswordUI.add( confirmPassPanel );

			containerChangePasswordUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

			containerChangePasswordUI.add( space4 );
			containerChangePasswordUI.add( btnContainer );
		 }

		newpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
				{
					/*newpinText.setText(newpinText.getText().substring(0, 1));*/
					newpinText.getElement().setPropertyString("type", "password");
					newpinText.setText(newpinText.getText().substring(newpinText.getText().length()-1, newpinText.getText().length()));
					horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
					if(newpinText1.getValue().isEmpty())
					{
						newpinText1.setFocus(true);
					}
					else
					{
						newpinText1.getElement().setPropertyString("type", "number");
						newpinText1.setFocus(true);
					}
				}
				if( newpinText.getText().length() == 0 )
				{
					newpinText.setText("".trim());
					return;
				}
			}
		});
		newpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
				{
					newpinText1.getElement().setPropertyString("type", "password");
					//newpinText1.setText(newpinText1.getText().substring(0, 1));
					newpinText1.setText(newpinText1.getText().substring(newpinText1.getText().length()-1, newpinText1.getText().length()));
					if(newpinText2.getValue().isEmpty())
					{
						newpinText2.setFocus(true);
					}
					else
					{
						newpinText2.getElement().setPropertyString("type", "number");
						newpinText2.setFocus(true);
					}
				}
				if( newpinText1.getText().length() == 0 )
				{
					newpinText1.setText("".trim());
					return;
				}
			}
		});
		newpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
				{
					newpinText2.getElement().setPropertyString("type", "password");
					/*newpinText2.setText(newpinText2.getText().substring(0, 1));*/
					newpinText2.setText(newpinText2.getText().substring(newpinText2.getText().length()-1, newpinText2.getText().length()));
					if(newpinText3.getValue().isEmpty())
					{
						newpinText3.setFocus(true);
					}
					else
					{
						newpinText3.getElement().setPropertyString("type", "number");
						newpinText3.setFocus(true);
					}
				}
				if( newpinText2.getText().length() == 0 )
				{
					newpinText2.setText("".trim());
					return;
				}
			}
		});
		newpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
				{
					newpinText3.getElement().setPropertyString("type", "password");
					//newpinText3.setText(newpinText3.getText().substring(0, 1));
					newpinText3.setText(newpinText3.getText().substring(newpinText3.getText().length()-1, newpinText3.getText().length()));
					String newPinval = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
					if(newPinval.length() == 4)
					{

						final String iPin = E12Storage.getItemLocalStorage("iPin_"+E12Constants.userID);
						final String ipinVal = SHA256.toSha256(newPinval);

						if(iPin.equalsIgnoreCase(ipinVal))
						{
							newpinText3.getElement().setPropertyString("type", "number");
							newpinText3.setFocus(false);
							//Added by sunny soni for showing error message [Start]
							errorPinLbl.setText("PIN Already Used.");
							horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzPinErrPanel.setVisible(true);
							newpinText.getElement().setPropertyString("type", "number");
							newpinText.setText("".trim());
							newpinText1.setText("".trim());
							newpinText2.setText("".trim());
							newpinText3.setText("".trim());
							newpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]

							/*final PopupPanel msgPopPanel = new PopupPanel();
							VerticalPanel vertMsgPanel = new VerticalPanel();
							vertMsgPanel.setWidth("100%");
							Label msg = new Label("PIN Already Used.");
							final Button okBtn = new Button("OK");
							TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
							okBtn.setWidth("40%");
							okBtn.addStyleName("okpopButton");

							vertMsgPanel.add(msg);
							vertMsgPanel.add(nextBtnTouchWidget);

							vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
							vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);
							//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
							{
								msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							}
							else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
							{
								msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
							}
							msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
							msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
							msgPopPanel.add(vertMsgPanel);
							msgPopPanel.setGlassEnabled(true);
							msgPopPanel.getElement().getStyle().setZIndex(2);
							msgPopPanel.center();

							okBtn.addClickHandler(new ClickHandler() {

								@Override
								public void onClick(ClickEvent event) {
									msgPopPanel.hide();
									newpinText.getElement().setPropertyString("type", "number");
									newpinText.setText("".trim());
									newpinText1.setText("".trim());
									newpinText2.setText("".trim());
									newpinText3.setText("".trim());
									newpinText.setFocus(true);
								}
							});*/
						}
						else
						{
							confirmpinText.getElement().setPropertyString("type", "number");
							confirmpinText.setEnabled(true);
							confirmpinText1.setEnabled(true);
							confirmpinText2.setEnabled(true);
							confirmpinText3.setEnabled(true);
							confirmpinText.setFocus(true);
						}
					}
					else
					{
						if(newpinText1.getValue().isEmpty())
						{
							newpinText.setFocus(true);
							newpinText.getElement().setPropertyString("type", "number");
						}
						if(newpinText1.getValue().isEmpty())
						{
							newpinText1.setFocus(true);
							newpinText1.getElement().setPropertyString("type", "number");
						}
						if(newpinText2.getValue().isEmpty())
						{
							newpinText2.setFocus(true);
							newpinText2.getElement().setPropertyString("type", "number");
						}
						if(newpinText3.getValue().isEmpty())
						{
							newpinText3.setFocus(true);
							newpinText3.getElement().setPropertyString("type", "number");
						}
					}
				}
				if( newpinText3.getText().length() == 0 )
				{
					newpinText3.setText("".trim());
					return;
				}
			}
		});

		newpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText.getValue().equalsIgnoreCase("")))
				{
					if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
					{
						newpinText.setText(newpinText.getText().substring(0, 1));
						newpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		newpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText1.getValue().equalsIgnoreCase("")))
				{
					if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
					{
						newpinText1.getElement().setPropertyString("type", "password");
						newpinText1.setText(newpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		newpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText2.getValue().equalsIgnoreCase("")))
				{
					if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
					{
						newpinText2.getElement().setPropertyString("type", "password");
						newpinText2.setText(newpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		newpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText3.getValue().equalsIgnoreCase("")))
				{
					if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
					{
						newpinText3.getElement().setPropertyString("type", "password");
						newpinText3.setText(newpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		newpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText.getValue().isEmpty()))
				{
					showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
					newpinText.getElement().setPropertyString("type", "number");
					newpinText.setCursorPos(newpinText.getValue().length());

					if(!(newpinText.getValue().equalsIgnoreCase("")))
					{
						newpinText.getElement().setPropertyString("type", "number");
						newpinText.setText(newpinText.getText().substring(0, 1));
						newpinText.setFocus(true);
					}
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText1.getValue().isEmpty()))
				{
					newpinText1.getElement().setPropertyString("type", "number");
					newpinText1.setCursorPos(newpinText1.getValue().length());
					if(!(newpinText1.getValue().equalsIgnoreCase("")))
					{
						newpinText1.getElement().setPropertyString("type", "number");
						newpinText1.setText(newpinText1.getText().substring(0, 1));
						newpinText1.setFocus(true);
					}
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText2.getValue().isEmpty()))
				{
					newpinText2.getElement().setPropertyString("type", "number");
					newpinText2.setCursorPos(newpinText2.getValue().length());
					if(!(newpinText2.getValue().equalsIgnoreCase("")))
					{
						newpinText2.getElement().setPropertyString("type", "number");
						newpinText2.setText(newpinText2.getText().substring(0, 1));
						newpinText2.setFocus(true);
					}
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText3.getValue().isEmpty()))
				{
					newpinText3.getElement().setPropertyString("type", "number");
					newpinText3.setCursorPos(newpinText3.getValue().length());
					if(!(newpinText3.getValue().equalsIgnoreCase("")))
					{
						newpinText3.getElement().setPropertyString("type", "number");
						newpinText3.setText(newpinText3.getText().substring(0, 1));
						newpinText3.setFocus(true);
					}
				}
			}
		});

		newpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				newpinText.getElement().setPropertyString("type", "number");
			}
		});
		newpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText1.getElement().setPropertyString("type", "number");
			}
		});
		newpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText2.getElement().setPropertyString("type", "number");
			}
		});
		newpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText3.getElement().setPropertyString("type", "number");
			}
		});

		confirmpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
				{
					//confirmpinText.setText(confirmpinText.getText().substring(0, 1));
					confirmpinText.getElement().setPropertyString("type", "password");
					confirmpinText.setText(confirmpinText.getText().substring(confirmpinText.getText().length()-1, confirmpinText.getText().length()));
					horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
					if(confirmpinText1.getValue().isEmpty())
					{
						confirmpinText1.setFocus(true);
					}
					else
					{
						confirmpinText1.getElement().setPropertyString("type", "number");
						confirmpinText1.setFocus(true);
					}
				}
				if( confirmpinText.getText().length() == 0 )
				{
					confirmpinText.setText("".trim());
					return;
				}
			}
		});
		confirmpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
				{
					confirmpinText1.getElement().setPropertyString("type", "password");
					//confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					confirmpinText1.setText(confirmpinText1.getText().substring(confirmpinText1.getText().length()-1, confirmpinText1.getText().length()));
					if(confirmpinText2.getValue().isEmpty())
					{
						confirmpinText2.setFocus(true);
					}
					else
					{
						confirmpinText2.getElement().setPropertyString("type", "number");
						confirmpinText2.setFocus(true);
					}
				}
				if( confirmpinText1.getText().length() == 0 )
				{
					confirmpinText1.setText("".trim());
					return;
				}
			}
		});
		confirmpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
				{
					confirmpinText2.getElement().setPropertyString("type", "password");
					//confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					confirmpinText2.setText(confirmpinText2.getText().substring(confirmpinText2.getText().length()-1, confirmpinText2.getText().length()));
					if(confirmpinText3.getValue().isEmpty())
					{
						confirmpinText3.setFocus(true);
					}
					else
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setFocus(true);
					}
				}
				if( confirmpinText2.getText().length() == 0 )
				{
					confirmpinText2.setText("".trim());
					return;
				}
			}
		});
		confirmpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
				{
					confirmpinText3.getElement().setPropertyString("type", "password");
					//confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
					confirmpinText3.setText(confirmpinText3.getText().substring(confirmpinText3.getText().length()-1, confirmpinText3.getText().length()));

					String newPinvalue = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
					String confirmpinVal = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
					if(confirmpinVal.length() == 4)
					{
						if(newPinvalue.equalsIgnoreCase(confirmpinVal))
						{
							changeLbl.setFocus(true);
						}
						else
						{
							confirmpinText3.getElement().setPropertyString("type", "number");
							confirmpinText3.setFocus(false);
							//Added by sunny soni for showing error message [Start]
							errorPinLbl.setText("PIN not matched.");
							horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzPinErrPanel.setVisible(true);
							confirmpinText.getElement().setPropertyString("type", "number");
							confirmpinText.setText("".trim());
							confirmpinText1.setText("".trim());
							confirmpinText2.setText("".trim());
							confirmpinText3.setText("".trim());
							confirmpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]

							/*final PopupPanel msgPopPanel = new PopupPanel();
							VerticalPanel vertMsgPanel = new VerticalPanel();
							vertMsgPanel.setWidth("100%");
							Label msg = new Label("PIN not Matched.");
							msg.getElement().getStyle().setMarginLeft(6, Unit.PX);
							final Button okBtn = new Button("OK");
							TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
							okBtn.setWidth("40%");
							okBtn.addStyleName("okpopButton");

							vertMsgPanel.add(msg);
							vertMsgPanel.add(nextBtnTouchWidget);

							vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
							vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

							//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
							{
								msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							}
							else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
							{
								msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
							}
							msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
							msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
							msgPopPanel.add(vertMsgPanel);
							msgPopPanel.setGlassEnabled(true);
							msgPopPanel.getElement().getStyle().setZIndex(2);
							msgPopPanel.center();

							okBtn.addClickHandler(new ClickHandler() {

								@Override
								public void onClick(ClickEvent event) {
									msgPopPanel.hide();
									confirmpinText.getElement().setPropertyString("type", "number");
									confirmpinText.setText("".trim());
									confirmpinText1.setText("".trim());
									confirmpinText2.setText("".trim());
									confirmpinText3.setText("".trim());
									confirmpinText.setFocus(true);
								}
							});*/
						}
					}
					else
					{
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Please Enter 4-digit PIN.");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setText("".trim());
						confirmpinText1.setText("".trim());
						confirmpinText2.setText("".trim());
						confirmpinText3.setText("".trim());
						confirmpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]

						/*final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Please Enter 4-digit PIN.");
						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");

						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);
						//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
						{
							msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						}
						else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
						{
							msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
						}
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								confirmpinText.setText("".trim());
								confirmpinText1.setText("".trim());
								confirmpinText2.setText("".trim());
								confirmpinText3.setText("".trim());
								confirmpinText.setFocus(true);
							}
						});*/
					}
				}
				if( confirmpinText3.getText().length() == 0 )
				{
					confirmpinText3.setText("".trim());
					return;
				}
			}
		});

		confirmpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
					{
						confirmpinText.setText(confirmpinText.getText().substring(0, 1));
						confirmpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		confirmpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
					{
						confirmpinText1.getElement().setPropertyString("type", "password");
						confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		confirmpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
					{
						confirmpinText2.getElement().setPropertyString("type", "password");
						confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		confirmpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
					{
						confirmpinText3.getElement().setPropertyString("type", "password");
						confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		confirmpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText.getValue().isEmpty()))
				{
					showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
					confirmpinText.getElement().setPropertyString("type", "number");
					confirmpinText.setCursorPos(confirmpinText.getValue().length());
					if(!(confirmpinText.getValue().equalsIgnoreCase("")))
					{
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setText(confirmpinText.getText().substring(0, 1));
						confirmpinText.setFocus(true);
					}
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText1.getValue().isEmpty()))
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
					confirmpinText1.setCursorPos(confirmpinText1.getValue().length());
					if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
					{
						confirmpinText1.getElement().setPropertyString("type", "number");
						confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
						confirmpinText1.setFocus(true);
					}
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText2.getValue().isEmpty()))
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
					confirmpinText2.setCursorPos(confirmpinText2.getValue().length());
					if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
					{
						confirmpinText2.getElement().setPropertyString("type", "number");
						confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
						confirmpinText2.setFocus(true);
					}
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText3.getValue().isEmpty()))
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
					confirmpinText3.setCursorPos(confirmpinText3.getValue().length());
					if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
						confirmpinText3.setFocus(true);
					}
				}
			}
		});

		confirmpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				confirmpinText.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
		});

    	e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerChangePasswordUI );
		e12PopupPanel.setAnimationEnabled(false);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
        ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();

	}
	private PopupPanel showMessagePanel(final String pin)
	{
		final PopupPanel msgPopPanel = new PopupPanel();
		VerticalPanel vertMsgPanel = new VerticalPanel();
		vertMsgPanel.setWidth("100%");
		Label msg = new Label("PIN Change Successfully.");
		final Button okBtn = new Button("OK");
		TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
		okBtn.setWidth("40%");
		okBtn.addStyleName("okpopButton");

		vertMsgPanel.add(msg);
		vertMsgPanel.add(nextBtnTouchWidget);

		vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
		vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
		vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
		vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

		//msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
		if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )
		{
			msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
		}
		else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
		{
			msgPopPanel.getElement().getStyle().setWidth(213, Unit.PX);
		}
		msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
		msgPopPanel.add(vertMsgPanel);
		msgPopPanel.setGlassEnabled(true);
		msgPopPanel.getElement().getStyle().setZIndex(2);
		msgPopPanel.center();

		okBtn.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				msgPopPanel.hide();
				E12Storage.removeItem("iPin"+E12Constants.userID);
				final String newPinResult = SHA256.toSha256(pin);
				E12Storage.localStorageVars.add("iPin_"+E12Constants.userID);
				E12Storage.setItem("iPin_"+E12Constants.userID, newPinResult);
			}
		});
		return msgPopPanel;
	}
	//Added by sunny soni for show pin UI on 17-NOV-16 end

	//Added by sunny soni on 19-NOV-16 for generating pin if not generate start
	private void generatePinUI()
	{
		welcomepopupPnl.hide();
		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",true);

		HorizontalPanel newPassPanel= new HorizontalPanel();
		HorizontalPanel confirmPassPanel = new HorizontalPanel();
		HorizontalPanel newLblPanel = new HorizontalPanel();
		HorizontalPanel confirmLblPanel = new HorizontalPanel();

		newLblPanel.setWidth("150px");
		confirmLblPanel.setWidth("150px");

		newPassImg = new Label();
		confirmPassImg = new Label();

		final VerticalPanel containerChangePasswordUI = new VerticalPanel();

		final Label changePasswordLbl = new Label( "Generate PIN" );
		changePasswordLbl.setStyleName( "changePasswordHeading" );


		Label newPinLbl = new Label( "Enter PIN" );
		Label confirmPinLbl = new Label( "Confirm PIN" );

		//New Added by sunny soni showing error instead of pop panel[Start]
		final HorizontalPanel horzPinErrPanel = new HorizontalPanel();
		Label errspace= new Label();
		errspace.getElement().getStyle().setHeight(10, Unit.PX);
		final Label errorPinLbl = new Label();
		errorPinLbl.getElement().getStyle().setColor("red");
		errorPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		horzPinErrPanel.setVisible(false);
		horzPinErrPanel.add(errspace);
		horzPinErrPanel.add(errorPinLbl);
		//New Added by sunny soni showing error instead of pop panel[End]

		final E12TextBox newpinText = new E12TextBox("number");
		final E12TextBox newpinText1 = new E12TextBox("number");
		final E12TextBox newpinText2 = new E12TextBox("number");
		final E12TextBox newpinText3 = new E12TextBox("number");

		newpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		newpinText.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		newpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		final E12TextBox confirmpinText = new E12TextBox("number");
		final E12TextBox confirmpinText1 = new E12TextBox("number");
		final E12TextBox confirmpinText2 = new E12TextBox("number");
		final E12TextBox confirmpinText3 = new E12TextBox("number");

		confirmpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText3.getElement().getStyle().setMarginLeft(14, Unit.PX);

		confirmpinText.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText1.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText2.setStyleName( "pinTextstylecss loginTextcss" );
		confirmpinText3.setStyleName( "pinTextstylecss loginTextcss" );

		confirmpinText.setEnabled(false);
		confirmpinText1.setEnabled(false);
		confirmpinText2.setEnabled(false);
		confirmpinText3.setEnabled(false);

		final Button changeLbl = new Button( "Submit" );
		changeLbl.addStyleName("pinButton");
		final Button resetLbl = new Button( E12Constants.constants.setresetLbl() );
		resetLbl.addStyleName("pinButton");

		//Added by sunny soni for getting focus on textbox [Start]
		(new Timer() {
			   @Override
			   public void run() {
				   newpinText.setFocus(true);
			   }
			}).schedule(1000);
		//Added by sunny soni for getting focus on textbox [End]

		changeLbl.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				String newPin = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
				if(newPin.length() == 4)
				{
					e12PopupPanel.hide(true);
					showMessagePanel1(newPin).center();
				}
			}
		});

		resetLbl.addClickHandler( new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				newpinText.getElement().setPropertyString("type", "number");
				newpinText.setText( "" );
				newpinText1.setText( "" );
				newpinText2.setText( "" );
				newpinText3.setText( "" );

				confirmpinText.setText( "" );
				confirmpinText1.setText( "" );
				confirmpinText2.setText( "" );
				confirmpinText3.setText( "" );

				newpinText.setFocus(true);

				confirmpinText.setEnabled(false);
				confirmpinText1.setEnabled(false);
				confirmpinText2.setEnabled(false);
				confirmpinText3.setEnabled(false);

				newPassImg.removeStyleName("rightPass");
				newPassImg.removeStyleName("wrongPass");
				confirmPassImg.removeStyleName("confirmRightPass");
				confirmPassImg.removeStyleName("confirmWrongPass");
			}
		});

		HorizontalPanel btnContainer = new HorizontalPanel();
		btnContainer.setWidth( "100%" );
		btnContainer.add( resetLbl );
		btnContainer.add( changeLbl );
		btnContainer.setCellHorizontalAlignment( changeLbl, HasHorizontalAlignment.ALIGN_RIGHT );

		Label space1 = new Label();

		space1.setStyleName( "space1" );
		Label space2 = new Label();
		space2.setStyleName( "space" );
		Label space3 = new Label();
		space3.setStyleName( "space" );
		Label space4 = new Label();
		space4.setStyleName( "changePasswordSpace" );

		Label oldLblSpace = new Label();
		oldLblSpace.setWidth("20px");
		Label newLblSpace = new Label();
		newLblSpace.setWidth("20px");
		Label confirmLblSpace = new Label();
		confirmLblSpace.setWidth("20px");
		Label space5= new Label();
		space5.setStyleName("buttonSpace");

		Scheduler.get().scheduleDeferred(new ScheduledCommand() {

		  @Override
		  public void execute() {
		   int width = e12PopupPanel.getOffsetWidth();
		   int lblwidth = width-28;
		   changePasswordLbl.setWidth(Integer.toString(lblwidth) +"px");

		  }
		});
		e12PopupPanel.addStyleName("adjustPopup");//Added by sunny soni for adjusting pin popup panel.
		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");

		resetLbl.addStyleName("redPinBtn");
		changeLbl.addStyleName("greenPinBtn");

		newPassPanel.add(newpinText);
		newPassPanel.add(newpinText1);
		newPassPanel.add(newpinText2);
		newPassPanel.add(newpinText3);
		confirmPassPanel.add(confirmpinText);
		confirmPassPanel.add(confirmpinText1);
		confirmPassPanel.add(confirmpinText2);
		confirmPassPanel.add(confirmpinText3);
		newPassPanel.add(newPassImg);
		confirmPassPanel.add(confirmPassImg);
		confirmPinLbl.getElement().getStyle().setMarginTop(7, Unit.PX);
		space1.setHeight("21px");
		containerChangePasswordUI.add( changePasswordLbl );
		containerChangePasswordUI.add( space1 );
		containerChangePasswordUI.add( newPinLbl );
		containerChangePasswordUI.add( newPassPanel );
		containerChangePasswordUI.add( space3 );
		containerChangePasswordUI.add( confirmPinLbl );
		containerChangePasswordUI.add( confirmPassPanel );

		containerChangePasswordUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

		containerChangePasswordUI.add( space4 );
		containerChangePasswordUI.add( btnContainer );

		newpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
				{
					//newpinText.setText(newpinText.getText().substring(0, 1));
					newpinText.getElement().setPropertyString("type", "password");
					newpinText.setText(newpinText.getText().substring(newpinText.getText().length()-1, newpinText.getText().length()));
					if(newpinText1.getValue().isEmpty())
					{
						newpinText1.setFocus(true);
					}
					else
					{
						newpinText1.getElement().setPropertyString("type", "number");
						newpinText1.setFocus(true);
					}
				}
				if( newpinText.getText().length() == 0 )
				{
					newpinText.setText("".trim());
					return;
				}
			}
		});
		newpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
				{
					newpinText1.getElement().setPropertyString("type", "password");
					//newpinText1.setText(newpinText1.getText().substring(0, 1));
					newpinText1.setText(newpinText1.getText().substring(newpinText1.getText().length()-1, newpinText1.getText().length()));
					if(newpinText2.getValue().isEmpty())
					{
						newpinText2.setFocus(true);
					}
					else
					{
						newpinText2.getElement().setPropertyString("type", "number");
						newpinText2.setFocus(true);
					}
				}
				if( newpinText1.getText().length() == 0 )
				{
					newpinText1.setText("".trim());
					return;
				}
			}
		});
		newpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
				{
					newpinText2.getElement().setPropertyString("type", "password");
					//newpinText2.setText(newpinText2.getText().substring(0, 1));
					newpinText2.setText(newpinText2.getText().substring(newpinText2.getText().length()-1, newpinText2.getText().length()));
					if(newpinText3.getValue().isEmpty())
					{
						newpinText3.setFocus(true);
					}
					else
					{
						newpinText3.getElement().setPropertyString("type", "number");
						newpinText3.setFocus(true);
					}
				}
				if( newpinText2.getText().length() == 0 )
				{
					newpinText2.setText("".trim());
					return;
				}
			}
		});
		newpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
				{
					newpinText3.getElement().setPropertyString("type", "password");
					//newpinText3.setText(newpinText3.getText().substring(0, 1));
					newpinText3.setText(newpinText3.getText().substring(newpinText3.getText().length()-1, newpinText3.getText().length()));

					String newPinval = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();

					if(newPinval.length() == 4)
					{
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setEnabled(true);
						confirmpinText1.setEnabled(true);
						confirmpinText2.setEnabled(true);
						confirmpinText3.setEnabled(true);
						confirmpinText.setFocus(true);
					}
					else
					{
						if(newpinText1.getValue().isEmpty())
						{
							newpinText.setFocus(true);
							newpinText.getElement().setPropertyString("type", "number");
						}
						if(newpinText1.getValue().isEmpty())
						{
							newpinText1.setFocus(true);
							newpinText1.getElement().setPropertyString("type", "number");
						}
						if(newpinText2.getValue().isEmpty())
						{
							newpinText2.setFocus(true);
							newpinText2.getElement().setPropertyString("type", "number");
						}
						if(newpinText3.getValue().isEmpty())
						{
							newpinText3.setFocus(true);
							newpinText3.getElement().setPropertyString("type", "number");
						}
					}
				}
				if( newpinText3.getText().length() == 0 )
				{
					newpinText3.setText("".trim());
					return;
				}
			}
		});

		newpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText.getValue().equalsIgnoreCase("")))
				{
					if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
					{
						newpinText.setText(newpinText.getText().substring(0, 1));
						newpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		newpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText1.getValue().equalsIgnoreCase("")))
				{
					if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
					{
						newpinText1.getElement().setPropertyString("type", "password");
						newpinText1.setText(newpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		newpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText2.getValue().equalsIgnoreCase("")))
				{
					if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
					{
						newpinText2.getElement().setPropertyString("type", "password");
						newpinText2.setText(newpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		newpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(newpinText3.getValue().equalsIgnoreCase("")))
				{
					if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
					{
						newpinText3.getElement().setPropertyString("type", "password");
						newpinText3.setText(newpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		newpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText.getValue().isEmpty()))
				{
					newpinText.getElement().setPropertyString("type", "number");
					newpinText.setCursorPos(newpinText.getValue().length());

					if(!(newpinText.getValue().equalsIgnoreCase("")))
					{
						newpinText.getElement().setPropertyString("type", "number");
						newpinText.setText(newpinText.getText().substring(0, 1));
						newpinText.setFocus(true);
					}
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText1.getValue().isEmpty()))
				{
					newpinText1.getElement().setPropertyString("type", "number");
					newpinText1.setCursorPos(newpinText1.getValue().length());
					if(!(newpinText1.getValue().equalsIgnoreCase("")))
					{
						newpinText1.getElement().setPropertyString("type", "number");
						newpinText1.setText(newpinText1.getText().substring(0, 1));
						newpinText1.setFocus(true);
					}
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText2.getValue().isEmpty()))
				{
					newpinText2.getElement().setPropertyString("type", "number");
					newpinText2.setCursorPos(newpinText2.getValue().length());
					if(!(newpinText2.getValue().equalsIgnoreCase("")))
					{
						newpinText2.getElement().setPropertyString("type", "number");
						newpinText2.setText(newpinText2.getText().substring(0, 1));
						newpinText2.setFocus(true);
					}
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		newpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(newpinText.getValue().isEmpty())
				{
					newpinText.getElement().setPropertyString("type", "number");
				}
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.getElement().setPropertyString("type", "number");
				}
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.getElement().setPropertyString("type", "number");
				}
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.getElement().setPropertyString("type", "number");
				}
				if(!(newpinText3.getValue().isEmpty()))
				{
					newpinText3.getElement().setPropertyString("type", "number");
					newpinText3.setCursorPos(newpinText3.getValue().length());
					if(!(newpinText3.getValue().equalsIgnoreCase("")))
					{
						newpinText3.getElement().setPropertyString("type", "number");
						newpinText3.setText(newpinText3.getText().substring(0, 1));
						newpinText3.setFocus(true);
					}
				}
			}
		});

		newpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText.getElement().setPropertyString("type", "number");
			}
		});
		newpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText1.getElement().setPropertyString("type", "number");
			}
		});
		newpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText2.getElement().setPropertyString("type", "number");
			}
		});
		newpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				newpinText3.getElement().setPropertyString("type", "number");
			}
		});

		confirmpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
				{
					confirmpinText.setText(confirmpinText.getText().substring(0, 1));
					confirmpinText.getElement().setPropertyString("type", "password");
					horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
					if(confirmpinText1.getValue().isEmpty())
					{
						confirmpinText1.setFocus(true);
					}
					else
					{
						confirmpinText1.getElement().setPropertyString("type", "number");
						confirmpinText1.setFocus(true);
					}
				}
				if( confirmpinText.getText().length() == 0 )
				{
					confirmpinText.setText("".trim());
					return;
				}
			}
		});
		confirmpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
				{
					confirmpinText1.getElement().setPropertyString("type", "password");
					confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					if(confirmpinText2.getValue().isEmpty())
					{
						confirmpinText2.setFocus(true);
					}
					else
					{
						confirmpinText2.getElement().setPropertyString("type", "number");
						confirmpinText2.setFocus(true);
					}
				}
				if( confirmpinText1.getText().length() == 0 )
				{
					confirmpinText1.setText("".trim());
					return;
				}
			}
		});
		confirmpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
				{
					confirmpinText2.getElement().setPropertyString("type", "password");
					confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					if(confirmpinText3.getValue().isEmpty())
					{
						confirmpinText3.setFocus(true);
					}
					else
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setFocus(true);
					}
				}
				if( confirmpinText2.getText().length() == 0 )
				{
					confirmpinText2.setText("".trim());
					return;
				}
			}
		});
		confirmpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
				{
					confirmpinText3.getElement().setPropertyString("type", "password");
					confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
					String newPinvalue = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
					String confirmpinVal = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
					if(confirmpinVal.length() == 4)
					{
						if(newPinvalue.equalsIgnoreCase(confirmpinVal))
						{
							changeLbl.setFocus(true);
						}
						else
						{
							confirmpinText3.getElement().setPropertyString("type", "number");
							//Added by sunny soni for showing error message [Start]
							errorPinLbl.setText("PIN not matched.");
							horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzPinErrPanel.setVisible(true);
							confirmpinText.getElement().setPropertyString("type", "number");
							confirmpinText.setText("".trim());
							confirmpinText1.setText("".trim());
							confirmpinText2.setText("".trim());
							confirmpinText3.setText("".trim());
							confirmpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]
							/*final PopupPanel msgPopPanel = new PopupPanel();
							VerticalPanel vertMsgPanel = new VerticalPanel();
							vertMsgPanel.setWidth("100%");
							Label msg = new Label("PIN not Matched.");
							msg.getElement().getStyle().setMarginLeft(6, Unit.PX);
							final Button okBtn = new Button("OK");
							TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
							okBtn.setWidth("40%");
							okBtn.addStyleName("okpopButton");

							vertMsgPanel.add(msg);
							vertMsgPanel.add(nextBtnTouchWidget);

							vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
							vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
							vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

							msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
							msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
							msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
							msgPopPanel.add(vertMsgPanel);
							msgPopPanel.setGlassEnabled(true);
							msgPopPanel.getElement().getStyle().setZIndex(2);
							msgPopPanel.center();

							okBtn.addClickHandler(new ClickHandler() {

								@Override
								public void onClick(ClickEvent event) {
									msgPopPanel.hide();
									confirmpinText.getElement().setPropertyString("type", "number");
									confirmpinText.setText("".trim());
									confirmpinText1.setText("".trim());
									confirmpinText2.setText("".trim());
									confirmpinText3.setText("".trim());
									confirmpinText.setFocus(true);
								}
							});*/
						}
					}
					else
					{
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Please Enter 4-digit PIN.");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setText("".trim());
						confirmpinText1.setText("".trim());
						confirmpinText2.setText("".trim());
						confirmpinText3.setText("".trim());
						confirmpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]
						/*final PopupPanel msgPopPanel = new PopupPanel();
						VerticalPanel vertMsgPanel = new VerticalPanel();
						vertMsgPanel.setWidth("100%");
						Label msg = new Label("Please Enter 4-digit PIN.");
						final Button okBtn = new Button("OK");
						TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
						okBtn.setWidth("40%");
						okBtn.addStyleName("okpopButton");

						vertMsgPanel.add(msg);
						vertMsgPanel.add(nextBtnTouchWidget);

						vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
						vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
						vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);
						msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
						msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
						msgPopPanel.getElement().getStyle().setBackgroundColor("lightgray");
						msgPopPanel.add(vertMsgPanel);
						msgPopPanel.setGlassEnabled(true);
						msgPopPanel.getElement().getStyle().setZIndex(2);
						msgPopPanel.center();

						okBtn.addClickHandler(new ClickHandler() {

							@Override
							public void onClick(ClickEvent event) {
								msgPopPanel.hide();
								confirmpinText.setText("".trim());
								confirmpinText1.setText("".trim());
								confirmpinText2.setText("".trim());
								confirmpinText3.setText("".trim());
								confirmpinText.setFocus(true);
							}
						});*/
					}
				}
				if( confirmpinText3.getText().length() == 0 )
				{
					confirmpinText3.setText("".trim());
					return;
				}
			}
		});

		confirmpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
					{
						confirmpinText.setText(confirmpinText.getText().substring(0, 1));
						confirmpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		confirmpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
					{
						confirmpinText1.getElement().setPropertyString("type", "password");
						confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		confirmpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
					{
						confirmpinText2.getElement().setPropertyString("type", "password");
						confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		confirmpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
				{
					if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
					{
						confirmpinText3.getElement().setPropertyString("type", "password");
						confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		confirmpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText.getValue().isEmpty()))
				{
					confirmpinText.getElement().setPropertyString("type", "number");
					confirmpinText.setCursorPos(confirmpinText.getValue().length());
					if(!(confirmpinText.getValue().equalsIgnoreCase("")))
					{
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setText(confirmpinText.getText().substring(0, 1));
						confirmpinText.setFocus(true);
					}
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText1.getValue().isEmpty()))
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
					confirmpinText1.setCursorPos(confirmpinText1.getValue().length());
					if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
					{
						confirmpinText1.getElement().setPropertyString("type", "number");
						confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
						confirmpinText1.setFocus(true);
					}
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText2.getValue().isEmpty()))
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
					confirmpinText2.setCursorPos(confirmpinText2.getValue().length());
					if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
					{
						confirmpinText2.getElement().setPropertyString("type", "number");
						confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
						confirmpinText2.setFocus(true);
					}
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		confirmpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(confirmpinText.getValue().isEmpty())
				{
					confirmpinText.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
				}
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
				}
				if(!(confirmpinText3.getValue().isEmpty()))
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
					confirmpinText3.setCursorPos(confirmpinText3.getValue().length());
					if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
						confirmpinText3.setFocus(true);
					}
				}
			}
		});

		confirmpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
		});
		confirmpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
		});

    	e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerChangePasswordUI );
		e12PopupPanel.setAnimationEnabled(false);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
        ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();
	}
	private PopupPanel showMessagePanel1(final String pin)
	{
		final PopupPanel msgPopPanel = new PopupPanel();
		VerticalPanel vertMsgPanel = new VerticalPanel();
		vertMsgPanel.setWidth("100%");
		Label msg = new Label("PIN Generated Successfully.");
		final Button okBtn = new Button("OK");
		TouchWidget nextBtnTouchWidget = new TouchWidget( okBtn );
		okBtn.setWidth("40%");
		okBtn.addStyleName("okpopButton");

		vertMsgPanel.add(msg);
		vertMsgPanel.add(nextBtnTouchWidget);

		vertMsgPanel.setCellVerticalAlignment(msg, HasVerticalAlignment.ALIGN_MIDDLE);
		vertMsgPanel.setCellHorizontalAlignment(msg, HasHorizontalAlignment.ALIGN_CENTER);
		vertMsgPanel.setCellVerticalAlignment(okBtn, HasVerticalAlignment.ALIGN_MIDDLE);
		vertMsgPanel.setCellHorizontalAlignment(okBtn, HasHorizontalAlignment.ALIGN_CENTER);

		msgPopPanel.getElement().getStyle().setWidth(Window.getClientWidth()/2, Unit.PX);
		msgPopPanel.getElement().getStyle().setHeight(58, Unit.PX);
		msgPopPanel.add(vertMsgPanel);
		msgPopPanel.setGlassEnabled(true);
		msgPopPanel.getElement().getStyle().setZIndex(2);
		msgPopPanel.center();

		okBtn.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {
				msgPopPanel.hide();
				//E12Storage.removeItem("iPin"+E12Constants.userID);
				final String newPinResult = SHA256.toSha256(pin);
				E12Storage.localStorageVars.add("iPin_"+E12Constants.userID);
				E12Storage.setItem("iPin_"+E12Constants.userID, newPinResult);
			}
		});
		return msgPopPanel;
	}
	//Added by sunny soni on 19-NOV-16 for generating pin if not generate end

	//Added by Amol S on 20-01-17 [Request Id : W16JJOH002 ] START
	/**
	 * This method provide the functionality of profile image cropping & adding.
	 * @param userImage - Image to be set as profile image.
	 */
	private void changeProfileImg(final Image userImage)
	{

		ContentPlugin contentPlugin = new ContentPlugin();

		PluginMetadata metadata = new PluginMetadata();
		metadata.put(MetadataKey.USER_ID, new MetadataValue(E12Constants.userID));
		metadata.put(MetadataKey.IS_PROFILE_IMAGE, new MetadataValue(true));
		metadata.put(MetadataKey.IS_HOSTED_MODE, new MetadataValue(E12Global.getInstance().isHostedMode()));
		metadata.put(MetadataKey.HOST_URL, new MetadataValue(E12Global.getHostUrl()));

		contentPlugin.addDoneHandler(new DoneHandler()
		{

			@Override
			public void onDone(DoneEvent event)
			{
				String imgCapturePath = event.getFileUrl();
				userImage.setUrl(imgCapturePath);
				//userImage.setPixelSize(65, 65);
				userImage.setPixelSize(104, 104);
				//added by Nikita s [ size of userimage after uploading new image] start
				if(E12Global.getInstance().getDeviceOS() == DeviceOS.iOS)
				{
					userImage.getElement().getStyle().setLeft(15, Unit.PX);
				}
				//added by Nikita s [ size of userimage after uploading new image] end
				userImageHB.setUrl(imgCapturePath);
				userImageHB.setStyleName("headerImage");
				userImageHB.setStyleName("userImage");

				// Added By Pravin k on 25-MAY-18 [To change feed user image after profile pic changed] END
				Storage localStorage = Storage.getLocalStorageIfSupported();
				localStorage.setItem(E12Constants.userID+"_userProfPicPath",imgCapturePath );
				changeProfilePicOfPosts(imgCapturePath, E12Constants.userID);
				// Added By Pravin k on 25-MAY-18 [To change feed user image after profile pic changed] END
			}
		});

		contentPlugin.init(metadata);

		Map<String, String> pluginData = new HashMap<String, String>();
		pluginData.put("fileUrl", userImage.getUrl());
		pluginData.put("docType", "Profile image");
		contentPlugin.setPluginData(pluginData);

		// PopupPanel imgPopupPnl = (PopupPanel) contentPlugin.getAddUI();
		PopupPanel imgPopupPnl = (PopupPanel) contentPlugin.getEditUI();
		imgPopupPnl.show();

	}
	//Added by Amol S on 20-01-17 [Request Id : W16JJOH002 ] END

	//Added by Amol S on 12-12-17 START
	public Image getUserImageHB()
	{
		return userImageHB;
	}

	public void setUserImageHB(Image userImageHB)
	{
		this.userImageHB = userImageHB;
	}
	//Added by Amol S on 12-12-17 END
	//Added By Samadhan on 08-Jan-2018 [ To display my places(place time and entity) ] Start
	private void showMyPlaces()
	{
		final E12PopupPanel myPlacesPopup = new E12PopupPanel(false,false,"",true);
		myPlacesPopup.getElement().setId("e12UserInfo-myPlacesPopup");
		myPlacesPopup.setGlassEnabled(true);
		myPlacesPopup.setAutoHideEnabled(false);
		myPlacesPopup.setGlassStyleName("bgGlass");
		myPlacesPopup.setWidth("100%");
		myPlacesPopup.setHeight("100%");
		VerticalPanel myPlacesVPnl = new VerticalPanel();

		Button btnCancel = new Button("x");
		btnCancel.getElement().setId("closeMyPlace");
		btnCancel.getElement().getStyle().setColor("white");
		btnCancel.getElement().setTitle("Close");
		//btnCancel.getElement().setAttribute("style", "font-size: 30px;width: 40px;    background-color: transparent;    border: none;    font-size: 28px; background:none;    width: 40px; color:white;    position: absolute; z-index: 1;");
		btnCancel.getElement().setAttribute("style", "background-color: transparent;    border: none;    font-size: 22px; background:none;    width: 40px; color:white;    position: absolute; z-index: 1;"
				+ "display: inline-block;height: 30px;cursor: pointer;background-repeat: no-repeat;margin-top: 5px; padding: 5px;");

		btnCancel.addClickHandler(new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				myPlacesPopup.hide();
				detachAngularPlugin("place-time-entity");
			}
		});

		SimplePanel myPlacesPnl = new SimplePanel();
		myPlacesPnl.getElement().setId("e12UserInfo-myPlacesPnl");
		myPlacesPnl.addStyleName("e12UserInfo-myPlacesPopup");

		myPlacesVPnl.add(btnCancel);
		myPlacesVPnl.add(myPlacesPnl);

		myPlacesPopup.add(myPlacesVPnl);
		myPlacesPopup.show();
		myPlacesPopup.getElement().setAttribute("style", "position: absolute; overflow: visible;   z-index: 10;    width: 100%;  height: 100%;	    margin: 0px;	    top: 0px;");
		myPlacesPopup.addStyleName("e12UserInfo-myPlacesPopup");
		JSONObject configData = new JSONObject();
		configData.put("componentName", new JSONString("place-time-entity"));
		configData.put("cacheComp", new JSONString("true"));
		configData.put("targetId", new JSONString("e12UserInfo-myPlacesPnl"));
		loadAngularPlugin( "e12UserInfo-myPlacesPnl", configData.toString() );

		myPlacesPopup.getElement().getStyle().setPosition(Position.FIXED);
	}

	public native static String loadAngularPlugin(String targetId, String componentData)
	/*-{
		try
		{
			console.log("Inside Native loadAngularPlugin");
			return $wnd.loadComponent(targetId, componentData);
		}
		catch(e)
	    {
	    	console.log("Exception in native loadAngularPlugin:"+e);
	    	return "false";
	    }
	}-*/;

	public native static String detachAngularPlugin(String componentName)
	/*-{
		try
		{
			console.log("Inside Native loadAngularPlugin");
			return $wnd.detachPlugin(componentName);
		}
		catch(e)
	    {
	    	console.log("Exception in native loadAngularPlugin:"+e);
	    	return "false";
	    }
	}-*/;
	//Added By Samadhan on 08-Jan-2018 [ To display my places(place time and entity) ] End
	//Added by sunny soni for showing change pin Popup [Start]
	private void displayPinUI(final String pinLabel)
	{
		E12CommonUtils.printOnConsole("Value of pinLabel:: [ "+pinLabel+" ]");
		welcomepopupPnl.hide();
		final String iPin = E12Storage.getItemLocalStorage("iPin_"+E12Constants.userID);

		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",false);
		final VerticalPanel containerChangePinUI = new VerticalPanel();

		final Label changePinLbl = new Label();

		final Label oldPinLbl = new Label();
		oldPinLbl.setVisible(false);
		final Label newPinLbl = new Label();
		newPinLbl.setVisible(false);
		final Label confirmPinLbl = new Label();
		confirmPinLbl.setVisible(false);

		final HorizontalPanel topPinPanel = new HorizontalPanel();
		final HorizontalPanel imgHrzPanel = new HorizontalPanel();

		HorizontalPanel oldPinTxtbxPanel = new HorizontalPanel();
		oldPinTxtbxPanel.setVisible(false);

		HorizontalPanel newPinTxtbxPanel= new HorizontalPanel();
		newPinTxtbxPanel.setVisible(false);

		HorizontalPanel confirmTxtbxPinPanel = new HorizontalPanel();
		confirmTxtbxPinPanel.setVisible(false);

		HorizontalPanel btnContainer = new HorizontalPanel();
		btnContainer.setVisible(false);

		final VerticalPanel generateBtnVrtPanel = new VerticalPanel();
		generateBtnVrtPanel.setVisible(false);

		final HorizontalPanel horzOldPinErrPanel = new HorizontalPanel();
		horzOldPinErrPanel.setVisible(false);

		Label space = new Label();
		Label space1 = new Label();
		Label space2 = new Label();
		Label space3 = new Label();
		Label space4 = new Label();

		final Button generateBtn = new Button( "Generate" );
		/*generateBtn.getElement().getStyle().setWidth(221, Unit.PX);*/

		if(pinLabel.indexOf("Change")!= -1)
		{
			if(E12Global.getInstance().getDeviceOS() == DeviceOS.Android)
			{
				if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Mobile") !=-1)
				{
					e12PopupPanel.addStyleName("adjustchangePinPopup");
				}
				else if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Tablet") !=-1)
				{
					e12PopupPanel.addStyleName("adjustchangePinPopup");
				}
			}
			else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
			{
				if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Mobile") !=-1)
				{
					e12PopupPanel.addStyleName("adjustchangePinPopup");
				}
				else if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Tablet") !=-1)
				{
					e12PopupPanel.addStyleName("adjustchangePinPopupFrTab");
				}
			}
			oldPinLbl.setVisible(true);
			oldPinTxtbxPanel.setVisible(true);
			newPinLbl.setVisible(true);
			newPinTxtbxPanel.setVisible(true);
			confirmPinLbl.setVisible(true);
			confirmTxtbxPinPanel.setVisible(true);
			btnContainer.setVisible(true);

			changePinLbl.setText("Change Pin");
			oldPinLbl.setText("Enter Old 4 digit pin");
			newPinLbl.setText("Enter New 4 digit pin");
			confirmPinLbl.setText("Verify 4 digit pin");
		}
		else
		{
			if(E12Global.getInstance().getDeviceOS() == DeviceOS.Android)
			{
				if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Mobile") !=-1)
				{
					e12PopupPanel.addStyleName("adjustGeneratePinPop");
				}
				else if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Tablet") !=-1)
				{
					e12PopupPanel.addStyleName("adjustGeneratePinPop");
				}
				generateBtn.addStyleName("generatePinBtnCss");
			}
			else if(E12Global.getInstance().getDeviceOS() == DeviceOS.iOS)
			{
				if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Mobile") !=-1)
				{
					e12PopupPanel.addStyleName("adjustGeneratePinPop");
				}
				else if(E12CommonUtils.getInstance().getPlatFormAndDeviceType().indexOf("Tablet") !=-1)
				{
					e12PopupPanel.addStyleName("adjustGeneratePinPopFrTab");
				}
				generateBtn.addStyleName("generatePinBtnCssfrTab");
			}

			oldPinLbl.setVisible(true);
			oldPinTxtbxPanel.setVisible(true);
			newPinLbl.setVisible(true);
			newPinTxtbxPanel.setVisible(true);
			generateBtnVrtPanel.setVisible(true);
			changePinLbl.setText("Generate Pin");
			oldPinLbl.setText("Enter 4 digit pin");
			newPinLbl.setText("Verify 4 digit pin");
		}
		newPassImg = new Label();
		confirmPassImg = new Label();

		final Image lockimage = new Image();
		String url = E12Global.getHostUrl() +"/ibase/images/Lock.png";
		lockimage.setWidth("100px");
		lockimage.setHeight("100px");
		lockimage.setUrl(url);

		lockimage.addErrorHandler( new ErrorHandler()
		{
			@Override
			public void onError(ErrorEvent event)
			{
				E12CommonUtils.printOnConsole("Error HAndle in E12Userinfo!!");
				lockimage.setResource( Resources.INSTANCE.lockIcon() );
				lockimage.setWidth("100px");
				lockimage.setHeight("100px");
			}
		});

		/*imgHrzPanel.getElement().getStyle().setMarginLeft(50, Unit.PX);

		imgHrzPanel.addStyleName("pincircle");
		imgHrzPanel.add(lockimage);*/

		//final Label changePinLbl = new Label( "Change Pin" );
		//changePinLbl.setStyleName( "changePasswordHeading" );

		//changePinLbl.getElement().getStyle().setColor("#2196f3 ");
		changePinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		/*topPinPanel.setStyleName("adjustTopUsrProfilePinpopup");
		topPinPanel.add(changePinLbl);
		topPinPanel.setCellHorizontalAlignment( changePinLbl, HasHorizontalAlignment.ALIGN_CENTER );*/

		//final Label oldPinLbl = new Label( "Enter Old 4 digit pin" );
		oldPinLbl.getElement().getStyle().setColor("#2196f3 ");
		oldPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		oldPinLbl.getElement().getStyle().setMarginBottom(8, Unit.PX);

		//final Label newPinLbl = new Label( "Enter New 4 digit pin" );
		newPinLbl.getElement().getStyle().setColor("#2196f3 ");
		newPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		newPinLbl.getElement().getStyle().setMarginBottom(8, Unit.PX);

		//final Label confirmPinLbl = new Label( "Verify 4 digit pin" );
		confirmPinLbl.getElement().getStyle().setColor("#2196f3 ");
		confirmPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);
		confirmPinLbl.getElement().getStyle().setMarginBottom(8, Unit.PX);

		//Added for showing generate button [Start]
		TouchWidget generatBtnTouchWidget = new TouchWidget( generateBtn );
		generateBtnVrtPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);
		generateBtnVrtPanel.add(generatBtnTouchWidget);
		//Added for showing generate button [Start]

		final E12TextBox oldpinText = new E12TextBox("number");
		final E12TextBox oldpinText1 = new E12TextBox("number");
		final E12TextBox oldpinText2 = new E12TextBox("number");
		final E12TextBox oldpinText3 = new E12TextBox("number");

		oldpinText.getElement().setId("oldpinText_1");

		oldpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		oldpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		oldpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		oldpinText.setStyleName( "changePinTxtCss" );
		oldpinText1.setStyleName( "changePinTxtCss" );
		oldpinText2.setStyleName( "changePinTxtCss" );
		oldpinText3.setStyleName( "changePinTxtCss" );

		//Added by sunny soni for getting focus on textbox [Start]
		(new Timer() {
			   @Override
			   public void run() {
				   oldpinText.setFocus(true);
			   }
			}).schedule(500);
		//Added by sunny soni for getting focus on textbox [End]

		final E12TextBox newpinText = new E12TextBox("number");
		final E12TextBox newpinText1 = new E12TextBox("number");
		final E12TextBox newpinText2 = new E12TextBox("number");
		final E12TextBox newpinText3 = new E12TextBox("number");

		newpinText.getElement().setId("newpinText_1");

		newpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		newpinText3.getElement().getStyle().setMarginLeft(17, Unit.PX);

		newpinText.setStyleName( "changePinTxtCss" );
		newpinText1.setStyleName( "changePinTxtCss" );
		newpinText2.setStyleName( "changePinTxtCss" );
		newpinText3.setStyleName( "changePinTxtCss" );

		final E12TextBox confirmpinText = new E12TextBox("number");
		final E12TextBox confirmpinText1 = new E12TextBox("number");
		final E12TextBox confirmpinText2 = new E12TextBox("number");
		final E12TextBox confirmpinText3 = new E12TextBox("number");

		confirmpinText.getElement().setId("confirmpinText_1");

		confirmpinText1.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText2.getElement().getStyle().setMarginLeft(14, Unit.PX);
		confirmpinText3.getElement().getStyle().setMarginLeft(14, Unit.PX);

		confirmpinText.setStyleName( "changePinTxtCss" );
		confirmpinText1.setStyleName( "changePinTxtCss" );
		confirmpinText2.setStyleName( "changePinTxtCss" );
		confirmpinText3.setStyleName( "changePinTxtCss" );

		confirmpinText.setEnabled(false);
		confirmpinText1.setEnabled(false);
		confirmpinText2.setEnabled(false);
		confirmpinText3.setEnabled(false);

		final Button changeBtn = new Button( E12Constants.constants.setchangeLbl() );
		//changeLbl.addStyleName("pinButton");
		changeBtn.addStyleName("changePinBtnCss");
		changeBtn.getElement().setId("E12UserInfo_Change_Pin_Button");

		final Button resetBtn = new Button( E12Constants.constants.setresetLbl() );
		//resetBtn.addStyleName("pinButton");
		resetBtn.addStyleName("changePinBtnCss");
		resetBtn.getElement().setId("E12UserInfo_Reset_Pin_Button");

		//New Added by sunny soni showing error instead of pop panel[Start]
		Label errOldspace = new Label();
		errOldspace.getElement().getStyle().setHeight(10, Unit.PX);

		Label errspace = new Label();
		errspace.getElement().getStyle().setHeight(10, Unit.PX);

		final Label errorOldPinLbl = new Label();
		errorOldPinLbl.getElement().getStyle().setColor("red");
		errorOldPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);

		final Label errorPinLbl = new Label();
		errorPinLbl.getElement().getStyle().setColor("red");
		errorPinLbl.getElement().getStyle().setFontSize(17, Unit.PX);


		horzOldPinErrPanel.setVisible(false);
		horzOldPinErrPanel.add(errOldspace);
		horzOldPinErrPanel.add(errorOldPinLbl);

		final HorizontalPanel horzPinErrPanel = new HorizontalPanel();
		horzPinErrPanel.setVisible(false);
		horzPinErrPanel.add(errspace);
		horzPinErrPanel.add(errorPinLbl);

		//New Added by sunny soni showing error instead of pop panel[End]
		btnContainer.setWidth( "100%" );
		btnContainer.add( resetBtn );
		btnContainer.add( changeBtn );
		btnContainer.setCellHorizontalAlignment( changeBtn, HasHorizontalAlignment.ALIGN_RIGHT );

		space.setStyleName( "space1" );
		space2.setStyleName( "space" );
		space3.setStyleName( "space" );
		//space4.setStyleName( "space" );

		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("closeAdjust close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");

		oldPinTxtbxPanel.add(oldpinText);
		oldPinTxtbxPanel.add(oldpinText1);
		oldPinTxtbxPanel.add(oldpinText2);
		oldPinTxtbxPanel.add(oldpinText3);

		newPinTxtbxPanel.add(newpinText);
		newPinTxtbxPanel.add(newpinText1);
		newPinTxtbxPanel.add(newpinText2);
		newPinTxtbxPanel.add(newpinText3);

		confirmTxtbxPinPanel.add(confirmpinText);
		confirmTxtbxPinPanel.add(confirmpinText1);
		confirmTxtbxPinPanel.add(confirmpinText2);
		confirmTxtbxPinPanel.add(confirmpinText3);

		if( E12Global.getInstance().getDeviceOS() == DeviceOS.Android )							 //for Mobile Device
		{
			imgHrzPanel.getElement().getStyle().setMarginLeft(50, Unit.PX);

			imgHrzPanel.addStyleName("pincircle");
			imgHrzPanel.add(lockimage);

			topPinPanel.setStyleName("adjustTopUsrProfilePinpopup");
			topPinPanel.add(changePinLbl);
			topPinPanel.setCellHorizontalAlignment( changePinLbl, HasHorizontalAlignment.ALIGN_CENTER );

			newPinTxtbxPanel.add(newPassImg);
			confirmTxtbxPinPanel.add(confirmPassImg);

			if(localeName.equals("ru"))
			{
				resetBtn.addStyleName("redPassRuBtn");
				changeBtn.addStyleName("greenPassRuBtn");
			}
			else
			{
				//resetBtn.addStyleName("redPinBtn");
				//changeBtn.addStyleName("greenPinBtn");
			}

			confirmPinLbl.getElement().getStyle().setMarginTop(7, Unit.PX);

			//space1.setHeight("21px");
			space1.setHeight("15px");
			space4.setHeight("15px");
			//containerChangePinUI.add( changePinLbl );
			containerChangePinUI.add( topPinPanel );
			containerChangePinUI.add( space );
			containerChangePinUI.add( imgHrzPanel );
			containerChangePinUI.add( space1 );

			containerChangePinUI.add( oldPinLbl);
			containerChangePinUI.add( oldPinTxtbxPanel);

			containerChangePinUI.add( horzOldPinErrPanel );//New Added by sunny soni showing error instead of pop panel
			containerChangePinUI.add( space2 );

			containerChangePinUI.add( newPinLbl );
			containerChangePinUI.add( newPinTxtbxPanel );
			containerChangePinUI.add( space3 );

			containerChangePinUI.add( confirmPinLbl );
			containerChangePinUI.add( confirmTxtbxPinPanel );
			containerChangePinUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

			containerChangePinUI.add( space4 );
			containerChangePinUI.add( btnContainer );
			containerChangePinUI.add( generateBtnVrtPanel );//new Added by sunny soni for showing generate pin btn

		}
		else if( E12Global.getInstance().getDeviceOS() == DeviceOS.iOS )
		{
			imgHrzPanel.getElement().getStyle().setMarginLeft(95, Unit.PX);

			imgHrzPanel.addStyleName("pincircle");
			imgHrzPanel.add(lockimage);

			topPinPanel.setWidth("111%");
			topPinPanel.setStyleName("adjustTopUsrProfilePinpopup");
			topPinPanel.add(changePinLbl);
			topPinPanel.setCellHorizontalAlignment( changePinLbl, HasHorizontalAlignment.ALIGN_CENTER );

			newPinTxtbxPanel.add(newPassImg);
			confirmTxtbxPinPanel.add(confirmPassImg);
			if(localeName.equals("ru"))
			{
				resetBtn.addStyleName("redPassRuBtn");
				changeBtn.addStyleName("greenPassRuBtn");
			}
			else
			{
				resetBtn.addStyleName("redPinBtn");
				changeBtn.addStyleName("greenPinBtn");
			}

			confirmPinLbl.getElement().getStyle().setMarginTop(7, Unit.PX);

			space1.setHeight("21px");
			space4.setHeight("15px");
			//containerChangePinUI.add( changePinLbl );
			containerChangePinUI.add( topPinPanel );
			containerChangePinUI.add( space );
			containerChangePinUI.add( imgHrzPanel );
			containerChangePinUI.add( space1 );

			containerChangePinUI.add( oldPinLbl);
			containerChangePinUI.add( oldPinTxtbxPanel);
			containerChangePinUI.add( horzOldPinErrPanel );//New Added by sunny soni showing error instead of pop panel
			containerChangePinUI.add( space2 );

			containerChangePinUI.add( newPinLbl );
			containerChangePinUI.add( newPinTxtbxPanel );
			containerChangePinUI.add( space3 );

			containerChangePinUI.add( confirmPinLbl );
			containerChangePinUI.add( confirmTxtbxPinPanel );

			containerChangePinUI.add( horzPinErrPanel );//New Added by sunny soni showing error instead of pop panel

			containerChangePinUI.add( space4 );
			containerChangePinUI.add( btnContainer );
			containerChangePinUI.add( generateBtnVrtPanel );//new Added by sunny soni for showing generate pin btn
		}

		oldpinText.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{

				if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
				{
					oldpinText.getElement().setPropertyString("type", "password");
					oldpinText.setText(oldpinText.getText().substring(oldpinText.getText().length()-1, oldpinText.getText().length()));
					horzOldPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
					if(oldpinText1.getValue().isEmpty())
					{
						oldpinText1.setFocus(true);
					}
					else
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setFocus(true);
					}
				}
				if( oldpinText.getText().length() == 0 )
				{
					oldpinText.setText("".trim());
					return;
				}
			}
		});
		oldpinText1.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
				{
					oldpinText1.getElement().setPropertyString("type", "password");
					oldpinText2.setText(oldpinText2.getText().substring(oldpinText2.getText().length()-1, oldpinText2.getText().length()));
					if(oldpinText2.getValue().isEmpty())
					{
						oldpinText2.setFocus(true);
					}
					else
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setFocus(true);
					}
				}
				if( oldpinText1.getText().length() == 0 )
				{
					oldpinText1.setText("".trim());
					return;
				}
			}
		});
		oldpinText2.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
				{
					oldpinText2.getElement().setPropertyString("type", "password");
					oldpinText2.setText(oldpinText2.getText().substring(oldpinText2.getText().length()-1, oldpinText2.getText().length()));
					if(oldpinText3.getValue().isEmpty())
					{
						oldpinText3.setFocus(true);
					}
					else
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setFocus(true);
					}
				}
				if( oldpinText2.getText().length() == 0 )
				{
					oldpinText2.setText("".trim());
					return;
				}
			}
		});
		oldpinText3.addKeyUpHandler(new KeyUpHandler() {
			@Override
			public void onKeyUp(KeyUpEvent event)
			{
				if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
				{
					oldpinText3.getElement().setPropertyString("type", "password");
					oldpinText3.setText(oldpinText3.getText().substring(oldpinText3.getText().length()-1, oldpinText3.getText().length()));
					String pinValues = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();

					if(pinValues.length() == 4)
					{
						if( pinLabel.indexOf("Change") != -1)
						{
							final String ipinVal = SHA256.toSha256(pinValues);
							if(iPin.equalsIgnoreCase(ipinVal))
							{
								newpinText.getElement().setPropertyString("type", "number");
								newpinText.setFocus(true);
							}
							else
							{
								oldpinText3.getElement().setPropertyString("type", "number");
								oldpinText3.setFocus(false);
								//Added by sunny soni for showing error message [Start]
								errorOldPinLbl.setText("Incorrect PIN.");
								horzOldPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
								horzOldPinErrPanel.setVisible(true);
								oldpinText.getElement().setPropertyString("type", "number");
								oldpinText.setText("".trim());
								oldpinText1.setText("".trim());
								oldpinText2.setText("".trim());
								oldpinText3.setText("".trim());
								oldpinText.setFocus(true);
								//Added by sunny soni for showing error message [End]
							}
						}
						else
						{
							newpinText.getElement().setPropertyString("type", "number");
							newpinText.setEnabled(true);
							newpinText1.setEnabled(true);
							newpinText2.setEnabled(true);
							newpinText3.setEnabled(true);
							newpinText.setFocus(true);
						}
					}
					else
					{
						if( pinLabel.indexOf("Change") != -1)
						{
							//Added by sunny soni for showing error message [Start]
							errorOldPinLbl.setText("Please Enter 4-Digit PIN.");
							horzOldPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzOldPinErrPanel.setVisible(true);
							oldpinText.getElement().setPropertyString("type", "number");
							oldpinText.setText("".trim());
							oldpinText1.setText("".trim());
							oldpinText2.setText("".trim());
							oldpinText3.setText("".trim());
							oldpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]
						}
						else
						{
							if(oldpinText.getValue().isEmpty())
							{
								oldpinText.setFocus(true);
								oldpinText.getElement().setPropertyString("type", "number");
							}
							if(oldpinText1.getValue().isEmpty())
							{
								oldpinText1.setFocus(true);
								oldpinText1.getElement().setPropertyString("type", "number");
							}
							if(oldpinText2.getValue().isEmpty())
							{
								oldpinText2.setFocus(true);
								oldpinText2.getElement().setPropertyString("type", "number");
							}
							if(oldpinText3.getValue().isEmpty())
							{
								oldpinText3.setFocus(true);
								oldpinText3.getElement().setPropertyString("type", "number");
							}
						}

					}

				}
				if( oldpinText3.getText().length() == 0 )
				{
					oldpinText3.setText("".trim());
					return;
				}
			}
		});

		oldpinText.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText.getText().length() == 1 || oldpinText.getText().length() > 1)
					{
						oldpinText.setText(oldpinText.getText().substring(0, 1));
						oldpinText.getElement().setPropertyString("type", "password");
					}
				}
			}
		});
		oldpinText1.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText1.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText1.getText().length() == 1 || oldpinText1.getText().length() > 1)
					{
						oldpinText1.getElement().setPropertyString("type", "password");
						oldpinText1.setText(oldpinText1.getText().substring(0, 1));
					}
				}
			}
		});
		oldpinText2.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText2.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText2.getText().length() == 1 || oldpinText2.getText().length() > 1)
					{
						oldpinText2.getElement().setPropertyString("type", "password");
						oldpinText2.setText(oldpinText2.getText().substring(0, 1));
					}
				}
			}
		});
		oldpinText3.addBlurHandler(new BlurHandler() {
			@Override
			public void onBlur(BlurEvent event) {
				if(!(oldpinText3.getValue().equalsIgnoreCase("")))
				{
					if(oldpinText3.getText().length() == 1 || oldpinText3.getText().length() > 1)
					{
						oldpinText3.getElement().setPropertyString("type", "password");
						oldpinText3.setText(oldpinText3.getText().substring(0, 1));
					}
				}
			}
		});

		oldpinText.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText.getValue().isEmpty()))
				{
					oldpinText.getElement().setPropertyString("type", "number");
					oldpinText.setCursorPos(oldpinText.getValue().length());
					if(!(oldpinText.getValue().equalsIgnoreCase("")))
					{
						oldpinText.getElement().setPropertyString("type", "number");
						oldpinText.setText(oldpinText.getText().substring(0, 1));
						oldpinText.setFocus(true);
					}
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText1.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText1.getValue().isEmpty()))
				{
					oldpinText1.getElement().setPropertyString("type", "number");
					oldpinText1.setCursorPos(oldpinText1.getValue().length());
					if(!(oldpinText1.getValue().equalsIgnoreCase("")))
					{
						oldpinText1.getElement().setPropertyString("type", "number");
						oldpinText1.setText(oldpinText1.getText().substring(0, 1));
						oldpinText1.setFocus(true);
					}
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText2.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText2.getValue().isEmpty()))
				{
					oldpinText2.getElement().setPropertyString("type", "number");
					oldpinText2.setCursorPos(oldpinText2.getValue().length());
					if(!(oldpinText2.getValue().equalsIgnoreCase("")))
					{
						oldpinText2.getElement().setPropertyString("type", "number");
						oldpinText2.setText(oldpinText2.getText().substring(0, 1));
						oldpinText2.setFocus(true);
					}
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
			}
		});
		oldpinText3.addFocusHandler(new FocusHandler() {
			@Override
			public void onFocus(FocusEvent event) {
				if(oldpinText.getValue().isEmpty())
				{
					oldpinText.getElement().setPropertyString("type", "number");
				}
				if(oldpinText1.getValue().isEmpty())
				{
					oldpinText1.getElement().setPropertyString("type", "number");
				}
				if(oldpinText2.getValue().isEmpty())
				{
					oldpinText2.getElement().setPropertyString("type", "number");
				}
				if(oldpinText3.getValue().isEmpty())
				{
					oldpinText3.getElement().setPropertyString("type", "number");
				}
				if( !(oldpinText3.getValue().isEmpty()))
				{
					oldpinText3.getElement().setPropertyString("type", "number");
					oldpinText3.setCursorPos(oldpinText3.getValue().length());
					if(!(oldpinText3.getValue().equalsIgnoreCase("")))
					{
						oldpinText3.getElement().setPropertyString("type", "number");
						oldpinText3.setText(oldpinText3.getText().substring(0, 1));
						oldpinText3.setFocus(true);
					}
				}
			}
		});

		oldpinText.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				oldpinText.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText1.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText1.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText2.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText2.getElement().setPropertyString("type", "number");
			}
		});
		oldpinText3.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				oldpinText3.getElement().setPropertyString("type", "number");
			}
		});

		newpinText.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{
			if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
			{
				/*newpinText.setText(newpinText.getText().substring(0, 1));*/
				newpinText.getElement().setPropertyString("type", "password");
				newpinText.setText(newpinText.getText().substring(newpinText.getText().length()-1, newpinText.getText().length()));
				horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
				if(newpinText1.getValue().isEmpty())
				{
					newpinText1.setFocus(true);
				}
				else
				{
					newpinText1.getElement().setPropertyString("type", "number");
					newpinText1.setFocus(true);
				}
			}
			if( newpinText.getText().length() == 0 )
			{
				newpinText.setText("".trim());
				return;
			}
		}
		});
		newpinText1.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{
			if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
			{
				newpinText1.getElement().setPropertyString("type", "password");
				//newpinText1.setText(newpinText1.getText().substring(0, 1));
				newpinText1.setText(newpinText1.getText().substring(newpinText1.getText().length()-1, newpinText1.getText().length()));
				if(newpinText2.getValue().isEmpty())
				{
					newpinText2.setFocus(true);
				}
				else
				{
					newpinText2.getElement().setPropertyString("type", "number");
					newpinText2.setFocus(true);
				}
			}
			if( newpinText1.getText().length() == 0 )
			{
				newpinText1.setText("".trim());
				return;
			}
		}
		});
		newpinText2.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{
			if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
			{
				newpinText2.getElement().setPropertyString("type", "password");
				/*newpinText2.setText(newpinText2.getText().substring(0, 1));*/
				newpinText2.setText(newpinText2.getText().substring(newpinText2.getText().length()-1, newpinText2.getText().length()));
				if(newpinText3.getValue().isEmpty())
				{
					newpinText3.setFocus(true);
				}
				else
				{
					newpinText3.getElement().setPropertyString("type", "number");
					newpinText3.setFocus(true);
				}
			}
			if( newpinText2.getText().length() == 0 )
			{
				newpinText2.setText("".trim());
				return;
			}
		}
		});
		newpinText3.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{
			if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
			{
				newpinText3.getElement().setPropertyString("type", "password");
				//newpinText3.setText(newpinText3.getText().substring(0, 1));
				newpinText3.setText(newpinText3.getText().substring(newpinText3.getText().length()-1, newpinText3.getText().length()));
				String newPinval = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
				if(newPinval.length() == 4)
				{
					if(pinLabel.indexOf("Change") != -1)
					{
						final String iPin = E12Storage.getItemLocalStorage("iPin_"+E12Constants.userID);
						final String ipinVal = SHA256.toSha256(newPinval);
						if(iPin.equalsIgnoreCase(ipinVal))
						{
							newpinText3.getElement().setPropertyString("type", "number");
							newpinText3.setFocus(false);
							//Added by sunny soni for showing error message [Start]
							errorPinLbl.setText("PIN Already Used.");
							horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzPinErrPanel.setVisible(true);
							newpinText.getElement().setPropertyString("type", "number");
							newpinText.setText("".trim());
							newpinText1.setText("".trim());
							newpinText2.setText("".trim());
							newpinText3.setText("".trim());
							newpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]
						}
						else
						{
							confirmpinText.getElement().setPropertyString("type", "number");
							confirmpinText.setEnabled(true);
							confirmpinText1.setEnabled(true);
							confirmpinText2.setEnabled(true);
							confirmpinText3.setEnabled(true);
							confirmpinText.setFocus(true);
						}
					}
					else
					{
						String oldpinVal = oldpinText.getValue()+oldpinText1.getValue()+oldpinText2.getValue()+oldpinText3.getValue();
						if(newPinval.equalsIgnoreCase(oldpinVal))
						{
							generateBtn.setFocus(true);
						}
						else
						{
							newpinText3.getElement().setPropertyString("type", "number");
							newpinText.getElement().setPropertyString("type", "number");
							//Added by sunny soni for showing error message [Start]
							errorPinLbl.setText("PIN NOT MATCHED");
							horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
							horzPinErrPanel.setVisible(true);
							newpinText.setText("".trim());
							newpinText1.setText("".trim());
							newpinText2.setText("".trim());
							newpinText3.setText("".trim());
							newpinText.setFocus(true);
							//Added by sunny soni for showing error message [End]
							//showDialogBox("", message, vrfyPinText, vrfyPinText1, vrfyPinText2, vrfyPinText3);
						}
					}

				}
				else
				{
					if(pinLabel.indexOf("Change") != -1)
					{
						if(newpinText1.getValue().isEmpty())
						{
							newpinText.setFocus(true);
							newpinText.getElement().setPropertyString("type", "number");
						}
						if(newpinText1.getValue().isEmpty())
						{
							newpinText1.setFocus(true);
							newpinText1.getElement().setPropertyString("type", "number");
						}
						if(newpinText2.getValue().isEmpty())
						{
							newpinText2.setFocus(true);
							newpinText2.getElement().setPropertyString("type", "number");
						}
						if(newpinText3.getValue().isEmpty())
						{
							newpinText3.setFocus(true);
							newpinText3.getElement().setPropertyString("type", "number");
						}
					}
					else
					{
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("Please Enter 4-digit PIN");
						horzPinErrPanel.getElement().getStyle().setMarginTop(-10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						newpinText.setText("".trim());
						newpinText1.setText("".trim());
						newpinText2.setText("".trim());
						newpinText3.setText("".trim());
						newpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]
					}
				}
			}
			if( newpinText3.getText().length() == 0 )
			{
				newpinText3.setText("".trim());
				return;
			}
		}
		});

		newpinText.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(newpinText.getValue().equalsIgnoreCase("")))
			{
				if(newpinText.getText().length() == 1 || newpinText.getText().length() > 1)
				{
					newpinText.setText(newpinText.getText().substring(0, 1));
					newpinText.getElement().setPropertyString("type", "password");
				}
			}
		}
		});
		newpinText1.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(newpinText1.getValue().equalsIgnoreCase("")))
			{
				if(newpinText1.getText().length() == 1 || newpinText1.getText().length() > 1)
				{
					newpinText1.getElement().setPropertyString("type", "password");
					newpinText1.setText(newpinText1.getText().substring(0, 1));
				}
			}
		}
		});
		newpinText2.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(newpinText2.getValue().equalsIgnoreCase("")))
			{
				if(newpinText2.getText().length() == 1 || newpinText2.getText().length() > 1)
				{
					newpinText2.getElement().setPropertyString("type", "password");
					newpinText2.setText(newpinText2.getText().substring(0, 1));
				}
			}
		}
		});
		newpinText3.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(newpinText3.getValue().equalsIgnoreCase("")))
			{
				if(newpinText3.getText().length() == 1 || newpinText3.getText().length() > 1)
				{
					newpinText3.getElement().setPropertyString("type", "password");
					newpinText3.setText(newpinText3.getText().substring(0, 1));
				}
			}
		}
		});

		newpinText.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(newpinText.getValue().isEmpty())
			{
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				newpinText.getElement().setPropertyString("type", "number");
			}
			if(!(newpinText.getValue().isEmpty()))
			{
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				newpinText.getElement().setPropertyString("type", "number");
				newpinText.setCursorPos(newpinText.getValue().length());

				if(!(newpinText.getValue().equalsIgnoreCase("")))
				{
					newpinText.getElement().setPropertyString("type", "number");
					newpinText.setText(newpinText.getText().substring(0, 1));
					newpinText.setFocus(true);
				}
			}
			if(newpinText1.getValue().isEmpty())
			{
				newpinText1.getElement().setPropertyString("type", "number");
			}
			if(newpinText2.getValue().isEmpty())
			{
				newpinText2.getElement().setPropertyString("type", "number");
			}
			if(newpinText3.getValue().isEmpty())
			{
				newpinText3.getElement().setPropertyString("type", "number");
			}
		}
		});
		newpinText1.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(newpinText.getValue().isEmpty())
			{
				newpinText.getElement().setPropertyString("type", "number");
			}
			if(newpinText1.getValue().isEmpty())
			{
				newpinText1.getElement().setPropertyString("type", "number");
			}
			if(!(newpinText1.getValue().isEmpty()))
			{
				newpinText1.getElement().setPropertyString("type", "number");
				newpinText1.setCursorPos(newpinText1.getValue().length());
				if(!(newpinText1.getValue().equalsIgnoreCase("")))
				{
					newpinText1.getElement().setPropertyString("type", "number");
					newpinText1.setText(newpinText1.getText().substring(0, 1));
					newpinText1.setFocus(true);
				}
			}
			if(newpinText2.getValue().isEmpty())
			{
				newpinText2.getElement().setPropertyString("type", "number");
			}
			if(newpinText3.getValue().isEmpty())
			{
				newpinText3.getElement().setPropertyString("type", "number");
			}
		}
		});
		newpinText2.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(newpinText.getValue().isEmpty())
			{
				newpinText.getElement().setPropertyString("type", "number");
			}
			if(newpinText1.getValue().isEmpty())
			{
				newpinText1.getElement().setPropertyString("type", "number");
			}
			if(newpinText2.getValue().isEmpty())
			{
				newpinText2.getElement().setPropertyString("type", "number");
			}
			if(!(newpinText2.getValue().isEmpty()))
			{
				newpinText2.getElement().setPropertyString("type", "number");
				newpinText2.setCursorPos(newpinText2.getValue().length());
				if(!(newpinText2.getValue().equalsIgnoreCase("")))
				{
					newpinText2.getElement().setPropertyString("type", "number");
					newpinText2.setText(newpinText2.getText().substring(0, 1));
					newpinText2.setFocus(true);
				}
			}
			if(newpinText3.getValue().isEmpty())
			{
				newpinText3.getElement().setPropertyString("type", "number");
			}
		}
		});
		newpinText3.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(newpinText.getValue().isEmpty())
			{
				newpinText.getElement().setPropertyString("type", "number");
			}
			if(newpinText1.getValue().isEmpty())
			{
				newpinText1.getElement().setPropertyString("type", "number");
			}
			if(newpinText2.getValue().isEmpty())
			{
				newpinText2.getElement().setPropertyString("type", "number");
			}
			if(newpinText3.getValue().isEmpty())
			{
				newpinText3.getElement().setPropertyString("type", "number");
			}
			if(!(newpinText3.getValue().isEmpty()))
			{
				newpinText3.getElement().setPropertyString("type", "number");
				newpinText3.setCursorPos(newpinText3.getValue().length());
				if(!(newpinText3.getValue().equalsIgnoreCase("")))
				{
					newpinText3.getElement().setPropertyString("type", "number");
					newpinText3.setText(newpinText3.getText().substring(0, 1));
					newpinText3.setFocus(true);
				}
			}
		}
		});

		newpinText.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
			newpinText.getElement().setPropertyString("type", "number");
		}
		});
		newpinText1.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			newpinText1.getElement().setPropertyString("type", "number");
		}
		});
		newpinText2.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			newpinText2.getElement().setPropertyString("type", "number");
		}
		});
		newpinText3.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			newpinText3.getElement().setPropertyString("type", "number");
		}
		});

		confirmpinText.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{

			if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
			{
				confirmpinText.getElement().setPropertyString("type", "password");
				confirmpinText.setText(confirmpinText.getText().substring(confirmpinText.getText().length()-1, confirmpinText.getText().length()));
				horzPinErrPanel.setVisible(false);//New Added by sunny soni showing error instead of pop panel
				if(confirmpinText1.getValue().isEmpty())
				{
					confirmpinText1.setFocus(true);
				}
				else
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
					confirmpinText1.setFocus(true);
				}
			}
			if( confirmpinText.getText().length() == 0 )
			{
				confirmpinText.setText("".trim());
				return;
			}
		}
		});
		confirmpinText1.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{
			if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
			{
				confirmpinText1.getElement().setPropertyString("type", "password");
				confirmpinText1.setText(confirmpinText1.getText().substring(confirmpinText1.getText().length()-1, confirmpinText1.getText().length()));
				if(confirmpinText2.getValue().isEmpty())
				{
					confirmpinText2.setFocus(true);
				}
				else
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
					confirmpinText2.setFocus(true);
				}
			}
			if( confirmpinText1.getText().length() == 0 )
			{
				confirmpinText1.setText("".trim());
				return;
			}
		}
		});
		confirmpinText2.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{

			if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
			{
				confirmpinText2.getElement().setPropertyString("type", "password");
				//confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
				confirmpinText2.setText(confirmpinText2.getText().substring(confirmpinText2.getText().length()-1, confirmpinText2.getText().length()));
				if(confirmpinText3.getValue().isEmpty())
				{
					confirmpinText3.setFocus(true);
				}
				else
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
					confirmpinText3.setFocus(true);
				}
			}
			if( confirmpinText2.getText().length() == 0 )
			{
				confirmpinText2.setText("".trim());
				return;
			}
		}
		});
		confirmpinText3.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event)
		{
			if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
			{
				confirmpinText3.getElement().setPropertyString("type", "password");
				confirmpinText3.setText(confirmpinText3.getText().substring(confirmpinText3.getText().length()-1, confirmpinText3.getText().length()));

				String newPinvalue = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
				String confirmpinVal = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
				if(confirmpinVal.length() == 4)
				{
					if(newPinvalue.equalsIgnoreCase(confirmpinVal))
					{
						changeBtn.setFocus(true);
					}
					else
					{
						confirmpinText3.getElement().setPropertyString("type", "number");
						confirmpinText3.setFocus(false);
						//Added by sunny soni for showing error message [Start]
						errorPinLbl.setText("PIN not matched.");
						horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
						horzPinErrPanel.setVisible(true);
						confirmpinText.getElement().setPropertyString("type", "number");
						confirmpinText.setText("".trim());
						confirmpinText1.setText("".trim());
						confirmpinText2.setText("".trim());
						confirmpinText3.setText("".trim());
						confirmpinText.setFocus(true);
						//Added by sunny soni for showing error message [End]
					}
				}
				else
				{
					//Added by sunny soni for showing error message [Start]
					errorPinLbl.setText("Please Enter 4-digit PIN.");
					horzPinErrPanel.getElement().getStyle().setMarginTop(10, Unit.PX);
					horzPinErrPanel.setVisible(true);
					confirmpinText.getElement().setPropertyString("type", "number");
					confirmpinText.setText("".trim());
					confirmpinText1.setText("".trim());
					confirmpinText2.setText("".trim());
					confirmpinText3.setText("".trim());
					confirmpinText.setFocus(true);
					//Added by sunny soni for showing error message [End]
				}
			}
			if( confirmpinText3.getText().length() == 0 )
			{
				confirmpinText3.setText("".trim());
				return;
			}
		}
		});

		confirmpinText.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(confirmpinText.getValue().equalsIgnoreCase("")))
			{
				if(confirmpinText.getText().length() == 1 || confirmpinText.getText().length() > 1)
				{
					confirmpinText.setText(confirmpinText.getText().substring(0, 1));
					confirmpinText.getElement().setPropertyString("type", "password");
				}
			}
		}
		});
		confirmpinText1.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
			{
				if(confirmpinText1.getText().length() == 1 || confirmpinText1.getText().length() > 1)
				{
					confirmpinText1.getElement().setPropertyString("type", "password");
					confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
				}
			}
		}
		});
		confirmpinText2.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
			{
				if(confirmpinText2.getText().length() == 1 || confirmpinText2.getText().length() > 1)
				{
					confirmpinText2.getElement().setPropertyString("type", "password");
					confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
				}
			}
		}
		});
		confirmpinText3.addBlurHandler(new BlurHandler() {
		@Override
		public void onBlur(BlurEvent event) {
			if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
			{
				if(confirmpinText3.getText().length() == 1 || confirmpinText3.getText().length() > 1)
				{
					confirmpinText3.getElement().setPropertyString("type", "password");
					confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
				}
			}
		}
		});

		confirmpinText.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(confirmpinText.getValue().isEmpty())
			{
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				confirmpinText.getElement().setPropertyString("type", "number");
			}
			if(!(confirmpinText.getValue().isEmpty()))
			{
				showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
				confirmpinText.getElement().setPropertyString("type", "number");
				confirmpinText.setCursorPos(confirmpinText.getValue().length());
				if(!(confirmpinText.getValue().equalsIgnoreCase("")))
				{
					confirmpinText.getElement().setPropertyString("type", "number");
					confirmpinText.setText(confirmpinText.getText().substring(0, 1));
					confirmpinText.setFocus(true);
				}
			}
			if(confirmpinText1.getValue().isEmpty())
			{
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText2.getValue().isEmpty())
			{
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText3.getValue().isEmpty())
			{
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
		}
		});
		confirmpinText1.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(confirmpinText.getValue().isEmpty())
			{
				confirmpinText.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText1.getValue().isEmpty())
			{
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
			if(!(confirmpinText1.getValue().isEmpty()))
			{
				confirmpinText1.getElement().setPropertyString("type", "number");
				confirmpinText1.setCursorPos(confirmpinText1.getValue().length());
				if(!(confirmpinText1.getValue().equalsIgnoreCase("")))
				{
					confirmpinText1.getElement().setPropertyString("type", "number");
					confirmpinText1.setText(confirmpinText1.getText().substring(0, 1));
					confirmpinText1.setFocus(true);
				}
			}
			if(confirmpinText2.getValue().isEmpty())
			{
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText3.getValue().isEmpty())
			{
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
		}
		});
		confirmpinText2.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(confirmpinText.getValue().isEmpty())
			{
				confirmpinText.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText1.getValue().isEmpty())
			{
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText2.getValue().isEmpty())
			{
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
			if(!(confirmpinText2.getValue().isEmpty()))
			{
				confirmpinText2.getElement().setPropertyString("type", "number");
				confirmpinText2.setCursorPos(confirmpinText2.getValue().length());
				if(!(confirmpinText2.getValue().equalsIgnoreCase("")))
				{
					confirmpinText2.getElement().setPropertyString("type", "number");
					confirmpinText2.setText(confirmpinText2.getText().substring(0, 1));
					confirmpinText2.setFocus(true);
				}
			}
			if(confirmpinText3.getValue().isEmpty())
			{
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
		}
		});
		confirmpinText3.addFocusHandler(new FocusHandler() {
		@Override
		public void onFocus(FocusEvent event) {
			if(confirmpinText.getValue().isEmpty())
			{
				confirmpinText.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText1.getValue().isEmpty())
			{
				confirmpinText1.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText2.getValue().isEmpty())
			{
				confirmpinText2.getElement().setPropertyString("type", "number");
			}
			if(confirmpinText3.getValue().isEmpty())
			{
				confirmpinText3.getElement().setPropertyString("type", "number");
			}
			if(!(confirmpinText3.getValue().isEmpty()))
			{
				confirmpinText3.getElement().setPropertyString("type", "number");
				confirmpinText3.setCursorPos(confirmpinText3.getValue().length());
				if(!(confirmpinText3.getValue().equalsIgnoreCase("")))
				{
					confirmpinText3.getElement().setPropertyString("type", "number");
					confirmpinText3.setText(confirmpinText3.getText().substring(0, 1));
					confirmpinText3.setFocus(true);
				}
			}
		}
		});

		confirmpinText.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			showScrollToViewInput( ((Widget) event.getSource()).getElement().getId() );
			confirmpinText.getElement().setPropertyString("type", "number");
		}
		});
		confirmpinText1.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			confirmpinText1.getElement().setPropertyString("type", "number");
		}
		});
		confirmpinText2.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			confirmpinText2.getElement().setPropertyString("type", "number");
		}
		});
		confirmpinText3.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			confirmpinText3.getElement().setPropertyString("type", "number");
		}
		});
		changeBtn.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				String newPin = confirmpinText.getValue()+confirmpinText1.getValue()+confirmpinText2.getValue()+confirmpinText3.getValue();
				if(newPin.length() == 4)
				{
					E12Storage.removeItem("iPin"+E12Constants.userID);
					final String newPinResult = SHA256.toSha256(newPin);
					E12Storage.localStorageVars.add("iPin_"+E12Constants.userID);
					//Changed by Sandeep S. on 20-MAR-18 [local storage & indexed db related changes] end
					E12Storage.setItem("iPin_"+E12Constants.userID, newPinResult);
					Window.alert( "PIN Updated Successfully" );
					e12PopupPanel.hide(true);
				}
			}
			});

			resetBtn.addClickHandler( new ClickHandler()
			{
				@Override
				public void onClick(ClickEvent event)
				{
					newpinText.getElement().setPropertyString("type", "number");
					newpinText.setText( "" );
					newpinText1.setText( "" );
					newpinText2.setText( "" );
					newpinText3.setText( "" );

					confirmpinText.setText( "" );
					confirmpinText1.setText( "" );
					confirmpinText2.setText( "" );
					confirmpinText3.setText( "" );

					newpinText.setFocus(true);

					confirmpinText.setEnabled(false);
					confirmpinText1.setEnabled(false);
					confirmpinText2.setEnabled(false);
					confirmpinText3.setEnabled(false);

					newPassImg.removeStyleName("rightPass");
					newPassImg.removeStyleName("wrongPass");
					confirmPassImg.removeStyleName("confirmRightPass");
					confirmPassImg.removeStyleName("confirmWrongPass");
				}
			});
			generateBtn.addClickHandler(new ClickHandler() {
				@Override
				public void onClick(ClickEvent event) {
					String newPin = newpinText.getValue()+newpinText1.getValue()+newpinText2.getValue()+newpinText3.getValue();
					if(newPin.length() == 4)
					{
						setGeneratedPin(newPin);
						Window.alert( "PIN Generated Successfully" );
						e12PopupPanel.hide(true);
					}
				}
			});

		e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerChangePinUI );
		e12PopupPanel.setAnimationEnabled(false);
		e12PopupPanel.setGlassEnabled(true);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
		ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();

	}
	public void setGeneratedPin(final String generatedPin)
	{
		try
		{
			if( generatedPin.length() > 0)
	      	{
	      	   E12Storage.removeItem("iPin"+E12Constants.userID);
	       	   final String newPinResult = SHA256.toSha256(generatedPin);
	       	E12Storage.localStorageVars.add("iPin_"+E12Constants.userID);
	       	   E12Storage.setItem("iPin_"+E12Constants.userID, newPinResult);
	      	}
		}
		catch(Exception ae)
		{
			ae.printStackTrace();
			E12CommonUtils.printOnConsole("Exception in newGeneratedPin::[ "+ae.getMessage()+" ]");
		}
	}
	//Added by sunny soni for showing change pin Popup [End]
	//Added by sunny soni for getting bluetooth device setting[Start]
	//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[Start]
	VerticalPanel containerBLESettingUI = null;
	VerticalPanel pairedDevicesVertPnl = null;
	//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[End]
	public void showBluetoothSetting(String result)
	{
		//Added by sunny soni for registering advertise native js function for getting device list on 22-Aug-19[Start]
		getAdvertiseDevices(this);
		//Added by sunny soni for test on 22-Aug-19[End]

		welcomepopupPnl.hide();
		final E12PopupPanel e12PopupPanel =  new E12PopupPanel(true,false,"",true);
		//final VerticalPanel containerBLESettingUI = new VerticalPanel();
		this.containerBLESettingUI = new VerticalPanel();
		E12CommonUtils.printOnConsole("---->>In showBluetoothSetting:: [ "+result+" ]");
		JSONValue jsonParser = JSONParser.parseStrict(result);
		JSONObject jsonObject = jsonParser.isObject();

		String loginDeviceName = jsonObject.get("deviceName").toString() == null ?"": jsonObject.get("deviceName").toString().replace("\"", "");
		String advertiseOnStr = jsonObject.get("isAdvertiseOn").toString() == null ?"": jsonObject.get("isAdvertiseOn").toString().replace("\"", "");
		E12CommonUtils.printOnConsole(loginDeviceName+":"+advertiseOnStr);
		boolean isAdvertiseOn = Boolean.parseBoolean(advertiseOnStr);
		String tglBgrdColr = isAdvertiseOn ? "#2196f3" : "#ccc";

		JSONValue pairedDevicesjsonArrValue = jsonObject.get("pairedDevices");
		E12CommonUtils.printOnConsole("pairedDevicesjsonArrValue: [ "+pairedDevicesjsonArrValue+" ]");
		JSONArray pairedDevicesjsonArr = null;
		if(pairedDevicesjsonArrValue!=null)
		{
			pairedDevicesjsonArr = pairedDevicesjsonArrValue.isArray();
		}

		String hrLineStyle = "<hr style=\"width:100%; background-color: lightgray; height: 1px; border: 0; position: absolute; right: 0px; margin-top : -6px;\" />";
		HTML html = new HTML(hrLineStyle);
		final Label settingLbl = new Label("Setting");
		settingLbl.addStyleName("settingLblAlignment");
		Scheduler.get().scheduleDeferred(new ScheduledCommand()
		{
			@Override
			  public void execute() {
			   int width = e12PopupPanel.getOffsetWidth();
			   int lblwidth = width-28;
			   settingLbl.setWidth(Integer.toString(lblwidth) +"px");
			  }
			});
			(new Timer()
			{
				   @Override
				   public void run() {
				   }
			}).schedule(500);

		HorizontalPanel pairedDeviceLblPanel = new HorizontalPanel();
		HorizontalPanel bluetoothToggleHorzPnl =  new HorizontalPanel();
		bluetoothToggleHorzPnl.getElement().setAttribute("Id", "0");
		bluetoothToggleHorzPnl = getBLEtoggleHzPnl(E12Constants.constants.getPairedDeviceLbl(),"bluetoothDevice",bluetoothToggleHorzPnl, isAdvertiseOn, tglBgrdColr);
		pairedDeviceLblPanel.add(bluetoothToggleHorzPnl);

		HorizontalPanel deviceNameHrzPnl = new HorizontalPanel();
		deviceNameHrzPnl.setWidth( "100%" );
		final Label deviceNameLbl = new Label("Device Name");
		deviceNameLbl.addStyleName("bleInFntWithClr");

		final Label deviceName = new Label(loginDeviceName);

		deviceNameHrzPnl.add( deviceNameLbl );
		deviceNameHrzPnl.add( deviceName );
		deviceNameHrzPnl.setCellHorizontalAlignment( deviceName, HasHorizontalAlignment.ALIGN_RIGHT );

		HorizontalPanel pairedDeviceInfoHrzpnl = new HorizontalPanel();
		final Label pairedDeviceInfoLbl = new Label("Paired Devices");
		pairedDeviceInfoLbl.getElement().getStyle().setMarginTop(10, Unit.PX);
		pairedDeviceInfoLbl.addStyleName("bleInFntWithClr");

		pairedDeviceInfoHrzpnl.add(pairedDeviceInfoLbl);
		pairedDeviceInfoHrzpnl.setCellHorizontalAlignment( pairedDeviceInfoLbl, HasHorizontalAlignment.ALIGN_RIGHT );

		Label space1 = new Label();
		space1.setHeight("25px");

		Label space2 = new Label();
		space2.setHeight("4px");

		Label space3 = new Label();
		space3.setHeight("4px");

		Label space4 = new Label();
		space4.setWidth("20px");

		Label space5 = new Label();
		space5.setHeight("4px");

		e12PopupPanel.addStyleName("adjustPopup");

		e12PopupPanel.addStyleName("changePasswordPanel");
		e12PopupPanel.setStyleNameToCloseLabel("close1");
		e12PopupPanel.addStyleNameToContainer("changePassPopupPanel");
		e12PopupPanel.getElement().setAttribute("style", "outline: none;");

		HTML html1 = new HTML(hrLineStyle);
		String hrLineStyle1 = "<hr style=\"width:100%; background-color: lightgray; height: 1px; border: 0; position: absolute; right: 0px;\" />";
		HTML html2 = new HTML(hrLineStyle1);
		if( E12Global.getInstance().getDeviceType() == DeviceType.Mobile )
		{
			containerBLESettingUI.add( space1 );
			containerBLESettingUI.add( settingLbl );
			containerBLESettingUI.add( space2 );
			containerBLESettingUI.add( html );
			containerBLESettingUI.add( pairedDeviceLblPanel);

			containerBLESettingUI.add( space3 );
			containerBLESettingUI.add( html1 );
			containerBLESettingUI.add( deviceNameHrzPnl );
			containerBLESettingUI.add( space4 );
			containerBLESettingUI.add( html2 );
			containerBLESettingUI.add( space5 );
			containerBLESettingUI.add(pairedDeviceInfoHrzpnl);
			if(pairedDevicesjsonArr!=null)
			{
				for(int i = 0; i < pairedDevicesjsonArr.size(); i++)
				{
					JSONObject pairedJsonObj = pairedDevicesjsonArr.get(i).isObject();
					String pairedDeviceName = pairedJsonObj.get("deviceName").toString() == null ?"": pairedJsonObj.get("deviceName").toString().replace("\"", "");
					String pairedDeviceStatus = pairedJsonObj.get("status").toString() == null ?"": pairedJsonObj.get("status").toString().replace("\"", "");
					String pairedDeviceType = pairedJsonObj.get("deviceType").toString() == null ?"": pairedJsonObj.get("deviceType").toString().replace("\"", "");
					E12CommonUtils.printOnConsole(pairedDeviceName+":"+pairedDeviceStatus+":"+pairedDeviceType);
					//containerBLESettingUI.add( getDevicesIforHorzPnl(pairedDeviceName,pairedDeviceStatus, pairedDeviceType) );
					getDevicesIforHorzPnl(pairedDeviceName,pairedDeviceStatus, pairedDeviceType);
				}
			}
			else
			{
				//containerBLESettingUI.add( getDevicesIforHorzPnl(null, null, null) );
				//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[Start]
				getDevicesIforHorzPnl(null, null, null);
				//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[End]
			}
		}
		else if( E12Global.getInstance().getDeviceType() == DeviceType.Tablet )
		 {
			containerBLESettingUI.add( space1 );
			containerBLESettingUI.add( settingLbl );
			containerBLESettingUI.add( space2 );
			containerBLESettingUI.add( html );
			containerBLESettingUI.add( pairedDeviceLblPanel);

			containerBLESettingUI.add( space3 );
			containerBLESettingUI.add( html1 );
			containerBLESettingUI.add( deviceNameHrzPnl );
			containerBLESettingUI.add( space4 );
			containerBLESettingUI.add( html2 );
			containerBLESettingUI.add( space5 );
			containerBLESettingUI.add(pairedDeviceInfoHrzpnl);

			if(pairedDevicesjsonArr!=null)
			{
				for(int i=0; i<pairedDevicesjsonArr.size(); i++)
				{
					JSONObject pairedJsonObj = pairedDevicesjsonArr.get(i).isObject();
					String pairedDeviceName = pairedJsonObj.get("deviceName").toString() == null ?"": pairedJsonObj.get("deviceName").toString().replace("\"", "");
					String pairedDeviceStatus = pairedJsonObj.get("status").toString() == null ?"": pairedJsonObj.get("status").toString().replace("\"", "");
					String pairedDeviceType = pairedJsonObj.get("deviceType").toString() == null ?"": pairedJsonObj.get("deviceType").toString().replace("\"", "");
					E12CommonUtils.printOnConsole(pairedDeviceName+":"+pairedDeviceStatus+":"+pairedDeviceType);
					//containerBLESettingUI.add(getDevicesIforHorzPnl(pairedDeviceName,pairedDeviceStatus, pairedDeviceType));
					getDevicesIforHorzPnl(pairedDeviceName,pairedDeviceStatus, pairedDeviceType);
				}
			}
			else
			{
				//containerBLESettingUI.add(getDevicesIforHorzPnl(null, null, null));
				//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[Start]
				getDevicesIforHorzPnl(null, null, null);
				//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[End]
			}
		 }
		//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[Start]
		if(this.pairedDevicesVertPnl!=null)
		{
			containerBLESettingUI.add( this.pairedDevicesVertPnl );
		}
		//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[End]
    	e12PopupPanel.getElement().getStyle().setZIndex( 2 );
		e12PopupPanel.setWidget( containerBLESettingUI );
		e12PopupPanel.setAnimationEnabled(false);
		Element ele = (Element) e12PopupPanel.getElement().getChild(0).getChild(0);
        ele.setAttribute("style", "outline: none;");
		e12PopupPanel.center();
	}
	private HorizontalPanel getBLEtoggleHzPnl(String pnlName,final String keyName,final HorizontalPanel outertglHzPnl, boolean isAdvertiseOn, String tglBgrdColr)
	{
		Label toggleLbl = new Label(pnlName);
		toggleLbl.getElement().getStyle().setFontWeight(FontWeight.BOLD);
		toggleLbl.getElement().getStyle().setColor("gray");

		HorizontalPanel toggleLblHrzPnl = new HorizontalPanel();
		toggleLblHrzPnl.add(toggleLbl);
		toggleLblHrzPnl.setWidth("67%");
		toggleLblHrzPnl.getElement().getStyle().setMarginBottom(12, Unit.PX);
		outertglHzPnl.addStyleName("bleoutertglHzPnl");
		toggleLbl.addStyleName("togglePnlName");

		final HorizontalPanel  tglHzPnl = new HorizontalPanel();
		final Label toggleButton = new Label();

		tglHzPnl.addStyleName("bletglHzPnl");
		tglHzPnl.getElement().getStyle().setBackgroundColor(tglBgrdColr);
		toggleButton.addStyleName("bletgleBtnDefault bletglTranslate");
		tglHzPnl.add(toggleButton);

		if(isAdvertiseOn)
		{
			toggleButton.setStyleName("bletglOn");
			toggleButton.addStyleName("toggleBtnOnClk bletglTranslate");
			bluetoothToggleValHashMap.put(keyName,"Yes");
			//outertglHzPnl.getElement().setAttribute("Id","0");
		}
		else
		{
			toggleButton.removeStyleName("bletglOn");
			toggleButton.removeStyleName("bletglTranslate");
			toggleButton.removeStyleName("bletgleBtnDefault");
			toggleButton.addStyleName("bletoggleButtonOff toggleBtnOnClk");
			bluetoothToggleValHashMap.put(keyName,"No");
			//outertglHzPnl.getElement().setAttribute("Id","1");
		}
		tglHzPnl.addDomHandler(new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				if(bluetoothToggleValHashMap.get(keyName).equalsIgnoreCase("No"))
				{
					isTgleClick = true;
				}
				else
				{
					isTgleClick = false;
				}
				updateToggleValue(isTgleClick, new Callback<String, String>()
				{
					@Override
					public void onSuccess(String result)
					{
						if(result.equalsIgnoreCase("true"))
						{
							outertglHzPnl.getElement().setAttribute("Id","1");
							tglHzPnl.getElement().getStyle().setBackgroundColor("#2196f3");
							onBLEToggleClick(keyName,outertglHzPnl,toggleButton);
						}
						else if(result.equalsIgnoreCase("false"))
						{
							outertglHzPnl.getElement().setAttribute("Id","0");
							tglHzPnl.getElement().getStyle().setBackgroundColor("#ccc");
							onBLEToggleClick(keyName,outertglHzPnl,toggleButton);
							//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[start]
							getDevicesIforHorzPnl(null, null, null);
							//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19[end]
						}
					}
					@Override
					public void onFailure(String reason)
					{
						E12CommonUtils.printOnConsole("Error in updateToggleValue:: "+reason);
					}
				});
				//onBLEToggleClick(keyName,outertglHzPnl,toggleButton);
			}
		},ClickEvent.getType());

		outertglHzPnl.setWidth("100%");
		outertglHzPnl.add(toggleLblHrzPnl);
		outertglHzPnl.add(tglHzPnl);
		outertglHzPnl.setCellWidth( toggleLblHrzPnl , "80%" );
		outertglHzPnl.setCellWidth( tglHzPnl , "20%" );
		return outertglHzPnl;
	}
	private void onBLEToggleClick(String keyName, HorizontalPanel outertglHzPnl, Label toggleButton)
	{
		final String id = outertglHzPnl.getElement().getAttribute("Id");
		if(id.equals("0"))
		{
			toggleButton.removeStyleName("bletglOn");
			toggleButton.removeStyleName("bletglTranslate");
			toggleButton.removeStyleName("bletgleBtnDefault");
			toggleButton.addStyleName("bletoggleButtonOff toggleBtnOnClk");

			bluetoothToggleValHashMap.put(keyName,"No");
			outertglHzPnl.getElement().setAttribute("Id","1");
		}
		else if(id.equals("1"))
		{
			toggleButton.setStyleName("bletglOn");
			toggleButton.addStyleName("toggleBtnOnClk bletglTranslate");

			bluetoothToggleValHashMap.put(keyName,"Yes");
			outertglHzPnl.getElement().setAttribute("Id","0");
		}
	}
	//private HorizontalPanel getDevicesIforHorzPnl(String deviceName, String deviceStatus, String pairedDeviceType)
	private void getDevicesIforHorzPnl(String deviceName, String deviceStatus, String pairedDeviceType)
	{
		//Added by sunny soni for test on 22-Aug-19[Start]
		if(this.pairedDevicesVertPnl == null)
		{
			this.pairedDevicesVertPnl = new VerticalPanel();
		}
		//Added by sunny soni for test on 22-Aug-19[End]
		E12CommonUtils.printOnConsole("HostURL:: [ "+E12Global.getHostUrl()+" ]");
		HorizontalPanel mainHortzPnl = new HorizontalPanel();
		if(deviceName!=null && deviceStatus!=null && pairedDeviceType!=null)
		{
			HorizontalPanel devicesImgHorzPnl = new HorizontalPanel();
			HorizontalPanel devicesNameHorzPnl = new HorizontalPanel();
			HorizontalPanel devicesSpaceHorzPnl = new HorizontalPanel();
			HorizontalPanel devicesStatusHorzPnl = new HorizontalPanel();

			/*String devicePicName = pairedDeviceType.equalsIgnoreCase("Tab") ?"Tablet":"Mob";
			final Image lockimage = new Image();
			String url = E12Global.getHostUrl()+"/ibase/images/"+devicePicName+".png";
			lockimage.setStyleName("bleDeviceImg");
			lockimage.setUrl(url);*/

			final Label deviceIcon = new Label("");
			if(pairedDeviceType.equalsIgnoreCase("Tab"))
			{
				deviceIcon.setStyleName("tabIcon");
			}
			else
			{
				deviceIcon.setStyleName("mobIcon");
			}
			devicesImgHorzPnl.addStyleName("bleDevicecircle");
			/*devicesImgHorzPnl.add(lockimage);*/
			devicesImgHorzPnl.add(deviceIcon);

			final Label deviceNameLbl = new Label(deviceName);
			deviceNameLbl.setStyleName("bleDeviceNameLblCss");
			devicesNameHorzPnl.add(deviceNameLbl);

			final Label space4 = new Label();
			space4.setWidth("57px");
			devicesSpaceHorzPnl.add(space4);

			final Label deviceStatusLbl = new Label( deviceStatus );
			if(deviceStatus.equalsIgnoreCase("connected"))
			{
				deviceStatusLbl.getElement().getStyle().setColor("darkgreen");
			}
			else
			{
				deviceStatusLbl.getElement().getStyle().setColor("gray");
			}
			deviceStatusLbl.addStyleName("bleDeviceStatusLblCss");
			devicesStatusHorzPnl.add(deviceStatusLbl);
			devicesStatusHorzPnl.setCellHorizontalAlignment(deviceStatusLbl, HasHorizontalAlignment.ALIGN_RIGHT);

			mainHortzPnl.add(devicesImgHorzPnl);
			mainHortzPnl.add(devicesNameHorzPnl);
			mainHortzPnl.add(devicesSpaceHorzPnl);
			mainHortzPnl.add(devicesStatusHorzPnl);
		}
		else
		{
			this.pairedDevicesVertPnl.clear();//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19
			final Label deviceNotfoundLbl = new Label("No Devices found");
			deviceNotfoundLbl.addStyleName("bleNoDeviceFoundCss");
			mainHortzPnl.add(deviceNotfoundLbl);
		}
		this.pairedDevicesVertPnl.add(mainHortzPnl);//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19
		//return mainHortzPnl;
	}
	public static native void getBleDevicesInfo(Callback<String, String> callback)
	/*-{
		try
		{
			var onSuccess = function(result)
			{
				console.log("result: " + result);
				callback.@com.google.gwt.core.client.Callback::onSuccess(Ljava/lang/Object;)(result);
			};

			var onError = function(error)
			{
				callback.@com.google.gwt.core.client.Callback::onFailure(Ljava/lang/Object;)(error);
			};

				$wnd.plugins.checkAdvertise.getAdvertisingDetails(onSuccess, onError);
		}
		catch(e)
		{
			//alert("getBleDevicesInfo::Exception in native method ["+e.message+"]");
			console.info("getBleDevicesInfo::Exception in native method ["+e.message+"]");
		}
	}-*/;
	public static native void updateToggleValue(boolean tglVal, Callback<String, String> callback)
	/*-{
			try
			{
				console.log('[In updateToggleValue method]toggle val::[ '+tglVal+' ]');
				var onSuccess = function(result)
				{
					console.log("In updateToggleValue result" + result+" ]");
					callback.@com.google.gwt.core.client.Callback::onSuccess(Ljava/lang/Object;)(result);
				};
				var onError = function(error)
				{
					console.log("In updateToggleValue error::[ " + error+" ]");
					callback.@com.google.gwt.core.client.Callback::onSuccess(Ljava/lang/Object;)(error);
				};
				$wnd.plugins.checkAdvertise.updateToggleValue(onSuccess,onError,tglVal);
			}
			catch(e)
			{
				console.log("E12RIA : exportNativeisAuthenticateMethod :: Exception in native method ["+e.message+"]");
			}
		}-*/;
	//Added by sunny soni for getting bluetooth device setting[End]
	public static native void showScrollToViewInput( String inputId )
	/*-{
	try
	{
		var input = $doc.getElementById(inputId);
		$wnd.scrollToViewInput( input );
	}
	catch(e)
	{
			console.log(e);
	}
	}-*/;

	//Added by Shrutika on 28-05-18 [Start] for search site code functionality dummy method.
	public void findsitedata()
	{

	}
	//Added by Shrutika on 28-05-18 [End] for search site code functionality dummy method.

	//Added by Pravin K on 29-MAY-18 [ to change post profile image after profile pic change ] START
	public native static String changeProfilePicOfPosts(String profImgPath, String userId)
	/*-{
		try
		{
			var imgArr = $doc.getElementsByTagName("img");
    		console.log(" profImgPath : " + profImgPath + ", userId : " + userId +", imgArr.length : "+ imgArr.length);
		    for (var i = 0; i < imgArr.length; i++)
		    {
		        var imgSrc= imgArr[i].getAttribute("src");
		        if(imgSrc.includes(userId))
		        {
		        	imgArr[i].setAttribute("src",profImgPath);
	    			console.log(" ProfImgPath :"+ profImgPath);
		        }
		    }
		}
		catch(e)
	    {
	    	console.log("Exception in native changeProfilePicOfPosts :"+e);
	    	return "";
	    }
	}-*/;
	//Added by Pravin K on 29-MAY-18 [ to change post profile imAge after profile pic change ] END

	//Added by Bhupendra to display Vision Assistant Start
	//Added by sainath T. on 29-AUG-2019 [To process assistant push notification data]
	//private void showAssistantComponent( String notificationData )
	public void showAssistantComponent( String notificationData )
	{
		final E12PopupPanel assistantPopup = new E12PopupPanel(false,false,"",true);
		assistantPopup.getElement().setId("e12UserInfo-assistantPopup");
		assistantPopup.setGlassEnabled(true);
		assistantPopup.setAutoHideEnabled(false);
		assistantPopup.setGlassStyleName("bgGlass");
		assistantPopup.setWidth("100%");
		assistantPopup.setHeight("100%");
		VerticalPanel assistantVPnl = new VerticalPanel();
		String targetId = "ang-comp-"+Math.random();
		Button btnCancel = new Button("x");
		btnCancel.getElement().setId("closeAssistant");
		btnCancel.getElement().getStyle().setColor("white");
		btnCancel.getElement().setTitle("Close");
		//btnCancel.getElement().setAttribute("style", "font-size: 30px;width: 40px;    background-color: transparent;    border: none;    font-size: 28px; background:none;    width: 40px; color:white;    position: absolute; z-index: 1;");
		btnCancel.setStyleName("visionCancelBtn");

		btnCancel.addClickHandler(new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				assistantPopup.hide();
				detachAngularPlugin("bis-assistant");
			}
		});

		SimplePanel assistantPnl = new SimplePanel();
		assistantPnl.getElement().setId(targetId);
		assistantPnl.addStyleName("e12UserInfo-myPlacesPopup");

		assistantVPnl.add(btnCancel);
		assistantVPnl.add(assistantPnl);

		assistantPopup.add(assistantVPnl);
		assistantPopup.show();
		assistantPopup.setStyleName("assistantPopUpShow");
		assistantPopup.addStyleName("e12UserInfo-myPlacesPopup");

		//Added by Sainath T. on 29-Ang-2019 [To check if notification data is present and set]- Start
		String userMsg = "";
		String response = "";
		if( !notificationData.equals("") && notificationData.length() != 0  )
		{
			userMsg = getUserMsgFromNotification(notificationData);
			response = getResponseFromNotification(notificationData);
		}
		//Added by Sainath T. on 29-Ang-2019 [To check if notification data is present and set]- End

		JSONObject configData = new JSONObject();
		configData.put("componentName", new JSONString("bis-assistant"));
		configData.put("cacheComp", new JSONString("true"));
		configData.put("showHeader", new JSONString("true"));
		configData.put("targetId", new JSONString(targetId));
		//Added by Sainath T. on 29-Ang-2019 [to process notification response]- Start
		configData.put("notificationRequest", new JSONString(userMsg));
		configData.put("notificationResponse", new JSONString(response));
		//Added by Sainth T. on 09-SEP-2019 [To identify the call from]
		configData.put("callFrom", new JSONString("Proteus_vision"));
		//Added by Sainath T. on 29-Ang-2019 [to process notification response]- Start
		loadAngularPlugin( targetId , configData.toString() );
		if ( DOM.getElementById("bis_showHeader") != null )
		{
			DOM.getElementById("bis_showHeader").removeClassName("showHeader_false");
		}
		//assistantPopup.getElement().getStyle().setPosition(Position.FIXED);
	}
	//Added by Bhupendra to display Vision Assistant End
	//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19 [Start]
	public void refreshDevicesHrzPnl(String pairedDevices)
	{
		try
		{
			if(this.pairedDevicesVertPnl == null)
			{
				this.pairedDevicesVertPnl = new VerticalPanel();
			}
			this.pairedDevicesVertPnl.clear();
			if(pairedDevices!=null)
			{
				JSONValue jsonParser = JSONParser.parseStrict(pairedDevices);
				JSONObject jsonObject = jsonParser.isObject();

				JSONValue pairedDevicesjsonArrValue = jsonObject.get("pairedDevices");
				E12CommonUtils.printOnConsole("pairedDevicesjsonArrValue: [ "+pairedDevicesjsonArrValue+" ]");
				JSONArray pairedDevicesjsonArr = null;
				if(pairedDevicesjsonArrValue!=null)
				{
					pairedDevicesjsonArr = pairedDevicesjsonArrValue.isArray();
				}
				if(pairedDevicesjsonArr!=null)
				{
					for(int i=0; i<pairedDevicesjsonArr.size(); i++)
					{
						JSONObject pairedJsonObj = pairedDevicesjsonArr.get(i).isObject();
						String pairedDeviceName = pairedJsonObj.get("deviceName").toString() == null ?"": pairedJsonObj.get("deviceName").toString().replace("\"", "");
						String pairedDeviceStatus = pairedJsonObj.get("status").toString() == null ?"": pairedJsonObj.get("status").toString().replace("\"", "");
						String pairedDeviceType = pairedJsonObj.get("deviceType").toString() == null ?"": pairedJsonObj.get("deviceType").toString().replace("\"", "");
						E12CommonUtils.printOnConsole(pairedDeviceName+":"+pairedDeviceStatus+":"+pairedDeviceType);
						getDevicesIforHorzPnl(pairedDeviceName,pairedDeviceStatus, pairedDeviceType);
					}
				}
				else
				{
					getDevicesIforHorzPnl(null, null, null);
				}
			}
			else
			{
				getDevicesIforHorzPnl(null, null, null);
			}
			if(this.pairedDevicesVertPnl!=null)
			{
				containerBLESettingUI.add( this.pairedDevicesVertPnl );
			}
		}
		catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception in refreshDevicesHrzPnl=["+e.getMessage()+"]");
			e.printStackTrace();
		}
	}
    //Added by Sainath T. 09-SEP-2019 [To get Notification Response and request] - Start
	private String getResponseFromNotification(String notificationData)
	{
		String response = "";
		try
		{
			response = notificationData.substring(notificationData.indexOf("~response~")+10, notificationData.indexOf("~userMsg~"));
			E12CommonUtils.printOnConsole("in E12ANGComp Response notification150>> " + response);
		}
		catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception in getNotificationData" + e.getMessage());
			response = notificationData;
		}
		return response;
	}
	private String getUserMsgFromNotification(String notificationData)
	{
		String userMsg = "";
		try
		{
			userMsg = notificationData.substring(notificationData.indexOf("~userMsg~")+10,notificationData.length()-1);
			E12CommonUtils.printOnConsole("in E12ANGComp ~userMsg~ notification150>> " + userMsg);
		}
		catch (Exception e)
		{
			E12CommonUtils.printOnConsole("Exception in getNotificationData" + e.getMessage());
			userMsg = notificationData;
		}
		return userMsg;
	}
    //Added by Sainath T. 09-SEP-2019 [To get Notification Response and request] - End

	/*
	 * Get remote devices from bluetooth
	 */
	private static native void getAdvertiseDevices(E12UserInfo e12UserInfo)/*-{
		try
		{
			$wnd.getAdvertiseDevices = function(pairedDevices)
			{
				e12UserInfo.@ibase.e12ria.client.E12UserInfo::refreshDevicesHrzPnl(Ljava/lang/String;)(pairedDevices);
			};
		}
		catch(e)
		{
			console.info('exception in getAdvertiseDevices:: '+e);
		}
	}-*/;
	//Added by sunny soni for auto refresh device horizontal panel with adding device or not on 22-Aug-19 [End]

	private native void showMyActivities()
	/*-{
		try
		{
			$wnd.openTransactionGWT('accountActivity','dashboard_accountActivity','A','Account Activity');
		}
		catch(e)
		{
			console.log("Error msg in showMyActivities:"+e);
		}
	}-*/;
	
	//Changed by Sainath on 14/09/19 [assistant in menu panel] START
	public E12PopupPanel getAssistantComponent( final String notificationData, final CustomPopUp slidePopupPnl, final FlowPanel menuContentPanel )
	{
		final E12PopupPanel assistantPopup = new E12PopupPanel(false,false,"",true);
		assistantPopup.getElement().setId("e12UserInfo-assistantPopup");
		assistantPopup.setGlassEnabled(true);
		assistantPopup.setAutoHideEnabled(false);
		assistantPopup.setGlassStyleName("bgGlass");

		assistantPopup.setWidth("100%");
		assistantPopup.setHeight("100%");
		VerticalPanel assistantVPnl = new VerticalPanel();
		String targetId = "ang-comp-"+Math.random();
		//final Button btnResize = new Button("");
		final Label btnResize = new Label("");
		btnResize.getElement().setId("resizeAssistant");
		//btnResize.getElement().getStyle().setColor("white");
		btnResize.getElement().setTitle("Resize");

		btnResize.setStyleName("visionResizeBtn");
		btnResize.addStyleName("vision-ui-fullscreen_expand");

		final Button btnCancel = new Button("x");
		btnCancel.getElement().setId("closeAssistant");
		//btnCancel.getElement().getStyle().setColor("white");
		btnCancel.getElement().setTitle("Close");
		//btnCancel.getElement().setAttribute("style", "font-size: 30px;width: 40px;    background-color: transparent;    border: none;    font-size: 28px; background:none;    width: 40px; color:white;    position: absolute; z-index: 1;");
		btnCancel.setStyleName("visionCancelBtn");
		btnCancel.setVisible(false);

		btnCancel.addClickHandler(new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				btnCancel.setVisible(false);
				btnResize.setVisible(true);
				if ( DOM.getElementById("bis_showHeader") != null )
				{
					DOM.getElementById("bis_showHeader").addClassName("showHeader_false");
				}
				assistantPopup.setStyleName("assistantPopUp");
				assistantPopup.hide();
				E12Global.getInstance().setAssistantPopupPanel( null );
				detachAngularPlugin("bis-assistant");
				menuContentPanel.clear();
				menuContentPanel.add( getAssistantComponent( "", slidePopupPnl, menuContentPanel ) );
			}
		});

		btnResize.addClickHandler(new ClickHandler()
		{
			@Override
			public void onClick(ClickEvent event)
			{
				if ( DOM.getElementById("bis_showHeader") != null )
				{
					DOM.getElementById("bis_showHeader").removeClassName("showHeader_false");
				}
				assistantPopup.removeStyleName("assistantPopUpInMenuPln");
				slidePopupPnl.hide();
				btnCancel.setVisible(true);
				btnResize.setVisible(false);
				menuContentPanel.clear();
				//showAssistantComponent( notificationData );
				visionAssistantResize();
			}
		});

		SimplePanel assistantPnl = new SimplePanel();
		assistantPnl.getElement().setId(targetId);
		assistantPnl.addStyleName("e12UserInfo-myPlacesPopup");

		assistantVPnl.add(btnCancel);
		assistantVPnl.add(assistantPnl);
		assistantVPnl.add(btnResize);

		assistantPopup.add(assistantVPnl);
		assistantPopup.show();
		assistantPopup.setStyleName( "assistantPopUp" );
		assistantPopup.addStyleName( "e12UserInfo-myPlacesPopup" );

		//Added by Sainath T. on 29-Ang-2019 [To check if notification data is present and set]- Start
		String userMsg = "";
		String response = "";
		if( !notificationData.equals("") && notificationData.length() != 0  )
		{
			userMsg = getUserMsgFromNotification(notificationData);
			response = getResponseFromNotification(notificationData);
		}
		//Added by Sainath T. on 29-Ang-2019 [To check if notification data is present and set]- End

		JSONObject configData = new JSONObject();
		configData.put("componentName", new JSONString("bis-assistant"));
		configData.put("cacheComp", new JSONString("true"));
		configData.put("showHeader", new JSONString("true"));
		configData.put("targetId", new JSONString(targetId));
		//Added by Sainath T. on 29-Ang-2019 [to process notification response]- Start
		configData.put("notificationRequest", new JSONString(userMsg));
		configData.put("notificationResponse", new JSONString(response));
		configData.put("callFrom", new JSONString("Proteus_vision"));
		//Added by Sainath T. on 29-Ang-2019 [to process notification response]- Start
		loadAngularPlugin( targetId , configData.toString() );
		E12CommonUtils.printOnConsole("Setting showHeader_false11");
		if ( DOM.getElementById("bis_showHeader") != null )
		{
			DOM.getElementById("bis_showHeader").addClassName("showHeader_false");
		}
		E12CommonUtils.printOnConsole("Setting showHeader_false22");
		E12Global.getInstance().setAssistantPopupPanel( assistantPopup );
		return assistantPopup;
	}

	private void visionAssistantResize()
	{
		E12PopupPanel assistantPopup = null;
		E12CommonUtils.printOnConsole( "E12Global.getInstance().assistantPopupPanel>>" + E12Global.getInstance().getAssistantPopupPanel() );
		if( E12Global.getInstance().getAssistantPopupPanel() != null)
		{
			assistantPopup = E12Global.getInstance().getAssistantPopupPanel();
		}
		assistantPopup.setGlassEnabled(true);
		assistantPopup.setAutoHideEnabled(false);
		assistantPopup.setGlassStyleName("bgGlass");
		E12CommonUtils.printOnConsole( "visionAssistantResize11 ");
		assistantPopup.setStyleName("assistantPopUpShow");
		E12CommonUtils.printOnConsole( "visionAssistantResize22 ");
		assistantPopup.center();
	}
	//Changed by Sainath on 14/09/19 [assistant in menu panel] END
}