
window.debug=(function(){var i=this,b=Array.prototype.slice,d=i.console,h={},f,g,m=9,c=["error","warn","info","debug","log"],l="assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" "),j=l.length,a=[];while(--j>=0){(function(n){h[n]=function(){m!==0&&d&&d[n]&&d[n].apply(d,arguments)}})(l[j])}j=c.length;while(--j>=0){(function(n,o){h[o]=function(){var q=b.call(arguments),p=[o].concat(q);a.push(p);e(p);if(!d||!k(n)){return}d.firebug?d[o].apply(i,q):d[o]?d[o](q):d.log(q)}})(j,c[j])}function e(n){if(f&&(g||!d||!d.log)){f.apply(i,n)}}h.setLevel=function(n){m=typeof n==="number"?n:9};function k(n){return m>0?m>n:c.length+m<=n}h.setCallback=function(){var o=b.call(arguments),n=a.length,p=n;f=o.shift()||null;g=typeof o[0]==="boolean"?o.shift():false;p-=typeof o[0]==="number"?o.shift():n;while(p<n){e(a[p++])}};return h})();

function AntiSpam(liste){
  var courriel = "";
  var texte  = "";
  var subject = "";
  var onClick = "";
  var tableau = liste.split('|');
   
  
  var tableauCourriel = tableau[0].split(',');
  for (i=0;i<tableauCourriel.length;i++)
   courriel+=String.fromCharCode(tableauCourriel[i]);
   
   
  if ((tableau.length>=2) && (tableau[1].length > 0)){
  var tableauTexte = tableau[1].split(',');
}

  if ((typeof(tableauTexte) != 'undefined') && (tableauTexte.length > 0)){
  for (i=0;i<tableauTexte.length;i++)
   texte+=String.fromCharCode(tableauTexte[i]);
 }
  else
   texte = courriel;

  
   
  if ((tableau.length>=3) && (tableau[2].length > 0))
  subject = tableau[2];
 else{
 var domaine = "http://" + window.location.toString().split("//")[1].split("/")[0] + "/";
 subject = "Demande via le site Internet " + domaine;
 } 

   
  if ((tableau.length>=4) && (tableau[3].length > 0)){
  onClick = tableau[3] + ';';
 }

  tableauTexte = texte.split("@");
  
  if (tableauTexte.length == 2){
   texte = tableauTexte[0] + '<span style="display:none;">[REMOVE-THIS-FOR-SPAM]</span>&#64;' + tableauTexte[1];
 }
   
  return('<a href="mailto:a" onclick="' + onClick + 'this.href = AntiSpamClic(Array(' + tableauCourriel + '),\'' + subject.replace("'","\\'") + '\');">' + texte + '</a>');
}

function AntiSpamClic(tableauCourriel, subject){
  var courriel = "";
  for (i=0;i<tableauCourriel.length;i++)
   courriel+=String.fromCharCode(tableauCourriel[i]);
  if (subject.length > 0)
   courriel+= '?subject=' + subject;
  return 'mai' + 'lto:' + courriel;
}
 
String.prototype.Ltrim = function() {
 return this.replace(/^\s+/,"");
}
String.prototype.Rtrim = function() {
 return this.replace(/\s+$/,"");
}

String.prototype.CorrigerSerialize = function() {
 return this.replace(/%E2%80%99/g,"'").replace(/%E2%80%93/g,"-");
}


function print_r(x, max, sep, l) {

 l = l || 0;
 max = max || 10;
 sep = sep || ' ';

 if (l > max) {
 return "[WARNING: Too much recursion]\n";
}

 var
 i,
 r = '',
 t = typeof x,
 tab = '';

 if (x === null) {
 r += "(null)\n";
} else if (t == 'object') {

 l++;

 for (i = 0;i < l;i++) {
  tab += sep;
}

 if (x && x.length) {
  t = 'array';
}

 r += '(' + t + ") :\n";

 for (i in x) {
  try {
  r += tab + '[' + i + '] : ' + print_r(x[i], max, sep, (l + 1));
 } catch(e) {
  return "[ERROR: " + e + "]\n";
 }
}

} else {

 if (t == 'string') {
  if (x == '') {
  x = '(empty)';
 }
}

 r += '(' + t + ') ' + x + "\n";

}

 return r;

};



var JSON = JSON || {};

// implement JSON.stringify serialization
JSON.stringify = JSON.stringify || function (obj) {

 var t = typeof (obj);
 if (t != "object" || obj === null) {

 // simple data type
 if (t == "string") obj = '"'+obj+'"';
 return String(obj);

}
 else {

 // recurse array or object
 var n, v, json = [], arr = (obj && obj.constructor == Array);

 for (n in obj) {
  v = obj[n];t = typeof(v);

  if (t == "string") v = '"'+v+'"';
  else if (t == "object" && v !== null) v = JSON.stringify(v);

  json.push((arr ? "" : '"' + n + '":') + String(v));
}

 return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
}
};


// implement JSON.parse de-serialization
JSON.parse = JSON.parse || function (str) {
 if (str === "") str = '""';
 eval("var p=" + str + ";");
 return p;
};
 
function CompterCliques(nomFichier){
 
 var donnees = 'nomFichier=' + nomFichier;
 $.ajax({
 url: "/utilitaires/compterCliques.php",
 type: "POST",
 cache: false,
 data: donnees,
  "error": function (XMLHttpRequest, textStatus, errorThrown) {
   alert( "Erreur");
   if (DevMode()){
 alert(XMLHttpRequest.status + XMLHttpRequest.responseText + ' ' + textStatus + ' ' + errorThrown);
  }   
 },
  success: function(resultat){
   if (DevMode())
   alert(print_r(resultat));
 }  
   
});
 return false;
}

//Fonctions pour traiter des dates
var re_date = /^\d{1,2}\-\d{1,2}\-\d{4}$/;
var tempo = new Array();
var max_mois = new Array();
for (n=1;n<100;n++)
  {
  if (n==4 || n==6 || n==9 || n==11)
   max_mois[n] = 30;
  else
   max_mois[n] = 31;
 }

function valideDate(dateSaisie)
  {
  t_date = re_date.test(dateSaisie);

  if (t_date)
   t_date = t_date && analyse(dateSaisie,1,2,3);

  return t_date;
 }

function analyse(quoi,p_jour,p_mois,p_an)
  {
  tempo = quoi.split('-');
  jour = eval(tempo[(p_jour-1)]);
  mois = eval(tempo[(p_mois-1)]);
  an = eval(tempo[(p_an-1)]);

  if (bisx(an))
   max_mois[2] = 29;
  else
   max_mois[2] = 28;

  t_tempo = (jour<=max_mois[mois] && mois<=12 && mois>=1 && jour>=1);

  return t_tempo;
 }

function bisx(quoi)
  {
  if ((quoi % 100 == 0) && (quoi % 400 == 0))
   return true;
  else if ((quoi % 4) == 0)
   return true;

  return false;
 }

function DateAdd(startDate, numDays, numMonths, numYears)
  {
  var returnDate = new Date(startDate.getTime());
  var yearsToAdd = numYears;
  var month = returnDate.getMonth() + numMonths;
  if (month > 11)
   {
   yearsToAdd = Math.floor((month+1)/12);
   month -= 12*yearsToAdd;
   yearsToAdd += numYears;
  }
  returnDate.setMonth(month);
  returnDate.setFullYear(returnDate.getFullYear() + yearsToAdd);
  returnDate.setTime(returnDate.getTime()+60000*60*24*numDays);
  return returnDate;
 }

function YearAdd(startDate, numYears)
  {
  return DateAdd(startDate,0,0,numYears);
 }

function MonthAdd(startDate, numMonths)
  {
  return DateAdd(startDate,0,numMonths,0);
 }

function DayAdd(startDate, numDays)
  {
  return DateAdd(startDate,numDays,0,0);
 }

function DateDiff(date1, date2)
  {
  diff = new Date();

  diff.setTime(date1.getTime() - date2.getTime());
  timediff = diff.getTime();
  days = Math.floor(timediff / (1000 * 60 * 60 * 24));
  timediff -= days * (1000 * 60 * 60 * 24);
  return days;
 }

function Langue(valeur, position){
  if (typeof(position) == 'undefined')
 return langue[valeur];
 else
 return langue[valeur][position];
}  
  





;(function($) {

if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {
 alert('blockUI requires jQuery v1.2.3 or later! You are using v' + $.fn.jquery);
 return;
}

$.fn._fadeIn = $.fn.fadeIn;

var noOp = function() {};

// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
// retarded userAgent strings on Vista)
var mode = document.documentMode || 0;
var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);
var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;

// global $ methods for blocking/unblocking the entire page
$.blockUI  = function(opts) {install(window, opts);};
$.unblockUI = function(opts) {remove(window, opts);};

// convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
$.growlUI = function(title, message, timeout, onClose) {
 var $m = $('<div class="growlUI"></div>');
 if (title) $m.append('<h1>'+title+'</h1>');
 if (message) $m.append('<h2>'+message+'</h2>');
 if (timeout == undefined) timeout = 3000;
 $.blockUI({
 message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,
 timeout: timeout, showOverlay: false,
 onUnblock: onClose, 
 css: $.blockUI.defaults.growlCSS
});
};

// plugin method for blocking element content
$.fn.block = function(opts) {
 return this.unblock({fadeOut: 0}).each(function() {
 if ($.css(this,'position') == 'static')
  this.style.position = 'relative';
 if ($.browser.msie)
  this.style.zoom = 1;// force 'hasLayout'
 install(this, opts);
});
};

// plugin method for unblocking element content
$.fn.unblock = function(opts) {
 return this.each(function() {
 remove(this, opts);
});
};

$.blockUI.version = 2.35;// 2nd generation blocking at no extra cost!

// override these in your code to change the default behavior and style
$.blockUI.defaults = {
 // message displayed when blocking (use null for no message)
 message: '<h1>Please wait...</h1>',

 title: null,  // title string;only used when theme == true
 draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
 
 theme: false, // set to true to use with jQuery UI themes
 
 // styles for the message when blocking;if you wish to disable
 // these and use an external stylesheet then do this in your code:
 // $.blockUI.defaults.css = {};
 css: {
 padding: 0,
 margin: 0,
 width: '30%',
 top: '40%',
 left: '35%',
 textAlign: 'center',
 color: '#000',
 border: '3px solid #aaa',
 backgroundColor:'#fff',
 cursor: 'wait'
},
 
 // minimal style set used when themes are used
 themedCSS: {
 width: '30%',
 top: '40%',
 left: '35%'
},

 // styles for the overlay
 overlayCSS: {
 backgroundColor: '#000',
 opacity:   0.6,
 cursor:   'wait'
},

 // styles applied when using $.growlUI
 growlCSS: {
 width:  '350px',
 top: '10px',
 left:  '',
 right:  '10px',
 border: 'none',
 padding: '5px',
 opacity: 0.6,
 cursor: 'default',
 color: '#fff',
 backgroundColor: '#000',
 '-webkit-border-radius': '10px',
 '-moz-border-radius': '10px',
 'border-radius':  '10px'
},
 
 // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
 // (hat tip to Jorge H. N. de Vasconcelos)
 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',

 // force usage of iframe in non-IE browsers (handy for blocking applets)
 forceIframe: false,

 // z-index for the blocking overlay
 baseZ: 1000,

 // set these to true to have the message automatically centered
 centerX: true, // <-- only effects element blocking (page block controlled via css above)
 centerY: true,

 // allow body element to be stetched in ie6;this makes blocking look better
 // on "short" pages. disable if you wish to prevent changes to the body height
 allowBodyStretch: true,

 // enable if you want key and mouse events to be disabled for content that is blocked
 bindEvents: true,

 // be default blockUI will supress tab navigation from leaving blocking content
 // (if bindEvents is true)
 constrainTabKey: true,

 // fadeIn time in millis;set to 0 to disable fadeIn on block
 fadeIn: 200,

 // fadeOut time in millis;set to 0 to disable fadeOut on unblock
 fadeOut: 400,

 // time in millis to wait before auto-unblocking;set to 0 to disable auto-unblock
 timeout: 0,

 // disable if you don't want to show the overlay
 showOverlay: true,

 // if true, focus will be placed in the first available input field when
 // page blocking
 focusInput: true,

 // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
 applyPlatformOpacityRules: true,
 
 // callback method invoked when fadeIn has completed and blocking message is visible
 onBlock: null,

 // callback method invoked when unblocking has completed;the callback is
 // passed the element that has been unblocked (which is the window object for page
 // blocks) and the options that were passed to the unblock call:
 // onUnblock(element, options)
 onUnblock: null,

 // don't ask;if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
 quirksmodeOffsetHack: 4,

 // class name of the message block
 blockMsgClass: 'blockMsg'
};

// private data and functions follow...

var pageBlock = null;
var pageBlockEls = [];

function install(el, opts) {
 var full = (el == window);
 var msg = opts && opts.message !== undefined ? opts.message : undefined;
 opts = $.extend({}, $.blockUI.defaults, opts || {});
 opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
 var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
 var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
 msg = msg === undefined ? opts.message : msg;

 // remove the current block (if there is one)
 if (full && pageBlock)
 remove(window, {fadeOut:0});

 // if an existing element is being used as the blocking content then we capture
 // its current place in the DOM (and current display style) so we can restore
 // it when we unblock
 if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
 var node = msg.jquery ? msg[0] : msg;
 var data = {};
 $(el).data('blockUI.history', data);
 data.el = node;
 data.parent = node.parentNode;
 data.display = node.style.display;
 data.position = node.style.position;
 if (data.parent)
  data.parent.removeChild(node);
}

 var z = opts.baseZ;

 // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
 // layer1 is the iframe layer which is used to supress bleed through of underlying content
 // layer2 is the overlay layer which has opacity and a wait cursor (by default)
 // layer3 is the message content that is displayed while blocking

 var lyr1 = ($.browser.msie || opts.forceIframe) 
 ? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')
 : $('<div class="blockUI" style="display:none"></div>');
 var lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
 
 var lyr3, s;
 if (opts.theme && full) {
 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +
  '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
  '<div class="ui-widget-content ui-dialog-content"></div>' +
  '</div>';
}
 else if (opts.theme) {
 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:absolute">' +
  '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +
  '<div class="ui-widget-content ui-dialog-content"></div>' +
  '</div>';
}
 else if (full) {
 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+z+';display:none;position:fixed"></div>';
}  
 else {
 s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+z+';display:none;position:absolute"></div>';
}
 lyr3 = $(s);

 // if we have a message, style it
 if (msg) {
 if (opts.theme) {
  lyr3.css(themedCSS);
  lyr3.addClass('ui-widget-content');
}
 else 
  lyr3.css(css);
}

 // style the overlay
 if (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform)))
 lyr2.css(opts.overlayCSS);
 lyr2.css('position', full ? 'fixed' : 'absolute');

 // make iframe layer transparent in IE
 if ($.browser.msie || opts.forceIframe)
 lyr1.css('opacity',0.0);

 //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
 var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
 $.each(layers, function() {
 this.appendTo($par);
});
 
 if (opts.theme && opts.draggable && $.fn.draggable) {
 lyr3.draggable({
  handle: '.ui-dialog-titlebar',
  cancel: 'li'
});
}

 // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
 var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);
 if (ie6 || expr) {
 // give body 100% height
 if (full && opts.allowBodyStretch && $.boxModel)
  $('html,body').css('height','100%');

 // fix ie6 issue when blocked element has a border width
 if ((ie6 || !$.boxModel) && !full) {
  var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
  var fixT = t ? '(0 - '+t+')' : 0;
  var fixL = l ? '(0 - '+l+')' : 0;
}

 // simulate fixed position
 $.each([lyr1,lyr2,lyr3], function(i,o) {
  var s = o[0].style;
  s.position = 'absolute';
  if (i < 2) {
  full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')
   : s.setExpression('height','this.parentNode.offsetHeight + "px"');
  full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')
   : s.setExpression('width','this.parentNode.offsetWidth + "px"');
  if (fixL) s.setExpression('left', fixL);
  if (fixT) s.setExpression('top', fixT);
 }
  else if (opts.centerY) {
  if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
  s.marginTop = 0;
 }
  else if (!opts.centerY && full) {
  var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;
  var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
  s.setExpression('top',expression);
 }
});
}

 // show the message
 if (msg) {
 if (opts.theme)
  lyr3.find('.ui-widget-content').append(msg);
 else
  lyr3.append(msg);
 if (msg.jquery || msg.nodeType)
  $(msg).show();
}

 if (($.browser.msie || opts.forceIframe) && opts.showOverlay)
 lyr1.show();// opacity is zero
 if (opts.fadeIn) {
 var cb = opts.onBlock ? opts.onBlock : noOp;
 var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
 var cb2 = msg ? cb : noOp;
 if (opts.showOverlay)
  lyr2._fadeIn(opts.fadeIn, cb1);
 if (msg)
  lyr3._fadeIn(opts.fadeIn, cb2);
}
 else {
 if (opts.showOverlay)
  lyr2.show();
 if (msg)
  lyr3.show();
 if (opts.onBlock)
  opts.onBlock();
}

 // bind key and mouse events
 bind(1, el, opts);

 if (full) {
 pageBlock = lyr3[0];
 pageBlockEls = $(':input:enabled:visible',pageBlock);
 if (opts.focusInput)
  setTimeout(focus, 20);
}
 else
 center(lyr3[0], opts.centerX, opts.centerY);

 if (opts.timeout) {
 // auto-unblock
 var to = setTimeout(function() {
  full ? $.unblockUI(opts) : $(el).unblock(opts);
}, opts.timeout);
 $(el).data('blockUI.timeout', to);
}
};

// remove the block
function remove(el, opts) {
 var full = (el == window);
 var $el = $(el);
 var data = $el.data('blockUI.history');
 var to = $el.data('blockUI.timeout');
 if (to) {
 clearTimeout(to);
 $el.removeData('blockUI.timeout');
}
 opts = $.extend({}, $.blockUI.defaults, opts || {});
 bind(0, el, opts);// unbind events
 
 var els;
 if (full) // crazy selector to handle odd field errors in ie6/7
 els = $('body').children().filter('.blockUI').add('body > .blockUI');
 else
 els = $('.blockUI', el);

 if (full)
 pageBlock = pageBlockEls = null;

 if (opts.fadeOut) {
 els.fadeOut(opts.fadeOut);
 setTimeout(function() {reset(els,data,opts,el);}, opts.fadeOut);
}
 else
 reset(els, data, opts, el);
};

// move blocking element back into the DOM where it started
function reset(els,data,opts,el) {
 els.each(function(i,o) {
 // remove via DOM calls so we don't lose event handlers
 if (this.parentNode)
  this.parentNode.removeChild(this);
});

 if (data && data.el) {
 data.el.style.display = data.display;
 data.el.style.position = data.position;
 if (data.parent)
  data.parent.appendChild(data.el);
 $(el).removeData('blockUI.history');
}

 if (typeof opts.onUnblock == 'function')
 opts.onUnblock(el,opts);
};

// bind/unbind the handler
function bind(b, el, opts) {
 var full = el == window, $el = $(el);

 // don't bother unbinding if there is nothing to unbind
 if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
 return;
 if (!full)
 $el.data('blockUI.isBlocked', b);

 // don't bind events when overlay is not in use or if bindEvents is false
 if (!opts.bindEvents || (b && !opts.showOverlay)) 
 return;

 // bind anchors and inputs for mouse and key events
 var events = 'mousedown mouseup keydown keypress';
 b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);

// former impl...
//  var $e = $('a,:input');
//  b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
};

// event handler to suppress keyboard/mouse events when blocking
function handler(e) {
 // allow tab navigation (conditionally)
 if (e.keyCode && e.keyCode == 9) {
 if (pageBlock && e.data.constrainTabKey) {
  var els = pageBlockEls;
  var fwd = !e.shiftKey && e.target === els[els.length-1];
  var back = e.shiftKey && e.target === els[0];
  if (fwd || back) {
  setTimeout(function(){focus(back)},10);
  return false;
 }
}
}
 var opts = e.data;
 // allow events within the message content
 if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)
 return true;

 // allow events for content that is not being blocked
 return $(e.target).parents().children().filter('div.blockUI').length == 0;
};

function focus(back) {
 if (!pageBlockEls)
 return;
 var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
 if (e)
 e.focus();
};

function center(el, x, y) {
 var p = el.parentNode, s = el.style;
 var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
 var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
 if (x) s.left = l > 0 ? (l+'px') : '0';
 if (y) s.top = t > 0 ? (t+'px') : '0';
};

function sz(el, p) {
 return parseInt($.css(el,p))||0;
};

})(jQuery);


(function($) {

$.fn.extend({
  jqEasyCounter: function(givenOptions) {
 return this.each(function() {
   var $this = $(this),
  options = $.extend({
 maxChars: 100,
   msgAppendMethod: 'insertAfter'
 }, givenOptions);
 
  if(options.maxChars <= 0) return;
  
  // create counter element
  var jqEasyCounterMsg = $("<div class=\"jqEasyCounterMsg\">&nbsp;</div>");

  // append counter element to DOM
  jqEasyCounterMsg[options.msgAppendMethod]($this);
  
  // bind events to this element
  $this
  .bind('keydown keyup keypress', doCount)
  .bind('focus paste', function(){setTimeout(doCount, 10);});
 
  doCount();// Ajout de Steeve
  
  jqEasyCounterMsg.stop().fadeTo( 'fast', 1);
  
  function doCount(){
  var val = $this.val(),
   length = val.length
  
  if(length >= options.maxChars) {
   val = val.substring(0, options.maxChars);  
 };
  
  if(length > options.maxChars){
   // keep scroll bar position
   var originalScrollTopPosition = $this.scrollTop();
   $this.val(val.substring(0, options.maxChars));
   $this.scrollTop(originalScrollTopPosition);
 };
 
  jqEasyCounterMsg.html('Caractères : ' + $this.val().length + "/" + options.maxChars);
 };
});
 }
});

})(jQuery);





jQuery.cookie = function(name, value, options) {
  if (typeof value != 'undefined') {// name and value given, set cookie
 options = options || {};
 if (value === null) {
   value = '';
   options.expires = -1;
}
 var expires = '';
 if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
   var date;
   if (typeof options.expires == 'number') {
  date = new Date();
  date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
  } else {
  date = options.expires;
  }
   expires = ';expires=' + date.toUTCString();// use expires attribute, max-age is not supported by IE
}
 // CAUTION: Needed to parenthesize options.path and options.domain
 // in the following expressions, otherwise they evaluate to undefined
 // in the packed version for some reason...
 var path = options.path ? ';path=' + (options.path) : '';
 var domain = options.domain ? ';domain=' + (options.domain) : '';
 var secure = options.secure ? ';secure' : '';
 document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
 } else {// only name given, get cookie
 var cookieValue = null;
 if (document.cookie && document.cookie != '') {
   var cookies = document.cookie.split(';');
   for (var i = 0;i < cookies.length;i++) {
  var cookie = jQuery.trim(cookies[i]);
  // Does this cookie string begin with the name we want?
  if (cookie.substring(0, name.length + 1) == (name + '=')) {
 cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
 break;
 }
  }
}
 return cookieValue;
 }
};

$.extend({
 getUrlVars: function(){
  var vars = [], hash;
  var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
  for(var i = 0;i < hashes.length;i++)
  {
   hash = hashes[i].split('=');
   vars.push(hash[0]);
   vars[hash[0]] = hash[1];
 }
  return vars;
},
 getUrlVar: function(name){
  return $.getUrlVars()[name];
} 
});


var devMode = false;

$(function() {
  if ($.getUrlVar("devMode") == 1) 
 devMode = true;
});

function DevMode(){
 return devMode;
}
var decalageH2eNiveau=0;
var decalageH3eNiveau=3;
var decalageV3eNiveau=2;

var delaiAffichage=250;

function activerMenus(idMenuAActiver,vitesseTransitionMenu)
 {
 $('ul#'+idMenuAActiver+' li ul>li:first-child').not('ul#'+idMenuAActiver+' div ul li').addClass('premier');
 $('ul#'+idMenuAActiver+' li ul>li:last-child').not('ul#'+idMenuAActiver+' div ul li').addClass('dernier');
 $('ul#'+idMenuAActiver+' li ul').not('ul#'+idMenuAActiver+' div ul').css('display','block').css('visibility','hidden').each(function(){
 $(this).css('height',$(this).height()+'px')
});
 
 
 
 
 $('ul#'+idMenuAActiver+' li a').prepend('<span class="fixPlein"></span>');
 $('ul#'+idMenuAActiver+' li span.fixPlein').each(function(){
 var paddingHaut=parseInt($(this).parent().css('padding-top').substr(0,$(this).parent().css('padding-top').length-2));
 var hauteurLien=$(this).parent().height();
 var hauteurFix=0
 if(jQuery.browser.msie){
  var hauteurFix=(paddingHaut*2)
}else{
  var hauteurFix=(paddingHaut*2)+hauteurLien
}
 
 $(this).css('height',hauteurFix+'px');
 $(this).css('width',$(this).parent().outerWidth()+'px');
})
 $('ul#'+idMenuAActiver+' li ul').not('ul#'+idMenuAActiver+' li div ul').css('display','none').css('visibility','visible');
 
 $('ul#'+idMenuAActiver+' li ul').not('ul#'+idMenuAActiver+' div ul').parent().find('>a').addClass('avecSousMenus')
 
 $('ul#'+idMenuAActiver+' li ul').parent().each(function(){
 $(this).find('>a').css('z-index','50');
 $(this).children().not('a').css('z-index','99');
 if($(this).parent().attr('id')==idMenuAActiver){
  //2e niveau
  if($(this).offset().left-decalageH2eNiveau+$(this).children().not('a').outerWidth() < $(window).width()){
  $(this).children().not('a').css('left',(decalageH2eNiveau*-1)+'px');
 }
  else
  {
  var differenceMenus=($(this).outerWidth()-$(this).children().not('a').outerWidth());
  $(this).children().not('a').css('left',(differenceMenus+decalageH2eNiveau)+'px');
 }
 }
  else
  {
  //3e,4e,5e... niveau
  if($(this).offset().left-decalageH2eNiveau+$(this).children().not('a').outerWidth()+$(this).outerWidth() < $(window).width()){
  $(this).children().not('a').css('left',($(this).outerWidth()-decalageH3eNiveau+1)+'px');
  $(this).children().not('a').css('top',decalageV3eNiveau+'px');
 }
  else{
  $(this).children().not('a').css('left',(1+decalageH3eNiveau-$(this).children().not('a').outerWidth())+'px');
  $(this).children().not('a').css('top',decalageV3eNiveau+'px');
 }
 }
})
 
 
 
 
 //detection sousMenusOuvert
 $('ul#'+idMenuAActiver+' li ul,ul#'+idMenuAActiver+' li div').not('ul#'+idMenuAActiver+' li div ul').parent().mouseover(function(){
 $(this).stop(true,true);
 $(this).children().not('a').stop(true,true);
 if($(this).children().not('a').css('display')!='block'){
  $(this).delay(delaiAffichage).queue(function(){
  $(this).find('>a').addClass('actif');
  $(this).children().not('a').stop(true,true).attr('style','display:none;visibility:visible;');
  $(this).children().not('a').css('overflow','hidden');
  $(this).children().not('a').clearQueue().slideDown(vitesseTransitionMenu,function(){$(this).css('overflow','visible')});
  $(this).siblings('li').each(function(){
  $(this).clearQueue();
   $(this).clearQueue();
   if($(this).children().not('a').length > 0){
   $(this).children().not('a').stop(true,true);
   if($(this).children().not('a').css('display') != 'none'){
 $(this).children().not('a').delay(delaiAffichage/2).queue(function(){
 $(this).parent().css('z-index','50');
 $(this).parent().find('>a').removeClass('actif');
 $(this).dequeue();
})
 .fadeOut(vitesseTransitionMenu,function(){$(this).attr('style','display:none;visibility:visible;');$(this).clearQueue()});
  }
  }
 })
  
  $(this).css('z-index','99');
  //position d'affichage par rapport au niveau
  if($(this).parent().attr('id')==idMenuAActiver){
  //2e niveau
  if($(this).offset().left-decalageH2eNiveau+$(this).children().not('a').outerWidth() < $(window).width()){
   $(this).children().not('a').css('left',(decalageH2eNiveau*-1)+'px');
  }
   else
   {
   var differenceMenus=($(this).outerWidth()-$(this).children().not('a').outerWidth());
   $(this).children().not('a').css('left',(differenceMenus+decalageH2eNiveau)+'px');
  }
 }else{
  //3e,4e,5e... niveau
  if($(this).offset().left-decalageH2eNiveau+$(this).children().not('a').outerWidth()+$(this).outerWidth() < $(window).width()){
   $(this).children().not('a').css('left',($(this).outerWidth()-decalageH3eNiveau+1)+'px');
   $(this).children().not('a').css('top',decalageV3eNiveau+'px');
  }else{
   $(this).children().not('a').css('left',(1+decalageH3eNiveau-$(this).children().not('a').outerWidth())+'px');
   $(this).children().not('a').css('top',decalageV3eNiveau+'px');
 }
 }
  $(this).dequeue();
 })
}
})
 
 $('ul#'+idMenuAActiver+' li ul,ul#'+idMenuAActiver+' li div').not('ul#'+idMenuAActiver+' li div *').parent().mouseout(function(){
  $(this).stop(true,true);
  $(this).children().not('a').stop(true,true);
  if($(this).children().not('a').css('display') != 'none'){
  $(this).children().not('a').delay(delaiAffichage/2).queue(function(){
   $(this).parent().css('z-index','50');
   $(this).parent().find('>a').removeClass('actif');
   $(this).dequeue();
 })
  .fadeOut(vitesseTransitionMenu,function(){$(this).attr('style','display:none;visibility:visible;');$(this).clearQueue()});
 }
})
}

jQuery(function($){var userAgent=navigator.userAgent.toLowerCase();var browserVersion=(userAgent.match(/.+(?:rv|webkit|khtml|opera|msie)[\/: ]([\d.]+)/)||[0,'0'])[1];var isIE6=(/msie/.test(userAgent)&&!/opera/.test(userAgent)&&parseInt(browserVersion)<7&&(!window.XMLHttpRequest||typeof(XMLHttpRequest)==='function'));var body=$('body');var currentSettings;var callingSettings;var shouldResize=false;var gallery={};var fixFF=false;var contentElt;var contentEltLast;var modal={started:false,ready:false,dataReady:false,anim:false,animContent:false,loadingShown:false,transition:false,resizing:false,closing:false,error:false,blocker:null,blockerVars:null,full:null,bg:null,loading:null,tmp:null,content:null,wrapper:null,contentWrapper:null,scripts:new Array(),scriptsShown:new Array()};var resized={width:false,height:false,windowResizing:false};var initSettingsSize={width:null,height:null,windowResizing:true};var windowResizeTimeout;$.fn.nyroModal=function(settings){if(!this)return false;return this.each(function(){var me=$(this);if(this.nodeName.toLowerCase()=='form'){me.unbind('submit.nyroModal').bind('submit.nyroModal',function(e){if(e.isDefaultPrevented())return false;if(me.data('nyroModalprocessing'))return true;if(this.enctype=='multipart/form-data'){processModal($.extend(settings,{from:this}));return true}e.preventDefault();processModal($.extend(settings,{from:this}));return false})}else{me.unbind('click.nyroModal').bind('click.nyroModal',function(e){if(e.isDefaultPrevented())return false;e.preventDefault();processModal($.extend(settings,{from:this}));return false})}})};$.fn.nyroModalManual=function(settings){if(!this.length)processModal(settings);return this.each(function(){processModal($.extend(settings,{from:this}))})};$.nyroModalManual=function(settings){processModal(settings)};$.nyroModalSettings=function(settings,deep1,deep2){setCurrentSettings(settings,deep1,deep2);if(!deep1&&modal.started){if(modal.bg&&settings.bgColor)currentSettings.updateBgColor(modal,currentSettings,function(){});if(modal.contentWrapper&&settings.title)setTitle();if(!modal.error&&(settings.windowResizing||(!modal.resizing&&(('width'in settings&&settings.width==currentSettings.width)||('height'in settings&&settings.height==currentSettings.height))))){modal.resizing=true;if(modal.contentWrapper)calculateSize(true);if(modal.contentWrapper&&modal.contentWrapper.is(':visible')&&!modal.animContent){if(fixFF)modal.content.css({position:''});currentSettings.resize(modal,currentSettings,function(){currentSettings.windowResizing=false;modal.resizing=false;if(fixFF)modal.content.css({position:'fixed'});if($.isFunction(currentSettings.endResize))currentSettings.endResize(modal,currentSettings)})}}}};$.nyroModalRemove=function(){removeModal()};$.nyroModalNext=function(){var link=getGalleryLink(1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.nyroModalPrev=function(){var link=getGalleryLink(-1);if(link)return link.nyroModalManual(getCurrentSettingsNew());return false};$.fn.nyroModal.settings={debug:false,blocker:false,windowResize:true,modal:false,type:'',forceType:null,from:'',hash:'',processHandler:null,selIndicator:'nyroModalSel',formIndicator:'nyroModal',content:null,bgColor:'#000000',ajax:{},swf:{wmode:'transparent'},width:null,height:null,minWidth:900,minHeight:300,resizable:true,autoSizable:true,padding:25,regexImg:'[^\.]\.(jpg|jpeg|png|tiff|gif|bmp)\s*$',addImageDivTitle:false,defaultImgAlt:'Image',setWidthImgTitle:true,ltr:true,gallery:null,galleryLinks:'<a href="#" class="nyroModalPrev">Prev</a><a href="#" class="nyroModalNext">Next</a>',galleryCounts:galleryCounts,galleryLoop:false,zIndexStart:100,cssOpt:{bg:{position:'absolute',overflow:'hidden',top:0,left:0,height:'100%',width:'100%'},wrapper:{position:'absolute',top:'50%',left:'50%'},wrapper2:{},content:{},loading:{position:'absolute',top:'50%',left:'50%',marginTop:'-50px',marginLeft:'-50px'}},wrap:{div:'<div class="wrapper"></div>',ajax:'<div class="wrapper"></div>',form:'<div class="wrapper"></div>',formData:'<div class="wrapper"></div>',image:'<div class="wrapperImg"></div>',swf:'<div class="wrapperSwf"></div>',iframe:'<div class="wrapperIframe"></div>',iframeForm:'<div class="wrapperIframe"></div>',manual:'<div class="wrapper"></div>'},closeButton:'<a href="#" class="nyroModalClose" id="closeBut" title="fermer">Fermer</a>',title:null,titleFromIframe:true,openSelector:'.nyroModal',closeSelector:'.nyroModalClose',contentLoading:'<a href="#" class="nyroModalClose">Cancel</a>',errorClass:'error',contentError:'The requested content cannot be loaded.<br />Please try again later.<br /><a href="#" class="nyroModalClose">Close</a>',handleError:null,showBackground:showBackground,hideBackground:hideBackground,endFillContent:null,showContent:showContent,endShowContent:null,beforeHideContent:null,hideContent:hideContent,showTransition:showTransition,hideTransition:hideTransition,showLoading:showLoading,hideLoading:hideLoading,resize:resize,endResize:null,updateBgColor:updateBgColor,endRemove:null};function processModal(settings){if(modal.loadingShown||modal.transition||modal.anim)return;debug('processModal');modal.started=true;callingSettings=$.extend(true,settings);setDefaultCurrentSettings(settings);if(!modal.full)modal.blockerVars=modal.blocker=null;modal.error=false;modal.closing=false;modal.dataReady=false;modal.scripts=new Array();modal.scriptsShown=new Array();currentSettings.type=fileType();if(currentSettings.forceType){if(!currentSettings.content)currentSettings.from=true;currentSettings.type=currentSettings.forceType;currentSettings.forceType=null}if($.isFunction(currentSettings.processHandler))currentSettings.processHandler(currentSettings);var from=currentSettings.from;var url=currentSettings.url;initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height;if(currentSettings.type=='swf'){setCurrentSettings({overflow:'visible'},'cssOpt','content');currentSettings.content='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+currentSettings.width+'" height="'+currentSettings.height+'"><param name="movie" value="'+url+'"></param>';var tmp='';$.each(currentSettings.swf,function(name,val){currentSettings.content+='<param name="'+name+'" value="'+val+'"></param>';tmp+=' '+name+'="'+val+'"'});currentSettings.content+='<embed src="'+url+'" type="application/x-shockwave-flash" width="'+currentSettings.width+'" height="'+currentSettings.height+'"'+tmp+'></embed></object>'}if(from){var jFrom=$(from).blur();if(currentSettings.type=='form'){var data=$(from).serializeArray();data.push({name:currentSettings.formIndicator,value:1});if(currentSettings.selector)data.push({name:currentSettings.selIndicator,value:currentSettings.selector.substring(1)});showModal();$.ajax($.extend({},currentSettings.ajax,{url:url,data:data,type:jFrom.attr('method')?jFrom.attr('method'):'get',success:ajaxLoaded,error:loadingError}));debug('Form Ajax Load: '+jFrom.attr('action'))}else if(currentSettings.type=='formData'){initModal();jFrom.attr('target','nyroModalIframe');jFrom.attr('action',url);jFrom.prepend('<input type="hidden" name="'+currentSettings.formIndicator+'" value="1" />');if(currentSettings.selector)jFrom.prepend('<input type="hidden" name="'+currentSettings.selIndicator+'" value="'+currentSettings.selector.substring(1)+'" />');modal.tmp.html('<iframe frameborder="0" hspace="0" name="nyroModalIframe" src="javascript:\'\';"></iframe>');$('iframe',modal.tmp).css({width:currentSettings.width,height:currentSettings.height}).error(loadingError).load(formDataLoaded);debug('Form Data Load: '+jFrom.attr('action'));showModal();showContentOrLoading()}else if(currentSettings.type=='image'){debug('Image Load: '+url);var title=jFrom.attr('title')||currentSettings.defaultImgAlt;initModal();modal.tmp.html('<img id="nyroModalImg" />').find('img').attr('alt',title);modal.tmp.css({lineHeight:0});$('img',modal.tmp).error(loadingError).load(function(){debug('Image Loaded: '+this.src);$(this).unbind('load');var w=modal.tmp.width();var h=modal.tmp.height();modal.tmp.css({lineHeight:''});resized.width=w;resized.height=h;setCurrentSettings({width:w,height:h,imgWidth:w,imgHeight:h});initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({overflow:'visible'},'cssOpt','content');modal.dataReady=true;if(modal.loadingShown||modal.transition)showContentOrLoading()}).attr('src',url);showModal()}else if(currentSettings.type=='iframeForm'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Form Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type=='iframe'){initModal();modal.tmp.html('<iframe frameborder="0" hspace="0" src="javascript:\'\';" name="nyroModalIframe" id="nyroModalIframe"></iframe>');debug('Iframe Load: '+url);$('iframe',modal.tmp).eq(0).css({width:'100%',height:$.support.boxModel?'99%':'100%'}).load(iframeLoaded);modal.dataReady=true;showModal()}else if(currentSettings.type){debug('Content: '+currentSettings.type);initModal();modal.tmp.html(currentSettings.content);var w=modal.tmp.width();var h=modal.tmp.height();var div=$(currentSettings.type);if(div.length){setCurrentSettings({type:'div'});w=div.width();h=div.height();if(contentElt)contentEltLast=contentElt;contentElt=div;modal.tmp.append(div.contents())}initSettingsSize.width=w;initSettingsSize.height=h;setCurrentSettings({width:w,height:h});if(modal.tmp.html())modal.dataReady=true;else loadingError();if(!modal.ready)showModal();else endHideContent()}else{debug('Ajax Load: '+url);setCurrentSettings({type:'ajax'});var data=currentSettings.ajax.data||{};if(currentSettings.selector){if(typeof data=="string"){data+='&'+currentSettings.selIndicator+'='+currentSettings.selector.substring(1)}else{data[currentSettings.selIndicator]=currentSettings.selector.substring(1)}}showModal();$.ajax($.extend(true,currentSettings.ajax,{url:url,success:ajaxLoaded,error:loadingError,data:data}))}}else if(currentSettings.content){debug('Content: '+currentSettings.type);setCurrentSettings({type:'manual'});initModal();modal.tmp.html($('<div/>').html(currentSettings.content).contents());if(modal.tmp.html())modal.dataReady=true;else loadingError();showModal()}else{}}function setDefaultCurrentSettings(settings){debug('setDefaultCurrentSettings');currentSettings=$.extend(true,{},$.fn.nyroModal.settings,settings);setMargin()}function setCurrentSettings(settings,deep1,deep2){if(modal.started){if(deep1&&deep2){$.extend(true,currentSettings[deep1][deep2],settings)}else if(deep1){$.extend(true,currentSettings[deep1],settings)}else{if(modal.animContent){if('width'in settings){if(!modal.resizing){settings.setWidth=settings.width;shouldResize=true}delete settings['width']}if('height'in settings){if(!modal.resizing){settings.setHeight=settings.height;shouldResize=true}delete settings['height']}}$.extend(true,currentSettings,settings)}}else{if(deep1&&deep2){$.extend(true,$.fn.nyroModal.settings[deep1][deep2],settings)}else if(deep1){$.extend(true,$.fn.nyroModal.settings[deep1],settings)}else{$.extend(true,$.fn.nyroModal.settings,settings)}}}function setMarginScroll(){if(isIE6&&!modal.blocker){if(document.documentElement){currentSettings.marginScrollLeft=document.documentElement.scrollLeft;currentSettings.marginScrollTop=document.documentElement.scrollTop}else{currentSettings.marginScrollLeft=document.body.scrollLeft;currentSettings.marginScrollTop=document.body.scrollTop}}else{currentSettings.marginScrollLeft=0;currentSettings.marginScrollTop=0}}function setMargin(){setMarginScroll();currentSettings.marginLeft=-(currentSettings.width+currentSettings.borderW)/2;currentSettings.marginTop=-(currentSettings.height+currentSettings.borderH)/2;if(!modal.blocker){currentSettings.marginLeft+=currentSettings.marginScrollLeft;currentSettings.marginTop+=currentSettings.marginScrollTop}}function setMarginLoading(){setMarginScroll();var outer=getOuter(modal.loading);currentSettings.marginTopLoading=-(modal.loading.height()+outer.h.border+outer.h.padding)/2;currentSettings.marginLeftLoading=-(modal.loading.width()+outer.w.border+outer.w.padding)/2;if(!modal.blocker){currentSettings.marginLeftLoading+=currentSettings.marginScrollLeft;currentSettings.marginTopLoading+=currentSettings.marginScrollTop}}function setTitle(){var title=$('h1#nyroModalTitle',modal.contentWrapper);if(title.length)title.text(currentSettings.title);else modal.contentWrapper.prepend('<h1 id="nyroModalTitle">'+currentSettings.title+'</h1>')}function initModal(){debug('initModal');if(!modal.full){if(currentSettings.debug)setCurrentSettings({color:'white'},'cssOpt','bg');var full={zIndex:currentSettings.zIndexStart,position:'fixed',top:0,left:0,width:'100%',height:'100%'};var contain=body;var iframeHideIE='';if(currentSettings.blocker){modal.blocker=contain=$(currentSettings.blocker);var pos=modal.blocker.offset();var w=modal.blocker.outerWidth();var h=modal.blocker.outerHeight();if(isIE6){setCurrentSettings({height:'100%',width:'100%',top:0,left:0},'cssOpt','bg')}modal.blockerVars={top:pos.top,left:pos.left,width:w,height:h};var plusTop=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderTopWidth'));var plusLeft=(/msie/.test(userAgent)?0:getCurCSS(body.get(0),'borderLeftWidth'));full={position:'absolute',top:pos.top+plusTop,left:pos.left+plusLeft,width:w,height:h}}else if(isIE6){body.css({marginLeft:0,marginRight:0});var w=body.width();var h=$(window).height()+'px';if($(window).height()>=body.outerHeight()){h=body.outerHeight()+'px'}else w+=20;w+='px';body.css({width:w,height:h,position:'static',overflow:'hidden'});$('html').css({overflow:'hidden'});setCurrentSettings({cssOpt:{bg:{position:'absolute',zIndex:currentSettings.zIndexStart+1,height:'110%',width:'110%',top:currentSettings.marginScrollTop+'px',left:currentSettings.marginScrollLeft+'px'},wrapper:{zIndex:currentSettings.zIndexStart+2},loading:{zIndex:currentSettings.zIndexStart+3}}});iframeHideIE=$('<iframe id="nyroModalIframeHideIe" src="javascript:\'\';"></iframe>').css($.extend({},currentSettings.cssOpt.bg,{opacity:0,zIndex:50,border:'none'}))}contain.append($('<div id="nyroModalFull"><div id="nyroModalBg"></div><div id="nyroModalWrapper"><div id="nyroModalContent"></div></div><div id="nyrModalTmp"></div><div id="nyroModalLoading"></div></div>').hide());modal.full=$('#nyroModalFull').css(full).show();modal.bg=$('#nyroModalBg').css($.extend({backgroundColor:currentSettings.bgColor},currentSettings.cssOpt.bg)).before(iframeHideIE);modal.bg.bind('click.nyroModal',clickBg);modal.loading=$('#nyroModalLoading').css(currentSettings.cssOpt.loading).hide();modal.contentWrapper=$('#nyroModalWrapper').css(currentSettings.cssOpt.wrapper).hide();modal.content=$('#nyroModalContent');modal.tmp=$('#nyrModalTmp').hide();if($.isFunction($.fn.mousewheel)){modal.content.mousewheel(function(e,d){var elt=modal.content.get(0);if((d>0&&elt.scrollTop==0)||(d<0&&elt.scrollHeight-elt.scrollTop==elt.clientHeight)){e.preventDefault();e.stopPropagation()}})}$(document).bind('keydown.nyroModal',keyHandler);modal.content.css({width:'auto',height:'auto'});modal.contentWrapper.css({width:'auto',height:'auto'});if(!currentSettings.blocker&&currentSettings.windowResize){$(window).bind('resize.nyroModal',function(){window.clearTimeout(windowResizeTimeout);windowResizeTimeout=window.setTimeout(windowResizeHandler,200)})}}}function windowResizeHandler(){$.nyroModalSettings(initSettingsSize)}function showModal(){debug('showModal');if(!modal.ready){initModal();modal.anim=true;currentSettings.showBackground(modal,currentSettings,endBackground)}else{modal.anim=true;modal.transition=true;currentSettings.showTransition(modal,currentSettings,function(){endHideContent();modal.anim=false;showContentOrLoading()})}}function clickBg(e){if(!currentSettings.modal)removeModal()}function keyHandler(e){if(e.keyCode==27){if(!currentSettings.modal)removeModal()}else if(currentSettings.gallery&&modal.ready&&modal.dataReady&&!modal.anim&&!modal.transition){if(e.keyCode==39||e.keyCode==40){e.preventDefault();$.nyroModalNext();return false}else if(e.keyCode==37||e.keyCode==38){e.preventDefault();$.nyroModalPrev();return false}}}function fileType(){var from=currentSettings.from;var url;if(from&&from.nodeName){var jFrom=$(from);url=jFrom.attr(from.nodeName.toLowerCase()=='form'?'action':'href');if(!url)url=location.href.substring(window.location.host.length+7);currentSettings.url=url;if(jFrom.attr('rev')=='modal')currentSettings.modal=true;currentSettings.title=jFrom.attr('title');if(from&&from.rel&&from.rel.toLowerCase()!='nofollow'){var indexSpace=from.rel.indexOf(' ');currentSettings.gallery=indexSpace>0?from.rel.substr(0,indexSpace):from.rel}var imgType=imageType(url,from);if(imgType)return imgType;if(isSwf(url))return'swf';var iframe=false;if(from.target&&from.target.toLowerCase()=='_blank'||(from.hostname&&from.hostname.replace(/:\d*$/,'')!=window.location.hostname.replace(/:\d*$/,''))){iframe=true}if(from.nodeName.toLowerCase()=='form'){if(iframe)return'iframeForm';setCurrentSettings(extractUrlSel(url));if(jFrom.attr('enctype')=='multipart/form-data')return'formData';return'form'}if(iframe)return'iframe'}else{url=currentSettings.url;if(!currentSettings.content)currentSettings.from=true;if(!url)return null;if(isSwf(url))return'swf';var reg1=new RegExp("^http://|https://","g");if(url.match(reg1))return'iframe'}var imgType=imageType(url,from);if(imgType)return imgType;var tmp=extractUrlSel(url);setCurrentSettings(tmp);if(!tmp.url)return tmp.selector}function imageType(url,from){var image=new RegExp(currentSettings.regexImg,'i');if(image.test(url)){return'image'}}function isSwf(url){var swf=new RegExp('[^\.]\.(swf)\s*$','i');return swf.test(url)}function extractUrlSel(url){var ret={url:null,selector:null};if(url){var hash=getHash(url);var hashLoc=getHash(window.location.href);var curLoc=window.location.href.substring(0,window.location.href.length-hashLoc.length);var req=url.substring(0,url.length-hash.length);if(req==curLoc||req==$('base').attr('href')){ret.selector=hash}else{ret.url=req;ret.selector=hash}}return ret}function loadingError(){debug('loadingError');modal.error=true;if(!modal.ready)return;if($.isFunction(currentSettings.handleError))currentSettings.handleError(modal,currentSettings);modal.loading.addClass(currentSettings.errorClass).html(currentSettings.contentError);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();modal.loading.css({marginTop:currentSettings.marginTopLoading+'px',marginLeft:currentSettings.marginLeftLoading+'px'})}function fillContent(){debug('fillContent');if(!modal.tmp.html())return;modal.content.html(modal.tmp.contents());modal.tmp.empty();wrapContent();if(currentSettings.type=='iframeForm'){$(currentSettings.from).attr('target','nyroModalIframe').data('nyroModalprocessing',1).submit().attr('target','_blank').removeData('nyroModalprocessing')}if(!currentSettings.modal)modal.wrapper.prepend(currentSettings.closeButton);if($.isFunction(currentSettings.endFillContent))currentSettings.endFillContent(modal,currentSettings);modal.content.append(modal.scripts);$(currentSettings.closeSelector,modal.contentWrapper).unbind('click.nyroModal').bind('click.nyroModal',removeModal);$(currentSettings.openSelector,modal.contentWrapper).nyroModal(getCurrentSettingsNew())}function getCurrentSettingsNew(){return callingSettings;var currentSettingsNew=$.extend(true,{},currentSettings);if(resized.width)currentSettingsNew.width=null;else currentSettingsNew.width=initSettingsSize.width;if(resized.height)currentSettingsNew.height=null;else currentSettingsNew.height=initSettingsSize.height;currentSettingsNew.cssOpt.content.overflow='auto';return currentSettingsNew}function wrapContent(){debug('wrapContent');var wrap=$(currentSettings.wrap[currentSettings.type]);modal.content.append(wrap.children().remove());modal.contentWrapper.wrapInner(wrap);if(currentSettings.gallery){modal.content.append(currentSettings.galleryLinks);gallery.links=$('[rel="'+currentSettings.gallery+'"], [rel^="'+currentSettings.gallery+' "]');gallery.index=gallery.links.index(currentSettings.from);if(currentSettings.galleryCounts&&$.isFunction(currentSettings.galleryCounts))currentSettings.galleryCounts(gallery.index+1,gallery.links.length,modal,currentSettings);var currentSettingsNew=getCurrentSettingsNew();var linkPrev=getGalleryLink(-1);if(linkPrev){var prev=$('.nyroModalPrev',modal.contentWrapper).attr('href',linkPrev.attr('href')).click(function(e){e.preventDefault();$.nyroModalPrev();return false});if(isIE6&&currentSettings.type=='swf'){prev.before($('<iframe id="nyroModalIframeHideIeGalleryPrev" src="javascript:\'\';"></iframe>').css({position:prev.css('position'),top:prev.css('top'),left:prev.css('left'),width:prev.width(),height:prev.height(),opacity:0,border:'none'}))}}else{$('.nyroModalPrev',modal.contentWrapper).remove()}var linkNext=getGalleryLink(1);if(linkNext){var next=$('.nyroModalNext',modal.contentWrapper).attr('href',linkNext.attr('href')).click(function(e){e.preventDefault();$.nyroModalNext();return false});if(isIE6&&currentSettings.type=='swf'){next.before($('<iframe id="nyroModalIframeHideIeGalleryNext" src="javascript:\'\';"></iframe>').css($.extend({},{position:next.css('position'),top:next.css('top'),left:next.css('left'),width:next.width(),height:next.height(),opacity:0,border:'none'})))}}else{$('.nyroModalNext',modal.contentWrapper).remove()}}calculateSize()}function getGalleryLink(dir){if(currentSettings.gallery){if(!currentSettings.ltr)dir*=-1;var index=gallery.index+dir;if(index>=0&&index<gallery.links.length)return gallery.links.eq(index);else if(currentSettings.galleryLoop){if(index<0)return gallery.links.eq(gallery.links.length-1);else return gallery.links.eq(0)}}return false}function calculateSize(resizing){debug('calculateSize');modal.wrapper=modal.contentWrapper.children('div:first');resized.width=false;resized.height=false;if(false&&!currentSettings.windowResizing){initSettingsSize.width=currentSettings.width;initSettingsSize.height=currentSettings.height}if(currentSettings.autoSizable&&(!currentSettings.width||!currentSettings.height)){modal.contentWrapper.css({opacity:0,width:'auto',height:'auto'}).show();var tmp={width:'auto',height:'auto'};if(currentSettings.width){tmp.width=currentSettings.width}else if(currentSettings.type=='iframe'){tmp.width=currentSettings.minWidth}if(currentSettings.height){tmp.height=currentSettings.height}else if(currentSettings.type=='iframe'){tmp.height=currentSettings.minHeight}modal.content.css(tmp);if(!currentSettings.width){currentSettings.width=modal.content.outerWidth(true);resized.width=true}if(!currentSettings.height){currentSettings.height=modal.content.outerHeight(true);resized.height=true}modal.contentWrapper.css({opacity:1});if(!resizing)modal.contentWrapper.hide()}if(currentSettings.type!='image'&&currentSettings.type!='swf'){currentSettings.width=Math.max(currentSettings.width,currentSettings.minWidth);currentSettings.height=Math.max(currentSettings.height,currentSettings.minHeight)}var outerWrapper=getOuter(modal.contentWrapper);var outerWrapper2=getOuter(modal.wrapper);var outerContent=getOuter(modal.content);var tmp={content:{width:currentSettings.width,height:currentSettings.height},wrapper2:{width:currentSettings.width+outerContent.w.total,height:currentSettings.height+outerContent.h.total},wrapper:{width:currentSettings.width+outerContent.w.total+outerWrapper2.w.total,height:currentSettings.height+outerContent.h.total+outerWrapper2.h.total}};if(currentSettings.resizable){var maxHeight=modal.blockerVars?modal.blockerVars.height:$(window).height()-outerWrapper.h.border-(tmp.wrapper.height-currentSettings.height);var maxWidth=modal.blockerVars?modal.blockerVars.width:$(window).width()-outerWrapper.w.border-(tmp.wrapper.width-currentSettings.width);maxHeight-=currentSettings.padding*2;maxWidth-=currentSettings.padding*2;if(tmp.content.height>maxHeight||tmp.content.width>maxWidth){if(currentSettings.type=='image'||currentSettings.type=='swf'){var useW=currentSettings.imgWidth?currentSettings.imgWidth:currentSettings.width;var useH=currentSettings.imgHeight?currentSettings.imgHeight:currentSettings.height;var diffW=tmp.content.width-useW;var diffH=tmp.content.height-useH;if(diffH<0)diffH=0;if(diffW<0)diffW=0;var calcH=maxHeight-diffH;var calcW=maxWidth-diffW;var ratio=Math.min(calcH/useH,calcW/useW);calcW=Math.floor(useW*ratio);calcH=Math.floor(useH*ratio);tmp.content.height=calcH+diffH;tmp.content.width=calcW+diffW}else{tmp.content.height=Math.min(tmp.content.height,maxHeight);tmp.content.width=Math.min(tmp.content.width,maxWidth)}tmp.wrapper2={width:tmp.content.width+outerContent.w.total,height:tmp.content.height+outerContent.h.total};tmp.wrapper={width:tmp.content.width+outerContent.w.total+outerWrapper2.w.total,height:tmp.content.height+outerContent.h.total+outerWrapper2.h.total}}}if(currentSettings.type=='swf'){$('object, embed',modal.content).attr('width',tmp.content.width).attr('height',tmp.content.height)}else if(currentSettings.type=='image'){$('img',modal.content).css({width:tmp.content.width,height:tmp.content.height})}modal.content.css($.extend({},tmp.content,currentSettings.cssOpt.content));modal.wrapper.css($.extend({},tmp.wrapper2,currentSettings.cssOpt.wrapper2));if(!resizing)modal.contentWrapper.css($.extend({},tmp.wrapper,currentSettings.cssOpt.wrapper));if(currentSettings.type=='image'&&currentSettings.addImageDivTitle){$('img',modal.content).removeAttr('alt');var divTitle=$('div',modal.content);if(currentSettings.title!=currentSettings.defaultImgAlt&&currentSettings.title){if(divTitle.length==0){divTitle=$('<div>'+currentSettings.title+'</div>');modal.content.append(divTitle)}if(currentSettings.setWidthImgTitle){var outerDivTitle=getOuter(divTitle);divTitle.css({width:(tmp.content.width+outerContent.w.padding-outerDivTitle.w.total)+'px'})}}else if(divTitle.length=0){divTitle.remove()}}if(currentSettings.title)setTitle();tmp.wrapper.borderW=outerWrapper.w.border;tmp.wrapper.borderH=outerWrapper.h.border;setCurrentSettings(tmp.wrapper);setMargin()}function removeModal(e){debug('removeModal');if(e)e.preventDefault();if(modal.full&&modal.ready){$(document).unbind('keydown.nyroModal');if(!currentSettings.blocker)$(window).unbind('resize.nyroModal');modal.ready=false;modal.anim=true;modal.closing=true;if(modal.loadingShown||modal.transition){currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;modal.transition=false;currentSettings.hideBackground(modal,currentSettings,endRemove)})}else{if(fixFF)modal.content.css({position:''});modal.wrapper.css({overflow:'hidden'});modal.content.css({overflow:'hidden'});$('iframe',modal.content).hide();if($.isFunction(currentSettings.beforeHideContent)){currentSettings.beforeHideContent(modal,currentSettings,function(){currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})})}else{currentSettings.hideContent(modal,currentSettings,function(){endHideContent();currentSettings.hideBackground(modal,currentSettings,endRemove)})}}}if(e)return false}function showContentOrLoading(){debug('showContentOrLoading');if(modal.ready&&!modal.anim){if(modal.dataReady){if(modal.tmp.html()){modal.anim=true;if(modal.transition){fillContent();modal.animContent=true;currentSettings.hideTransition(modal,currentSettings,function(){modal.loading.hide();modal.transition=false;modal.loadingShown=false;endShowContent()})}else{currentSettings.hideLoading(modal,currentSettings,function(){modal.loading.hide();modal.loadingShown=false;fillContent();setMarginLoading();setMargin();modal.animContent=true;currentSettings.showContent(modal,currentSettings,endShowContent)})}}}else if(!modal.loadingShown&&!modal.transition){modal.anim=true;modal.loadingShown=true;if(modal.error)loadingError();else modal.loading.html(currentSettings.contentLoading);$(currentSettings.closeSelector,modal.loading).unbind('click.nyroModal').bind('click.nyroModal',removeModal);setMarginLoading();currentSettings.showLoading(modal,currentSettings,function(){modal.anim=false;showContentOrLoading()})}}}function ajaxLoaded(data){debug('AjaxLoaded: '+this.url);if(currentSettings.selector){var tmp={};var i=0;data=data.replace(/\r\n/gi,'nyroModalLN').replace(/<script(.|\s)*?\/script>/gi,function(x){tmp[i]=x;return'<pre style="display: none" class=nyroModalScript rel="'+(i++)+'"></pre>'});data=$('<div>'+data+'</div>').find(currentSettings.selector).html().replace(/<pre style="display: none;?" class="?nyroModalScript"? rel="(.?)"><\/pre>/gi,function(x,y,z){return tmp[y]}).replace(/nyroModalLN/gi,"\r\n")}modal.tmp.html(filterScripts(data));if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function formDataLoaded(){debug('formDataLoaded');var jFrom=$(currentSettings.from);jFrom.attr('action',jFrom.attr('action')+currentSettings.selector);jFrom.attr('target','');$('input[name='+currentSettings.formIndicator+']',currentSettings.from).remove();var iframe=modal.tmp.children('iframe');var iframeContent=iframe.unbind('load').contents().find(currentSettings.selector||'body').not('script[src]');iframe.attr('src','about:blank');modal.tmp.html(iframeContent.html());if(modal.tmp.html()){modal.dataReady=true;showContentOrLoading()}else loadingError()}function iframeLoaded(){if((window.location.hostname&&currentSettings.url.indexOf(window.location.hostname)>-1)||currentSettings.url.indexOf('http://')){var iframe=$('iframe',modal.full).contents();var tmp={};if(currentSettings.titleFromIframe){tmp.title=iframe.find('title').text();if(!tmp.title){try{tmp.title=iframe.find('title').html()}catch(err){}}}var body=iframe.find('body');if(!currentSettings.height&&body.height())tmp.height=body.height();if(!currentSettings.width&&body.width())tmp.width=body.width();$.extend(initSettingsSize,tmp);$.nyroModalSettings(tmp)}}function galleryCounts(nb,total,elts,settings){if(total>1)settings.title+=(settings.title?' - ':'')+nb+'/'+total}function endHideContent(){debug('endHideContent');modal.anim=false;if(contentEltLast){contentEltLast.append(modal.content.contents());contentEltLast=null}else if(contentElt){contentElt.append(modal.content.contents());contentElt=null}modal.content.empty();gallery={};modal.contentWrapper.hide().children().remove().empty().attr('style','').hide();if(modal.closing||modal.transition)modal.contentWrapper.hide();modal.contentWrapper.css(currentSettings.cssOpt.wrapper).append(modal.content);showContentOrLoading()}function endRemove(){debug('endRemove');$(document).unbind('keydown',keyHandler);modal.anim=false;modal.full.remove();modal.full=null;if(isIE6){body.css({height:'',width:'',position:'',overflow:'',marginLeft:'',marginRight:''});$('html').css({overflow:''})}if($.isFunction(currentSettings.endRemove))currentSettings.endRemove(modal,currentSettings)}function endBackground(){debug('endBackground');modal.ready=true;modal.anim=false;showContentOrLoading()}function endShowContent(){debug('endShowContent');modal.anim=false;modal.animContent=false;modal.contentWrapper.css({opacity:''});fixFF=/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)&&parseFloat(browserVersion)<1.9&&currentSettings.type!='image';if(fixFF)modal.content.css({position:'fixed'});modal.content.append(modal.scriptsShown);if(currentSettings.type=='iframe')modal.content.find('iframe').attr('src',currentSettings.url);if($.isFunction(currentSettings.endShowContent))currentSettings.endShowContent(modal,currentSettings);if(shouldResize){shouldResize=false;$.nyroModalSettings({width:currentSettings.setWidth,height:currentSettings.setHeight});delete currentSettings['setWidth'];delete currentSettings['setHeight']}if(resized.width)setCurrentSettings({width:null});if(resized.height)setCurrentSettings({height:null})}function getHash(url){if(typeof url=='string'){var hashPos=url.indexOf('#');if(hashPos>-1)return url.substring(hashPos)}return''}function filterScripts(data){if(typeof data=='string')data=data.replace(/<\/?(html|head|body)([^>]*)>/gi,'');var tmp=new Array();$.each($.clean({0:data},this.ownerDocument),function(){if($.nodeName(this,"script")){if(!this.src||$(this).attr('rel')=='forceLoad'){if($(this).attr('rev')=='shown')modal.scriptsShown.push(this);else modal.scripts.push(this)}}else tmp.push(this)});return tmp}function getOuter(elm){elm=elm.get(0);var ret={h:{margin:getCurCSS(elm,'marginTop')+getCurCSS(elm,'marginBottom'),border:getCurCSS(elm,'borderTopWidth')+getCurCSS(elm,'borderBottomWidth'),padding:getCurCSS(elm,'paddingTop')+getCurCSS(elm,'paddingBottom')},w:{margin:getCurCSS(elm,'marginLeft')+getCurCSS(elm,'marginRight'),border:getCurCSS(elm,'borderLeftWidth')+getCurCSS(elm,'borderRightWidth'),padding:getCurCSS(elm,'paddingLeft')+getCurCSS(elm,'paddingRight')}};ret.h.outer=ret.h.margin+ret.h.border;ret.w.outer=ret.w.margin+ret.w.border;ret.h.inner=ret.h.padding+ret.h.border;ret.w.inner=ret.w.padding+ret.w.border;ret.h.total=ret.h.outer+ret.h.padding;ret.w.total=ret.w.outer+ret.w.padding;return ret}function getCurCSS(elm,name){var ret=parseInt($.curCSS(elm,name,true));if(isNaN(ret))ret=0;return ret}function debug(msg){if($.fn.nyroModal.settings.debug||currentSettings&&currentSettings.debug)nyroModalDebug(msg,modal,currentSettings||{})}function showBackground(elts,settings,callback){elts.bg.css({opacity:0}).fadeTo(500,0.75,callback)}function hideBackground(elts,settings,callback){elts.bg.fadeOut(300,callback)}function showLoading(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px',opacity:0}).show().animate({opacity:1},{complete:callback,duration:400})}function hideLoading(elts,settings,callback){callback()}function showContent(elts,settings,callback){elts.loading.css({marginTop:settings.marginTopLoading+'px',marginLeft:settings.marginLeftLoading+'px'}).show().animate({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'},{duration:350,complete:function(){elts.contentWrapper.css({width:settings.width+'px',height:settings.height+'px',marginTop:settings.marginTop+'px',marginLeft:settings.marginLeft+'px'}).show();elts.loading.fadeOut(200,callback)}})}function hideContent(elts,settings,callback){elts.contentWrapper.animate({height:'50px',width:'50px',marginTop:(-(25+settings.borderH)/2+settings.marginScrollTop)+'px',marginLeft:(-(25+settings.borderW)/2+settings.marginScrollLeft)+'px'},{duration:350,complete:function(){elts.contentWrapper.hide();callback()}})}function showTransition(elts,settings,callback){elts.loading.css({marginTop:elts.contentWrapper.css('marginTop'),marginLeft:elts.contentWrapper.css('marginLeft'),height:elts.contentWrapper.css('height'),width:elts.contentWrapper.css('width'),opacity:0}).show().fadeTo(400,1,function(){elts.contentWrapper.hide();callback()})}function hideTransition(elts,settings,callback){elts.contentWrapper.hide().css({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px',opacity:1});elts.loading.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:function(){elts.contentWrapper.show();elts.loading.fadeOut(400,function(){elts.loading.hide();callback()})},duration:350})}function resize(elts,settings,callback){elts.contentWrapper.animate({width:settings.width+'px',height:settings.height+'px',marginLeft:settings.marginLeft+'px',marginTop:settings.marginTop+'px'},{complete:callback,duration:400})}function updateBgColor(elts,settings,callback){if(!$.fx.step.backgroundColor){elts.bg.css({backgroundColor:settings.bgColor});callback()}else elts.bg.animate({backgroundColor:settings.bgColor},{complete:callback,duration:400})}$($.fn.nyroModal.settings.openSelector).nyroModal()});var tmpDebug='';function nyroModalDebug(msg,elts,settings){if(elts.full&&elts.bg){elts.bg.prepend(msg+'<br />'+tmpDebug);tmpDebug=''}else tmpDebug+=msg+'<br />'}

(function(b){function k(e){var c=[],a=false;this.each(function(){if(!(this==document||this==window)){var d=b(this);if(d.scrollTop()>0)c.push(this);else{d.scrollTop(1);a=d.scrollTop()>0;d.scrollTop(0);a&&c.push(this)}}});if(e==="first"&&c.length)c=[c.shift()];return c}function l(e){return e.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")}var m=l(location.pathname);b.fn.extend({scrollable:function(){return this.pushStack(k.call(this))},firstScrollable:function(){return this.pushStack(k.call(this,
"first"))},smoothScroll:function(e){e=e||{};var c=b.extend({},b.fn.smoothScroll.defaults,e);this.die("click.smoothscroll").live("click.smoothscroll",function(a){var d=b(this),f=location.hostname===this.hostname||!this.hostname,g=c.scrollTarget||(l(this.pathname)||m)===m,i=this.hash,h=true;if(!c.scrollTarget&&(!f||!g||!i))h=false;else{f=c.exclude;g=0;for(var j=f.length;h&&g<j;)if(d.is(f[g++]))h=false;f=c.excludeWithin;g=0;for(j=f.length;h&&g<j;)if(d.closest(f[g++]).length)h=false}if(h){c.scrollTarget=
e.scrollTarget||i;c.link=this;a.preventDefault();b.smoothScroll(c)}});return this}});b.smoothScroll=function(e,c){var a,d,f,g=0;d="offset";var i={};if(typeof e==="number"){a=b.fn.smoothScroll.defaults;f=e}else{a=b.extend({},b.fn.smoothScroll.defaults,e||{});if(a.scrollElement){d="position";a.scrollElement.css("position")=="static"&&a.scrollElement.css("position","relative")}f=c||b(a.scrollTarget)[d]()&&b(a.scrollTarget)[d]()[a.direction]||0}a=b.extend({link:null},a);if(a.scrollElement){d=a.scrollElement;
g=d.scrollTop()}else d=b("html, body").firstScrollable();i["scroll"+{top:"Top",left:"Left"}[a.direction]]=f+g+a.offset;d.animate(i,{duration:a.speed,easing:a.easing,complete:function(){a.afterScroll&&b.isFunction(a.afterScroll)&&a.afterScroll.call(a.link,a)}})};b.smoothScroll.version="1.3.1";b.fn.smoothScroll.defaults={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,afterScroll:null,easing:"swing",speed:400}})(jQuery);

eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|crop|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}));


(function($) {

$.extend($.fn, {
 // http://docs.jquery.com/Plugins/Validation/validate
 validate: function( options ) {
 // if nothing is selected, return nothing;can't chain anyway
 if (!this.length) {
  options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" );
  return;
}

 // check if a validator for this form was already created
 var validator = $.data(this[0], 'validator');
 if ( validator ) {
  return validator;
}
 
 validator = new $.validator( options, this[0] );
 $.data(this[0], 'validator', validator);
 
 if ( validator.settings.onsubmit ) {
 
  // allow suppresing validation by adding a cancel class to the submit button
  this.find("input, button").filter(".cancel").click(function() {
  validator.cancelSubmit = true;
 });
  
  // when a submitHandler is used, capture the submitting button
  if (validator.settings.submitHandler) {
  this.find("input, button").filter(":submit").click(function() {
   validator.submitButton = this;
 });
 }
 
  // validate the form on submit
  this.submit( function( event ) {
  if ( validator.settings.debug )
   // prevent form submit to be able to see console output
   event.preventDefault();
   
  function handle() {
   if ( validator.settings.submitHandler ) {
   if (validator.submitButton) {
 // insert a hidden input as a replacement for the missing submit button
 var hidden = $("<input type='hidden'/>").attr("name", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);
  }
   validator.settings.submitHandler.call( validator, validator.currentForm );
   if (validator.submitButton) {
 // and clean up afterwards;thanks to no-block-scope, hidden can be referenced
 hidden.remove();
  }
   return false;
  }
   return true;
 }
   
  // prevent submit for invalid forms or custom submit handlers
  if ( validator.cancelSubmit ) {
   validator.cancelSubmit = false;
   return handle();
 }
  if ( validator.form() ) {
   if ( validator.pendingRequest ) {
   validator.formSubmitted = true;
   return false;
  }
   return handle();
 } else {
   validator.focusInvalid();
   return false;
 }
 });
}
 
 return validator;
},
 // http://docs.jquery.com/Plugins/Validation/valid
 valid: function() {
 if ( $(this[0]).is('form')) {
   return this.validate().form();
} else {
   var valid = true;
   var validator = $(this[0].form).validate();
   this.each(function() {
  valid &= validator.element(this);
  });
   return valid;
}
 },
 // attributes: space seperated list of attributes to retrieve and remove
 removeAttrs: function(attributes) {
 var result = {},
  $element = this;
 $.each(attributes.split(/\s/), function(index, value) {
  result[value] = $element.attr(value);
  $element.removeAttr(value);
});
 return result;
},
 // http://docs.jquery.com/Plugins/Validation/rules
 rules: function(command, argument) {
 var element = this[0];
 
 if (command) {
  var settings = $.data(element.form, 'validator').settings;
  var staticRules = settings.rules;
  var existingRules = $.validator.staticRules(element);
  switch(command) {
  case "add":
  $.extend(existingRules, $.validator.normalizeRule(argument));
  staticRules[element.name] = existingRules;
  if (argument.messages)
   settings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );
  break;
  case "remove":
  if (!argument) {
   delete staticRules[element.name];
   return existingRules;
 }
  var filtered = {};
  $.each(argument.split(/\s/), function(index, method) {
   filtered[method] = existingRules[method];
   delete existingRules[method];
 });
  return filtered;
 }
}
 
 var data = $.validator.normalizeRules(
 $.extend(
  {},
  $.validator.metadataRules(element),
  $.validator.classRules(element),
  $.validator.attributeRules(element),
  $.validator.staticRules(element)
 ), element);
 
 // make sure required is at front
 if (data.required) {
  var param = data.required;
  delete data.required;
  data = $.extend({required: param}, data);
}
 
 return data;
}
});

// Custom selectors
$.extend($.expr[":"], {
 // http://docs.jquery.com/Plugins/Validation/blank
 blank: function(a) {return !$.trim("" + a.value);},
 // http://docs.jquery.com/Plugins/Validation/filled
 filled: function(a) {return !!$.trim("" + a.value);},
 // http://docs.jquery.com/Plugins/Validation/unchecked
 unchecked: function(a) {return !a.checked;}
});

// constructor for validator
$.validator = function( options, form ) {
 this.settings = $.extend( true, {}, $.validator.defaults, options );
 this.currentForm = form;
 this.init();
};

$.validator.format = function(source, params) {
 if ( arguments.length == 1 ) 
 return function() {
  var args = $.makeArray(arguments);
  args.unshift(source);
  return $.validator.format.apply( this, args );
};
 if ( arguments.length > 2 && params.constructor != Array ) {
 params = $.makeArray(arguments).slice(1);
}
 if ( params.constructor != Array ) {
 params = [ params ];
}
 $.each(params, function(i, n) {
 source = source.replace(new RegExp("\\{" + i + "\\}", "g"), n);
});
 return source;
};

$.extend($.validator, {
 
 defaults: {
 messages: {},
 groups: {},
 rules: {},
 errorClass: "error",
 validClass: "valid",
 errorElement: "label",
 focusInvalid: true,
 errorContainer: $( [] ),
 errorLabelContainer: $( [] ),
 onsubmit: true,
 ignore: [],
 ignoreTitle: false,
 onfocusin: function(element) {
  this.lastActive = element;
  
  // hide error label and remove error class on focus if enabled
  if ( this.settings.focusCleanup && !this.blockFocusCleanup ) {
  this.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
  this.errorsFor(element).hide();
 }
},
 onfocusout: function(element) {
  if ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {
  this.element(element);
 }
},
 onkeyup: function(element) {
  if ( element.name in this.submitted || element == this.lastElement ) {
  this.element(element);
 }
},
 onclick: function(element) {
  // click on selects, radiobuttons and checkboxes
  if ( element.name in this.submitted )
  this.element(element);
  // or option elements, check parent select in that case
  else if (element.parentNode.name in this.submitted)
  this.element(element.parentNode);
},
 highlight: function( element, errorClass, validClass ) {
  $(element).addClass(errorClass).removeClass(validClass);
},
 unhighlight: function( element, errorClass, validClass ) {
  $(element).removeClass(errorClass).addClass(validClass);
}
},

 // http://docs.jquery.com/Plugins/Validation/Validator/setDefaults
 setDefaults: function(settings) {
 $.extend( $.validator.defaults, settings );
},

 messages: {
 required: "This field is required.",
 remote: "Please fix this field.",
 email: "Please enter a valid email address.",
 url: "Please enter a valid URL.",
 date: "Please enter a valid date.",
 dateISO: "Please enter a valid date (ISO).",
 number: "Please enter a valid number.",
 digits: "Please enter only digits.",
 creditcard: "Please enter a valid credit card number.",
 equalTo: "Please enter the same value again.",
 accept: "Please enter a value with a valid extension.",
 maxlength: $.validator.format("Please enter no more than {0} characters."),
 minlength: $.validator.format("Please enter at least {0} characters."),
 rangelength: $.validator.format("Please enter a value between {0} and {1} characters long."),
 range: $.validator.format("Please enter a value between {0} and {1}."),
 max: $.validator.format("Please enter a value less than or equal to {0}."),
 min: $.validator.format("Please enter a value greater than or equal to {0}.")
},
 
 autoCreateRanges: false,
 
 prototype: {
 
 init: function() {
  this.labelContainer = $(this.settings.errorLabelContainer);
  this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
  this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
  this.submitted = {};
  this.valueCache = {};
  this.pendingRequest = 0;
  this.pending = {};
  this.invalid = {};
  this.reset();
  
  var groups = (this.groups = {});
  $.each(this.settings.groups, function(key, value) {
  $.each(value.split(/\s/), function(index, name) {
   groups[name] = key;
 });
 });
  var rules = this.settings.rules;
  $.each(rules, function(key, value) {
  rules[key] = $.validator.normalizeRule(value);
 });
  
  function delegate(event) {
  var validator = $.data(this[0].form, "validator"),
   eventType = "on" + event.type.replace(/^validate/, "");
  validator.settings[eventType] && validator.settings[eventType].call(validator, this[0] );
 }
  $(this.currentForm)
  .validateDelegate(":text, :password, :file, select, textarea", "focusin focusout keyup", delegate)
  .validateDelegate(":radio, :checkbox, select, option", "click", delegate);

  if (this.settings.invalidHandler)
  $(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
},

 // http://docs.jquery.com/Plugins/Validation/Validator/form
 form: function() {
  this.checkForm();
  $.extend(this.submitted, this.errorMap);
  this.invalid = $.extend({}, this.errorMap);
  if (!this.valid())
  $(this.currentForm).triggerHandler("invalid-form", [this]);
  this.showErrors();
  return this.valid();
},
 
 checkForm: function() {
  this.prepareForm();
  for ( var i = 0, elements = (this.currentElements = this.elements());elements[i];i++ ) {
  this.check( elements[i] );
 }
  return this.valid();
},
 
 // http://docs.jquery.com/Plugins/Validation/Validator/element
 element: function( element ) {
  element = this.clean( element );
  this.lastElement = element;
  this.prepareElement( element );
  this.currentElements = $(element);
  var result = this.check( element );
  if ( result ) {
  delete this.invalid[element.name];
 } else {
  this.invalid[element.name] = true;
 }
  if ( !this.numberOfInvalids() ) {
  // Hide error containers on last error
  this.toHide = this.toHide.add( this.containers );
 }
  this.showErrors();
  return result;
},

 // http://docs.jquery.com/Plugins/Validation/Validator/showErrors
 showErrors: function(errors) {
  if(errors) {
  // add items to error list and map
  $.extend( this.errorMap, errors );
  this.errorList = [];
  for ( var name in errors ) {
   this.errorList.push({
   message: errors[name],
   element: this.findByName(name)[0]
  });
 }
  // remove items from success list
  this.successList = $.grep( this.successList, function(element) {
   return !(element.name in errors);
 });
 }
  this.settings.showErrors
  ? this.settings.showErrors.call( this, this.errorMap, this.errorList )
  : this.defaultShowErrors();
},
 
 // http://docs.jquery.com/Plugins/Validation/Validator/resetForm
 resetForm: function() {
  if ( $.fn.resetForm )
  $( this.currentForm ).resetForm();
  this.submitted = {};
  this.prepareForm();
  this.hideErrors();
  this.elements().removeClass( this.settings.errorClass );
},
 
 numberOfInvalids: function() {
  return this.objectLength(this.invalid);
},
 
 objectLength: function( obj ) {
  var count = 0;
  for ( var i in obj )
  count++;
  return count;
},
 
 hideErrors: function() {
  this.addWrapper( this.toHide ).hide();
},
 
 valid: function() {
  return this.size() == 0;
},
 
 size: function() {
  return this.errorList.length;
},
 
 focusInvalid: function() {
  if( this.settings.focusInvalid ) {
  try {
   $(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])
   .filter(":visible")
   .focus()
   // manually trigger focusin event;without it, focusin handler isn't called, findLastActive won't have anything to find
   .trigger("focusin");
 } catch(e) {
   // ignore IE throwing errors when focusing hidden elements
 }
 }
},
 
 findLastActive: function() {
  var lastActive = this.lastActive;
  return lastActive && $.grep(this.errorList, function(n) {
  return n.element.name == lastActive.name;
 }).length == 1 && lastActive;
},
 
 elements: function() {
  var validator = this,
  rulesCache = {};
  
  // select all valid inputs inside the form (no submit or reset buttons)
  // workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved
  return $([]).add(this.currentForm.elements)
  .filter(":input")
  .not(":submit, :reset, :image, [disabled]")
  .not( this.settings.ignore )
  .filter(function() {
  !this.name && validator.settings.debug && window.console && console.error( "%o has no name assigned", this);
  
  // select only the first element for each name, and only those with rules specified
  if ( this.name in rulesCache || !validator.objectLength($(this).rules()) )
   return false;
  
  rulesCache[this.name] = true;
  return true;
 });
},
 
 clean: function( selector ) {
  return $( selector )[0];
},
 
 errors: function() {
  return $( this.settings.errorElement + "." + this.settings.errorClass, this.errorContext );
},
 
 reset: function() {
  this.successList = [];
  this.errorList = [];
  this.errorMap = {};
  this.toShow = $([]);
  this.toHide = $([]);
  this.currentElements = $([]);
},
 
 prepareForm: function() {
  this.reset();
  this.toHide = this.errors().add( this.containers );
},
 
 prepareElement: function( element ) {
  this.reset();
  this.toHide = this.errorsFor(element);
},
 
 check: function( element ) {
  element = this.clean( element );
  
  // if radio/checkbox, validate first element in group instead
  if (this.checkable(element)) {
  element = this.findByName( element.name )[0];
 }
  
  var rules = $(element).rules();
  var dependencyMismatch = false;
  for( method in rules ) {
  var rule = {method: method, parameters: rules[method]};
  try {
   var result = $.validator.methods[method].call( this, element.value.replace(/\r/g, ""), element, rule.parameters );
   
   // if a method indicates that the field is optional and therefore valid,
   // don't mark it as valid when there are no other rules
   if ( result == "dependency-mismatch" ) {
   dependencyMismatch = true;
   continue;
  }
   dependencyMismatch = false;
   
   if ( result == "pending" ) {
   this.toHide = this.toHide.not( this.errorsFor(element) );
   return;
  }
   
   if( !result ) {
   this.formatAndAdd( element, rule );
   return false;
  }
 } catch(e) {
   this.settings.debug && window.console && console.log("exception occured when checking element " + element.id
 + ", check the '" + rule.method + "' method", e);
   throw e;
 }
 }
  if (dependencyMismatch)
  return;
  if ( this.objectLength(rules) )
  this.successList.push(element);
  return true;
},
 
 // return the custom message for the given element and validation method
 // specified in the element's "messages" metadata
 customMetaMessage: function(element, method) {
  if (!$.metadata)
  return;
  
  var meta = this.settings.meta
  ? $(element).metadata()[this.settings.meta]
  : $(element).metadata();
  
  return meta && meta.messages && meta.messages[method];
},
 
 // return the custom message for the given element name and validation method
 customMessage: function( name, method ) {
  var m = this.settings.messages[name];
  return m && (m.constructor == String
  ? m
  : m[method]);
},
 
 // return the first defined argument, allowing empty strings
 findDefined: function() {
  for(var i = 0;i < arguments.length;i++) {
  if (arguments[i] !== undefined)
   return arguments[i];
 }
  return undefined;
},
 
 defaultMessage: function( element, method) {
  return this.findDefined(
  this.customMessage( element.name, method ),
  this.customMetaMessage( element, method ),
  // title is never undefined, so handle empty string as undefined
  !this.settings.ignoreTitle && element.title || undefined,
  $.validator.messages[method],
  "<strong>Warning: No message defined for " + element.name + "</strong>"
  );
},
 
 formatAndAdd: function( element, rule ) {
  var message = this.defaultMessage( element, rule.method ),
  theregex = /\$?\{(\d+)\}/g;
  if ( typeof message == "function" ) {
  message = message.call(this, rule.parameters, element);
 } else if (theregex.test(message)) {
  message = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters);
 }  
  this.errorList.push({
  message: message,
  element: element
 });
  
  this.errorMap[element.name] = message;
  this.submitted[element.name] = message;
},
 
 addWrapper: function(toToggle) {
  if ( this.settings.wrapper )
  toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
  return toToggle;
},
 
 defaultShowErrors: function() {
  for ( var i = 0;this.errorList[i];i++ ) {
  var error = this.errorList[i];
  this.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
  this.showLabel( error.element, error.message );
 }
  if( this.errorList.length ) {
  this.toShow = this.toShow.add( this.containers );
 }
  if (this.settings.success) {
  for ( var i = 0;this.successList[i];i++ ) {
   this.showLabel( this.successList[i] );
 }
 }
  if (this.settings.unhighlight) {
  for ( var i = 0, elements = this.validElements();elements[i];i++ ) {
   this.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );
 }
 }
  this.toHide = this.toHide.not( this.toShow );
  this.hideErrors();
  this.addWrapper( this.toShow ).show();
},
 
 validElements: function() {
  return this.currentElements.not(this.invalidElements());
},
 
 invalidElements: function() {
  return $(this.errorList).map(function() {
  return this.element;
 });
},
 
 showLabel: function(element, message) {
  var label = this.errorsFor( element );
  if ( label.length ) {
  // refresh error/success class
  label.removeClass().addClass( this.settings.errorClass );
  
  // check if we have a generated label, replace the message then
  label.attr("generated") && label.html(message);
 } else {
  // create label
  label = $("<" + this.settings.errorElement + "/>")
   .attr({"for": this.idOrName(element), generated: true})
   .addClass(this.settings.errorClass)
   .html(message || "");
  if ( this.settings.wrapper ) {
   // make sure the element is visible, even in IE
   // actually showing the wrapped element is handled elsewhere
   label = label.hide().show().wrap("<" + this.settings.wrapper + "/>").parent();
 }
  if ( !this.labelContainer.append(label).length )
   this.settings.errorPlacement
   ? this.settings.errorPlacement(label, $(element) )
   : label.insertAfter(element);
 }
  if ( !message && this.settings.success ) {
  label.text("");
  typeof this.settings.success == "string"
   ? label.addClass( this.settings.success )
   : this.settings.success( label );
 }
  this.toShow = this.toShow.add(label);
},
 
 errorsFor: function(element) {
  var name = this.idOrName(element);
   return this.errors().filter(function() {
  return $(this).attr('for') == name;
 });
},
 
 idOrName: function(element) {
  return this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);
},

 checkable: function( element ) {
  return /radio|checkbox/i.test(element.type);
},
 
 findByName: function( name ) {
  // select by name and filter by form for performance over form.find("[name=...]")
  var form = this.currentForm;
  return $(document.getElementsByName(name)).map(function(index, element) {
  return element.form == form && element.name == name && element || null;
 });
},
 
 getLength: function(value, element) {
  switch( element.nodeName.toLowerCase() ) {
  case 'select':
  return $("option:selected", element).length;
  case 'input':
  if( this.checkable( element) )
   return this.findByName(element.name).filter(':checked').length;
 }
  return value.length;
},
 
 depend: function(param, element) {
  return this.dependTypes[typeof param]
  ? this.dependTypes[typeof param](param, element)
  : true;
},
 
 dependTypes: {
  "boolean": function(param, element) {
  return param;
 },
  "string": function(param, element) {
  return !!$(param, element.form).length;
 },
  "function": function(param, element) {
  return param(element);
 }
},
 
 optional: function(element) {
  return !$.validator.methods.required.call(this, $.trim(element.value), element) && "dependency-mismatch";
},
 
 startRequest: function(element) {
  if (!this.pending[element.name]) {
  this.pendingRequest++;
  this.pending[element.name] = true;
 }
},
 
 stopRequest: function(element, valid) {
  this.pendingRequest--;
  // sometimes synchronization fails, make sure pendingRequest is never < 0
  if (this.pendingRequest < 0)
  this.pendingRequest = 0;
  delete this.pending[element.name];
  if ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {
  $(this.currentForm).submit();
  this.formSubmitted = false;
 } else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {
  $(this.currentForm).triggerHandler("invalid-form", [this]);
  this.formSubmitted = false;
 }
},
 
 previousValue: function(element) {
  return $.data(element, "previousValue") || $.data(element, "previousValue", {
  old: null,
  valid: true,
  message: this.defaultMessage( element, "remote" )
 });
}
 
},
 
 classRuleSettings: {
 required: {required: true},
 email: {email: true},
 url: {url: true},
 date: {date: true},
 dateISO: {dateISO: true},
 dateDE: {dateDE: true},
 number: {number: true},
 numberDE: {numberDE: true},
 digits: {digits: true},
 creditcard: {creditcard: true}
},
 
 addClassRules: function(className, rules) {
 className.constructor == String ?
  this.classRuleSettings[className] = rules :
  $.extend(this.classRuleSettings, className);
},
 
 classRules: function(element) {
 var rules = {};
 var classes = $(element).attr('class');
 classes && $.each(classes.split(' '), function() {
  if (this in $.validator.classRuleSettings) {
  $.extend(rules, $.validator.classRuleSettings[this]);
 }
});
 return rules;
},
 
 attributeRules: function(element) {
 var rules = {};
 var $element = $(element);
 
 for (method in $.validator.methods) {
  var value = $element.attr(method);
  if (value) {
  rules[method] = value;
 }
}
 
 // maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
 if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
  delete rules.maxlength;
}
 
 return rules;
},
 
 metadataRules: function(element) {
 if (!$.metadata) return {};
 
 var meta = $.data(element.form, 'validator').settings.meta;
 return meta ?
  $(element).metadata()[meta] :
  $(element).metadata();
},
 
 staticRules: function(element) {
 var rules = {};
 var validator = $.data(element.form, 'validator');
 if (validator.settings.rules) {
  rules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};
}
 return rules;
},
 
 normalizeRules: function(rules, element) {
 // handle dependency check
 $.each(rules, function(prop, val) {
  // ignore rule when param is explicitly false, eg. required:false
  if (val === false) {
  delete rules[prop];
  return;
 }
  if (val.param || val.depends) {
  var keepRule = true;
  switch (typeof val.depends) {
   case "string":
   keepRule = !!$(val.depends, element.form).length;
   break;
   case "function":
   keepRule = val.depends.call(element, element);
   break;
 }
  if (keepRule) {
   rules[prop] = val.param !== undefined ? val.param : true;
 } else {
   delete rules[prop];
 }
 }
});
 
 // evaluate parameters
 $.each(rules, function(rule, parameter) {
  rules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;
});
 
 // clean number parameters
 $.each(['minlength', 'maxlength', 'min', 'max'], function() {
  if (rules[this]) {
  rules[this] = Number(rules[this]);
 }
});
 $.each(['rangelength', 'range'], function() {
  if (rules[this]) {
  rules[this] = [Number(rules[this][0]), Number(rules[this][1])];
 }
});
 
 if ($.validator.autoCreateRanges) {
  // auto-create ranges
  if (rules.min && rules.max) {
  rules.range = [rules.min, rules.max];
  delete rules.min;
  delete rules.max;
 }
  if (rules.minlength && rules.maxlength) {
  rules.rangelength = [rules.minlength, rules.maxlength];
  delete rules.minlength;
  delete rules.maxlength;
 }
}
 
 // To support custom messages in metadata ignore rule methods titled "messages"
 if (rules.messages) {
  delete rules.messages;
}
 
 return rules;
},
 
 // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
 normalizeRule: function(data) {
 if( typeof data == "string" ) {
  var transformed = {};
  $.each(data.split(/\s/), function() {
  transformed[this] = true;
 });
  data = transformed;
}
 return data;
},
 
 // http://docs.jquery.com/Plugins/Validation/Validator/addMethod
 addMethod: function(name, method, message) {
 $.validator.methods[name] = method;
 $.validator.messages[name] = message != undefined ? message : $.validator.messages[name];
 if (method.length < 3) {
  $.validator.addClassRules(name, $.validator.normalizeRule(name));
}
},

 methods: {

 // http://docs.jquery.com/Plugins/Validation/Methods/required
 required: function(value, element, param) {
  // check if dependency is met
  if ( !this.depend(param, element) )
  return "dependency-mismatch";
  switch( element.nodeName.toLowerCase() ) {
  case 'select':
  // could be an array for select-multiple or a string, both are fine this way
  var val = $(element).val();
  return val && val.length > 0;
  case 'input':
  if ( this.checkable(element) )
   return this.getLength(value, element) > 0;
  default:
  return $.trim(value).length > 0;
 }
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/remote
 remote: function(value, element, param) {
  if ( this.optional(element) )
  return "dependency-mismatch";
  
  var previous = this.previousValue(element);
  if (!this.settings.messages[element.name] )
  this.settings.messages[element.name] = {};
  previous.originalMessage = this.settings.messages[element.name].remote;
  this.settings.messages[element.name].remote = previous.message;
  
  param = typeof param == "string" && {url:param} || param;
  
  if ( previous.old !== value ) {
  previous.old = value;
  var validator = this;
  this.startRequest(element);
  var data = {};
  data[element.name] = value;
  $.ajax($.extend(true, {
   url: param,
   mode: "abort",
   port: "validate" + element.name,
   dataType: "json",
   data: data,
   success: function(response) {
   validator.settings.messages[element.name].remote = previous.originalMessage;
   var valid = response === true;
   if ( valid ) {
 var submitted = validator.formSubmitted;
 validator.prepareElement(element);
 validator.formSubmitted = submitted;
 validator.successList.push(element);
 validator.showErrors();
  } else {
 var errors = {};
 var message = (previous.message = response || validator.defaultMessage( element, "remote" ));
 errors[element.name] = $.isFunction(message) ? message(value) : message;
 validator.showErrors(errors);
  }
   previous.valid = valid;
   validator.stopRequest(element, valid);
  }
 }, param));
  return "pending";
 } else if( this.pending[element.name] ) {
  return "pending";
 }
  return previous.valid;
},

 // http://docs.jquery.com/Plugins/Validation/Methods/minlength
 minlength: function(value, element, param) {
  return this.optional(element) || this.getLength($.trim(value), element) >= param;
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/maxlength
 maxlength: function(value, element, param) {
  return this.optional(element) || this.getLength($.trim(value), element) <= param;
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/rangelength
 rangelength: function(value, element, param) {
  var length = this.getLength($.trim(value), element);
  return this.optional(element) || ( length >= param[0] && length <= param[1] );
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/min
 min: function( value, element, param ) {
  return this.optional(element) || value >= param;
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/max
 max: function( value, element, param ) {
  return this.optional(element) || value <= param;
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/range
 range: function( value, element, param ) {
  return this.optional(element) || ( value >= param[0] && value <= param[1] );
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/email
 email: function(value, element) {
  // contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
  return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/url
 url: function(value, element) {
  // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
  return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/date
 date: function(value, element) {
  return this.optional(element) || !/Invalid|NaN/.test(new Date(value));
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/dateISO
 dateISO: function(value, element) {
  return this.optional(element) || /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(value);
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/number
 number: function(value, element) {
  return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(value);
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/digits
 digits: function(value, element) {
  return this.optional(element) || /^\d+$/.test(value);
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/creditcard
 // based on http://en.wikipedia.org/wiki/Luhn
 creditcard: function(value, element) {
  if ( this.optional(element) )
  return "dependency-mismatch";
  // accept only digits and dashes
  if (/[^0-9-]+/.test(value))
  return false;
  var nCheck = 0,
  nDigit = 0,
  bEven = false;

  value = value.replace(/\D/g, "");

  for (var n = value.length - 1;n >= 0;n--) {
  var cDigit = value.charAt(n);
  var nDigit = parseInt(cDigit, 10);
  if (bEven) {
   if ((nDigit *= 2) > 9)
   nDigit -= 9;
 }
  nCheck += nDigit;
  bEven = !bEven;
 }

  return (nCheck % 10) == 0;
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/accept
 accept: function(value, element, param) {
  param = typeof param == "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
  return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
},
 
 // http://docs.jquery.com/Plugins/Validation/Methods/equalTo
 equalTo: function(value, element, param) {
  // bind to the blur event of the target in order to revalidate whenever the target field is updated
  // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
  var target = $(param).unbind(".validate-equalTo").bind("blur.validate-equalTo", function() {
  $(element).valid();
 });
  return value == target.val();
}
 
}
 
});

// deprecated, use $.validator.format instead
$.format = $.validator.format;

})(jQuery);

// ajax mode: abort
// usage: $.ajax({mode: "abort"[, port: "uniqueport"]});
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() 
;(function($) {
 var ajax = $.ajax;
 var pendingRequests = {};
 $.ajax = function(settings) {
 // create settings for compatibility with ajaxSetup
 settings = $.extend(settings, $.extend({}, $.ajaxSettings, settings));
 var port = settings.port;
 if (settings.mode == "abort") {
  if ( pendingRequests[port] ) {
  pendingRequests[port].abort();
 }
  return (pendingRequests[port] = ajax.apply(this, arguments));
}
 return ajax.apply(this, arguments);
};
})(jQuery);

// provides cross-browser focusin and focusout events
// IE has native support, in other browsers, use event caputuring (neither bubbles)

// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target 
;(function($) {
 // only implement if not provided by jQuery core (since 1.4)
 // TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs
 if (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {
 $.each({
  focus: 'focusin',
  blur: 'focusout' 
}, function( original, fix ){
  $.event.special[fix] = {
  setup:function() {
   this.addEventListener( original, handler, true );
 },
  teardown:function() {
   this.removeEventListener( original, handler, true );
 },
  handler: function(e) {
   arguments[0] = $.event.fix(e);
   arguments[0].type = fix;
   return $.event.handle.apply(this, arguments);
 }
 };
  function handler(e) {
  e = $.event.fix(e);
  e.type = fix;
  return $.event.handle.call(this, e);
 }
});
};
 $.extend($.fn, {
 validateDelegate: function(delegate, type, handler) {
  return this.bind(type, function(event) {
  var target = $(event.target);
  if (target.is(delegate)) {
   return handler.apply(target, arguments);
 }
 });
}
});
})(jQuery);


 switch (cfg["langueAbr"])
 {
 case 'fr':
 jQuery.extend(jQuery.validator.messages, {
   required: "Ce champ est obligatoire.",
   remote: "Corrigez ce champ.",
   email: "Courriel invalide",
   url: "Lien invalide.",
  complete_url: "Lien invalide.",
   date: "Date invalide.",
   dateISO: "Date invalide.",
   number: "Chiffre invalide.",
   digits: "Nombre seulement.",
   creditcard: "Numéro de carte de crédit invalide",
   equalTo: "Entrez la même valeur.",
   accept: "Extension invalide.",
   maxlength: $.validator.format("Entrez une valeur avec {0} caractère(s) maximum."),
   minlength: $.validator.format("Entrez une valeur avec {0} caractère(s) minimum."),
   rangelength: $.validator.format("Entrez une valeur entre{0} et {1} caractère(s) de long."),
   range: $.validator.format("Entrez une valeur entre {0} et {1}."),
   max: $.validator.format("Entrez une valeur plus petite ou égale à {0}."),
   min: $.validator.format("Entrez une valeur plus grande ou égale à {0}."),
  telephone : "Téléphone invalide"
});
  break;
 case 'en':
 jQuery.extend(jQuery.validator.messages, {
  complete_url: "Please enter a valid URL,"  
});
 break; 
 case 'es':
 jQuery.extend(jQuery.validator.messages, {
   required: "ESCe champ est obligatoire.",
   remote: "ESCorrigez ce champ.",
   email: "ESCourriel invalide",
   url: "ESLien invalide.",
  complete_url: "ESLien invalide.",  
   date: "ESDate invalide.",
   dateISO: "ESDate invalide.",
   number: "ESChiffre invalide.",
   digits: "ESNombre seulement.",
   creditcard: "ESNuméro de carte de crédit invalide",
   equalTo: "ESEntrez la même valeur.",
   accept: "ESExtension invalide.",
   maxlength: $.validator.format("ESEntrez une valeur avec {0} caractère(s) maximum."),
   minlength: $.validator.format("ESEntrez une valeur avec {0} caractère(s) minimum."),
   rangelength: $.validator.format("ESEntrez une valeur entre{0} et {1} caractère(s) de long."),
   range: $.validator.format("ESEntrez une valeur entre {0} et {1}."),
   max: $.validator.format("ESEntrez une valeur plus petite ou égale à {0}."),
   min: $.validator.format("ESEntrez une valeur plus grande ou égale à {0}."),
  telephone : "ENTéléphone invalide"
});
  break;
} 



var langue=new Object();
switch (cfg["langueAbr"])
{
 case 'fr':
 langue.nomLangue = 'Français';
 langue.prenom = 'prenom';
 langue.nom  = 'nom';
 langue.saisons = ["VIDE","Hiver","Automne","Été","Printemps"];
 langue.estEnvoye = 'Ce formulaire a déjà été envoyé.';
 langue.mois   = ["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"];
 langue.moisabr  = ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juill.', 'aout', 'sept.', 'oct.', 'nov.', 'dec.'];
 langue.jours   = ["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"];
 langue.joursMin = ["D","L","M","M","J","V","S"];
 langue.joursAbr = ["dim.","lun.","mar.","mer.","jeu.","ven.","sam."];
 break;
 
 case 'en': 
 langue.nomLangue = 'English';
 langue.prenom = 'firstname';
 langue.nom  = 'name';
 langue.saisons = ["VIDE","Winter","Autumn","Summer","Spring"];
 langue.estEnvoye = 'This for has already been sent.';
 langue.mois   = ["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"];
 langue.moisAbr  = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
 langue.jours   = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
 langue.joursMin = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
 langue.joursAbr = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
 break;
}
$(document).ready(function() {

 // Mouse hover sur les obj
 $(".partenairesBas>li:has(a), #btnPageIndex>li").hover(function(){
 $(this).stop(true,true).fadeTo("fast", 0.5);
},function(){
 $(this).stop(true,true).fadeTo("fast", 1.0);
}) 
 
 $.nyroModalSettings({
 processHandler: function(settings) {
  //$(settings.from).attr('class');
  var scaleRatio = 1;
  var from = settings.from;
  if (from && from.href && (from.href.indexOf('http://www.youtube.com/watch?v=') == 0|| from.href.indexOf('http://www.youtube.com/p/') == 0)) {
  $.nyroModalSettings({
   type: 'swf',
   zIndexStart : 99999,
   width: (990 * scaleRatio),
   height: (580 * scaleRatio),
   url: (from.href.replace(new RegExp("watch\\?v=", "i"), 'v/') + '&autoplay=1')
 });
 } else if (from && from.href && (from.href.indexOf('/fr/galerie-de-photos/') > 0)) {
  var tmpBoxmodel = $.support.boxModel;
  $.support.boxModel = 0;
  $.nyroModalSettings({
   type : 'iframe',
   zIndexStart : 99999,
   width: 667,
   height: 502,
   padding: 0,
   url: from.href
 });
 }
}
});



 //banque d'images
 // We only want these styles applied when javascript is enabled
 if($('#banqueDImagesThumnails').length >0){
  //$('div.navigation').css({'width' : '300px', 'float' : 'left'});
  $('div.content').css('display', 'block');

  // Initially set opacity on thumbs and add
  // additional styling for hover effect on thumbs
  var onMouseOutOpacity = 0.67;

  // Initialize Advanced Galleriffic Gallery
  var gallery = $('#banqueDImagesThumnails').galleriffic({
   delay:  5000,
   numThumbs:   20,
   preloadAhead: -1,
   enableTopPager:   true,
   enableBottomPager:  true,
   maxPagesToShow:   7,
   imageContainerSel:  '#slideshow',
   controlsContainerSel:   '#controls',
   captionContainerSel: '#caption',
   loadingContainerSel: '#loading',
   renderSSControls:  true,
   renderNavControls:  true,
   playLinkText: 'Lancer le défilement',
   pauseLinkText: 'Pause',
   prevLinkText: '&lsaquo;Photo précédente',
   nextLinkText: 'Photo suivante &rsaquo;',
   nextPageLinkText:  'Suivant &rsaquo;',
   prevPageLinkText:  '&lsaquo;Précédent',
   enableHistory: false,
   autoStart:   false,
   syncTransitions:   true,
   defaultTransitionDuration: 900,
   onSlideChange: function(prevIndex, nextIndex) {
   // 'this' refers to the gallery, which is an extension of $('#thumbs')
   this.find('ul.thumbs').children()
 .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
 .eq(nextIndex).fadeTo('fast', 1.0);
  }
 });
  
  $('div#controls').prepend('<a href="#" class="slideviewer"></a>');
  $('#banqueDImagesThumnails').prepend('<div class="fond"></div>');
  $('#banqueDImagesThumnails div.fond').css('height',($(window).height()-60)+'px').fadeTo(0,0.5);
  $('#banqueDImagesThumnailsFixe').css('height',($(window).height()-60)+'px')
  $('#banqueDImagesThumnails').css('height',($(window).height()-60)+'px')
  
  $('div#controls a.slideviewer').click(function(){
   $('#banqueDImagesThumnailsFixe').stop(true,true).slideToggle(500);
 })
  
  $('div#boiteBanqueDImages').css('height',$(window).height()+'px');
  $('div#boiteBanqueDImages').css('width',$(window).width()+'px');
  $('div#caption').css('width',(($(window).width()-20)-$('div#controls').width())+'px');
  $('#banqueDImagesThumnails ul').css('height',($(window).height()-60)+'px')
  
  $('div#controls div.nav-controls').css('top',(0-($(window).height()/2)-($('div#controls div.nav-controls').outerHeight()/2))+'px')
}










 
 
 
 
 $("a[href^='http:'],a[href^='https:']")
  .not("[href*='" + location.hostname + "']").attr('target','_blank')
  .not(":has(img)")
  .not("[id]")
  .after('<img src="/images/icones/icone_externe.gif" width="12" height="12" alt="external link" style="margin-left:3px;"/>');


 
  $('.antiSpam').each(function(i) {
  jQuery(this).html(AntiSpam(jQuery(this).html())).toggle();
 });
 if($('#nav').length > 0){
 activerMenus('nav',250);
}
 
 switch (cfg["langueAbr"]){
  case "fr":
  $.datepicker.setDefaults({
   buttonText: 'Selection',
   closeText: 'Fermer',
   prevText: '&#x3c;Préc',
   nextText: 'Suiv&#x3e;',
   currentText: 'Courant',
   monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
   monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun','Jul','Aoû','Sep','Oct','Nov','Déc'],
   dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
   dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'],
   dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'],
   dateFormat : 'd MM, yy',
   altFormat : 'yy-mm-dd'
  });
   break;
  case "en":
  $.datepicker.setDefaults({
  dateFormat : 'd MM yy',
  altFormat : 'yy-mm-dd'
 });

   break;

  case "es":
  $.datepicker.setDefaults({
   buttonText: 'Selection',
   closeText: 'Cerrar',
   prevText: '&#x3c;Ant',
   nextText: 'Sig&#x3e;',
   currentText: 'Hoy',
   monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
   monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
   dayNames: ['Domingo','Lunes','Martes','Mi&eacute;rcoles','Jueves','Viernes','S&aacute;bado'],
   dayNamesShort: ['Dom','Lun','Mar','Mi&eacute;','Juv','Vie','S&aacute;b'],
   dayNamesMin: ['Do','Lu','Ma','Mi','Ju','Vi','S&aacute;'],
   dateFormat: 'd MM, yy',
   altFormat : 'yy-mm-dd'
 });
   break;
}
 
 $('input.datepicker').each(function(){
  var prefix = "texte";
  $(this).clone(false).attr("id", prefix + $(this).attr('id'))
 .attr("name", prefix + $(this).attr('name'))
 .attr("readonly", true)
 .insertAfter($(this));
 
  $('#' + prefix + this.id).datepicker({
   altField : '#' + this.id,
   showOn  : 'both'
 }).next('button').text('»').button({icons:{primary : 'ui-icon-calendar'}});

  var dateValue = $.trim($(this).val());

  if(dateValue.match(/\d{4}-\d{2}-\d{2}/i) && dateValue.length > 0)
  dateObj = $.datepicker.parseDate('yy-mm-dd', dateValue);
  else
  dateObj = new Date();
  
  $('#' + prefix + this.id).datepicker('setDate', dateObj);
  $(this).removeClass('datepicker').hide();
});
 
 
 // jQuery validator
 
 jQuery.validator.defaults.errorPlacement = function(error, element){
 if(element.is(':checkbox')){
  error.appendTo(element.closest('.ensembleCheckbox').parent());
}else if(element.is(':radio')){
  error.appendTo(element.closest('.ensembleCheckbox').parent());
}else{
  error.appendTo(element.parent());
}
};
 
 jQuery.validator.defaults.invalidHandler = function(form, validator){
 formTMP = $(form.target);
 setTimeout('smoothScrollToFirstError()',15);
}
 
 
});

function ajouterClassesObligatoires(nomFormulaire){
 
 if(typeof(nomFormulaire) == 'undefined'){
 nomFormulaire = 'Donnees';
}
 
 var nomFormulaire = "form[name=" + nomFormulaire +"]";
 
 $(nomFormulaire).find(':input,select,textarea').each(function(){
 if($(this).rules().required == true) {
  if($(this).is(':radio')){
  //$(this).closest('.ensembleCheckbox').sibblings('label').addclass('obl');
  $('#lbl_' + $(this).attr('name')).addClass('obl');
 }else if($(this).is(':checkbox')){
  $(this).closest('.boiteChamp').children('label').addClass('obl');
 }else{
  $(nomFormulaire +' :[for^='+ $(this).attr('name').replace('[]','') +']').addClass('obl');
 }
}
});
}

function populerListeVilles(fonction,destination,param,valeur){
 if(param.val() != 0){
 $.ajax({
  url: '/utilitaires/run.php?ajax=1',
  data: {executer: fonction, parametre: param.val(), defaut: valeur},
  type: 'get',
  async: false,
  cache: true,
  dataType: "json",
  success: function(data) {
   var obj = destination;
   if(data.length > 0 ){
   obj.html('');
   $.each(data,function(key,values){
 $(obj).append($('<option></option>').attr("value",values.valeur).text(values.texte).attr('selected', values.selected ));
  });
   obj.show().attr("disabled","");
   obj.next().hide().attr("disabled","disabled");
   //$("#noVille").show().next().hide().attr("disabled","disabled");
  }else{
   obj.hide().attr("disabled","disabled");
   obj.val("");
   obj.next().show().attr("disabled","");
   //$("#noVille").hide().attr("disabled","disabled");
   //$("#noVille").val("");
   //$("#noVille").next().show().attr("disabled","");
  }
 },
  error: function() {
   alert("Failed to load names");
 }
});
}
 return true;
}

function submitPaypalForm(form,attributes,fields){
 var $form = form;
 $.each(attributes, function(k,v){
 $form.attr(k,v);
});
 $.each(fields, function(k,v){
 $('<input>').attr({
  type:"hidden",
  name:k,
  value:v
}).appendTo($form);
});
 $form.submit();
}


function goToByScroll(id){
  $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}

function smoothScrollToFirstError(){
 var listeErreurs = ($(formTMP).find('.error:eq(0)'));
 
 $.smoothScroll({
 scrollTarget: $(listeErreurs[0]),
 offset : -150,
 easing: 'easeOutBack'
});
}


