package org.apache.jsp.sales.person;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.edeal.frontline.navigation.FlRequest;
import com.edeal.frontline.controller.actions.GetListFunctionsAction;
import com.edeal.frontline.helper.MultifunctionHelper;
import com.edeal.frontline.Utils;
import com.edeal.frontline.FlContext;
import java.util.*;
import com.edeal.frontline.DataDictionary;
import com.edeal.frontline.FrontlineException;

public final class bar_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  static {
    _jspx_dependants = new java.util.ArrayList(1);
    _jspx_dependants.add("/WEB-INF/taglib.tld");
  }

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/plain;charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;


/******************************************************************************
 * Copyright (c) 2000-2005 e-Deal
 *
 * e-Deal S.A.
 * 55 rue Brillat Savarin
 * 75013 Paris
 * France
 *
 * T: +33 (0)1 53 80 80 30
 * F: +33 (0)1 73 01 69 77
 * http://www.e-deal.com
 * 
 * La diffusion de ce code source sous quelque forme que ce soit sans
 * l'autorisation de E-DEAL est interdite.
 *
 * Vous �tes autoris�s � modifier ce code source uniquement pour votre usage
 * propre et sous r�serve que les mentions de copyright demeurent intactes.
 *
 * Ce code est fourni en l'�tat. Aucune garantie d'aucune sorte, explicite ou
 * implicite n'est donn�e. En aucun cas E-DEAL ne pourra �tre tenu pour
 * responsable des dommages pouvant r�sulter de l'utilisation de ce code
 * source.
 ******************************************************************************/
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");

FlRequest flRequest = new FlRequest(request);
FlContext context = flRequest.getContext();
DataDictionary dico = context.getDataDictionary();

LinkedHashMap<String, Hashtable> functions = (LinkedHashMap<String, Hashtable>) flRequest.getAttribute(GetListFunctionsAction.VECT_FCT);

if (functions == null) {
	functions = new LinkedHashMap<String, Hashtable>();
}
String currentID = (String) flRequest.getAttribute(GetListFunctionsAction.CURRENT_ID);
String parentID = (String) flRequest.getAttribute(GetListFunctionsAction.PARENT_ID);
//#DD3300

      out.write("\n");
      out.write("<script type= \"text/javascript\">/*<![CDATA[*/\n");
      out.write("$(function(){\n");
      out.write("\t//Get our elements for faster access and set overlay width\n");
      out.write("\tvar div = $('#function_bar'),\n");
      out.write("\t\tul = $('#function_bar ul'),\n");
      out.write("\t\tulPadding = 1;\n");
      out.write("\n");
      out.write("\t//Get menu width\n");
      out.write("\tvar divWidth = div.width();\n");
      out.write("\n");
      out.write("\t//Remove scrollbars\t\n");
      out.write("\tdiv.css({overflow: 'hidden'});\n");
      out.write("\n");
      out.write("\t//Find last image container\n");
      out.write("\tvar lastLi = ul.find('li:last-child');\n");
      out.write("\t\n");
      out.write("\t//When user move mouse over menu\n");
      out.write("\tdiv.mousemove(function(e){\n");
      out.write("\t\t//As images are loaded ul width increases,\n");
      out.write("\t\t//so we recalculate it each time\n");
      out.write("\t\tvar ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;\t\n");
      out.write("\t\tvar left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;\n");
      out.write("\t\tdiv.scrollLeft(left);\n");
      out.write("\t});\n");
      out.write("});\n");
      out.write("/*]]>*/</script>\n");
      out.write("\n");
      out.write("<ul id=\"sortlist\" class=\"sc_menuc\">\n");
	
	if(functions.entrySet().size() > 1){
		Iterator<?> it = functions.entrySet().iterator();
		while (it.hasNext()) {
			Map.Entry<?, ?> entry = (Map.Entry<?, ?>) it.next();
			String perID = (String) entry.getKey();
			Hashtable information = (Hashtable) entry.getValue();
			String ent = null;
			String title = null;
			ent = (String)information.get(MultifunctionHelper.ENTERPRISE_NAME);
			if (!Utils.isEmpty(ent)) {
				title = (String)information.get(MultifunctionHelper.TITLE_NAME);
				title = title != null ? title : "<span style=\"font-style: italic;\">" + Utils.getMessage(session, "L8147", "Inconnu") + "</span>";
			} else {
				ent = Utils.getMessage(session, "L8148", "Particulier");
				title = (String)information.get(MultifunctionHelper.CITY_NAME);
			}

      out.write("\t\n");
      out.write("\t<li id=\"");
      out.print( perID );
      out.write("\" style=\"background-color : ");
      out.print( (perID.equals(currentID) ? "#92BBFF" : "#e4efff") );
      out.write("\"> \t\n");
      out.write("\t\t<a href=\"");
      out.print( flRequest.computeURL("/read_person_consolidated.fl?id=" + perID) );
      out.write("\" style=\"color : black\"><b>");
      out.print( ent );
      out.write("</b></a>\n");
      out.write("\t\t<br/><a href=\"");
      out.print( flRequest.computeURL("/read_person_consolidated.fl?id=" + perID) );
      out.write("\" style=\"color : black\">");
      out.print( title );
      out.write("</a>\n");
      out.write("\t</li>\t\t\n");

		}
	}

      out.write("\n");
      out.write("</ul>");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else log(t.getMessage(), t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
