@SuppressWarnings("unchecked")
	public static void SetPageFacet(int facetType, String facetName, long delay) {
		FacesContext context = FacesContext.getCurrentInstance();
		Map viewScope = context.getViewRoot().getViewMap();
		String previousFacet = "";
		String selectedFacet = "";
		try {
			switch (facetType) {
			case 1:// Login
				previousFacet = "previousLoginFacet";
				selectedFacet = "selectedLoginFacet";
				break;
			case 2:// Home
				previousFacet = "previousHomeFacet";
				selectedFacet = "selectedHomeFacet";
				break;
			case 3:// FormPlaceholderFacet
				previousFacet = "previousFormPlaceholderFacet";
				selectedFacet = "selectedFormPlaceholderFacet";
				break;
			}
			if (facetName.equals("Previous")) {
				SetPageFacet(facetType, viewScope.get(previousFacet).toString(), delay);
			} else if (!facetName.equals(viewScope.get(selectedFacet))) {
				if (delay > 0) {
					Thread.currentThread();
					Thread.sleep(delay);
				}
				viewScope.put(previousFacet, viewScope.get(selectedFacet));
				viewScope.put(selectedFacet, facetName);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
@SuppressWarnings("unchecked")
	public static void SetPageFacet(int facetType, String facetName, long delay) {
		FacesContext context = FacesContext.getCurrentInstance();
		Map viewScope = context.getViewRoot().getViewMap();
		String previousFacet = "";
		String selectedFacet = "";
		try {
			switch (facetType) {
			case 1
				previousFacet = "previousLoginFacet";
				selectedFacet = "selectedLoginFacet";
				break;
			case 2
				previousFacet = "previousHomeFacet";
				selectedFacet = "selectedHomeFacet";
				break;
			case 3
				previousFacet = "previousFormPlaceholderFacet";
				selectedFacet = "selectedFormPlaceholderFacet";
				break;
			}
			if (facetName.equals("Previous")) {
				SetPageFacet(facetType, viewScope.get(previousFacet).toString(), delay);
			} else if (!facetName.equals(viewScope.get(selectedFacet))) {
				if (delay > 0) {
					Thread.currentThread();
					Thread.sleep(delay);
				}
				viewScope.put(previousFacet, viewScope.get(selectedFacet));
				viewScope.put(selectedFacet, facetName);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
@suppresswarnings("unchecked") public static void setpagefacet(int facettype, string facetname, long delay) { facescontext context = facescontext.getcurrentinstance(); map viewscope = context.getviewroot().getviewmap(); string previousfacet = ""; string selectedfacet = ""; try { switch (facettype) { case 1 previousfacet = "previousloginfacet"; selectedfacet = "selectedloginfacet"; break; case 2 previousfacet = "previoushomefacet"; selectedfacet = "selectedhomefacet"; break; case 3 previousfacet = "previousformplaceholderfacet"; selectedfacet = "selectedformplaceholderfacet"; break; } if (facetname.equals("previous")) { setpagefacet(facettype, viewscope.get(previousfacet).tostring(), delay); } else if (!facetname.equals(viewscope.get(selectedfacet))) { if (delay > 0) { thread.currentthread(); thread.sleep(delay); } viewscope.put(previousfacet, viewscope.get(selectedfacet)); viewscope.put(selectedfacet, facetname); } } catch (interruptedexception e) { e.printstacktrace(); } }