/** >  /scripts-v66/view/json/modules/jsonrpc_push.js **/
/**
 * Appel du coeur de JSON.
 */
 
/** Loading /scripts-v66/view/json/jsonrpc_ah.js **/
/* ATTENTION 1 : NE PAS FAIRE DE PROTOTYPE POUR L INSTANT DANS CE JS PAR MESURE DE COMPATIBILITE AVEC LES PAGE COMPORTANT TJS DU PSEUDOJS
   ATTENTION 2 : <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> est obligatoire sur la pages incluant ce js */

/** Loading /scripts-v66/dwr/interface/RemoteView.js **/
// Provide a default path to dwr.engine
if (dwr == null) var dwr = {};
if (dwr.engine == null) dwr.engine = {};
if (DWREngine == null) var DWREngine = dwr.engine;

if (RemoteView == null) var RemoteView = {};
RemoteView._path = '/dwr';
RemoteView.toString = function(callback) {
  dwr.engine._execute(RemoteView._path, 'RemoteView', 'toString', callback);
}

RemoteView.getViewBeans = function(p0, p1, p2, p3, callback, p4) {
  if (typeof p4 == "undefined") // Retrocompatibilite
    dwr.engine._execute(RemoteView._path, 'RemoteView', 'getViewBeans', p0, p1, p2, p3, callback);
  else 
    dwr.engine._execute(RemoteView._path, 'RemoteView', 'getViewBeans', p0, p1, p2, p3, p4, callback);
}

/** Done /scripts-v66/dwr/interface/RemoteView.js **/ 

/** Loading /scripts-v66/dwr/engine.js **/
/*
 * Copyright 2005 Joe Walker
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Declare an object to which we can add real functions.
 */
if (dwr == null) var dwr = {};
if (dwr.engine == null) dwr.engine = {};
if (DWREngine == null) var DWREngine = dwr.engine;

/**
 * Set an alternative error handler from the default alert box.
 * @see getahead.org/dwr/browser/engine/errors
 */
dwr.engine.setErrorHandler = function(handler) {
  dwr.engine._errorHandler = handler;
};

/**
 * Set an alternative warning handler from the default alert box.
 * @see getahead.org/dwr/browser/engine/errors
 */
dwr.engine.setWarningHandler = function(handler) {
  dwr.engine._warningHandler = handler;
};

/**
 * Setter for the text/html handler - what happens if a DWR request gets an HTML
 * reply rather than the expected Javascript. Often due to login timeout
 */
dwr.engine.setTextHtmlHandler = function(handler) {
  dwr.engine._textHtmlHandler = handler;
};

/**
 * Set a default timeout value for all calls. 0 (the default) turns timeouts off.
 * @see getahead.org/dwr/browser/engine/errors
 */
dwr.engine.setTimeout = function(timeout) {
  dwr.engine._timeout = timeout;
};

/**
 * The Pre-Hook is called before any DWR remoting is done.
 * @see getahead.org/dwr/browser/engine/hooks
 */
dwr.engine.setPreHook = function(handler) {
  dwr.engine._preHook = handler;
};

/**
 * The Post-Hook is called after any DWR remoting is done.
 * @see getahead.org/dwr/browser/engine/hooks
 */
dwr.engine.setPostHook = function(handler) {
  dwr.engine._postHook = handler;
};

/**
 * Custom headers for all DWR calls
 * @see getahead.org/dwr/????
 */
dwr.engine.setHeaders = function(headers) {
  dwr.engine._headers = headers;
};

/**
 * Custom parameters for all DWR calls
 * @see getahead.org/dwr/????
 */
dwr.engine.setParameters = function(parameters) {
  dwr.engine._parameters = parameters;
};

/** XHR remoting type constant. See dwr.engine.set[Rpc|Poll]Type() */
dwr.engine.XMLHttpRequest = 1;

/** XHR remoting type constant. See dwr.engine.set[Rpc|Poll]Type() */
dwr.engine.IFrame = 2;

/** XHR remoting type constant. See dwr.engine.setRpcType() */
dwr.engine.ScriptTag = 3;

/**
 * Set the preferred remoting type.
 * @param newType One of dwr.engine.XMLHttpRequest or dwr.engine.IFrame or dwr.engine.ScriptTag
 * @see getahead.org/dwr/browser/engine/options
 */
dwr.engine.setRpcType = function(newType) {
  if (newType != dwr.engine.XMLHttpRequest && newType != dwr.engine.IFrame && newType != dwr.engine.ScriptTag) {
    dwr.engine._handleError(null, { name:"dwr.engine.invalidRpcType", message:"RpcType must be one of dwr.engine.XMLHttpRequest or dwr.engine.IFrame or dwr.engine.ScriptTag" });
    return;
  }
  dwr.engine._rpcType = newType;
};

/**
 * Which HTTP method do we use to send results? Must be one of "GET" or "POST".
 * @see getahead.org/dwr/browser/engine/options
 */
dwr.engine.setHttpMethod = function(httpMethod) {
  if (httpMethod != "GET" && httpMethod != "POST") {
    dwr.engine._handleError(null, { name:"dwr.engine.invalidHttpMethod", message:"Remoting method must be one of GET or POST" });
    return;
  }
  dwr.engine._httpMethod = httpMethod;
};

/**
 * Ensure that remote calls happen in the order in which they were sent? (Default: false)
 * @see getahead.org/dwr/browser/engine/ordering
 */
dwr.engine.setOrdered = function(ordered) {
  dwr.engine._ordered = ordered;
};

/**
 * Do we ask the XHR object to be asynchronous? (Default: true)
 * @see getahead.org/dwr/browser/engine/options
 */
dwr.engine.setAsync = function(async) {
  dwr.engine._async = async;
};

/**
 * Does DWR poll the server for updates? (Default: false)
 * @see getahead.org/dwr/browser/engine/options
 */
dwr.engine.setActiveReverseAjax = function(activeReverseAjax) {
  if (activeReverseAjax) {
    // Bail if we are already started
    if (dwr.engine._activeReverseAjax) return;
    dwr.engine._activeReverseAjax = true;
    dwr.engine._poll();
  }
  else {
    // Can we cancel an existing request?
    if (dwr.engine._activeReverseAjax && dwr.engine._pollReq) dwr.engine._pollReq.abort();
    dwr.engine._activeReverseAjax = false;
  }
  // TODO: in iframe mode, if we start, stop, start then the second start may
  // well kick off a second iframe while the first is still about to return
  // we should cope with this but we don't
};

/**
 * The default message handler.
 * @see getahead.org/dwr/browser/engine/errors
 */
dwr.engine.defaultErrorHandler = function(message, ex) {
  dwr.engine._debug("Error: " + ex.name + ", " + ex.message, true);
  if (message == null || message == "") alert("A server error has occured.");
  // Ignore NS_ERROR_NOT_AVAILABLE if Mozilla is being narky
  else if (message.indexOf("0x80040111") != -1) dwr.engine._debug(message);
  else alert(message);
};

/**
 * The default warning handler.
 * @see getahead.org/dwr/browser/engine/errors
 */
dwr.engine.defaultWarningHandler = function(message, ex) {
  dwr.engine._debug(message);
};

/**
 * For reduced latency you can group several remote calls together using a batch.
 * @see getahead.org/dwr/browser/engine/batch
 */
dwr.engine.beginBatch = function() {
  if (dwr.engine._batch) {
    dwr.engine._handleError(null, { name:"dwr.engine.batchBegun", message:"Batch already begun" });
    return;
  }
  dwr.engine._batch = dwr.engine._createBatch();
};

/**
 * Finished grouping a set of remote calls together. Go and execute them all.
 * @see getahead.org/dwr/browser/engine/batch
 */
dwr.engine.endBatch = function(options) {
  var batch = dwr.engine._batch;
  if (batch == null) {
    dwr.engine._handleError(null, { name:"dwr.engine.batchNotBegun", message:"No batch in progress" });
    return;
  }
  dwr.engine._batch = null;
  if (batch.map.callCount == 0) return;

  // The hooks need to be merged carefully to preserve ordering
  if (options) dwr.engine._mergeBatch(batch, options);

  // In ordered mode, we don't send unless the list of sent items is empty
  if (dwr.engine._ordered && dwr.engine._batchesLength != 0) {
    dwr.engine._batchQueue[dwr.engine._batchQueue.length] = batch;
  }
  else {
    dwr.engine._sendData(batch);
  }
};

/** @deprecated */
dwr.engine.setPollMethod = function(type) { dwr.engine.setPollType(type); };
dwr.engine.setMethod = function(type) { dwr.engine.setRpcType(type); };
dwr.engine.setVerb = function(verb) { dwr.engine.setHttpMethod(verb); };
dwr.engine.setPollType = function() { dwr.engine._debug("Manually setting the Poll Type is not supported"); };

//==============================================================================
// Only private stuff below here
//==============================================================================

/** The original page id sent from the server */
dwr.engine._origScriptSessionId = "2858DC313E6A37485D9FFDE0491583D3";

/** The session cookie name */
dwr.engine._sessionCookieName = "JSESSIONID"; // JSESSIONID

/** Is GET enabled for the benefit of Safari? */
dwr.engine._allowGetForSafariButMakeForgeryEasier = "false";

/** The script prefix to strip in the case of scriptTagProtection. */
dwr.engine._scriptTagProtection = "throw 'allowScriptTagRemoting is false.';";

/** The default path to the DWR servlet */
dwr.engine._defaultPath = "/accorhotels/dwr";

/** Do we use XHR for reverse ajax because we are not streaming? */
dwr.engine._pollWithXhr = "false";

/** The read page id that we calculate */
dwr.engine._scriptSessionId = null;

/** The function that we use to fetch/calculate a session id */
dwr.engine._getScriptSessionId = function() {
  if (dwr.engine._scriptSessionId == null) {
    dwr.engine._scriptSessionId = dwr.engine._origScriptSessionId + Math.floor(Math.random() * 1000);
  }
  return dwr.engine._scriptSessionId;
};

/** A function to call if something fails. */
dwr.engine._errorHandler = dwr.engine.defaultErrorHandler;

/** For debugging when something unexplained happens. */
dwr.engine._warningHandler = dwr.engine.defaultWarningHandler;

/** A function to be called before requests are marshalled. Can be null. */
dwr.engine._preHook = null;

/** A function to be called after replies are received. Can be null. */
dwr.engine._postHook = null;

/** An map of the batches that we have sent and are awaiting a reply on. */
dwr.engine._batches = {};

/** A count of the number of outstanding batches. Should be == to _batches.length unless prototype has messed things up */
dwr.engine._batchesLength = 0;

/** In ordered mode, the array of batches waiting to be sent */
dwr.engine._batchQueue = [];

/** What is the default rpc type */
dwr.engine._rpcType = dwr.engine.XMLHttpRequest;

/** What is the default remoting method (ie GET or POST) */
dwr.engine._httpMethod = "POST";

/** Do we attempt to ensure that calls happen in the order in which they were sent? */
dwr.engine._ordered = false;

/** Do we make the calls async? */
dwr.engine._async = true;

/** The current batch (if we are in batch mode) */
dwr.engine._batch = null;

/** The global timeout */
dwr.engine._timeout = 0;

/** ActiveX objects to use when we want to convert an xml string into a DOM object. */
dwr.engine._DOMDocument = ["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"];

/** The ActiveX objects to use when we want to do an XMLHttpRequest call. */
dwr.engine._XMLHTTP = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"];

/** Are we doing comet or polling? */
dwr.engine._activeReverseAjax = false;

/** The iframe that we are using to poll */
dwr.engine._outstandingIFrames = [];

/** The xhr object that we are using to poll */
dwr.engine._pollReq = null;

/** How many milliseconds between internal comet polls */
dwr.engine._pollCometInterval = 200;

/** How many times have we re-tried to poll? */
dwr.engine._pollRetries = 0;
dwr.engine._maxPollRetries = 0;

/** Do we do a document.reload if we get a text/html reply? */
dwr.engine._textHtmlHandler = null;

/** If you wish to send custom headers with every request */
dwr.engine._headers = null;

/** If you wish to send extra custom request parameters with each request */
dwr.engine._parameters = null;

/** Undocumented interceptors - do not use */
dwr.engine._postSeperator = "\n";
dwr.engine._defaultInterceptor = function(data) { return data; };
dwr.engine._urlRewriteHandler = dwr.engine._defaultInterceptor;
dwr.engine._contentRewriteHandler = dwr.engine._defaultInterceptor;
dwr.engine._replyRewriteHandler = dwr.engine._defaultInterceptor;

/** Batch ids allow us to know which batch the server is answering */
dwr.engine._nextBatchId = 0;

/** A list of the properties that need merging from calls to a batch */
dwr.engine._propnames = [ "rpcType", "httpMethod", "async", "timeout", "errorHandler", "warningHandler", "textHtmlHandler" ];

/** Do we stream, or can be hacked to do so? */
dwr.engine._partialResponseNo = 0;
dwr.engine._partialResponseYes = 1;
dwr.engine._partialResponseFlush = 2;

/** Is this page in the process of unloading? */
dwr.engine._unloading = false;

/**
 * @private Send a request. Called by the Javascript interface stub
 * @param path part of URL after the host and before the exec bit without leading or trailing /s
 * @param scriptName The class to execute
 * @param methodName The method on said class to execute
 * @param func The callback function to which any returned data should be passed
 *       if this is null, any returned data will be ignored
 * @param vararg_params The parameters to pass to the above class
 */
dwr.engine._execute = function(path, scriptName, methodName, vararg_params) {
  var singleShot = false;
  if (dwr.engine._batch == null) {
    dwr.engine.beginBatch();
    singleShot = true;
  }
  var batch = dwr.engine._batch;
  // To make them easy to manipulate we copy the arguments into an args array
  var args = [];
  for (var i = 0; i < arguments.length - 3; i++) {
    args[i] = arguments[i + 3];
  }
  // All the paths MUST be to the same servlet
  if (batch.path == null) {
    batch.path = path;
  }
  else {
    if (batch.path != path) {
      dwr.engine._handleError(batch, { name:"dwr.engine.multipleServlets", message:"Can't batch requests to multiple DWR Servlets." });
      return;
    }
  }
  // From the other params, work out which is the function (or object with
  // call meta-data) and which is the call parameters
  var callData;
  var lastArg = args[args.length - 1];
  if (typeof lastArg == "function" || lastArg == null) callData = { callback:args.pop() };
  else callData = args.pop();

  // Merge from the callData into the batch
  dwr.engine._mergeBatch(batch, callData);
  batch.handlers[batch.map.callCount] = {
    exceptionHandler:callData.exceptionHandler,
    callback:callData.callback
  };

  // Copy to the map the things that need serializing
  var prefix = "c" + batch.map.callCount + "-";
  batch.map[prefix + "scriptName"] = scriptName;
  batch.map[prefix + "methodName"] = methodName;
  batch.map[prefix + "id"] = batch.map.callCount;
  for (i = 0; i < args.length; i++) {
    dwr.engine._serializeAll(batch, [], args[i], prefix + "param" + i);
  }

  // Now we have finished remembering the call, we incr the call count
  batch.map.callCount++;
  if (singleShot) dwr.engine.endBatch();
};

/** @private Poll the server to see if there is any data waiting */
dwr.engine._poll = function() {
  if (!dwr.engine._activeReverseAjax) return;

  var batch = dwr.engine._createBatch();
  batch.map.id = 0; // TODO: Do we need this??
  batch.map.callCount = 1;
  batch.isPoll = true;
  if (dwr.engine._pollWithXhr == "true") {
    batch.rpcType = dwr.engine.XMLHttpRequest;
    batch.map.partialResponse = dwr.engine._partialResponseNo;
  }
  else {
    if (navigator.userAgent.indexOf("Gecko/") != -1) {
      batch.rpcType = dwr.engine.XMLHttpRequest;
      batch.map.partialResponse = dwr.engine._partialResponseYes;
    }
    else {
      batch.rpcType = dwr.engine.XMLHttpRequest;
      batch.map.partialResponse = dwr.engine._partialResponseNo;
    }
  }
  batch.httpMethod = "POST";
  batch.async = true;
  batch.timeout = 0;
  batch.path = dwr.engine._defaultPath;
  batch.preHooks = [];
  batch.postHooks = [];
  batch.errorHandler = dwr.engine._pollErrorHandler;
  batch.warningHandler = dwr.engine._pollErrorHandler;
  batch.handlers[0] = {
    callback:function(pause) {
      dwr.engine._pollRetries = 0;
      setTimeout(dwr.engine._poll, pause);
    }
  };

  // Send the data
  dwr.engine._sendData(batch);
  if (batch.rpcType == dwr.engine.XMLHttpRequest && batch.map.partialResponse == dwr.engine._partialResponseYes) {
    dwr.engine._checkCometPoll();
  }
};

/** Try to recover from polling errors */
dwr.engine._pollErrorHandler = function(msg, ex) {
  // if anything goes wrong then just silently try again (up to 3x) after 10s
  dwr.engine._pollRetries++;
  dwr.engine._debug("Reverse Ajax poll failed (pollRetries=" + dwr.engine._pollRetries + "): " + ex.name + " : " + ex.message);
  if (dwr.engine._pollRetries < dwr.engine._maxPollRetries) {
    setTimeout(dwr.engine._poll, 10000);
  }
  else {
    dwr.engine._activeReverseAjax = false;
    dwr.engine._debug("Giving up.");
  }
};

/** @private Generate a new standard batch */
dwr.engine._createBatch = function() {
  var batch = {
    map:{
      callCount:0,
      page:window.location.pathname + window.location.search,
      httpSessionId:dwr.engine._getJSessionId(),
      scriptSessionId:dwr.engine._getScriptSessionId()
    },
    charsProcessed:0, paramCount:0,
    parameters:{}, headers:{},
    isPoll:false, handlers:{}, preHooks:[], postHooks:[],
    rpcType:dwr.engine._rpcType,
    httpMethod:dwr.engine._httpMethod,
    async:dwr.engine._async,
    timeout:dwr.engine._timeout,
    errorHandler:dwr.engine._errorHandler,
    warningHandler:dwr.engine._warningHandler,
    textHtmlHandler:dwr.engine._textHtmlHandler
  };
  if (dwr.engine._preHook) batch.preHooks.push(dwr.engine._preHook);
  if (dwr.engine._postHook) batch.postHooks.push(dwr.engine._postHook);
  var propname, data;
  if (dwr.engine._headers) {
    for (propname in dwr.engine._headers) {
      data = dwr.engine._headers[propname];
      if (typeof data != "function") batch.headers[propname] = data;
    }
  }
  if (dwr.engine._parameters) {
    for (propname in dwr.engine._parameters) {
      data = dwr.engine._parameters[propname];
      if (typeof data != "function") batch.parameters[propname] = data;
    }
  }
  return batch;
};

/** @private Take further options and merge them into */
dwr.engine._mergeBatch = function(batch, overrides) {
  var propname, data;
  for (var i = 0; i < dwr.engine._propnames.length; i++) {
    propname = dwr.engine._propnames[i];
    if (overrides[propname] != null) batch[propname] = overrides[propname];
  }
  if (overrides.preHook != null) batch.preHooks.unshift(overrides.preHook);
  if (overrides.postHook != null) batch.postHooks.push(overrides.postHook);
  if (overrides.headers) {
    for (propname in overrides.headers) {
      data = overrides.headers[propname];
      if (typeof data != "function") batch.headers[propname] = data;
    }
  }
  if (overrides.parameters) {
    for (propname in overrides.parameters) {
      data = overrides.parameters[propname];
      if (typeof data != "function") batch.map["p-" + propname] = "" + data;
    }
  }
};

/** @private What is our session id? */
dwr.engine._getJSessionId =  function() {
  var cookies = document.cookie.split(';');
  for (var i = 0; i < cookies.length; i++) {
    var cookie = cookies[i];
    while (cookie.charAt(0) == ' ') cookie = cookie.substring(1, cookie.length);
    if (cookie.indexOf(dwr.engine._sessionCookieName + "=") == 0) {
      return cookie.substring(dwr.engine._sessionCookieName.length + 1, cookie.length);
    }
  }
  return "";
};

/** @private Check for reverse Ajax activity */
dwr.engine._checkCometPoll = function() {
  for (var i = 0; i < dwr.engine._outstandingIFrames.length; i++) {
    var text = "";
    var iframe = dwr.engine._outstandingIFrames[i];
    try {
      text = dwr.engine._getTextFromCometIFrame(iframe);
    }
    catch (ex) {
      dwr.engine._handleWarning(iframe.batch, ex);
    }
    if (text != "") dwr.engine._processCometResponse(text, iframe.batch);
  }
  if (dwr.engine._pollReq) {
    var req = dwr.engine._pollReq;
    var text = req.responseText;
    if (text != null) dwr.engine._processCometResponse(text, req.batch);
  }

  // If the poll resources are still there, come back again
  if (dwr.engine._outstandingIFrames.length > 0 || dwr.engine._pollReq) {
    setTimeout(dwr.engine._checkCometPoll, dwr.engine._pollCometInterval);
  }
};

/** @private Extract the whole (executed an all) text from the current iframe */
dwr.engine._getTextFromCometIFrame = function(frameEle) {
  var body = frameEle.contentWindow.document.body;
  if (body == null) return "";
  var text = body.innerHTML;
  // We need to prevent IE from stripping line feeds
  if (text.indexOf("<PRE>") == 0 || text.indexOf("<pre>") == 0) {
    text = text.substring(5, text.length - 7);
  }
  return text;
};

/** @private Some more text might have come in, test and execute the new stuff */
dwr.engine._processCometResponse = function(response, batch) {
  if (batch.charsProcessed == response.length) return;
  if (response.length == 0) {
    batch.charsProcessed = 0;
    return;
  }

  var firstStartTag = response.indexOf("//#DWR-START#", batch.charsProcessed);
  if (firstStartTag == -1) {
    // dwr.engine._debug("No start tag (search from " + batch.charsProcessed + "). skipping '" + response.substring(batch.charsProcessed) + "'");
    batch.charsProcessed = response.length;
    return;
  }
  // if (firstStartTag > 0) {
  //   dwr.engine._debug("Start tag not at start (search from " + batch.charsProcessed + "). skipping '" + response.substring(batch.charsProcessed, firstStartTag) + "'");
  // }

  var lastEndTag = response.lastIndexOf("//#DWR-END#");
  if (lastEndTag == -1) {
    // dwr.engine._debug("No end tag. unchanged charsProcessed=" + batch.charsProcessed);
    return;
  }

  // Skip the end tag too for next time, remembering CR and LF
  if (response.charCodeAt(lastEndTag + 11) == 13 && response.charCodeAt(lastEndTag + 12) == 10) {
    batch.charsProcessed = lastEndTag + 13;
  }
  else {
    batch.charsProcessed = lastEndTag + 11;
  }

  var exec = response.substring(firstStartTag + 13, lastEndTag);

  dwr.engine._receivedBatch = batch;
  dwr.engine._eval(exec);
  dwr.engine._receivedBatch = null;
};

/** @private Actually send the block of data in the batch object. */
dwr.engine._sendData = function(batch) {
  batch.map.batchId = dwr.engine._nextBatchId;
  dwr.engine._nextBatchId++;
  dwr.engine._batches[batch.map.batchId] = batch;
  dwr.engine._batchesLength++;
  batch.completed = false;

  for (var i = 0; i < batch.preHooks.length; i++) {
    batch.preHooks[i]();
  }
  batch.preHooks = null;
  // Set a timeout
  if (batch.timeout && batch.timeout != 0) {
    batch.timeoutId = setTimeout(function() { dwr.engine._abortRequest(batch); }, batch.timeout);
  }
  // Get setup for XMLHttpRequest if possible
  if (batch.rpcType == dwr.engine.XMLHttpRequest) {
    if (window.XMLHttpRequest) {
      batch.req = new XMLHttpRequest();
    }
    // IE5 for the mac claims to support window.ActiveXObject, but throws an error when it's used
    else if (window.ActiveXObject && !(navigator.userAgent.indexOf("Mac") >= 0 && navigator.userAgent.indexOf("MSIE") >= 0)) {
      batch.req = dwr.engine._newActiveXObject(dwr.engine._XMLHTTP);
    }
  }

  var prop, request;
  if (batch.req) {
    // Proceed using XMLHttpRequest
    if (batch.async) {
      batch.req.onreadystatechange = function() {
        if (typeof dwr != 'undefined') dwr.engine._stateChange(batch);
      };
    }
    // If we're polling, record this for monitoring
    if (batch.isPoll) {
      dwr.engine._pollReq = batch.req;
      // In IE XHR is an ActiveX control so you can't augment it like this
      if (!(document.all && !window.opera)) batch.req.batch = batch;
    }
    // Workaround for Safari 1.x POST bug
    var indexSafari = navigator.userAgent.indexOf("Safari/");
    if (indexSafari >= 0) {
      var version = navigator.userAgent.substring(indexSafari + 7);
      if (parseInt(version, 10) < 400) {
        if (dwr.engine._allowGetForSafariButMakeForgeryEasier == "true") batch.httpMethod = "GET";
        else dwr.engine._handleWarning(batch, { name:"dwr.engine.oldSafari", message:"Safari GET support disabled. See getahead.org/dwr/server/servlet and allowGetForSafariButMakeForgeryEasier." });
      }
    }
    batch.mode = batch.isPoll ? dwr.engine._ModePlainPoll : dwr.engine._ModePlainCall;
    request = dwr.engine._constructRequest(batch);
    try {
      batch.req.open(batch.httpMethod, request.url, batch.async);
      try {
        for (prop in batch.headers) {
          var value = batch.headers[prop];
          if (typeof value == "string") batch.req.setRequestHeader(prop, value);
        }
        if (!batch.headers["Content-Type"]) batch.req.setRequestHeader("Content-Type", "text/plain");
      }
      catch (ex) {
        dwr.engine._handleWarning(batch, ex);
      }
      batch.req.send(request.body);
      if (!batch.async) dwr.engine._stateChange(batch);
    }
    catch (ex) {
      dwr.engine._handleError(batch, ex);
    }
  }
  else if (batch.rpcType != dwr.engine.ScriptTag) {
    var idname = batch.isPoll ? "dwr-if-poll-" + batch.map.batchId : "dwr-if-" + batch.map.batchId;
    // Removed htmlfile implementation. Don't expect it to return before v3
    batch.div = document.createElement("div");
    // Add the div to the document first, otherwise IE 6 will ignore onload handler.
    document.body.appendChild(batch.div);
    batch.div.innerHTML = "<iframe src='javascript:void(0)' frameborder='0' style='width:0px;height:0px;border:0;' id='" + idname + "' name='" + idname + "' onload='dwr.engine._iframeLoadingComplete (" + batch.map.batchId + ");'></iframe>";
    batch.document = document;
    batch.iframe = batch.document.getElementById(idname);
    batch.iframe.batch = batch;
    batch.mode = batch.isPoll ? dwr.engine._ModeHtmlPoll : dwr.engine._ModeHtmlCall;
    if (batch.isPoll) dwr.engine._outstandingIFrames.push(batch.iframe);
    request = dwr.engine._constructRequest(batch);
    if (batch.httpMethod == "GET") {
      batch.iframe.setAttribute("src", request.url);
    }
    else {
      batch.form = batch.document.createElement("form");
      batch.form.setAttribute("id", "dwr-form");
      batch.form.setAttribute("action", request.url);
      batch.form.setAttribute("style", "display:none;");
      batch.form.setAttribute("target", idname);
      batch.form.target = idname;
      batch.form.setAttribute("method", batch.httpMethod);
      for (prop in batch.map) {
        var value = batch.map[prop];
        if (typeof value != "function") {
          var formInput = batch.document.createElement("input");
          formInput.setAttribute("type", "hidden");
          formInput.setAttribute("name", prop);
          formInput.setAttribute("value", value);
          batch.form.appendChild(formInput);
        }
      }
      batch.document.body.appendChild(batch.form);
      batch.form.submit();
    }
  }
  else {
    batch.httpMethod = "GET"; // There's no such thing as ScriptTag using POST
    batch.mode = batch.isPoll ? dwr.engine._ModePlainPoll : dwr.engine._ModePlainCall;
    request = dwr.engine._constructRequest(batch);
    batch.script = document.createElement("script");
    batch.script.id = "dwr-st-" + batch.map["c0-id"];
    batch.script.src = request.url;
    document.body.appendChild(batch.script);
  }
};

dwr.engine._ModePlainCall = "/call/plaincall/";
dwr.engine._ModeHtmlCall = "/call/htmlcall/";
dwr.engine._ModePlainPoll = "/call/plainpoll/";
dwr.engine._ModeHtmlPoll = "/call/htmlpoll/";

/** @private Work out what the URL should look like */
dwr.engine._constructRequest = function(batch) {
  // A quick string to help people that use web log analysers
  var request = { url:batch.path + batch.mode, body:null };
  if (batch.isPoll == true) {
    request.url += "ReverseAjax.dwr";
  }
  else if (batch.map.callCount == 1) {
    request.url += batch.map["c0-scriptName"] + "." + batch.map["c0-methodName"] + ".dwr";
  }
  else {
    request.url += "Multiple." + batch.map.callCount + ".dwr";
  }
  // Play nice with url re-writing
  var sessionMatch = location.href.match(/jsessionid=([^?]+)/);
  if (sessionMatch != null) {
    request.url += ";jsessionid=" + sessionMatch[1];
  }

  var prop;
  if (batch.httpMethod == "GET") {
    // Some browsers (Opera/Safari2) seem to fail to convert the callCount value
    // to a string in the loop below so we do it manually here.
    batch.map.callCount = "" + batch.map.callCount;
    request.url += "?";
    for (prop in batch.map) {
      if (typeof batch.map[prop] != "function") {
        request.url += encodeURIComponent(prop) + "=" + encodeURIComponent(batch.map[prop]) + "&";
      }
    }
    request.url = request.url.substring(0, request.url.length - 1);
  }
  else {
    // PERFORMANCE: for iframe mode this is thrown away.
    request.body = "";
    if (document.all && !window.opera) {
      // Use array joining on IE (fastest)
      var buf = [];
      for (prop in batch.map) {
        if (typeof batch.map[prop] != "function") {
          buf.push(prop + "=" + batch.map[prop] + dwr.engine._postSeperator);
        }
      }
      request.body = buf.join("");
    }
    else {
      // Use string concat on other browsers (fastest)
      for (prop in batch.map) {
        if (typeof batch.map[prop] != "function") {
          request.body += prop + "=" + batch.map[prop] + dwr.engine._postSeperator;
        }
      }
    }
    request.body = dwr.engine._contentRewriteHandler(request.body);
  }
  request.url = dwr.engine._urlRewriteHandler(request.url);
  return request;
};

/** @private Called by XMLHttpRequest to indicate that something has happened */
dwr.engine._stateChange = function(batch) {
  var toEval;

  if (batch.completed) {
    dwr.engine._debug("Error: _stateChange() with batch.completed");
    return;
  }

  var req = batch.req;
  try {
    if (req.readyState != 4) return;
  }
  catch (ex) {
    dwr.engine._handleWarning(batch, ex);
    // It's broken - clear up and forget this call
    dwr.engine._clearUp(batch);
    return;
  }

  if (dwr.engine._unloading) {
    dwr.engine._debug("Ignoring reply from server as page is unloading.");
    return;
  }
  
  try {
    var reply = req.responseText;
    reply = dwr.engine._replyRewriteHandler(reply);
    var status = req.status; // causes Mozilla to except on page moves

    if (reply == null || reply == "") {
      dwr.engine._handleWarning(batch, { name:"dwr.engine.missingData", message:"No data received from server" });
    }
    else if (status != 200) {
      dwr.engine._handleError(batch, { name:"dwr.engine.http." + status, message:req.statusText });
    }
    else {
      var contentType = req.getResponseHeader("Content-Type");
      if (!contentType.match(/^text\/plain/) && !contentType.match(/^text\/javascript/)) {
        if (contentType.match(/^text\/html/) && typeof batch.textHtmlHandler == "function") {
          batch.textHtmlHandler({ status:status, responseText:reply, contentType:contentType });
        }
        else {
          dwr.engine._handleWarning(batch, { name:"dwr.engine.invalidMimeType", message:"Invalid content type: '" + contentType + "'" });
        }
      }
      else {
        // Comet replies might have already partially executed
        if (batch.isPoll && batch.map.partialResponse == dwr.engine._partialResponseYes) {
          dwr.engine._processCometResponse(reply, batch);
        }
        else {
          if (reply.search("//#DWR") == -1) {
            dwr.engine._handleWarning(batch, { name:"dwr.engine.invalidReply", message:"Invalid reply from server" });
          }
          else {
            toEval = reply;
          }
        }
      }
    }
  }
  catch (ex) {
    dwr.engine._handleWarning(batch, ex);
  }

  dwr.engine._callPostHooks(batch);

  // Outside of the try/catch so errors propogate normally:
  dwr.engine._receivedBatch = batch;
  if (toEval != null) toEval = toEval.replace(dwr.engine._scriptTagProtection, "");
  dwr.engine._eval(toEval);
  dwr.engine._receivedBatch = null;
  dwr.engine._validateBatch(batch);
  if (!batch.completed) dwr.engine._clearUp(batch);
};

/**
 * @private This function is invoked when a batch reply is received.
 * It checks that there is a response for every call in the batch. Otherwise,
 * an error will be signaled (a call without a response indicates that the 
 * server failed to send complete batch response). 
 */
dwr.engine._validateBatch = function(batch) {
  // If some call left unreplied, report an error.
  if (!batch.completed) {
    for (var i = 0; i < batch.map.callCount; i++) {
      if (batch.handlers[i] != null) {
        dwr.engine._handleWarning(batch, { name:"dwr.engine.incompleteReply", message:"Incomplete reply from server" });
        break;
      }
    }
  }
}

/** @private Called from iframe onload, check batch using batch-id */
dwr.engine._iframeLoadingComplete = function(batchId) {
  // dwr.engine._checkCometPoll();
  var batch = dwr.engine._batches[batchId];
  if (batch) dwr.engine._validateBatch(batch);
}

/** @private Called by the server: Execute a callback */
dwr.engine._remoteHandleCallback = function(batchId, callId, reply) {
  var batch = dwr.engine._batches[batchId];
  if (batch == null) {
    dwr.engine._debug("Warning: batch == null in remoteHandleCallback for batchId=" + batchId, true);
    return;
  }
  // Error handlers inside here indicate an error that is nothing to do
  // with DWR so we handle them differently.
  try {
    var handlers = batch.handlers[callId];
    batch.handlers[callId] = null;
    if (!handlers) {
      dwr.engine._debug("Warning: Missing handlers. callId=" + callId, true);
    }
    else if (typeof handlers.callback == "function") handlers.callback(reply);
  }
  catch (ex) {
    dwr.engine._handleError(batch, ex);
  }
};

/** @private Called by the server: Handle an exception for a call */
dwr.engine._remoteHandleException = function(batchId, callId, ex) {
  var batch = dwr.engine._batches[batchId];
  if (batch == null) { dwr.engine._debug("Warning: null batch in remoteHandleException", true); return; }
  var handlers = batch.handlers[callId];
  batch.handlers[callId] = null;
  if (handlers == null) { dwr.engine._debug("Warning: null handlers in remoteHandleException", true); return; }
  if (ex.message == undefined) ex.message = "";
  if (typeof handlers.exceptionHandler == "function") handlers.exceptionHandler(ex.message, ex);
  else if (typeof batch.errorHandler == "function") batch.errorHandler(ex.message, ex);
};

/** @private Called by the server: The whole batch is broken */
dwr.engine._remoteHandleBatchException = function(ex, batchId) {
  var searchBatch = (dwr.engine._receivedBatch == null && batchId != null);
  if (searchBatch) {
    dwr.engine._receivedBatch = dwr.engine._batches[batchId];
  }
  if (ex.message == undefined) ex.message = "";
  dwr.engine._handleError(dwr.engine._receivedBatch, ex);
  if (searchBatch) {
    dwr.engine._receivedBatch = null;
    dwr.engine._clearUp(dwr.engine._batches[batchId]);
  }
};

/** @private Called by the server: Reverse ajax should not be used */
dwr.engine._remotePollCometDisabled = function(ex, batchId) {
  dwr.engine.setActiveReverseAjax(false);
  var searchBatch = (dwr.engine._receivedBatch == null && batchId != null);
  if (searchBatch) {
    dwr.engine._receivedBatch = dwr.engine._batches[batchId];
  }
  if (ex.message == undefined) ex.message = "";
  dwr.engine._handleError(dwr.engine._receivedBatch, ex);
  if (searchBatch) {
    dwr.engine._receivedBatch = null;
    dwr.engine._clearUp(dwr.engine._batches[batchId]);
  }
};

/** @private Called by the server: An IFrame reply is about to start */
dwr.engine._remoteBeginIFrameResponse = function(iframe, batchId) {
  if (iframe != null) dwr.engine._receivedBatch = iframe.batch;
  dwr.engine._callPostHooks(dwr.engine._receivedBatch);
};

/** @private Called by the server: An IFrame reply is just completing */
dwr.engine._remoteEndIFrameResponse = function(batchId) {
  dwr.engine._clearUp(dwr.engine._receivedBatch);
  dwr.engine._receivedBatch = null;
};

/** @private This is a hack to make the context be this window */
dwr.engine._eval = function(script) {
  if (script == null) return null;
  if (script == "") { dwr.engine._debug("Warning: blank script", true); return null; }
  // dwr.engine._debug("Exec: [" + script + "]", true);
  return eval(script);
};

/** @private Called as a result of a request timeout */
dwr.engine._abortRequest = function(batch) {
  if (batch && !batch.completed) {
    dwr.engine._clearUp(batch);
    if (batch.req) batch.req.abort();
    dwr.engine._handleError(batch, { name:"dwr.engine.timeout", message:"Timeout" });
  }
};

/** @private call all the post hooks for a batch */
dwr.engine._callPostHooks = function(batch) {
  if (batch.postHooks) {
    for (var i = 0; i < batch.postHooks.length; i++) {
      batch.postHooks[i]();
    }
    batch.postHooks = null;
  }
};

/** @private A call has finished by whatever means and we need to shut it all down. */
dwr.engine._clearUp = function(batch) {
  if (!batch) { dwr.engine._debug("Warning: null batch in dwr.engine._clearUp()", true); return; }
  if (batch.completed) { dwr.engine._debug("Warning: Double complete", true); return; }

  // IFrame tidyup
  if (batch.div) batch.div.parentNode.removeChild(batch.div);
  if (batch.iframe) {
    // If this is a poll frame then stop comet polling
    for (var i = 0; i < dwr.engine._outstandingIFrames.length; i++) {
      if (dwr.engine._outstandingIFrames[i] == batch.iframe) {
        dwr.engine._outstandingIFrames.splice(i, 1);
      }
    }
    batch.iframe.parentNode.removeChild(batch.iframe);
  }
  if (batch.form) batch.form.parentNode.removeChild(batch.form);

  // XHR tidyup: avoid IE handles increase
  if (batch.req) {
    // If this is a poll frame then stop comet polling
    if (batch.req == dwr.engine._pollReq) dwr.engine._pollReq = null;
    delete batch.req;
  }

  // Timeout tidyup
  if (batch.timeoutId) {
    clearTimeout(batch.timeoutId);
    delete batch.timeoutId;
  }

  if (batch.map && (batch.map.batchId || batch.map.batchId == 0)) {
    delete dwr.engine._batches[batch.map.batchId];
    dwr.engine._batchesLength--;
  }

  batch.completed = true;

  // If there is anything on the queue waiting to go out, then send it.
  // We don't need to check for ordered mode, here because when ordered mode
  // gets turned off, we still process *waiting* batches in an ordered way.
  if (dwr.engine._batchQueue.length != 0) {
    var sendbatch = dwr.engine._batchQueue.shift();
    dwr.engine._sendData(sendbatch);
  }
};

/** @private Abort any XHRs in progress at page unload (solves zombie socket problems in IE). */
dwr.engine._unloader = function() {
  dwr.engine._unloading = true;

  // Empty queue of waiting ordered requests
  dwr.engine._batchQueue.length = 0;

  // Abort any ongoing XHRs and clear their batches
  for (var batchId in dwr.engine._batches) {
    var batch = dwr.engine._batches[batchId];
    // Only process objects that look like batches (avoid prototype additions!)
    if (batch && batch.map) {
      if (batch.req) {
        batch.req.abort();
      }
      dwr.engine._clearUp(batch);
    }
  }
};
// Now register the unload handler
if (window.addEventListener) window.addEventListener('unload', dwr.engine._unloader, false);
else if (window.attachEvent) window.attachEvent('onunload', dwr.engine._unloader);

/** @private Generic error handling routing to save having null checks everywhere */
dwr.engine._handleError = function(batch, ex) {
  if (typeof ex == "string") ex = { name:"unknown", message:ex };
  if (ex.message == null) ex.message = "";
  if (ex.name == null) ex.name = "unknown";
  if (batch && typeof batch.errorHandler == "function") batch.errorHandler(ex.message, ex);
  else if (dwr.engine._errorHandler) dwr.engine._errorHandler(ex.message, ex);
  if (batch) dwr.engine._clearUp(batch);
};

/** @private Generic error handling routing to save having null checks everywhere */
dwr.engine._handleWarning = function(batch, ex) {
  if (typeof ex == "string") ex = { name:"unknown", message:ex };
  if (ex.message == null) ex.message = "";
  if (ex.name == null) ex.name = "unknown";
  if (batch && typeof batch.warningHandler == "function") batch.warningHandler(ex.message, ex);
  else if (dwr.engine._warningHandler) dwr.engine._warningHandler(ex.message, ex);
  if (batch) dwr.engine._clearUp(batch);
};

/**
 * @private Marshall a data item
 * @param batch A map of variables to how they have been marshalled
 * @param referto An array of already marshalled variables to prevent recurrsion
 * @param data The data to be marshalled
 * @param name The name of the data being marshalled
 */
dwr.engine._serializeAll = function(batch, referto, data, name) {
  if (data == null) {
    batch.map[name] = "null:null";
    return;
  }

  switch (typeof data) {
  case "boolean":
    batch.map[name] = "boolean:" + data;
    break;
  case "number":
    batch.map[name] = "number:" + data;
    break;
  case "string":
    batch.map[name] = "string:" + encodeURIComponent(data);
    break;
  case "object":
    if (data instanceof String) batch.map[name] = "String:" + encodeURIComponent(data);
    else if (data instanceof Boolean) batch.map[name] = "Boolean:" + data;
    else if (data instanceof Number) batch.map[name] = "Number:" + data;
    else if (data instanceof Date) batch.map[name] = "Date:" + data.getTime();
    else if (data && data.join) batch.map[name] = dwr.engine._serializeArray(batch, referto, data, name);
    else batch.map[name] = dwr.engine._serializeObject(batch, referto, data, name);
    break;
  case "function":
    // We just ignore functions.
    break;
  default:
    dwr.engine._handleWarning(null, { name:"dwr.engine.unexpectedType", message:"Unexpected type: " + typeof data + ", attempting default converter." });
    batch.map[name] = "default:" + data;
    break;
  }
};

/** @private Have we already converted this object? */
dwr.engine._lookup = function(referto, data, name) {
  var lookup;
  // Can't use a map: getahead.org/ajax/javascript-gotchas
  for (var i = 0; i < referto.length; i++) {
    if (referto[i].data == data) {
      lookup = referto[i];
      break;
    }
  }
  if (lookup) return "reference:" + lookup.name;
  referto.push({ data:data, name:name });
  return null;
};

/** @private Marshall an object */
dwr.engine._serializeObject = function(batch, referto, data, name) {
  var ref = dwr.engine._lookup(referto, data, name);
  if (ref) return ref;

  // This check for an HTML is not complete, but is there a better way?
  // Maybe we should add: data.hasChildNodes typeof "function" == true
  if (data.nodeName && data.nodeType) {
    return dwr.engine._serializeXml(batch, referto, data, name);
  }

  // treat objects as an associative arrays
  var reply = "Object_" + dwr.engine._getObjectClassName(data) + ":{";
  var element;
  for (element in data) {
    if (typeof data[element] != "function") {
      batch.paramCount++;
      var childName = "c" + dwr.engine._batch.map.callCount + "-e" + batch.paramCount;
      dwr.engine._serializeAll(batch, referto, data[element], childName);

      reply += encodeURIComponent(element) + ":reference:" + childName + ", ";
    }
  }

  if (reply.substring(reply.length - 2) == ", ") {
    reply = reply.substring(0, reply.length - 2);
  }
  reply += "}";

  return reply;
};

/** @private Returns the classname of supplied argument obj */
dwr.engine._errorClasses = { "Error":Error, "EvalError":EvalError, "RangeError":RangeError, "ReferenceError":ReferenceError, "SyntaxError":SyntaxError, "TypeError":TypeError, "URIError":URIError };
dwr.engine._getObjectClassName = function(obj) {
  // Try to find the classname by stringifying the object's constructor
  // and extract <class> from "function <class>".
  if (obj && obj.constructor && obj.constructor.toString)
  {
    var str = obj.constructor.toString();
    var regexpmatch = str.match(/function\s+(\w+)/);
    if (regexpmatch && regexpmatch.length == 2) {
      return regexpmatch[1];
    }
  }

  // Now manually test against the core Error classes, as these in some 
  // browsers successfully match to the wrong class in the 
  // Object.toString() test we will do later
  if (obj && obj.constructor) {
	for (var errorname in dwr.engine._errorClasses) {
      if (obj.constructor == dwr.engine._errorClasses[errorname]) return errorname;
    }
  }

  // Try to find the classname by calling Object.toString() on the object
  // and extracting <class> from "[object <class>]"
  if (obj) {
    var str = Object.prototype.toString.call(obj);
    var regexpmatch = str.match(/\[object\s+(\w+)/);
    if (regexpmatch && regexpmatch.length==2) {
      return regexpmatch[1];
    }
  }

  // Supplied argument was probably not an object, but what is better?
  return "Object";
};

/** @private Marshall an object */
dwr.engine._serializeXml = function(batch, referto, data, name) {
  var ref = dwr.engine._lookup(referto, data, name);
  if (ref) return ref;

  var output;
  if (window.XMLSerializer) output = new XMLSerializer().serializeToString(data);
  else if (data.toXml) output = data.toXml;
  else output = data.innerHTML;

  return "XML:" + encodeURIComponent(output);
};

/** @private Marshall an array */
dwr.engine._serializeArray = function(batch, referto, data, name) {
  var ref = dwr.engine._lookup(referto, data, name);
  if (ref) return ref;

  if (document.all && !window.opera) {
    // Use array joining on IE (fastest)
    var buf = ["Array:["];
    for (var i = 0; i < data.length; i++) {
      if (i != 0) buf.push(",");
      batch.paramCount++;
      var childName = "c" + dwr.engine._batch.map.callCount + "-e" + batch.paramCount;
      dwr.engine._serializeAll(batch, referto, data[i], childName);
      buf.push("reference:");
      buf.push(childName);
    }
    buf.push("]");
    reply = buf.join("");
  }
  else {
    // Use string concat on other browsers (fastest)
    var reply = "Array:[";
    for (var i = 0; i < data.length; i++) {
      if (i != 0) reply += ",";
      batch.paramCount++;
      var childName = "c" + dwr.engine._batch.map.callCount + "-e" + batch.paramCount;
      dwr.engine._serializeAll(batch, referto, data[i], childName);
      reply += "reference:";
      reply += childName;
    }
    reply += "]";
  }

  return reply;
};

/** @private Convert an XML string into a DOM object. */
dwr.engine._unserializeDocument = function(xml) {
  var dom;
  if (window.DOMParser) {
    var parser = new DOMParser();
    dom = parser.parseFromString(xml, "text/xml");
    if (!dom.documentElement || dom.documentElement.tagName == "parsererror") {
      var message = dom.documentElement.firstChild.data;
      message += "\n" + dom.documentElement.firstChild.nextSibling.firstChild.data;
      throw message;
    }
    return dom;
  }
  else if (window.ActiveXObject) {
    dom = dwr.engine._newActiveXObject(dwr.engine._DOMDocument);
    dom.loadXML(xml); // What happens on parse fail with IE?
    return dom;
  }
  else {
    var div = document.createElement("div");
    div.innerHTML = xml;
    return div;
  }
};

/** @param axarray An array of strings to attempt to create ActiveX objects from */
dwr.engine._newActiveXObject = function(axarray) {
  var returnValue;  
  for (var i = 0; i < axarray.length; i++) {
    try {
      returnValue = new ActiveXObject(axarray[i]);
      break;
    }
    catch (ex) { /* ignore */ }
  }
  return returnValue;
};

/** @private Used internally when some message needs to get to the programmer */
dwr.engine._debug = function(message, stacktrace) {
  var written = false;
  try {
    if (window.console) {
      if (stacktrace && window.console.trace) window.console.trace();
      window.console.log(message);
      written = true;
    }
    else if (window.opera && window.opera.postError) {
      window.opera.postError(message);
      written = true;
    }
  }
  catch (ex) { /* ignore */ }

  if (!written) {
    var debug = document.getElementById("dwr-debug");
    if (debug) {
      var contents = message + "<br/>" + debug.innerHTML;
      if (contents.length > 2048) contents = contents.substring(0, 2048);
      debug.innerHTML = contents;
    }
  }
};

/** Done /scripts-v66/dwr/engine.js **/ 

var jsonrpc;
var preventCall=false;
var beans;
var beanToLoad;
var dummyElement;
var codeLang;
var viewBeans;

/*Initialisation des beans par leurs noms declares*/
function initBeanList(beanNames){
	if (beanNames){
		beanToLoad="beans="+beanNames;
		var tabBean = beanNames.split(";");
		beans = new Array;

		for(var num=0;num<tabBean.length;num++)
			beans.unshift(new Bean(tabBean[num]));
	} else
		 alert("Attention: Pas de beans declares!");
}

/*Decalaration de l objet bean*/
function Bean(nomBean){
	this.nom = nomBean;
	this.bean= null;
}

/*Initialisation de la vue*/
function initView(viewBeans) {
	for( var num=0;num<beans.length; num++)
		beans[num].bean = viewBeans[beans[num].nom];
}

function updateView(actionName, viewName, parameters){
	try {
		if (preventCall==false) {
			preventCall=true;

			if (!codeLang)
				codeLang = getDirLangFromHtmlAttrib();			
			
      RemoteView.getViewBeans(actionName, viewName, parameters, codeLang, { callback:function(data) {
          viewBeans = data;           
          initView(viewBeans); 
        }, async:false
        , errorHandler:function(errorString, exception) {
                 
            if (errorString && errorString.startsWith("Erreur de session")){
              document.location='/'+ codeLang + '/session/expired.html';
            }
                
            throw exception;            
          }
        }, document.referrer      
      );			
			rewriteView();
		}
	} catch(e) {
		if (e.name == "JSONRpcClientException" ) {
			/* Redirection vers page err tech
			if (!codeLang || codeLang=="")
				var errPage = "/gb/error/error.shtml";
			else
				var errPage = "/" + codeLang + "/error/error.shtml";

			if (parent.location.href == self.location.href)
				 document.location.href = errPage;
			else
				 parent.location.href = errPage;
			alert("UpdateView failed: " + e);
			*/
		} else
			throw e;

	} finally {
		preventCall=false;
	}
}

/* Permet de recuperer la langue de la page. Meta OBLIGATOIRE sur les pages incluant ce js !
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 */
function getDirLangFromHtmlAttrib() {
	var htmlTag = document.getElementsByTagName("html")[0];
	var langue = "";
	if(htmlTag.attributes["xml:lang"] && htmlTag.attributes["xml:lang"].value)
		langue = htmlTag.attributes["xml:lang"].value;
	else if(htmlTag.attributes["lang"] && htmlTag.attributes["lang"].value)
		langue = htmlTag.attributes["lang"].value;
	return convertEn2Gb(langue);
}

function convertEn2Gb(langue) {
	if (langue && langue.toUpperCase()=="EN")
		langue = "gb";
  return langue;
}

function fillSelect(selectId, values, selectedValue, blankValue){
	// si l element n est pas present, on sort
	if (!document.getElementById(selectId)) return;
	var selectElement = document.getElementById(selectId);
	//On force le nettoyage du select
	selectElement.options.length=0;
	selectElement.innerHTML="";

	var index = 0;
	var selectIndex = -1;
	if(blankValue!=null)
		selectElement[index++]=new Option(blankValue, "");

	for(var mapKey in values){
		//On regarde si c est une option ou un groupe d ptions
		//Cas groupe d options
		if(values[mapKey]!=null && typeof(values[mapKey]) == 'object'){
			var oGroup = document.createElement('optgroup');
			oGroup.label = mapKey;
			selectElement.appendChild(oGroup);
			var options = values[mapKey];
			for(var optionKey in options){
				var oOption = document.createElement('option');
				oOption.value = optionKey;
				oOption.innerHTML = options[optionKey];
				oGroup.appendChild(oOption);
			}
		}
		//Cas option seule
		else {
			//BUG IE : bug sur innerHTML dans un select et pb constrinction select en DOM + selection valeur pas defaut
			selectElement.options[index] = new Option(values[mapKey],mapKey);
		}
		if(selectedValue!= null && mapKey==selectedValue){

			selectIndex=index;
		}
		index++;
	}

	if(selectIndex!=-1){
	 //alert(selectIndex);
		selectElement.selectedIndex=selectIndex;
	}else
		selectElement.selectedIndex=0;
}

function fillSelectWithKeys(selectId, values, selectedValue, blankValue){
	// si l element n est pas present, on sort
	if (!document.getElementById(selectId)) return;
	var selectElement = document.getElementById(selectId);
	selectElement.options.length=0;
	var index = 0;
	var selectIndex = -1;
	if(blankValue && blankValue!=null)
		selectElement[index++]=new Option(blankValue, "");
	for(var mapKey in values){
		selectElement[index]=new Option(mapKey, mapKey);
		if(selectedValue!= null && mapKey==selectedValue){
			selectIndex=index;
		}
		index++;

		if(selectIndex!=-1)
			selectElement.selectedIndex=selectIndex;
		else
			selectElement.selectedIndex=0;
	}
}

function updateCheckBoxStatus(checkBoxId){
	// si l element n est pas present, on sort
	if (!document.getElementById(checkBoxId)) return;

	var checkBoxElement = document.getElementById(checkBoxId);
	if(checkBoxElement.checked)
		checkBoxElement.value="ON";
	else
		checkBoxElement.value="";
}

function selectOption(selectid, selectedValue){
	// si l element n est pas present, on sort
	if (!document.getElementById(selectid)) return;

	var selectElement = document.getElementById(selectid);
	if(selectElement && selectElement.options){
		for(var i=0; i<selectElement.options.length; i++){
			if(selectElement.options[i].value==selectedValue)
				selectElement.selectedIndex=i;
		}
	}
}

function checkRadio(radioElement, selectedValue){
	// si l element n est pas present, on sort
	if (!radioElement) return;

	for(var i=0; i<radioElement.length; i++){
		if(radioElement[i].value==selectedValue)
			radioElement[i].checked=true;
	}
}

// fonction qui retourne un element s il existe, sinon retourne un element dummy qui n est jamais ecrit dans la page
// mais qui permet de faire fonctionner le js meme si l element cherche n existe pas
function getElementByIdIfExists(id){
	if (document.getElementById(id)){
		return document.getElementById(id);
	} else {
		// creation d un element dummy s il n existe pas
		if (!dummyElement)
			dummyElement = document.createElement('dummy_json_rpc');
		return dummyElement;
	}
}

/** Done /scripts-v66/view/json/jsonrpc_ah.js **/ 


var core = Array();
//********************************************************************************
// Cette fonctionnalite permet de charger des objets javascripts, declares dans
// des fichiers annexes, et qui s'ajoutent au tableau core.
// Sur le onload le tableau est parcouru, et les methode getBeans, initJSON, 
// Et rewrite sont appelee.
// Les objets ajoutes dans le core doivent avoir le prototype suivant:
// var MyJsonObject = {
//     variable: null,
//     
//     getBeans: function() {
//         return "MyViewBeanObject;";
//     },
//     
//     initJSON: function() {
//         var num;
//     	try {
//         	for( num in beans){
//                 if("MyViewBeanObject" == beans[num].nom) {
//                     variable = beans[num].bean;
//             	}
//             }
//         } catch(e) {
//     		alert(e);
//     	}
//     }, 
//     
//     //
//     // Dear agencies, Write your code here.
//     //
//     rewrite: function() {
//         // Your code here ...
//     }
// }
// 
// core.push(MyJsonObject);
//********************************************************************************

      Event.observe(window, 'load', function () {pushOnLoad();});      
      Event.observe(document, 'rewrite:load', function () {pushOnLoad();});

function pushOnLoad() {    
    if(core.length>0) {
        var beanNames = "";
        for(var i=0;i<core.length;i++) {
            beanNames=beanNames+core[i].getBeans()+";";
        }        
        initBeanList(beanNames);
        updateView(null, "", beanToLoad);
    }
}

//********************************************************************************
// Cette methode est appelee lors de la mise a jour du JSON par la methode
// updateView().
//********************************************************************************
function rewriteView() {
    for(var i=0;i<core.length;i++) {
        core[i].initJSON();
        core[i].rewrite();  
    }
}

function Bean(nom, bean) {
    this.nom = nom;
    this.bean = bean;
}

/** /scripts-v66/view/json/modules/jsonrpc_push.js **/

/** >  /scripts-v66/view/spec/profile.js **/

var Profile = {
  
  initialized: false,
  
  elm_ident: null,
  elm_not_ident: null,

  elm_name: null,
  
  init: function() {
    if (!this.initialized) { 
         this.elm_ident = document.getElementById("bloc_ident");
      this.elm_notIdent = document.getElementById("bloc_not_ident");      
      this.elm_template = $("logId");
      this.initialized = !!this.elm_ident && !!this.elm_notIdent && !!this.elm_template;
    }
  },
  
  getBeans: function() {  
    return "ProfileViewBean";
  },
  
  initJSON: function() {
  },
  
  rewrite: function() {	

    
    this.init();
    var bean = viewBeans["ProfileViewBean"];

    if(bean && this.initialized){
		// capitalize civility & name
		String.prototype.capitalize = function(){
		 return this.toLowerCase().replace( /(^|\s)([a-z])/g , function(m,p1,p2){ return p1+p2.toUpperCase(); } );
		}
		capitalizedCivility = (bean.civilityCode).capitalize();
		capitalizedlastName = (bean.lastName).capitalize();

      // template creation
      var data = {name: capitalizedlastName, civility: capitalizedCivility};
      var template = new Template(unescape(this.elm_template.innerHTML));
      Element.update(this.elm_template, template.evaluate(data));

      this.elm_notIdent.style.display = "none";
      this.elm_ident.style.display = "block";
	  
	  // update header value
		headerProfile =	function (){
			jQuery('#profil').append(jQuery('#logId').clone());
			jQuery('#logId').remove(); 
			var difWprofil = jQuery('#logId').width()  - jQuery('#profil .tooltip').width() ;
			jQuery('#faqContactLanguages').width(jQuery('#faqContactLanguages').width() + difWprofil);
			jQuery('#profil .tooltip').hide(); 
		}
		headerProfile();
	  
    } 
  }

}

core.push(Profile); 

/** /scripts-v66/view/spec/profile.js **/

/** > /scripts-v66/siteZones.js **/
var siteZones = {
	"" : 
	{   
		"Français" : {"lang" : "fr", "country" : "fr", "zone" : "france" , "flag" : "fr"},						
		"Deutschland" : {"lang" : "de", "country" : "", "zone" : "home" , "flag" : "de"},	
		"Italia" : {"lang" : "it", "country" : "", "zone" :"home" , "flag" : "it"}, 					
		"United Kingdom" : {"lang" : "gb", "country" : "gb", "zone" :"united-kingdom" , "flag" : "gb"},
		"United States" : {"lang" : "gb", "country" : "us", "zone" :"usa" , "flag" : "us"},
		"Australia" : {"lang" : "gb", "country" : "au", "zone" :"australia" , "flag" : "au"},
		"Asia" : {"lang" : "gb", "country" : "th", "zone" :"asia-middle-east" , "flag" : "none"},
		"New Zealand & Fiji" : {"lang" : "gb", "country" : "nz", "zone" :"new-zealand-fidji" , "flag" : "none"},
		"Autres pays" : {"lang" : "fr", "country" : "", "zone" :"home" , "flag" : "none"},
		"Other countries" : {"lang" : "gb", "country" : "", "zone" :"home" , "flag" : "none"}				
	}
};

function getCookieCountry(){
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x=='userBrowsingZoneLocalization')
		{
		return unescape(y);
		}
	  }
}

function getCookieLocation(){
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++)
	{
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x=='userLocalization')
		{
		return unescape(y);
		}
	  }
}

function createSiteZonesOptions(selectId){
 if(document.getElementById(selectId) && siteZones){
	var zone ='';
	var currentLang ='';
	var langContent = document.getElementById('languages');
	var locat = getCookieCountry();		
   
   /* case home tplHome */
	if (document.getElementById('tplHome')) {
	var langZoneExp = /\/([a-z]{2}(?:-[a-z]{2})?)\/([a-z\-]+)\/index\.shtml/;
	langZoneExp.exec(document.location);
	zone = RegExp.$2;
	currentLang = RegExp.$1;	
	} 
	 /* other case */
	else { 
	var countrySelected = getCookieCountry();	
	if (countrySelected != undefined) { var zone = countrySelected; }
	//else if (countrySelected == undefined || countrySelected == '') { var zone="home"; alert(countrySelected);}
	var url = window.location.pathname;	
	var currentLang = url.substring(1,url.indexOf("/",1));
	if(currentLang == 'hotel-cms'){	var currentLang = url.substring(11,url.indexOf("/",11));}//case hotel-cms		
	}

	for(var zones in siteZones){
		var oOptgroup = document.createElement('optgroup');
		oOptgroup.label = zones;
		
   	if(siteZones[zones]){
   		for(var countryName in siteZones[zones]){
	   		if(siteZones[zones][countryName]){
				var oOption = document.createElement('option'); 
		 
				oOption.setAttribute("class", siteZones[zones][countryName].flag);
				oOption.setAttribute("className", siteZones[zones][countryName].flag);
				
				
				if(siteZones[zones][countryName].lang == currentLang){								
					if (zone != '' && siteZones[zones][countryName].zone == zone){
						oOption.setAttribute("selected","selected");
						langContent.setAttribute("class", siteZones[zones][countryName].flag);
						langContent.setAttribute("className", siteZones[zones][countryName].flag);
					} 

					else if ( siteZones[zones][countryName].country == locat) { 
						oOption.setAttribute("selected","selected"); 
					}
					else if ( zone == '' && siteZones[zones][countryName].zone == 'home'){
								oOption.setAttribute("selected","selected");
								zone='home';
				  }
        } 
        oOption.innerHTML = countryName;
     		oOption.value = "/geo/setZone.jsp?lang="+siteZones[zones][countryName].lang+"&country="+siteZones[zones][countryName].country;
			  oOptgroup.appendChild(oOption);
		   }
	 	 }
		   document.getElementById(selectId).appendChild(oOptgroup);
		  
   	}
  }
 }
}

	
/** /scripts-v66/siteZones.js **/

/** > /scripts-v66/lib/swfobject.js **/
/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
/** /scripts-v66/lib/swfobject.js **/

/** > /scripts-v66/lib/jplugins/jquery.jcarousel.pack-0.2.7.js **/
/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(i){var q={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null, itemFallbackDimension:null},r=false;i(window).bind("load.jcarousel",function(){r=true});i.jcarousel=function(a,c){this.options=i.extend({},q,c||{});this.autoStopped=this.locked=false;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===undefined)this.options.rtl=(i(a).attr("dir")||i("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?this.options.rtl? "right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){i(a).removeClass(d[f]);b=d[f];break}if(a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"){this.list=i(a);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");this.container=this.container.parent()}else if(!this.container.hasClass("jcarousel-container"))this.container= this.list.wrap("<div></div>").parent()}else{this.container=i(a);this.list=this.container.find("ul,ol").eq(0)}b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();this.buttonNext=i(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext= this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className("jcarousel-next"));this.buttonPrev=i(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden", position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;b=this.list.children("li");var e=this;if(b.size()>0){var g=0,k=this.options.offset;b.each(function(){e.format(this,k++);g+=e.dimension(this, j)});this.list.css(this.wh,g+100+"px");if(!c||c.size===undefined)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.reload()};this.options.initCallback!==null&&this.options.initCallback(this,"init");if(!r&&i.browser.safari){this.buttons(false,false);i(window).bind("load.jcarousel",function(){e.setup()})}else this.setup()}; var h=i.jcarousel;h.fn=h.prototype={jcarousel:"0.2.7"};h.fn.extend=h.extend=i.extend;h.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=false;this.tail=this.timer=null;this.inTail=false;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(a,false);i(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}}, reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0; this.list.children("li").each(function(f){b+=a.dimension(this,c);if(f+1<a.first)d=b});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(a){if(a!==undefined){this.options.size=a;this.locked||this.buttons()}return this.options.size},has:function(a,c){if(c===undefined||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b= a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return false}return true},get:function(a){return i(".jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,f=i(c);if(b.length===0){var j,e=h.intval(a);for(b=this.create(a);;){j=this.get(--e);if(e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}}else d=this.dimension(b);if(f.get(0).nodeName.toUpperCase()=="LI"){b.replaceWith(f);b=f}else b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")), a);f=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;d=this.dimension(b,f)-d;a>0&&a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,h.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(!(!c.length||a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,h.intval(this.list.css(this.wh))- b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!(this.locked|| this.animating||!this.tail)){this.pauseAuto();var c=h.intval(this.list.css(this.lt));c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){if(!(this.locked||this.animating)){this.pauseAuto();this.animate(this.pos(a),c)}},pos:function(a,c){var b=h.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;if(this.options.wrap!="circular")a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a;for(var d= this.first>a,f=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(f):this.get(this.last),e=d?f:f-1,g=null,k=0,l=false,m=0;d?--e>=a:++e<a;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g=this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(l)k+= m;if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<=this.options.size)))b=d?b+m:b-m}f=this.clipping();var p=[],o=0,n=0;j=this.get(a-1);for(e=a;++o;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j.length===0?this.list.prepend(g):j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g= this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(m===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");if(this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size)p.push(g);else if(l)k+=m;n+=m;if(n>=f)break;e++}for(g=0;g<p.length;g++)p[g].remove();if(k>0){this.list.css(this.wh,this.dimension(this.list)+k+"px");if(d){b-=k;this.list.css(this.lt,h.intval(this.list.css(this.lt))-k+"px")}}k=a+o-1;if(this.options.wrap!="circular"&& this.options.size&&k>this.options.size)k=this.options.size;if(e>k){o=0;e=k;for(n=0;++o;){g=this.get(e--);if(!g.length)break;n+=this.dimension(g);if(n>=f)break}}e=k-o+1;if(this.options.wrap!="circular"&&e<1)e=1;if(this.inTail&&d){b+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&k==this.options.size&&k-o+1>=1){d=h.margin(this.get(k),!this.options.vertical?"marginRight":"marginBottom");if(n-d>f)this.tail=n-f-d}if(c&&a===this.options.size&&this.tail){b-=this.tail;this.inTail= true}for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=k;return b},animate:function(a,c){if(!(this.locked||this.animating)){this.animating=true;var b=this,d=function(){b.animating=false;a===0&&b.list.css(b.lt,0);if(!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail))b.startAuto();b.buttons();b.notify("onAfterAnimation"); if(b.options.wrap=="circular"&&b.options.size!==null)for(var f=b.prevFirst;f<=b.prevLast;f++)if(f!==null&&!(f>=b.first&&f<=b.last)&&(f<1||f>b.options.size))b.remove(f)};this.notify("onBeforeAnimation");if(!this.options.animation||c===false){this.list.css(this.lt,a+"px");d()}else this.list.animate(!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},this.options.animation,this.options.easing,d)}},startAuto:function(a){if(a!==undefined)this.options.auto=a;if(this.options.auto===0)return this.stopAuto(); if(this.timer===null){this.autoStopped=false;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null}},buttons:function(a,c){if(a==null){a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap== "first")&&this.options.size!==null&&this.last>=this.options.size)a=this.tail!==null&&!this.inTail}if(c==null){c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1)c=this.tail!==null&&this.inTail}var b=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);a&&this.buttonNext.bind(this.options.buttonNextEvent+ ".jcarousel",this.funcNext);this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?false:true);this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)}else this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+ ".jcarousel",this.funcPrev);c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?false:true);this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)}else this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b, null,c);this.buttonNextState=a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",a,c,this.first);this.callback("itemFirstOutCallback",a,c,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",a,c,this.last);this.callback("itemLastOutCallback",a,c,this.prevLast)}this.callback("itemVisibleInCallback", a,c,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var g=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(i.isFunction(g)){var k=this;if(d===undefined)g(k,b,c);else if(f===undefined)this.get(d).each(function(){g(k,this,d,b,c)});else{a=function(m){k.get(m).each(function(){g(k, this,m,b,c)})};for(var l=d;l<=f;l++)l!==null&&!(l>=j&&l<=e)&&a(l)}}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){a=i(a);for(var b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical? "-horizontal":"-vertical")},dimension:function(a,c){var b=a.jquery!==undefined?a[0]:a,d=!this.options.vertical?(b.offsetWidth||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginLeft")+h.margin(b,"marginRight"):(b.offsetHeight||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginTop")+h.margin(b,"marginBottom");if(c==null||d==c)return d;d=!this.options.vertical?c-h.margin(b,"marginLeft")-h.margin(b,"marginRight"):c-h.margin(b,"marginTop")-h.margin(b,"marginBottom");i(b).css(this.wh, d+"px");return this.dimension(b)},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-h.intval(this.clip.css("borderLeftWidth"))-h.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-h.intval(this.clip.css("borderTopWidth"))-h.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});h.extend({defaults:function(a){return i.extend(q,a||{})},margin:function(a,c){if(!a)return 0; var b=a.jquery!==undefined?a[0]:a;if(c=="marginRight"&&i.browser.safari){var d={display:"block","float":"none",width:"auto"},f,j;i.swap(b,d,function(){f=b.offsetWidth});d.marginRight=0;i.swap(b,d,function(){j=b.offsetWidth});return j-f}return h.intval(i.css(b,c))},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a}});i.fn.jcarousel=function(a){if(typeof a=="string"){var c=i(this).data("jcarousel"),b=Array.prototype.slice.call(arguments,1);return c[a].apply(c,b)}else return this.each(function(){i(this).data("jcarousel", new h(this,a))})}})(jQuery);

/** < /scripts-v66/lib/jplugins/jquery.jcarousel.pack-0.2.7.js **/

/** > /scripts-v66/lib/jplugins/jquery.mousewheel.js **/
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 * Thanks to: Seamus Leahy for adding deltaX and deltaY
 *
 * Version: 3.0.4
 * 
 * Requires: 1.2.2+
 */

(function($) {

var types = ['DOMMouseScroll', 'mousewheel'];

$.event.special.mousewheel = {
    setup: function() {
        if ( this.addEventListener ) {
            for ( var i=types.length; i; ) {
                this.addEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = handler;
        }
    },
    
    teardown: function() {
        if ( this.removeEventListener ) {
            for ( var i=types.length; i; ) {
                this.removeEventListener( types[--i], handler, false );
            }
        } else {
            this.onmousewheel = null;
        }
    }
};

$.fn.extend({
    mousewheel: function(fn) {
        return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
    },
    
    unmousewheel: function(fn) {
        return this.unbind("mousewheel", fn);
    }
});


function handler(event) {
    var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0;
    event = $.event.fix(orgEvent);
    event.type = "mousewheel";
    
    // Old school scrollwheel delta
    if ( event.wheelDelta ) { delta = event.wheelDelta/120; }
    if ( event.detail     ) { delta = -event.detail/3; }
    
    // New school multidimensional scroll (touchpads) deltas
    deltaY = delta;
    
    // Gecko
    if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
        deltaY = 0;
        deltaX = -1*delta;
    }
    
    // Webkit
    if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; }
    if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; }
    
    // Add event and delta to the front of the arguments
    args.unshift(event, delta, deltaX, deltaY);
    
    return $.event.handle.apply(this, args);
}

})(jQuery);
/** < /scripts-v66/lib/jplugins/jquery.mousewheel.js **/

/** > /scripts-v66/lib/jplugins/jscrollpane.js **/
/*
 * jScrollPane - v2.0.0beta9 - 2011-02-04
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2010 Kelvin Luck
 * Dual licensed under the MIT and GPL licenses.
 */
(function(b,a,c){b.fn.jScrollPane=function(f){function d(D,N){var ay,P=this,X,aj,w,al,S,Y,z,r,az,aE,au,j,I,i,k,Z,T,ap,W,u,B,aq,ae,am,G,m,at,ax,y,av,aH,g,K,ai=true,O=true,aG=false,l=false,ao=D.clone(false,false).empty(),ab=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aH=D.css("paddingTop")+" "+D.css("paddingRight")+" "+D.css("paddingBottom")+" "+D.css("paddingLeft");g=(parseInt(D.css("paddingLeft"),10)||0)+(parseInt(D.css("paddingRight"),10)||0);function ar(aQ){var aO,aP,aK,aM,aL,aJ,aI,aN;ay=aQ;if(X===c){aI=D.scrollTop();aN=D.scrollLeft();D.css({overflow:"hidden",padding:0});aj=D.innerWidth()+g;w=D.innerHeight();D.width(aj);X=b('<div class="jspPane" />').css("padding",aH).append(D.children());al=b('<div class="jspContainer" />').css({width:aj+"px",height:w+"px"}).append(X).appendTo(D)}else{D.css("width","");aJ=D.innerWidth()+g!=aj||D.outerHeight()!=w;if(aJ){aj=D.innerWidth()+g;w=D.innerHeight();al.css({width:aj+"px",height:w+"px"})}if(!aJ&&K==S&&X.outerHeight()==Y){D.width(aj);return}K=S;X.css("width","");D.width(aj);al.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}aO=X.clone(false,false).css("position","absolute");aP=b('<div style="width:1px; position: relative;" />').append(aO);b("body").append(aP);S=Math.max(X.outerWidth(),aO.outerWidth());aP.remove();Y=X.outerHeight();z=S/aj;r=Y/w;az=r>1;aE=z>1;if(!(aE||az)){D.removeClass("jspScrollable");X.css({top:0,width:al.width()-g});o();E();Q();x();ah()}else{D.addClass("jspScrollable");aK=ay.maintainPosition&&(I||Z);if(aK){aM=aC();aL=aA()}aF();A();F();if(aK){M(aM,false);L(aL,false)}J();af();an();if(ay.enableKeyboardNavigation){R()}if(ay.clickOnTrack){q()}C();if(ay.hijackInternalLinks){n()}}if(ay.autoReinitialise&&!av){av=setInterval(function(){ar(ay)},ay.autoReinitialiseDelay)}else{if(!ay.autoReinitialise&&av){clearInterval(av)}}aI&&D.scrollTop(0)&&L(aI,false);aN&&D.scrollLeft(0)&&M(aN,false);D.trigger("jsp-initialised",[aE||az])}function aF(){if(az){al.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));T=al.find(">.jspVerticalBar");ap=T.find(">.jspTrack");au=ap.find(">.jspDrag");if(ay.showArrows){aq=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",aD(0,-1)).bind("click.jsp",aB);ae=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",aD(0,1)).bind("click.jsp",aB);if(ay.arrowScrollOnHover){aq.bind("mouseover.jsp",aD(0,-1,aq));ae.bind("mouseover.jsp",aD(0,1,ae))}ak(ap,ay.verticalArrowPositions,aq,ae)}u=w;al.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){u-=b(this).outerHeight()});au.hover(function(){au.addClass("jspHover")},function(){au.removeClass("jspHover")}).bind("mousedown.jsp",function(aI){b("html").bind("dragstart.jsp selectstart.jsp",aB);au.addClass("jspActive");var s=aI.pageY-au.position().top;b("html").bind("mousemove.jsp",function(aJ){U(aJ.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",aw);return false});p()}}function p(){ap.height(u+"px");I=0;W=ay.verticalGutter+ap.outerWidth();X.width(aj-W-g);if(T.position().left===0){X.css("margin-left",W+"px")}}function A(){if(aE){al.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));am=al.find(">.jspHorizontalBar");G=am.find(">.jspTrack");i=G.find(">.jspDrag");if(ay.showArrows){ax=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",aD(-1,0)).bind("click.jsp",aB);y=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",aD(1,0)).bind("click.jsp",aB);
if(ay.arrowScrollOnHover){ax.bind("mouseover.jsp",aD(-1,0,ax));y.bind("mouseover.jsp",aD(1,0,y))}ak(G,ay.horizontalArrowPositions,ax,y)}i.hover(function(){i.addClass("jspHover")},function(){i.removeClass("jspHover")}).bind("mousedown.jsp",function(aI){b("html").bind("dragstart.jsp selectstart.jsp",aB);i.addClass("jspActive");var s=aI.pageX-i.position().left;b("html").bind("mousemove.jsp",function(aJ){V(aJ.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",aw);return false});m=al.innerWidth();ag()}}function ag(){al.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){m-=b(this).outerWidth()});G.width(m+"px");Z=0}function F(){if(aE&&az){var aI=G.outerHeight(),s=ap.outerWidth();u-=aI;b(am).find(">.jspCap:visible,>.jspArrow").each(function(){m+=b(this).outerWidth()});m-=s;w-=s;aj-=aI;G.parent().append(b('<div class="jspCorner" />').css("width",aI+"px"));p();ag()}if(aE){X.width((al.outerWidth()-g)+"px")}Y=X.outerHeight();r=Y/w;if(aE){at=Math.ceil(1/z*m);if(at>ay.horizontalDragMaxWidth){at=ay.horizontalDragMaxWidth}else{if(at<ay.horizontalDragMinWidth){at=ay.horizontalDragMinWidth}}i.width(at+"px");k=m-at;ad(Z)}if(az){B=Math.ceil(1/r*u);if(B>ay.verticalDragMaxHeight){B=ay.verticalDragMaxHeight}else{if(B<ay.verticalDragMinHeight){B=ay.verticalDragMinHeight}}au.height(B+"px");j=u-B;ac(I)}}function ak(aJ,aL,aI,s){var aN="before",aK="after",aM;if(aL=="os"){aL=/Mac/.test(navigator.platform)?"after":"split"}if(aL==aN){aK=aL}else{if(aL==aK){aN=aL;aM=aI;aI=s;s=aM}}aJ[aN](aI)[aK](s)}function aD(aI,s,aJ){return function(){H(aI,s,this,aJ);this.blur();return false}}function H(aL,aK,aO,aN){aO=b(aO).addClass("jspActive");var aM,aJ,aI=true,s=function(){if(aL!==0){P.scrollByX(aL*ay.arrowButtonSpeed)}if(aK!==0){P.scrollByY(aK*ay.arrowButtonSpeed)}aJ=setTimeout(s,aI?ay.initialDelay:ay.arrowRepeatFreq);aI=false};s();aM=aN?"mouseout.jsp":"mouseup.jsp";aN=aN||b("html");aN.bind(aM,function(){aO.removeClass("jspActive");aJ&&clearTimeout(aJ);aJ=null;aN.unbind(aM)})}function q(){x();if(az){ap.bind("mousedown.jsp",function(aN){if(aN.originalTarget===c||aN.originalTarget==aN.currentTarget){var aL=b(this),aO=aL.offset(),aM=aN.pageY-aO.top-I,aJ,aI=true,s=function(){var aR=aL.offset(),aS=aN.pageY-aR.top-B/2,aP=w*ay.scrollPagePercent,aQ=j*aP/(Y-w);if(aM<0){if(I-aQ>aS){P.scrollByY(-aP)}else{U(aS)}}else{if(aM>0){if(I+aQ<aS){P.scrollByY(aP)}else{U(aS)}}else{aK();return}}aJ=setTimeout(s,aI?ay.initialDelay:ay.trackClickRepeatFreq);aI=false},aK=function(){aJ&&clearTimeout(aJ);aJ=null;b(document).unbind("mouseup.jsp",aK)};s();b(document).bind("mouseup.jsp",aK);return false}})}if(aE){G.bind("mousedown.jsp",function(aN){if(aN.originalTarget===c||aN.originalTarget==aN.currentTarget){var aL=b(this),aO=aL.offset(),aM=aN.pageX-aO.left-Z,aJ,aI=true,s=function(){var aR=aL.offset(),aS=aN.pageX-aR.left-at/2,aP=aj*ay.scrollPagePercent,aQ=k*aP/(S-aj);if(aM<0){if(Z-aQ>aS){P.scrollByX(-aP)}else{V(aS)}}else{if(aM>0){if(Z+aQ<aS){P.scrollByX(aP)}else{V(aS)}}else{aK();return}}aJ=setTimeout(s,aI?ay.initialDelay:ay.trackClickRepeatFreq);aI=false},aK=function(){aJ&&clearTimeout(aJ);aJ=null;b(document).unbind("mouseup.jsp",aK)};s();b(document).bind("mouseup.jsp",aK);return false}})}}function x(){if(G){G.unbind("mousedown.jsp")}if(ap){ap.unbind("mousedown.jsp")}}function aw(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");if(au){au.removeClass("jspActive")}if(i){i.removeClass("jspActive")}}function U(s,aI){if(!az){return}if(s<0){s=0}else{if(s>j){s=j}}if(aI===c){aI=ay.animateScroll}if(aI){P.animate(au,"top",s,ac)}else{au.css("top",s);ac(s)}}function ac(aI){if(aI===c){aI=au.position().top}al.scrollTop(0);I=aI;var aL=I===0,aJ=I==j,aK=aI/j,s=-aK*(Y-w);if(ai!=aL||aG!=aJ){ai=aL;aG=aJ;D.trigger("jsp-arrow-change",[ai,aG,O,l])}v(aL,aJ);X.css("top",s);D.trigger("jsp-scroll-y",[-s,aL,aJ]).trigger("scroll")}function V(aI,s){if(!aE){return}if(aI<0){aI=0}else{if(aI>k){aI=k}}if(s===c){s=ay.animateScroll}if(s){P.animate(i,"left",aI,ad)
}else{i.css("left",aI);ad(aI)}}function ad(aI){if(aI===c){aI=i.position().left}al.scrollTop(0);Z=aI;var aL=Z===0,aK=Z==k,aJ=aI/k,s=-aJ*(S-aj);if(O!=aL||l!=aK){O=aL;l=aK;D.trigger("jsp-arrow-change",[ai,aG,O,l])}t(aL,aK);X.css("left",s);D.trigger("jsp-scroll-x",[-s,aL,aK]).trigger("scroll")}function v(aI,s){if(ay.showArrows){aq[aI?"addClass":"removeClass"]("jspDisabled");ae[s?"addClass":"removeClass"]("jspDisabled")}}function t(aI,s){if(ay.showArrows){ax[aI?"addClass":"removeClass"]("jspDisabled");y[s?"addClass":"removeClass"]("jspDisabled")}}function L(s,aI){var aJ=s/(Y-w);U(aJ*j,aI)}function M(aI,s){var aJ=aI/(S-aj);V(aJ*k,s)}function aa(aU,aP,aJ){var aN,aK,aL,s=0,aT=0,aI,aO,aR,aQ,aS;try{aN=b(aU)}catch(aM){return}aK=aN.outerHeight();aL=aN.outerWidth();al.scrollTop(0);al.scrollLeft(0);while(!aN.is(".jspPane")){s+=aN.position().top;aT+=aN.position().left;aN=aN.offsetParent();if(/^body|html$/i.test(aN[0].nodeName)){return}}aI=aA();aO=aI+w;if(s<aI||aP){aQ=s-ay.verticalGutter}else{if(s+aK>aO){aQ=s-w+aK+ay.verticalGutter}}if(aQ){L(aQ,aJ)}viewportLeft=aC();aR=viewportLeft+aj;if(aT<viewportLeft||aP){aS=aT-ay.horizontalGutter}else{if(aT+aL>aR){aS=aT-aj+aL+ay.horizontalGutter}}if(aS){M(aS,aJ)}}function aC(){return -X.position().left}function aA(){return -X.position().top}function af(){al.unbind(ab).bind(ab,function(aL,aM,aK,aI){var aJ=Z,s=I;P.scrollBy(aK*ay.mouseWheelSpeed,-aI*ay.mouseWheelSpeed,false);return aJ==Z&&s==I})}function o(){al.unbind(ab)}function aB(){return false}function J(){X.find(":input,a").unbind("focus.jsp").bind("focus.jsp",function(s){aa(s.target,false)})}function E(){X.find(":input,a").unbind("focus.jsp")}function R(){var s,aI;X.focus(function(){D.focus()});D.attr("tabindex",0).unbind("keydown.jsp keypress.jsp").bind("keydown.jsp",function(aM){if(aM.target!==this){return}var aL=Z,aK=I;switch(aM.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:s=aM.keyCode;aJ();break;case 35:L(Y-w);s=null;break;case 36:L(0);s=null;break}aI=aM.keyCode==s&&aL!=Z||aK!=I;return !aI}).bind("keypress.jsp",function(aK){if(aK.keyCode==s){aJ()}return !aI});if(ay.hideFocus){D.css("outline","none");if("hideFocus" in al[0]){D.attr("hideFocus",true)}}else{D.css("outline","");if("hideFocus" in al[0]){D.attr("hideFocus",false)}}function aJ(){var aL=Z,aK=I;switch(s){case 40:P.scrollByY(ay.keyboardSpeed,false);break;case 38:P.scrollByY(-ay.keyboardSpeed,false);break;case 34:case 32:P.scrollByY(w*ay.scrollPagePercent,false);break;case 33:P.scrollByY(-w*ay.scrollPagePercent,false);break;case 39:P.scrollByX(ay.keyboardSpeed,false);break;case 37:P.scrollByX(-ay.keyboardSpeed,false);break}aI=aL!=Z||aK!=I;return aI}}function Q(){D.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp keypress.jsp")}function C(){if(location.hash&&location.hash.length>1){var aJ,aI;try{aJ=b(location.hash)}catch(s){return}if(aJ.length&&X.find(location.hash)){if(al.scrollTop()===0){aI=setInterval(function(){if(al.scrollTop()>0){aa(location.hash,true);b(document).scrollTop(al.position().top);clearInterval(aI)}},50)}else{aa(location.hash,true);b(document).scrollTop(al.position().top)}}}}function ah(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function n(){ah();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aI;if(s.length>1){aI=s[1];if(aI.length>0&&X.find("#"+aI).length>0){aa("#"+aI,true);return false}}})}function an(){var aJ,aI,aL,aK,aM,s=false;al.unbind("touchstart.jsp touchmove.jsp touchend.jsp click.jsp-touchclick").bind("touchstart.jsp",function(aN){var aO=aN.originalEvent.touches[0];aJ=aC();aI=aA();aL=aO.pageX;aK=aO.pageY;aM=false;s=true}).bind("touchmove.jsp",function(aQ){if(!s){return}var aP=aQ.originalEvent.touches[0],aO=Z,aN=I;P.scrollTo(aJ+aL-aP.pageX,aI+aK-aP.pageY);aM=aM||Math.abs(aL-aP.pageX)>5||Math.abs(aK-aP.pageY)>5;return aO==Z&&aN==I}).bind("touchend.jsp",function(aN){s=false}).bind("click.jsp-touchclick",function(aN){if(aM){aM=false;return false}})}function h(){var s=aA(),aI=aC();
D.removeClass("jspScrollable").unbind(".jsp");D.replaceWith(ao.append(X.children()));ao.scrollTop(s);ao.scrollLeft(aI)}b.extend(P,{reinitialise:function(aI){aI=b.extend({},ay,aI);ar(aI)},scrollToElement:function(aJ,aI,s){aa(aJ,aI,s)},scrollTo:function(aJ,s,aI){M(aJ,aI);L(s,aI)},scrollToX:function(aI,s){M(aI,s)},scrollToY:function(s,aI){L(s,aI)},scrollToPercentX:function(aI,s){M(aI*(S-aj),s)},scrollToPercentY:function(aI,s){L(aI*(Y-w),s)},scrollBy:function(aI,s,aJ){P.scrollByX(aI,aJ);P.scrollByY(s,aJ)},scrollByX:function(s,aJ){var aI=aC()+s,aK=aI/(S-aj);V(aK*k,aJ)},scrollByY:function(s,aJ){var aI=aA()+s,aK=aI/(Y-w);U(aK*j,aJ)},positionDragX:function(s,aI){V(s,aI)},positionDragY:function(aI,s){V(aI,s)},animate:function(aI,aL,s,aK){var aJ={};aJ[aL]=s;aI.animate(aJ,{duration:ay.animateDuration,ease:ay.animateEase,queue:false,step:aK})},getContentPositionX:function(){return aC()},getContentPositionY:function(){return aA()},getContentWidth:function(){return S()},getContentHeight:function(){return Y()},getPercentScrolledX:function(){return aC()/(S-aj)},getPercentScrolledY:function(){return aA()/(Y-w)},getIsScrollableH:function(){return aE},getIsScrollableV:function(){return az},getContentPane:function(){return X},scrollToBottom:function(s){U(j,s)},hijackInternalLinks:function(){n()},destroy:function(){h()}});ar(N)}f=b.extend({},b.fn.jScrollPane.defaults,f);b.each(["mouseWheelSpeed","arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){f[this]=f[this]||f.speed});var e;this.each(function(){var g=b(this),h=g.data("jsp");if(h){h.reinitialise(f)}else{h=new d(g,f);g.data("jsp",h)}e=e?e.add(g):g});return e};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:0,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:false,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:0.8}})(jQuery,this);
/** < /scripts-v66/lib/jplugins/jscrollpane.js **/

/** > /scripts-v66/lib/jplugins/fakeselect.js **/
var fakeForm = {};

(function(){
    
    window.fakeForm = fakeForm;
    function getWindowSize(){
        return  {height:jQuery(document.body).outerHeight() ,width:jQuery(document.body).outerWidth()};
    }

	var selectMask = {
		fakeSelectId:null,
		addMask:function(){
			jQuery(document.body).append('<div id="selectMask"></div>');
			jQuery('#selectMask').click(function(){
				selectMask.hideMask();
			});
		},
		showMask:function(el){
			selectMask.fakeSelectId = el;
			var size = getWindowSize();
			jQuery('#selectMask').css({
				'width':size.width+'px',
				'height':size.height+'px'   
			}).show();
		},
		hideMask:function(){
			jQuery('#selectMask').hide();
			fakeForm.controlFselects.getObjFselectById(selectMask.fakeSelectId).closeSelect();
		}
	}

	var scrollPane = {
		api:[],
		statut:false,
		create:function(el,conf){
			var element = el.jScrollPane({
				showArrows: true,
				verticalDragMinHeight: 20,
				verticalDragMaxHeight: conf.maxScrollHeight
			});
			scrollPane.api = element.data('jsp');
			scrollPane.statut = true;
		},
		destroy:function(){
			if (scrollPane.statut) {
				scrollPane.api.destroy();
				jQuery('#fakeOptions .scroll-pane').css('height','auto');
				scrollPane.statut = false;
			}
		}
	}


	var Fakeselect = function(select,conf){ this.initialize(select,conf);}
    
    Fakeselect.prototype = {
        initialize: function(select,conf){
            this.select = jQuery(select);
            this.selectId = select.id;
            this.selectFakeId = select.id+'-fake';
            this.maxHeight = null;
            this.fakeSelect = null;
            this.open = false;
            this.options = this.select.find('option');
            this.value = null;
            this.selectWidth = this.select.css('width').replace('px','');
            this.conf = conf;
            var _this = this;
            
            if(jQuery('#selectMask').size() == 0) selectMask.addMask();
            _this.createFselect();
            
            this.fakeSelect.find('a').bind('click',function(e){
                e.preventDefault();
                if (!_this.select.attr('disabled')) {
                    if (!_this.open) {
                        _this.openSelect();
                    } else {
                        _this.closeSelect();
                    }
                }
            });
        },
        createFselect:function(){
            this.select.css({'position':'absolute','top':'-10000px'});
            var disabled = '';
            if(this.select.attr('disabled')){disabled = ' disabled';}
			var countryClass = '';
			if(this.getSelected().val()!=""){countryClass = ' class="'+this.getSelected().attr('class')+'"';}
			
			this.select.after('<div class="fakeSelect'+disabled+'" style="width:'+this.selectWidth+'px" id="'+this.selectFakeId+'"><a href="#" class="head"><span'+countryClass+'>'+this.getSelected().text()+'</span></a></div>');
            
            this.fakeSelect = jQuery('#'+this.selectId+'-fake');
            if (jQuery('#fakeOptions').size() == 0) {
                var wOpt = this.select.width() - 2;
                jQuery(document.body).append('<div style="width:'+wOpt+'px" id="fakeOptions"><div id="wrapperOpt"><div class="scroll-pane"><ul></ul></div></div></div>');
            }
        },
        getSelected:function(){
		
            if(this.select.val() != ''){return this.select.find('option:selected');} 
			else {return this.select.find('option:eq(0)');}
        },
        openSelect:function(){
            this.open = true;
            selectMask.showMask(this.selectFakeId);
            this.setFoptions(this.fakeSelect,this);
            this.fakeSelect.addClass('open');
        },
        closeSelect:function(){
            this.open = false;
            scrollPane.destroy();
            
            jQuery('#fakeOptions').css('top','-10000px').attr('class','');
            jQuery('#fakeOptions #wrapperOpt').attr('class','');
            this.fakeSelect.removeClass('open');
        },
/*         getCountry:function(txt){
			if(txt == undefined) return false;
			t = txt.substring(txt.indexOf('country=')+8,txt.length);
			t = (t == '') ? 'none' : t.substring(0,2);
			return t;
		}, */
        setFoptions:function(fakeSelect,_this){
            var ul = jQuery('#fakeOptions ul');
            var cssClass;
            (fakeSelect.attr('id')== 'changeLang-fake') ? cssClass='opts-header': cssClass='opts-main';
            jQuery('#fakeOptions #wrapperOpt').addClass(cssClass);
            var text = fakeSelect.find('.head span').text();
            ul.html('');
            if(this.options.size() != this.select.find('option').size()) {this.options = this.select.find('option')}
            if(this.options.length){
                if (this.selectId == 'changeLang') {
					var countrySelected;
					
					this.options.each(function(){
						if(jQuery(this).attr('selected')){
							countrySelected = jQuery(this).text();
						}
					});
					
					for(var zones in siteZones){
						for(var countryName in siteZones[zones]){
							if(countrySelected == countryName){
								ul.append('<li class="selected '+siteZones[zones][countryName].flag+'"><a href="#">' + countryName + '</a></li>');
							} else {
								ul.append('<li class="'+siteZones[zones][countryName].flag+'"><a href="#">' + countryName + '</a></li>');
							}
						}
					}
                } else {
                    this.options.each(function(i){
                        if (jQuery(this).text() == text) {
                            ul.append('<li class="selected">' + jQuery(this).text() + '</li>');
                        } else {
                            ul.append('<li><a href="#">' + jQuery(this).text() + '</a></li>');
                        }
                    });
                }
            }
            var lis = ul.find('li'); 
            lis.hover(
                function(){
                    jQuery(this).addClass('hover');
                },function(){
                    jQuery(this).removeClass('hover');
                }
            );
            lis.click(function(){
               lis.removeClass('selected');
               jQuery(this).addClass('selected');
               _this.change(this);
            });
			
            this.showOptions();
        },
        
        showOptions:function(){
            var size = getWindowSize();
            var fakeOptions = jQuery('#fakeOptions');
            var pos = this.fakeSelect.offset();
            var top = pos.top+this.conf.hselector+((this.conf.ydecal==undefined) ? 0 : this.conf.ydecal);
            var width = this.selectWidth;
            var height = fakeOptions.find('ul').height();
            var scroll = fakeOptions.find('.scroll-pane');
            if(width!="auto"){width = width+'px';}
            fakeOptions.css('width',width);
            
            if(height>this.conf.maxHeight){
                scroll.css('height',this.conf.maxHeight+'px');
                scrollPane.create(scroll, this.conf);
            } else {
                scroll.css('height',height+'px');
            }
            
            if((fakeOptions.height()+top)>size.height){
                top = top - fakeOptions.height()- this.conf.hselector;
            }
            
            fakeOptions.css({
               'top':top+'px',
               'left':pos.left+'px'
            });
        },
        
        change:function(el){
            this.options.attr('selected','');
			this.select.val(jQuery(el).text());
            this.changeHead();
            this.select.change();
            selectMask.hideMask();
        },
        
        changeHead:function(){
			this.fakeSelect.find('.head span').text(this.getSelected().text());
			if(this.getSelected().attr('class')!=""){	this.fakeSelect.find('.head span').addClass(this.getSelected().attr('class'));}
        }
    }
    
    fakeForm.checkBox = {
        init:function(root){
           var chk = jQuery(root).find('input[type=checkbox]');
     
           chk.css({'position':'absolute','top':'-10000px'});
           chk.parent().find('label').addClass('fakeCheckbox');
           chk.parent().find('label').click(function(){
               if(!jQuery(this).hasClass('checked')){
                   jQuery(this).addClass('checked');
               } else {
                   jQuery(this).removeClass('checked');
               }
           });
        }
    }
    fakeForm.controlFselects = {
        selectList:new Array(),
        init:function(root,conf){
			jQuery(root).find('select').each(function(){
				fakeForm.controlFselects.selectList.push(new Fakeselect(this,conf));
			});
        },
        getObjFselectById:function(id){
            for(i = 0;i<fakeForm.controlFselects.selectList.length;i++){
                 if(fakeForm.controlFselects.selectList[i].selectFakeId == id){
                     return fakeForm.controlFselects.selectList[i];
                     break;
                 }
            }
        }
    }
})();
/** < /scripts-v66/lib/jplugins/fakeselect.js **/

/** > /scripts-v66/global.js **/
jQuery.noConflict();
var displayDyn = (function(){
    
    var transparent = '/imagerie/common/transparent.gif';
    
    var correctPNG = function(img) {
        var src = img.src;
        img.src = transparent;
        img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='image');";
    };
    
    jQuery.fn.correctPNG = function(byPassMode) {
        this.find('img.png').each(function() {
            if(byPassMode || this.className.indexOf('mode=delegate') === -1) {
                correctPNG(this);
            }
        });
    };
    
    jQuery.fn.getFilterPNG = function() {
        if(this.get(0).src.indexOf(transparent) > -1) {
            var src = this.get(0).runtimeStyle.filter.match(/src='([^']+)/);
            return src && src[1];
        }
        return null;
    };
    
    
    function _getWindowSize(){
        return {
            height: jQuery(document.body).outerHeight(),
            width: jQuery(document.body).outerWidth()
        };
    }
    
    function _addMask(e){
        var menuMaskStat = true;
        var size = _getWindowSize();
        var offset = e.offset();
        e.append('<div id="menuMask" style="z-index:1;width:'+size.width+'px; height:'+size.height+'px; position:absolute; top:-'+offset.top+'px; left:-'+offset.left+'px;"></div>');
        
        jQuery('#menuMask').mouseover(function(){
            setTimeout(function(){
                if(menuMaskStat){
                    jQuery(document.body).trigger('removeMenuMask');
                    jQuery('#menuMask').remove();
                }
            },2000);
        });
        
        jQuery('#nav').hover(
          function(){
              menuMaskStat = false;
          },
          function(){
              menuMaskStat = true;
          });
    }
    
    function _menuTop(){        
		var isOpen = false;
	
        jQuery('#btHome').mouseenter(function(){
			if(!isOpen){
				jQuery('#maskNav').show();
				jQuery('#nav').animate({height:+jQuery('#nav ul').height()+30+'px'},500,'linear').addClass('open');
				isOpen = true;
			}
        });
			
        
        jQuery('#nav ul > li').mouseover(function(){
            var that = jQuery(this);
            if (that.children('div').size() !== 0) {
                jQuery('#nav > ul > li').removeClass('hover');
                that.addClass('hover');
                if (jQuery('#menuMask').size() < 1) {
                    _addMask(jQuery('#nav').parent()); 
                }
            } else {
                if (that.attr('id') !== 'btHome') {
                    jQuery('#nav > ul > li').removeClass('hover');
                    that.addClass('hover');
                }
            }
        });
        
		jQuery('li.close-nav,#btHome').click(function(e) {
			e.preventDefault();
			if(isOpen){
				jQuery('#nav').animate({
					height: '20px'
				},1000,'linear').removeClass('open');
				isOpen = false;
			}
		});

        jQuery('#profil').hover(
			function(){
				jQuery(this).addClass('open');
			},
			function(){
				jQuery(this).removeClass('open');
			}
        );
    }
	
	
    return {
        init:function(){
            _menuTop();
			displayDyn.getLang();
        },
        getJSONFragment: function(json, type){
            return (typeof json === 'object' && json[type] && typeof json[type] !== 'undefined') ? json[type] : null;
        },
        en2gb: function(l){
            return (l === 'en') ? 'gb' : l;
        },
        isIE6: function(){
            return (jQuery.browser.msie && jQuery.browser.version === '6.0') ? true : false;
        },
		getMeta: function(n,d){
		 var _m = document.getElementsByTagName("meta");
		 for (var i = 0;i<_m.length;i++) 
			try {if (_m[i].name === n) return _m[i].content;}catch(ee){};
		 return d;
		},
        getLang: function() {
                var _h = document.getElementsByTagName("html")[0];
                try {return _h.attributes["xml:lang"].value;} catch(ee){};
                try {return _h.attributes["lang"].value;} catch(ee){};
                try {/\/([a-z]{2}(?:-[a-z]{2})?)\//.exec(document.location);return RegExp.$1;}catch(ee){};
                return "en";
        },
        loadBackground: function(url){
            var objImage = new Image();
            objImage.onload = function(){
                jQuery('#pageWrapper').css('backgroundImage','url('+url+')');
                jQuery('#carouselBg').animate({
                    opacity:0
                },1000,function(){
                    jQuery('#carouselBg').css('backgroundImage','url('+url+')').css('opacity',1);
                });
            };
            objImage.src=url;
        }
    };
})();
jQuery(document).ready(function() {
    displayDyn.init();
/*     fakeForm.controlFselects.init('#header-home',{
        hselector:16,
        maxHeight:70,
        maxScrollHeight:50,
        ydecal:7
    }); */
});

/** > /scripts-v66/global.js **/

var diapoHotels = "/hotel-cms/"+displayDyn.en2gb(displayDyn.getLang())+"/home/json/diapo-hotels-"+displayDyn.getMeta("X-Accor-userBrowsingZone","home")+".js?";		

/** > /scripts-v66/diapo-hotels-noh.js **/
var jsonBuilder = (function(){

    var bgDiapoHotelList = new Array(),
		count = 0,
		diapoCarousel = null,
		time,
		tmpDiapoList = new Array();
   
    
    function _changeBackground(url,color){
        jQuery('#pageWrapper').css('backgroundImage','url('+url+')');
        if(color != 'undefined') {
			if(color=='white'){
				jQuery('#diapoHotels .jcarousel-container').addClass('white');
			} else {
				jQuery('#diapoHotels .jcarousel-container').removeClass('white');
			}
			jQuery('#diapoHotels .content a').css('color',color);
		}
        jQuery('#carouselBg').animate({
            opacity:0
        },1000,function(){
            jQuery('#carouselBg').css('backgroundImage','url('+url+')').css('opacity',1);
			jQuery('#diapoHotels').removeClass('srcoll');
        });
    }
    
    function _callBackCarousel(c){
		diapoCarousel = c;
        if(jQuery.browser.msie && jQuery.browser.version == '6.0'){
            jQuery('#diapoHotels .carousel').correctPNG();
        }
        
        jQuery('#diapoHotels .jcarousel-container').append('<div class="jcarousel-next"></div><div class="jcarousel-prev"></div>');
        _changeBackground(bgDiapoHotelList[0].url,bgDiapoHotelList[0].color);
        
        jQuery('#diapoHotels .jcarousel-next').click(function(e) {
			e.preventDefault();
			clearInterval(time);
			if(!jQuery('#diapoHotels').hasClass('srcoll')){
				diapoCarousel.next();
				jQuery('#diapoHotels').addClass('scroll');
			}
        });

        jQuery('#diapoHotels .jcarousel-prev').click(function(e) {
			e.preventDefault();
			clearInterval(time);
            if(!jQuery('#diapoHotels').hasClass('srcoll')){
				diapoCarousel.prev();
				jQuery('#diapoHotels').addClass('scroll');
			}
        });
        
        //preload background
		for (i=0;i<2;i++){
            objImage = new Image();
			objImage.onload = function(){
				tmpDiapoList.push(bgDiapoHotelList[i].url);
			}
            objImage.src=bgDiapoHotelList[i].url;
        }
		
		if(!displayDyn.isIE6()){
			_autoChangeBackground();
		}
    }
    
    function _jsonDiapoHotel(json){
        if(displayDyn.getJSONFragment(json,"car_hotels")){
            jQuery('#diapoHotels .carousel').html('');
            for(var i=0;i<json.car_hotels.length;i++){
                var curNode = json.car_hotels[i];
                var tagline = curNode.accroche,
                   textlink = curNode.lien.lib_url,
                    urllink = curNode.lien.url;
                   
                   var data = {
                          url:curNode.img_bg,
                          color:curNode.color
                   }
                   bgDiapoHotelList.push(data);
                                         
                jQuery('#diapoHotels .carousel').append('<li>'
                                            +'<div class="content">'
                                            +'<a href="'+urllink+'"><p class="tagLine">'+tagline+'</p></a>'
                                            +'</div>'
                                            +'<div class="button"><a href="'+urllink+'">'+textlink+'</a></div>'
                                            +'</li>');
            }            
            if(json.car_hotels.length>1){
                var wrap = (displayDyn.isIE6())? null : 'circular';
                jQuery('#diapoHotels .carousel').jcarousel({
                    scroll: 1,
                    wrap:wrap,
                    buttonNextHTML: null,
                    buttonPrevHTML: null,
                    initCallback:_callBackCarousel,
					itemVisibleInCallback:function(carousel,b,c,step){
						if(step == 'next'){
							count++;
							if(count>(bgDiapoHotelList.length)-1)count=0;
							_preloadBackground(count,'next');
						} else if(step == 'prev') {
							count--;
							if(count<0)count=bgDiapoHotelList.length-1;
							_preloadBackground(count,'prev');
						}
						_changeBackground(bgDiapoHotelList[count].url,bgDiapoHotelList[count].color);
					}
                });
            }
        }
    }
    
	function _preloadBackground(count,step){
		function imgLoad(url){
			var test = true;
			for(var i=0;i<tmpDiapoList.length;i++){
				if(tmpDiapoList[i] == url) test = false;
			}
			if(test){
				objImage = new Image();
				objImage.onload = function(){
					tmpDiapoList.push(url);
				}
				objImage.src=url;
			}
		}
		if(step == 'next' && count != 0){
			count = count + 2;
			if(count<bgDiapoHotelList.length){
				imgLoad(bgDiapoHotelList[count].url);
			}
		} else if (step == 'prev' && count > 4){
			count = count - 1;
			imgLoad(bgDiapoHotelList[count].url);
		}
	}
	
	function _autoChangeBackground(){
			time = setInterval(function(){ diapoCarousel.next();}, 8000 );
	}
	
    
    return {
        init:function(){
            if(typeof diapoHotels!="undefined" && jQuery('#diapoHotels .carousel').size()){
                jQuery.getJSON(diapoHotels,function(json) { _jsonDiapoHotel(json);});
            }
        }
    }
})();


jQuery(document).ready(function() {
    jsonBuilder.init();
});

/** < /scripts-v66/diapo-hotels-noh.js **/

var diapoOffers = "/hotel-cms/"+displayDyn.en2gb(displayDyn.getLang())+"/home/json/diapo-offers.js";

/** > /scripts-v66/diapo-hotels-noh.js **/
var jsonBuilderOffers = (function(){
    
    var thisJson;
    var thisCarousel;
    var textInfos = '';

    
    
    function _removeLoading(){
       jQuery('#loadingMask').fadeOut(500,function(){jQuery(this).remove()});
    }
    
    function _moveIndex(e){
        var that = jQuery(e);
        var selected = jQuery('#diapoOffers .nav li.selected');
        if (that.hasClass('jcarousel-prev')) {
            if(parseInt(selected.text())-4<1){
                jQuery('#diapoOffers .nav li.step:last').addClass('selected');
            } else {
                var cal = parseInt(selected.text())-4;
                jQuery('#diapoOffers .nav li#pos'+cal).addClass('selected');
            }
        } else if (that.hasClass('jcarousel-next')) {
            if((parseInt(selected.text())+4)> jQuery('#diapoOffers .nav li.step:last').text()){
                jQuery('#diapoOffers .nav li.step:first').addClass('selected');
            } else {
                var cal = parseInt(selected.text())+4;
                jQuery('#diapoOffers .nav li#pos'+cal).addClass('selected');
            }
        } else {
            that.addClass('selected');
        }
        selected.removeClass('selected');
    }
    
    function _callBackCarousel(c){
	
        thisCarousel = c;       
        
        if(displayDyn.isIE6()){
            jQuery('#blocDiapos .carousel').correctPNG();
        }
        
        jQuery('#blocDiapos .carousel li a').hover(
            function(){
                jQuery('#blocDiapos .carousel li a').removeClass('hover');
                jQuery(this).addClass('hover');
            },
            function(){
                jQuery('#blocDiapos .carousel li a').removeClass('hover');
            }
        );
        
        _removeLoading();
    }
    
    function _setCarouselNav(){
        var nbScroll = Math.ceil(jQuery('#diapoOffers .carousel li').size() / 4);
        if (nbScroll > 1) {
            var list = '';
            var op = 1;
            for (var i = 0; i < nbScroll; i++) {
                if (i == 0) {
                    list += '<li id="pos' + op + '" class="step selected">' + op + '</li>';
                }
                else {
                    list += '<li id="pos' + op + '" class="step">' + op + '</li>';
                }
                op = op + 4;
            }
            
            
            jQuery('#diapoOffers .jcarousel-container').after('<div class="navWrapper"><div class="navWrapperIE"><ul class="nav"><li class="jcarousel-prev">prev</li>' + list + '<li class="jcarousel-next">next</li></ul></div></div>');
            
            if (jQuery.browser.msie && jQuery.browser.version == '6.0' || jQuery.browser.version == '7.0') {
                var wt = Math.round(jQuery('.navWrapper ul.nav').width());
                jQuery('.navWrapper .navWrapperIE').css('margin-left', '-' + wt + 'px');
                
            }
            jQuery('#diapoOffers .nav li.step').click(function() {
                _moveIndex(this);
                thisCarousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
                return false;
            });
            
            jQuery('#diapoOffers .jcarousel-next').click(function() {
                _moveIndex(this);
                thisCarousel.next();
                return false;
            });
    
            jQuery('#diapoOffers .jcarousel-prev').click(function() {
                _moveIndex(this);
                thisCarousel.prev();
                return false;
            });
        }
    }
    
    function _writeDesc(json,theme){
        var text = jQuery('#blocDiapos .textInfos');
        text.html('');
        if(theme=='all'){
            text.append(json.param.desc_theme);
        } else {
            text.append(textInfos);
        }
    }
    
    function _testTheme(lib,theme){
        var text = jQuery('#blocDiapos .textInfos');
        if(theme == 'all'){
            return true;
        } else if (lib.lib_theme==theme){
            textInfos = lib.desc_theme;
            return true;
        } else {
            return false;
        }
    }
    
    function _setListElement(json,theme){
        var list = new Array();
        if(displayDyn.getJSONFragment(json,"themes")){
            jQuery('#blocDiapos .blocCarousel').append('<div id="loadingMask"></div>');
            jQuery('#diapoOffers .carousel').html('');            
            for (var i = 0; i < json.themes.length; i++) {
                if(_testTheme(json.themes[i],theme)){
                    for (var j = 0; j < json.themes[i].hotels.length; j++) {
                        var curNode = json.themes[i].hotels[j];
                        var pict = curNode.img,
                            link = curNode.url_link,
                            logo = curNode.logo;
                        list.push('<li>' +
                        '<a href="'+link+'">'+
                        '<img class="pict" src="'+pict+'" alt="">'+
                        '<img class="logo png" src="'+logo+'" alt="">'+
                        '<span class="plus"></span></a>'+
                        '</li>');
                    }
                }
            }
        }
        list.sort(_random);
        return list;
    }
    
    function _initCarousel(json,theme){
        _writeDesc(json,theme);
        var list = _setListElement(json,theme);
        for(i=0;i<list.length;i++){
            jQuery('#diapoOffers .carousel').append(list[i]);
        }
        
        if(jQuery('#diapoOffers .carousel li').size()>4){
            jQuery('#diapoOffers .carousel').jcarousel({
                scroll: 4,
                wrap:'circular',
                buttonNextHTML: null,
                buttonPrevHTML: null,
                initCallback:_callBackCarousel
            });
            _setCarouselNav();
        }
    }
    
    function _random(){
        return (Math.round(Math.random())-0.5);
    }
    
    function _resetCarousel(e){
        var theme = jQuery(e).attr('href').replace('#','');
        var list = _setListElement(thisJson,theme);
        jQuery('#diapoOffers .navWrapper').remove();
        thisCarousel.reset();
        for(i=0;i<list.length;i++){
            thisCarousel.add(i+1,list[i]);
        }
        _setCarouselNav();
        thisCarousel.size(list.length);
        _writeDesc(thisJson,theme);
    }
    
    return {
        init:function(){
            jQuery('#diapoOffers .head h2').toggle(
                function(){
					if(typeof thisCarousel != 'object'){
						if(typeof diapoOffers!="undefined" && jQuery('#diapoOffers .carousel').size()){
							jQuery.getJSON(diapoOffers,function(json) { thisJson = json; _initCarousel(json,'all');});
						}
					}
                   jQuery('#diapoOffers').animate({bottom:0}).addClass('open');
                },
                function(){
                   jQuery('#diapoOffers').animate({bottom:'-179px'}).removeClass('open');
                }
            );
            
            jQuery('#diapoOffers .selection a').click(function(e){
                e.preventDefault();
                jQuery('#diapoOffers .selection li').removeClass('selected');
                jQuery(this).parent().addClass('selected');
                _resetCarousel(this);
            });
        }
    }
})();
    
jQuery(document).ready(function() {
    jsonBuilderOffers.init();
});

/** < /scripts-v66/diapo-hotels-noh.js **/

/** > /scripts-v66/home/home.js **/
var homeBookingEngine;

var home = (function(){
	
	
	function _hideBanners(){
		function test(){
			if(jQuery('#search-roomNumber-boo').val()>1 || jQuery('#search-childrenNumber-boo').val()>0 || jQuery('#enginepro-form label').hasClass('checked') || jQuery('#more-criteria .lnk-moreoptions').parent().hasClass('undeploy')){
				jQuery('#banners').hide();
			} else {
				jQuery('#banners').show();
			}
		}
		
		jQuery('#search-roomNumber-boo, #search-childrenNumber-boo').change(function(){
			test();
		});
		
		jQuery('#enginepro-form label').click(function(){
			test();
		});
		
		jQuery('#more-criteria .lnk-moreoptions').click(function(){
			setTimeout(function(){
				test();
			},500);
		});
	}
	

	return {
        init: function(){
			/* bookingengine */
			homeBookingEngine = new BookingEngine("bookingEngine", "homeBookingEngine", true,"",0);
			ajaxRequest._executeByUrl("/bean/getViewBeans.action?beans=SearchCriteriaViewBean|OriginViewBean","validatorInvalidState","homeBookingEngine.success(errors, response); "); 
			
			var confGen = {
				hselector:16,
				maxHeight:150,
				maxScrollHeight:'auto'
			}
			fakeForm.controlFselects.init('#header-home',{
					hselector:16,
					maxHeight:70,
					maxScrollHeight:50,
					ydecal:7
				});
			
			_hideBanners();
		   }
    }
})();

jQuery(document).ready(function() {
    home.init();
	utils.tooltips.init();
});
/** < /scripts-v66/home/home.js **/

