/* jquery.twitter.js v1.0
   http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter */
(function(a) { a.fn.getTwitter = function(b) { var d = a.extend({}, a.fn.getTwitter.defaults, b); a(this).hide(); if (d.showHeading) { a(this).append("<h2>" + d.headingText + "</h2>") } a(this).append('<ul id="twitter_update_list"><li></li></ul>'); a("ul#twitter_update_list").hide(); var c = a('<p id="' + d.preloaderId + '">' + d.loaderText + "</p>"); a(this).append(c); if (d.showProfileLink) { a(this).append('<a id="profileLink" href="http://twitter.com/' + d.userName + '">http://twitter.com/' + d.userName + "</a>") } a(this).show(); a.getScript("http://twitter.com/javascripts/blogger.js"); a.getScript("http://twitter.com/statuses/user_timeline/" + d.userName + ".json?callback=twitterCallback2&count=" + d.numTweets, function() { a(c).remove(); if (d.slideIn) { a("ul#twitter_update_list").slideDown(1000) } else { a("ul#twitter_update_list").show() } a("ul#twitter_update_list li:first").addClass("firstTweet"); a("ul#twitter_update_list li:last").addClass("lastTweet") }) }; a.fn.getTwitter.defaults = { userName: null, numTweets: 5, preloaderId: "preloader", loaderText: "Loading tweets...", slideIn: false, showHeading: true, headingText: "Latest Tweets", showProfileLink: true} })(jQuery);

/**
* **************************************************************
*                                                              *
* JavaScript  						                         *
*                                                              *
****************************************************************
*/


var t;//important pour le timer du featured Article home page

Orck = {

    // Active Debug Mode
    _DEBUG_: true,

    /**
    * Init function, the first function called once the page is loaded
    */
    Init: function() {

        //$.debug(Orck._DEBUG_);

        Orck.VedetteEvents.Init();
        Orck.OrckLive.Init();
        Orck.SubMenu.Init();
        Orck.LayoutGeneric.Init();
        Orck.SimpleModal.Init();
        Orck.SetHeightToElements.Init();
        Orck.ExternalLinks.Init();
        Orck.GoogleAnalytics.Init();
        Orck.templateEvents.Init();

        // PrettyPhoto
        $("a[rel^='prettyPhoto']").prettyPhoto({
            animation_speed: 'fast', /* fast/slow/normal */
            slideshow: false, /* false OR interval time in ms */
            autoplay_slideshow: false, /* true/false */
            opacity: 0.80, /* Value between 0 and 1 */
            show_title: true, /* true/false */
            theme: 'light_rounded',
            overlay_gallery: false,
            markup: '<div class="pp_pic_holder"><div class="ppt">&nbsp;</div><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content_container"><div class="pp_left"><div class="pp_right"><div class="pp_content"><div class="pp_loaderIcon"></div><div class="pp_fade"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><p class="pp_description"></p><a class="pp_close" href="#">'+ $('#prettyPhoto-label-close').html() +'</a><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0/0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div></div></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div><div class="pp_overlay"></div>'
        });
        $("a[rel^='prettyPhotoNoTitle']").prettyPhoto({
            animation_speed: 'fast', /* fast/slow/normal */
            slideshow: false, /* false OR interval time in ms */
            autoplay_slideshow: false, /* true/false */
            opacity: 0.80, /* Value between 0 and 1 */
            show_title: false, /* true/false */
            theme: 'light_rounded',
            overlay_gallery: false,
            markup: '<div class="pp_pic_holder"><div class="ppt">&nbsp;</div><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content_container"><div class="pp_left"><div class="pp_right"><div class="pp_content"><div class="pp_loaderIcon"></div><div class="pp_fade"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><p class="pp_description"></p><a class="pp_close" href="#">'+ $('#prettyPhoto-label-close').html() +'</a><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0/0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div></div></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div><div class="pp_overlay"></div>'
        });
    }
}
Orck.templateEvents = {
    Init: function() {
        var dtstart = $('.vevents .dtstart');
        if (dtstart.length > 0) {
            dtstart.each(function() {
                var summary = $(this).parent().find('.summary');
                if (summary.length > 0) {
                    var summaryHeight = summary.outerHeight();
                    var dtStartHeight = dtstart.outerHeight();
                    if (summaryHeight > dtStartHeight / 2) {
                        var diff = summaryHeight - dtStartHeight;
                        $(this).css('top', diff + dtStartHeight / 2);
                    }
                }
            });
        }
    }
};

    Orck.ExternalLinks = {
       // Ouvre tous les lien externe dans une nouvelle fenetre et ajoute une css class 'ext-link'
       Init: function() {
   		    $("a[href^='http']").each(function() {
   			    $(this).attr('target','_blank').addClass('ext-link');
   		    });
   	    }
    };
   
   Orck.SetHeightToElements = {
   	/*
   	* SetHeightToElements:
   	* Définit une hauteur identique à un groupe d'éléments
   	*
   	* Container : [Jquery Selector] Element parent de chaque groupe d'éléments à ajuster
   	* ItemsSelector : [String] Selecteur CSS de chaque éléments à ajuster
   	* Range : [Int] Optionel. Permet d'ajuster la hauteur par ensemble d'éléments plutot que sur tous les éléments du groupe.
   	**/

   	Init: function() {
   		//this.HandleHeight($(".mediaroom .employee-list"), ".fig", 2);
   		//this.HandleHeight($(".mediaroom .logo-list"), ".fig", 2);
   	},

   	HandleHeight: function(Container, ItemsSelector, Range) {
   		var tempHeight = 0;

   		$(Container).each(function() {
   			var tempTotalItems = $(ItemsSelector, this).length;
   			var RangeTemp = Range;

   			// Si le Range n'est pas définie, on y attribue le nombre total d'éléments
   			if (!RangeTemp || RangeTemp <= 1) {
   				RangeTemp = tempTotalItems;
   			}

   			for (i = 0; i < tempTotalItems; i += RangeTemp) {

   				// On cherche la hauteur la plus grande
   				$(ItemsSelector, this).slice(i, i + RangeTemp).each(function() {
   					if ($(this).height() > tempHeight) {
   						tempHeight = $(this).height();
   					}
   				});

   				// On définit à chaque éléments la hauteur la plus grande
   				$(ItemsSelector, this).slice(i, i + RangeTemp).each(function() {
   					$(this).height(tempHeight);
   				});

   				tempHeight = 0;
   			}
   		});
   	}
   };
   

   Orck.GoogleAnalytics = {
   	Init: function() {
   		var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");

   		// use jQuery to call the Google Analytics JavaScript
   		$.getScript(gaJsHost + "google-analytics.com/ga.js", function() {

   			// tell Analytics about the current page load using standard _trackPageview method
   			try {
   				var pageTracker = _gat._getTracker("UA-3559341-1");
   				pageTracker._trackPageview();
   			} catch (err) { }

   			// loop though each anchor element
   			$('a').each(function() {

   				var href = $(this).attr('href');
   				var filetypes = /\.(zip|exe|pdf|doc*|xls*|ppt*|mp3)$/i;

   				if (href) {
   					// check for links starting with http or https, making sure that links to our own domain are excluded
   					if ((href.match(/^https?\:/i)) && (!href.match(document.domain))) {
   						$(this).click(function() {
   							var extLink = href.replace(/^https?\:\/\//i, '');
   							pageTracker._trackEvent('External', 'Click', extLink);
   						});
   					}
   					// check for links starting with mailto
   					else if (href.match(/^mailto\:/i)) {
   						$(this).click(function() {
   							var mailLink = href.replace(/^mailto\:/i, '');
   							pageTracker._trackEvent('Email', 'Click', mailLink);
   						});
   					}
   					// check for links with file extension that match the filetypes regular expression
   					else if (href.match(filetypes)) {
   						$(this).click(function() {
   							var extension = (/[.]/.exec(href)) ? /[^.]+$/.exec(href) : undefined;
   							var filePath = href.replace(/^https?\:\/\/(www.)mydomain\.com\//i, '');
   							pageTracker._trackEvent('Download', 'Click - ' + extension, filePath);
   						});
   					}
   				}
   			});
   		});
   	}
   };

  /**
  * Class pour la gestion orckestra Live
  */
   Orck.OrckLive = {

   	Init: function() {
   		Orck.OrckLive.RollOver();
   		Orck.OrckLive.Twitter();
   	},

   	// debut de la function over
   	RollOver: function() {

   		$("h2.header").hover(function() {
   			$(this).addClass("selected");
   		}, function() {
   			$(this).removeClass("selected");
   		}), // fin de la function over

   		//début de la function onclick
          $("h2.header").click(function() {
          	$("h2.header").removeClass("selected-click");
          	$(this).addClass("selected-click");
          });
   	},

   	Twitter: function() {

   		$(".twitter-feed").each(function() {
   			$(this).getTwitter({
   				userName: "orckestra",
   				numTweets: 4,
   				loaderText: "Loading tweets...",
   				slideIn: false,
   				showHeading: false,
   				headingText: "",
   				showProfileLink: false
   			});
   		});
   	}

   	/*  Ajuster l'accordeon */

   	/*$(function(){ 
   	$(".haccordion").haccordion();
   	});

	$(document).ready(function() {


	var p = $("div.haccordion")[0];
   	p.opened = $("h2.header:first")[0];
   	$("div.content:first").width(335).css("display","block");
           
   	});*/

   }

   Orck.VedetteEvents = {

       currentIdx: 0,
       fadeInOutTime: 400,
       timer: 8000,


       Init: function() {

           this.currentIdx = $("#feature-list #tabs li.current").index();
           Orck.VedetteEvents.HandleClick();
           Orck.VedetteEvents.HandleTimer();
           Orck.VedetteEvents.HandleLayout();
       },

       /*
       * Roll over
       */

       HandleClick: function() {
           $("#feature-list #tabs li a").click(
			function() {
			    if (!$(this).hasClass("current")) {
			        clearTimeout(t);
			        Orck.VedetteEvents.SwapImage(this);
			    }
			});
       }, //rollover

       SwapImage: function(el) {
           $("li.current a").toggleClass("current");
           $("li.current").toggleClass("current");

           $(el).toggleClass("current");
           $(el).parent().toggleClass("current");

           var idx = $(el).parent().index();

           $($("#output li").get(idx)).fadeTo(this.fadeInOutTime, 1);
           $($("#output li").get(this.currentIdx)).fadeTo(this.fadeInOutTime, 0).css('display', 'none');

           this.currentIdx = idx;

           this.HandleTimer();
       },

       HandleTimer: function() {
           if (Orck.VedetteEvents.timer > 0) {
               var tempIdx = this.currentIdx + 1;
               if (tempIdx >= $("#output li").get().length) {
                   tempIdx = 0;
               }
               t = setTimeout(function() {
                   Orck.VedetteEvents.SwapImage($("#feature-list #tabs li a").get(tempIdx));
               }, Orck.VedetteEvents.timer);
           }
       }, // Handle Timer

       HandleLayout: function() {

           $("#feature-list #tabs li").first().addClass("first");


       } //handle Layout

}// fin class de la vedette

Orck.SubMenu = {



	Init: function() {

		Orck.SubMenu.HandleLayout();
	},

	HandleLayout: function() {
		// Manage submenu background with JS
		var myLis = $(".CMSListMenuLI:has(ul), .CMSListMenuLIlast:has(ul)");
		myLis.find(".CMSListMenuLink:first").css("width", "140px").css("padding-right", "30px").css("background", "#EFEFEF url(/App_Themes/Orckestra/images/buttons/btn-submenu.png) no-repeat 158px 8px");

		var myLisHL = $(".CMSListMenuHighlightedLI:has(ul), .CMSListMenuHighlightedLIlast:has(ul)");
		myLisHL.find(".CMSListMenuLinkHighlighted:first").css("width", "140px").css("padding-right", "30px").css("background", "#EFEFEF url(/App_Themes/Orckestra/images/buttons/btn-submenu.png) no-repeat 158px 8px");

	} // handle layout

}// Orck.SubMenu

Orck.LayoutGeneric = {


    Init: function() {

        Orck.LayoutGeneric.HandleLayout();
        Orck.LayoutGeneric.HandleLayoutClient();
    
    },



    HandleLayout: function() {

        // add class last in the clients section
        $(".wrap .part-article").last().addClass("last");
        for (var i = 3; i <= $(".wrap2 .box").length; i = i + 4) {

            $($(".wrap2 .box")[i]).addClass("last");
        }

        /* adjust the height box in the clients section */
        
        //tableau qui contient toutes les valeurs de grandeur des colonnes
        var minHeight = new Array();
        
        //boucle pour ajouter chaque valeur dans length tableau
        for (var i = 0; i < $(".wrap2 .box").length; i++) {

            minHeight.push($($(".wrap2 .box")[i]).height());

        }
        
        //methode pour trier des nombres
        minHeight = minHeight.sort(function(i, j) {
            return j - i; //gere l ordre decroissant
        });
        
        //assigne la grandeur avec la plus grande valeur
        $(".wrap2 .box").css("height", minHeight[0]);

        //addclass last in the Gallery component
        $(".gl-ct a").last().addClass("last");

    }, // handle layout

    /* adjust the height box in the clients featured project section */
    HandleLayoutClient: function(){

        //tableau qui contient toutes les valeurs de grandeur des colonnes
        var minHeight = new Array();

        //boucle pour ajouter chaque valeur dans length tableau
        /* Comment because graphic conflict. See Bug#3712 */
        /*for (var i = 0; i < $(".part-article .content p").length; i++) {
            minHeight.push($($(".part-article .content p")[i]).height());
        }*/

        //methode pour trier des nombres
        minHeight = minHeight.sort(function(i, j) {
            return j - i; //gere l ordre decroissant
        });

        //assigne la grandeur avec la plus grande valeur
        $(".part-article .content p").css("height", minHeight[0]);

    } //HandleLayoutClient



}// Orck.LayoutGeneric

Orck.SimpleModal = {
    Init: function() {
        var options = {
            overlayClose: true
        }
    $('.basic').click(function(e) {
        $.modal('<img src="' + this + '" />');
        return false;
    });
    $('.modal-flv').click(function(e) {
        var href = $(this).attr("href");
        $.modal('<embed width="640" height="360" flashvars="controlbar=over&amp;dock=false&amp;autostart=true&amp;icons=false&amp;stretching=exactfit&amp;file=' + href + '" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" quality="high" name="mpl" id="mpl" src="/Orckestra/jw/player.swf" type="application/x-shockwave-flash">', options);
        $('#simplemodal-container').css({ width: +"640", height: +"360" });
        return false;
    });
    $('.basic-video').click(function(e) {
        var href = $('.basic-video').attr("href");
        var h = href.substring(href.indexOf('h=') + 2, href.indexOf('&'));
        var w = href.substring(href.indexOf('w=') + 2, href.length);

        $('#video-container').modal();
        if (h != "" && w != "") {
            $('#simplemodal-container').css({ width: w + "px", height: h + "px" });
        }
        return false;
    });
}
}

  /* Active les fonction lorsque la page est chargée*/
  $(document).ready(function() {
        Orck.Init();
  });

  /*
  **  jquery.debug.js -- jQuery plugin for debugging
  **  Copyright (c) 2007 Ralf S. Engelschall <rse@engelschall.com> 
  **  Licensed under GPL <http://www.gnu.org/licenses/gpl.txt>
  **
  **  $LastChangedDate$
  **  $LastChangedRevision$
  */

  (function($) {
      /* jQuery class extension methods */
      $.extend({
          /* boolean status whether debugging is enabled */
          _debug$: null,

          /* method for getting and setting debug status */
          debug: function(onoff) {
              var old_value = ($._debug$ == true ? true : false);
              $._debug$ = (onoff ? true : false);
              return old_value;
          },

          /* method for logging an object or message */
          log: function(message) {
              if ($._debug$ == true)
                  window.console.debug(message);
          }
      });

      /* jQuery object extension methods */
      $.fn.extend({
          /* method for logging all jQuery items */
          log: function(message) {
              if ($._debug$ == true) {
                  return this.each(function() {
                      if (typeof message !== "undefined")
                          $.log(message);
                      $.log(this);
                  });
              }
          }
      });

      /* determine default enable status */
      $(document).ready(function() {
          var req = $("html").attr("debug");
          if (req == "true" || req == "false")
              $.debug(req == "true" ? true : false);
      });

      /* minimum Firebug emulation (see http://getfirebug.com/firebug/firebugx.js) */
      $(document).ready(function() {
          if (typeof window.console === "undefined") {
              /* minimum conversion of arbitrary object to text representation */
              function object2text(obj) {
                  var text = null;
                  if (typeof obj === "undefined")
                      text = "[undefined]";
                  else if (typeof obj === "boolean")
                      text = (obj ? "true" : "false");
                  else if (typeof obj === "number")
                      text = "" + obj;
                  else if (typeof obj === "string")
                      text = obj;
                  else if (typeof obj === "function")
                      text = obj;
                  else if (typeof obj === "object") {
                      if (typeof obj.nodeType !== "undefined") {
                          if (obj.nodeType == 1) { /* W3C DOM element node */
                              text = '&lt;';
                              text += obj.nodeName.toLowerCase();
                              for (var i = 0; i < obj.attributes.length; i++)
                                  text += ' ' + obj.attributes[i].nodeName.toLowerCase() +
                                        '="' + obj.attributes[i].nodeValue + '"';
                              text += '&gt;';
                          }
                          else if (obj.nodeType == 2) /* W3C DOM attribute node */
                              text = obj.nodeName + '="' + obj.nodeValue;
                          else if (obj.nodeType == 3) /* W3C DOM text node */
                              text = obj.nodeValue;
                      }
                      else if (typeof obj.toJSONString !== "undefined")
                          text = obj.toJSONString();
                      else if (typeof obj.toString !== "undefined")
                          text = obj.toString();
                  }
                  if (text == null)
                      text = "[unknown]";
                  return text;
              };

              /* create the custom console <div> node */
              $(document).ready(function() {
                  $("body")
                    .append('<div id="jQueryDebug"><ol></ol></div>');
                  $("#jQueryDebug")
                    .css("display", "none")
                    .css("fontFamily", "monospace")
                    .css("backgroundColor", "#ffffff")
                    .css("color", "#000000")
                    .css("padding", "10px 0px 10px 0px")
                    .css("border", "4px solid #666699")
                    .css("margin", "4px 4px 4px 4px");
                  $("#jQueryDebug ol")
                    .css("margin", "0px 0px 0px 0px")
                    .css("paddingRight", "20px");
              });

              /* attach a logging function to each of the usual Firebug methods */
              var names = [
                "log", "debug", "info", "warn", "error", "assert",
                "dir", "dirxml", "group", "groupEnd", "time", "timeEnd",
                "count", "trace", "profile", "profileEnd"
            ];
              var logfunc = function(msg) {
                  $('#jQueryDebug')
                    .css("display", $._debug$ == true ? "block" : "none");
                  $('#jQueryDebug ol')
                    .append('<li>' + object2text(msg) + '</li>').css;
                  $("#jQueryDebug ol li")
                    .css("borderBottom", "1px solid #cccccc")
                    .css("padding", "1px 10px 1px 10px");
              };
              window.console = {};
              for (var i = 0; i < names.length; i++)
                  window.console[names[i]] = logfunc;

              /* indicate that we are the one who is providing the Firebug interface */
              window.console["jQueryDebug"] = true;
          }
      });

  })(jQuery);

  /*
  * SimpleModal 1.3.5 - jQuery Plugin
  * http://www.ericmmartin.com/projects/simplemodal/
  * Copyright (c) 2010 Eric Martin (http://twitter.com/EricMMartin)
  * Dual licensed under the MIT and GPL licenses
  * Revision: $Id: jquery.simplemodal.js 245 2010-03-25 20:41:15Z emartin24 $
  */
  ; (function($) { var ie6 = $.browser.msie && parseInt($.browser.version) == 6 && typeof window['XMLHttpRequest'] != "object", ieQuirks = null, w = []; $.modal = function(data, options) { return $.modal.impl.init(data, options); }; $.modal.close = function() { $.modal.impl.close(); }; $.fn.modal = function(options) { return $.modal.impl.init(this, options); }; $.modal.defaults = { appendTo: 'body', focus: true, opacity: 50, overlayId: 'simplemodal-overlay', overlayCss: {}, containerId: 'simplemodal-container', containerCss: {}, dataId: 'simplemodal-data', dataCss: {}, minHeight: null, minWidth: null, maxHeight: null, maxWidth: null, autoResize: false, autoPosition: true, zIndex: 1000, close: true, closeHTML: '<a class="modalCloseImg" title="Close"></a>', closeClass: 'simplemodal-close', escClose: true, overlayClose: false, position: null, persist: false, modal: true, onOpen: null, onShow: null, onClose: null }; $.modal.impl = { o: null, d: {}, init: function(data, options) { var s = this; if (s.d.data) { return false; } ieQuirks = $.browser.msie && !$.boxModel; s.o = $.extend({}, $.modal.defaults, options); s.zIndex = s.o.zIndex; s.occb = false; if (typeof data == 'object') { data = data instanceof jQuery ? data : $(data); s.d.placeholder = false; if (data.parent().parent().size() > 0) { data.before($('<span></span>').attr('id', 'simplemodal-placeholder').css({ display: 'none' })); s.d.placeholder = true; s.display = data.css('display'); if (!s.o.persist) { s.d.orig = data.clone(true); } } } else if (typeof data == 'string' || typeof data == 'number') { data = $('<div></div>').html(data); } else { alert('SimpleModal Error: Unsupported data type: ' + typeof data); return s; } s.create(data); data = null; s.open(); if ($.isFunction(s.o.onShow)) { s.o.onShow.apply(s, [s.d]); } return s; }, create: function(data) { var s = this; w = s.getDimensions(); if (s.o.modal && ie6) { s.d.iframe = $('<iframe src="javascript:false;"></iframe>').css($.extend(s.o.iframeCss, { display: 'none', opacity: 0, position: 'fixed', height: w[0], width: w[1], zIndex: s.o.zIndex, top: 0, left: 0 })).appendTo(s.o.appendTo); } s.d.overlay = $('<div></div>').attr('id', s.o.overlayId).addClass('simplemodal-overlay').css($.extend(s.o.overlayCss, { display: 'none', opacity: s.o.opacity / 100, height: s.o.modal ? w[0] : 0, width: s.o.modal ? w[1] : 0, position: 'fixed', left: 0, top: 0, zIndex: s.o.zIndex + 1 })).appendTo(s.o.appendTo); s.d.container = $('<div></div>').attr('id', s.o.containerId).addClass('simplemodal-container').css($.extend(s.o.containerCss, { display: 'none', position: 'fixed', zIndex: s.o.zIndex + 2 })).append(s.o.close && s.o.closeHTML ? $(s.o.closeHTML).addClass(s.o.closeClass) : '').appendTo(s.o.appendTo); s.d.wrap = $('<div></div>').attr('tabIndex', -1).addClass('simplemodal-wrap').css({ height: '100%', outline: 0, width: '100%' }).appendTo(s.d.container); s.d.data = data.attr('id', data.attr('id') || s.o.dataId).addClass('simplemodal-data').css($.extend(s.o.dataCss, { display: 'none' })).appendTo('body'); data = null; s.setContainerDimensions(); s.d.data.appendTo(s.d.wrap); if (ie6 || ieQuirks) { s.fixIE(); } }, bindEvents: function() { var s = this; $('.' + s.o.closeClass).bind('click.simplemodal', function(e) { e.preventDefault(); s.close(); }); if (s.o.modal && s.o.close && s.o.overlayClose) { s.d.overlay.bind('click.simplemodal', function(e) { e.preventDefault(); s.close(); }); } $(document).bind('keydown.simplemodal', function(e) { if (s.o.modal && s.o.focus && e.keyCode == 9) { s.watchTab(e); } else if ((s.o.close && s.o.escClose) && e.keyCode == 27) { e.preventDefault(); s.close(); } }); $(window).bind('resize.simplemodal', function() { w = s.getDimensions(); s.setContainerDimensions(true); if (ie6 || ieQuirks) { s.fixIE(); } else if (s.o.modal) { s.d.iframe && s.d.iframe.css({ height: w[0], width: w[1] }); s.d.overlay.css({ height: w[0], width: w[1] }); } }); }, unbindEvents: function() { $('.' + this.o.closeClass).unbind('click.simplemodal'); $(document).unbind('keydown.simplemodal'); $(window).unbind('resize.simplemodal'); this.d.overlay.unbind('click.simplemodal'); }, fixIE: function() { var s = this, p = s.o.position; $.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container], function(i, el) { if (el) { var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth', bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft', bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth', ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth', sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop', s = el[0].style; s.position = 'absolute'; if (i < 2) { s.removeExpression('height'); s.removeExpression('width'); s.setExpression('height', '' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"'); s.setExpression('width', '' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"'); } else { var te, le; if (p && p.constructor == Array) { var top = p[0] ? typeof p[0] == 'number' ? p[0].toString() : p[0].replace(/px/, '') : el.css('top').replace(/px/, ''); te = top.indexOf('%') == -1 ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"' : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; if (p[1]) { var left = typeof p[1] == 'number' ? p[1].toString() : p[1].replace(/px/, ''); le = left.indexOf('%') == -1 ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"' : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; } } else { te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; } s.removeExpression('top'); s.removeExpression('left'); s.setExpression('top', te); s.setExpression('left', le); } } }); }, focus: function(pos) { var s = this, p = pos || 'first'; var input = $(':input:enabled:visible:' + p, s.d.wrap); input.length > 0 ? input.focus() : s.d.wrap.focus(); }, getDimensions: function() { var el = $(window); var h = $.browser.opera && $.browser.version > '9.5' && $.fn.jquery <= '1.2.6' ? document.documentElement['clientHeight'] : $.browser.opera && $.browser.version < '9.5' && $.fn.jquery > '1.2.6' ? window.innerHeight : el.height(); return [h, el.width()]; }, getVal: function(v) { return v == 'auto' ? 0 : v.indexOf('%') > 0 ? v : parseInt(v.replace(/px/, '')); }, setContainerDimensions: function(resize) { var s = this; if (!resize || (resize && s.o.autoResize)) { var ch = $.browser.opera ? s.d.container.height() : s.getVal(s.d.container.css('height')), cw = $.browser.opera ? s.d.container.width() : s.getVal(s.d.container.css('width')), dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true); var mh = s.o.maxHeight && s.o.maxHeight < w[0] ? s.o.maxHeight : w[0], mw = s.o.maxWidth && s.o.maxWidth < w[1] ? s.o.maxWidth : w[1]; if (!ch) { if (!dh) { ch = s.o.minHeight; } else { if (dh > mh) { ch = mh; } else if (dh < s.o.minHeight) { ch = s.o.minHeight; } else { ch = dh; } } } else { ch = ch > mh ? mh : ch; } if (!cw) { if (!dw) { cw = s.o.minWidth; } else { if (dw > mw) { cw = mw; } else if (dw < s.o.minWidth) { cw = s.o.minWidth; } else { cw = dw; } } } else { cw = cw > mw ? mw : cw; } s.d.container.css({ height: ch, width: cw }); if (dh > ch || dw > cw) { s.d.wrap.css({ overflow: 'auto' }); } } if (s.o.autoPosition) { s.setPosition(); } }, setPosition: function() { var s = this, top, left, hc = (w[0] / 2) - (s.d.container.outerHeight(true) / 2), vc = (w[1] / 2) - (s.d.container.outerWidth(true) / 2); if (s.o.position && Object.prototype.toString.call(s.o.position) === "[object Array]") { top = s.o.position[0] || hc; left = s.o.position[1] || vc; } else { top = hc; left = vc; } s.d.container.css({ left: left, top: top }); }, watchTab: function(e) { var s = this; if ($(e.target).parents('.simplemodal-container').length > 0) { s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]); if ((!e.shiftKey && e.target == s.inputs[s.inputs.length - 1]) || (e.shiftKey && e.target == s.inputs[0]) || s.inputs.length == 0) { e.preventDefault(); var pos = e.shiftKey ? 'last' : 'first'; setTimeout(function() { s.focus(pos); }, 10); } } else { e.preventDefault(); setTimeout(function() { s.focus(); }, 10); } }, open: function() { var s = this; s.d.iframe && s.d.iframe.show(); if ($.isFunction(s.o.onOpen)) { s.o.onOpen.apply(s, [s.d]); } else { s.d.overlay.show(); s.d.container.show(); s.d.data.show(); } s.focus(); s.bindEvents(); }, close: function() { var s = this; if (!s.d.data) { return false; } s.unbindEvents(); if ($.isFunction(s.o.onClose) && !s.occb) { s.occb = true; s.o.onClose.apply(s, [s.d]); } else { if (s.d.placeholder) { var ph = $('#simplemodal-placeholder'); if (s.o.persist) { ph.replaceWith(s.d.data.removeClass('simplemodal-data').css('display', s.display)); } else { s.d.data.hide().remove(); ph.replaceWith(s.d.orig); } } else { s.d.data.hide().remove(); } s.d.container.hide().remove(); s.d.overlay.hide().remove(); s.d.iframe && s.d.iframe.hide().remove(); s.d = {}; } } }; })(jQuery);

  /* ------------------------------------------------------------------------
  * Class: prettyPhoto
  * Use: Lightbox clone for jQuery
  * Author: Stephane Caron (http://www.no-margin-for-errors.com)
  * Version: 3.0
  * ------------------------------------------------------------------------- */

  (function(a) { a.prettyPhoto = { version: "3.0" }; a.fn.prettyPhoto = function(d) { d = jQuery.extend({ animation_speed: "fast", slideshow: false, autoplay_slideshow: false, opacity: 0.8, show_title: true, allow_resize: true, default_width: 500, default_height: 344, counter_separator_label: "/", theme: "facebook", hideflash: false, wmode: "opaque", autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true, changepicturecallback: function() { }, callback: function() { }, markup: '<div class="pp_pic_holder"><div class="ppt">&nbsp;</div><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content_container"><div class="pp_left"><div class="pp_right"><div class="pp_content"><div class="pp_loaderIcon"></div><div class="pp_fade"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><p class="pp_description"></p><a class="pp_close" href="#">Close</a><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0/0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div></div></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div><div class="pp_overlay"></div>', gallery_markup: '<div class="pp_gallery"><a href="#" class="pp_arrow_previous">Previous</a><ul>{gallery}</ul><a href="#" class="pp_arrow_next">Next</a></div>', image_markup: '<img id="fullResImage" src="" />', flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>', quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>', iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>', inline_markup: '<div class="pp_inline clearfix">{content}</div>', custom_markup: "" }, d); var i = this, h = false, s, m, n, o, r, u, e = a(window).height(), x = a(window).width(), f; doresize = true, scroll_pos = v(); a(window).unbind("resize").resize(function() { l(); q() }); if (d.keyboard_shortcuts) { a(document).unbind("keydown").keydown(function(y) { if (typeof $pp_pic_holder != "undefined") { if ($pp_pic_holder.is(":visible")) { switch (y.keyCode) { case 37: a.prettyPhoto.changePage("previous"); break; case 39: a.prettyPhoto.changePage("next"); break; case 27: if (!settings.modal) { a.prettyPhoto.close() } break } return false } } }) } a.prettyPhoto.initialize = function() { settings = d; if (a.browser.msie && parseInt(a.browser.version) == 6) { settings.theme = "light_square" } t(this); if (settings.allow_resize) { a(window).scroll(function() { l() }) } l(); set_position = jQuery.inArray(a(this).attr("href"), pp_images); a.prettyPhoto.open(); return false }; a.prettyPhoto.open = function() { if (typeof settings == "undefined") { settings = d; if (a.browser.msie && a.browser.version == 6) { settings.theme = "light_square" } t(this); pp_images = a.makeArray(arguments[0]); pp_titles = (arguments[1]) ? a.makeArray(arguments[1]) : a.makeArray(""); pp_descriptions = (arguments[2]) ? a.makeArray(arguments[2]) : a.makeArray(""); isSet = (pp_images.length > 1) ? true : false; set_position = 0 } if (a.browser.msie && a.browser.version == 6) { a("select").css("visibility", "hidden") } if (settings.hideflash) { a("object,embed").css("visibility", "hidden") } g(a(pp_images).size()); a(".pp_loaderIcon").show(); if ($ppt.is(":hidden")) { $ppt.css("opacity", 0).show() } $pp_overlay.show().fadeTo(settings.animation_speed, settings.opacity); $pp_pic_holder.find(".currentTextHolder").text((set_position + 1) + settings.counter_separator_label + a(pp_images).size()); $pp_pic_holder.find(".pp_description").show().html(unescape(pp_descriptions[set_position])); (settings.show_title && pp_titles[set_position] != "") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html("&nbsp;"); movie_width = (parseFloat(b("width", pp_images[set_position]))) ? b("width", pp_images[set_position]) : settings.default_width.toString(); movie_height = (parseFloat(b("height", pp_images[set_position]))) ? b("height", pp_images[set_position]) : settings.default_height.toString(); if (movie_width.indexOf("%") != -1 || movie_height.indexOf("%") != -1) { movie_height = parseFloat((a(window).height() * parseFloat(movie_height) / 100) - 150); movie_width = parseFloat((a(window).width() * parseFloat(movie_width) / 100) - 150); h = true } else { h = false } $pp_pic_holder.fadeIn(function() { imgPreloader = ""; switch (w(pp_images[set_position])) { case "image": imgPreloader = new Image(); nextImage = new Image(); if (isSet && set_position > a(pp_images).size()) { nextImage.src = pp_images[set_position + 1] } prevImage = new Image(); if (isSet && pp_images[set_position - 1]) { prevImage.src = pp_images[set_position - 1] } $pp_pic_holder.find("#pp_full_res")[0].innerHTML = settings.image_markup; $pp_pic_holder.find("#fullResImage").attr("src", pp_images[set_position]); imgPreloader.onload = function() { s = k(imgPreloader.width, imgPreloader.height); _showContent() }; imgPreloader.onerror = function() { alert("Image cannot be loaded. Make sure the path is correct and image exist."); a.prettyPhoto.close() }; imgPreloader.src = pp_images[set_position]; break; case "youtube": s = k(movie_width, movie_height); movie = "http://www.youtube.com/v/" + b("v", pp_images[set_position]); if (settings.autoplay) { movie += "&autoplay=1" } toInject = settings.flash_markup.replace(/{width}/g, s.width).replace(/{height}/g, s.height).replace(/{wmode}/g, settings.wmode).replace(/{path}/g, movie); break; case "vimeo": s = k(movie_width, movie_height); movie_id = pp_images[set_position]; var z = /http:\/\/(www\.)?vimeo.com\/(\d+)/; var y = movie_id.match(z); movie = "http://player.vimeo.com/video/" + y[2] + "?title=0&amp;byline=0&amp;portrait=0"; if (settings.autoplay) { movie += "&autoplay=1;" } vimeo_width = s.width + "/embed/?moog_width=" + s.width; toInject = settings.iframe_markup.replace(/{width}/g, vimeo_width).replace(/{height}/g, s.height).replace(/{path}/g, movie); break; case "quicktime": s = k(movie_width, movie_height); s.height += 15; s.contentHeight += 15; s.containerHeight += 15; toInject = settings.quicktime_markup.replace(/{width}/g, s.width).replace(/{height}/g, s.height).replace(/{wmode}/g, settings.wmode).replace(/{path}/g, pp_images[set_position]).replace(/{autoplay}/g, settings.autoplay); break; case "flash": s = k(movie_width, movie_height); flash_vars = pp_images[set_position]; flash_vars = flash_vars.substring(pp_images[set_position].indexOf("flashvars") + 10, pp_images[set_position].length); filename = pp_images[set_position]; filename = filename.substring(0, filename.indexOf("?")); toInject = settings.flash_markup.replace(/{width}/g, s.width).replace(/{height}/g, s.height).replace(/{wmode}/g, settings.wmode).replace(/{path}/g, filename + "?" + flash_vars); break; case "iframe": s = k(movie_width, movie_height); frame_url = pp_images[set_position]; frame_url = frame_url.substr(0, frame_url.indexOf("iframe") - 1); toInject = settings.iframe_markup.replace(/{width}/g, s.width).replace(/{height}/g, s.height).replace(/{path}/g, frame_url); break; case "custom": s = k(movie_width, movie_height); toInject = settings.custom_markup; break; case "inline": myClone = a(pp_images[set_position]).clone().css({ width: settings.default_width }).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo(a("body")); s = k(a(myClone).width(), a(myClone).height()); a(myClone).remove(); toInject = settings.inline_markup.replace(/{content}/g, a(pp_images[set_position]).html()); break } if (!imgPreloader) { $pp_pic_holder.find("#pp_full_res")[0].innerHTML = toInject; _showContent() } }); return false }; a.prettyPhoto.changePage = function(y) { currentGalleryPage = 0; if (y == "previous") { set_position--; if (set_position < 0) { set_position = 0; return } } else { if (y == "next") { set_position++; if (set_position > a(pp_images).size() - 1) { set_position = 0 } } else { set_position = y } } if (!doresize) { doresize = true } a(".pp_contract").removeClass("pp_contract").addClass("pp_expand"); j(function() { a.prettyPhoto.open() }) }; a.prettyPhoto.changeGalleryPage = function(y) { if (y == "next") { currentGalleryPage++; if (currentGalleryPage > totalPage) { currentGalleryPage = 0 } } else { if (y == "previous") { currentGalleryPage--; if (currentGalleryPage < 0) { currentGalleryPage = totalPage } } else { currentGalleryPage = y } } itemsToSlide = (currentGalleryPage == totalPage) ? pp_images.length - ((totalPage) * itemsPerPage) : itemsPerPage; $pp_pic_holder.find(".pp_gallery li").each(function(z) { a(this).animate({ left: (z * itemWidth) - ((itemsToSlide * itemWidth) * currentGalleryPage) }) }) }; a.prettyPhoto.startSlideshow = function() { if (typeof f == "undefined") { $pp_pic_holder.find(".pp_play").unbind("click").removeClass("pp_play").addClass("pp_pause").click(function() { a.prettyPhoto.stopSlideshow(); return false }); f = setInterval(a.prettyPhoto.startSlideshow, settings.slideshow) } else { a.prettyPhoto.changePage("next") } }; a.prettyPhoto.stopSlideshow = function() { $pp_pic_holder.find(".pp_pause").unbind("click").removeClass("pp_pause").addClass("pp_play").click(function() { a.prettyPhoto.startSlideshow(); return false }); clearInterval(f); f = undefined }; a.prettyPhoto.close = function() { clearInterval(f); $pp_pic_holder.stop().find("object,embed").css("visibility", "hidden"); a("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(settings.animation_speed, function() { a(this).remove() }); $pp_overlay.fadeOut(settings.animation_speed, function() { if (a.browser.msie && a.browser.version == 6) { a("select").css("visibility", "visible") } if (settings.hideflash) { a("object,embed").css("visibility", "visible") } a(this).remove(); a(window).unbind("scroll"); settings.callback(); doresize = true; m = false; delete settings }) }; _showContent = function() { a(".pp_loaderIcon").hide(); $ppt.fadeTo(settings.animation_speed, 1); projectedTop = scroll_pos.scrollTop + ((e / 2) - (s.containerHeight / 2)); if (projectedTop < 0) { projectedTop = 0 } $pp_pic_holder.find(".pp_content").animate({ height: s.contentHeight }, settings.animation_speed); $pp_pic_holder.animate({ top: projectedTop, left: (x / 2) - (s.containerWidth / 2), width: s.containerWidth }, settings.animation_speed, function() { $pp_pic_holder.find(".pp_hoverContainer,#fullResImage").height(s.height).width(s.width); $pp_pic_holder.find(".pp_fade").fadeIn(settings.animation_speed); if (isSet && w(pp_images[set_position]) == "image") { $pp_pic_holder.find(".pp_hoverContainer").show() } else { $pp_pic_holder.find(".pp_hoverContainer").hide() } if (s.resized) { a("a.pp_expand,a.pp_contract").fadeIn(settings.animation_speed) } if (settings.autoplay_slideshow && !f && !m) { a.prettyPhoto.startSlideshow() } settings.changepicturecallback(); m = true }); c() }; function j(y) { $pp_pic_holder.find("#pp_full_res object,#pp_full_res embed").css("visibility", "hidden"); $pp_pic_holder.find(".pp_fade").fadeOut(settings.animation_speed, function() { a(".pp_loaderIcon").show(); y() }) } function g(y) { if (set_position == y - 1) { $pp_pic_holder.find("a.pp_next").css("visibility", "hidden"); $pp_pic_holder.find("a.pp_next").addClass("disabled").unbind("click") } else { $pp_pic_holder.find("a.pp_next").css("visibility", "visible"); $pp_pic_holder.find("a.pp_next.disabled").removeClass("disabled").bind("click", function() { a.prettyPhoto.changePage("next"); return false }) } if (set_position == 0) { $pp_pic_holder.find("a.pp_previous").css("visibility", "hidden").addClass("disabled").unbind("click") } else { $pp_pic_holder.find("a.pp_previous.disabled").css("visibility", "visible").removeClass("disabled").bind("click", function() { a.prettyPhoto.changePage("previous"); return false }) } (y > 1) ? a(".pp_nav").show() : a(".pp_nav").hide() } function k(z, y) { resized = false; p(z, y); imageWidth = z, imageHeight = y; if (((u > x) || (r > e)) && doresize && settings.allow_resize && !h) { resized = true, fitting = false; while (!fitting) { if ((u > x)) { imageWidth = (x - 200); imageHeight = (y / z) * imageWidth } else { if ((r > e)) { imageHeight = (e - 200); imageWidth = (z / y) * imageHeight } else { fitting = true } } r = imageHeight, u = imageWidth } p(imageWidth, imageHeight) } return { width: Math.floor(imageWidth), height: Math.floor(imageHeight), containerHeight: Math.floor(r), containerWidth: Math.floor(u) + 40, contentHeight: Math.floor(n), contentWidth: Math.floor(o), resized: resized} } function p(z, y) { z = parseFloat(z); y = parseFloat(y); $pp_details = $pp_pic_holder.find(".pp_details"); $pp_details.width(z); detailsHeight = parseFloat($pp_details.css("marginTop")) + parseFloat($pp_details.css("marginBottom")); $pp_details = $pp_details.clone().appendTo(a("body")).css({ position: "absolute", top: -10000 }); detailsHeight += $pp_details.height(); detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; if (a.browser.msie && a.browser.version == 7) { detailsHeight += 8 } $pp_details.remove(); n = y + detailsHeight; o = z; r = n + $ppt.height() + $pp_pic_holder.find(".pp_top").height() + $pp_pic_holder.find(".pp_bottom").height(); u = z } function w(y) { if (y.match(/youtube\.com\/watch/i)) { return "youtube" } else { if (y.match(/vimeo\.com/i)) { return "vimeo" } else { if (y.indexOf(".mov") != -1) { return "quicktime" } else { if (y.indexOf(".swf") != -1) { return "flash" } else { if (y.indexOf("iframe") != -1) { return "iframe" } else { if (y.indexOf("custom") != -1) { return "custom" } else { if (y.substr(0, 1) == "#") { return "inline" } else { return "image" } } } } } } } } function l() { if (doresize && typeof $pp_pic_holder != "undefined") { scroll_pos = v(); titleHeight = $ppt.height(), contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width(); projectedTop = (e / 2) + scroll_pos.scrollTop - (contentHeight / 2); $pp_pic_holder.css({ top: projectedTop, left: (x / 2) + scroll_pos.scrollLeft - (contentwidth / 2) }) } } function v() { if (self.pageYOffset) { return { scrollTop: self.pageYOffset, scrollLeft: self.pageXOffset} } else { if (document.documentElement && document.documentElement.scrollTop) { return { scrollTop: document.documentElement.scrollTop, scrollLeft: document.documentElement.scrollLeft} } else { if (document.body) { return { scrollTop: document.body.scrollTop, scrollLeft: document.body.scrollLeft} } } } } function q() { e = a(window).height(), x = a(window).width(); if (typeof $pp_overlay != "undefined") { $pp_overlay.height(a(document).height()) } } function c() { if (isSet && settings.overlay_gallery && w(pp_images[set_position]) == "image") { itemWidth = 52 + 5; navWidth = (settings.theme == "facebook") ? 58 : 38; itemsPerPage = Math.floor((s.containerWidth - 100 - navWidth) / itemWidth); itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length; totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1; if (totalPage == 0) { navWidth = 0; $pp_pic_holder.find(".pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous").hide() } else { $pp_pic_holder.find(".pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous").show() } galleryWidth = itemsPerPage * itemWidth + navWidth; $pp_pic_holder.find(".pp_gallery").width(galleryWidth).css("margin-left", -(galleryWidth / 2)); $pp_pic_holder.find(".pp_gallery ul").width(itemsPerPage * itemWidth).find("li.selected").removeClass("selected"); goToPage = (Math.floor(set_position / itemsPerPage) <= totalPage) ? Math.floor(set_position / itemsPerPage) : totalPage; if (itemsPerPage) { $pp_pic_holder.find(".pp_gallery").hide().show().removeClass("disabled") } else { $pp_pic_holder.find(".pp_gallery").hide().addClass("disabled") } a.prettyPhoto.changeGalleryPage(goToPage); $pp_pic_holder.find(".pp_gallery ul li:eq(" + set_position + ")").addClass("selected") } else { $pp_pic_holder.find(".pp_content").unbind("mouseenter mouseleave"); $pp_pic_holder.find(".pp_gallery").hide() } } function t(y) { theRel = a(y).attr("rel"); galleryRegExp = /\[(?:.*)\]/; isSet = (galleryRegExp.exec(theRel)) ? true : false; pp_images = (isSet) ? jQuery.map(i, function(D, C) { if (a(D).attr("rel").indexOf(theRel) != -1) { return a(D).attr("href") } }) : a.makeArray(a(y).attr("href")); pp_titles = (isSet) ? jQuery.map(i, function(D, C) { if (a(D).attr("rel").indexOf(theRel) != -1) { return (a(D).find("img").attr("alt")) ? a(D).find("img").attr("alt") : "" } }) : a.makeArray(a(y).find("img").attr("alt")); pp_descriptions = (isSet) ? jQuery.map(i, function(D, C) { if (a(D).attr("rel").indexOf(theRel) != -1) { return (a(D).attr("title")) ? a(D).attr("title") : "" } }) : a.makeArray(a(y).attr("title")); a("body").append(settings.markup); $pp_pic_holder = a(".pp_pic_holder"), $ppt = a(".ppt"), $pp_overlay = a("div.pp_overlay"); if (isSet && settings.overlay_gallery) { currentGalleryPage = 0; toInject = ""; for (var A = 0; A < pp_images.length; A++) { var B = new RegExp("(.*?).(jpg|jpeg|png|gif)$"); var z = B.exec(pp_images[A]); if (!z) { classname = "default" } else { classname = "" } toInject += "<li class='" + classname + "'><a href='#'><img src='" + pp_images[A] + "' width='50' alt='' /></a></li>" } toInject = settings.gallery_markup.replace(/{gallery}/g, toInject); $pp_pic_holder.find("#pp_full_res").after(toInject); $pp_pic_holder.find(".pp_gallery .pp_arrow_next").click(function() { a.prettyPhoto.changeGalleryPage("next"); a.prettyPhoto.stopSlideshow(); return false }); $pp_pic_holder.find(".pp_gallery .pp_arrow_previous").click(function() { a.prettyPhoto.changeGalleryPage("previous"); a.prettyPhoto.stopSlideshow(); return false }); $pp_pic_holder.find(".pp_content").hover(function() { $pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeIn() }, function() { $pp_pic_holder.find(".pp_gallery:not(.disabled)").fadeOut() }); itemWidth = 52 + 5; $pp_pic_holder.find(".pp_gallery ul li").each(function(C) { a(this).css({ position: "absolute", left: C * itemWidth }); a(this).find("a").unbind("click").click(function() { a.prettyPhoto.changePage(C); a.prettyPhoto.stopSlideshow(); return false }) }) } if (settings.slideshow) { $pp_pic_holder.find(".pp_nav").prepend('<a href="#" class="pp_play">Play</a>'); $pp_pic_holder.find(".pp_nav .pp_play").click(function() { a.prettyPhoto.startSlideshow(); return false }) } $pp_pic_holder.attr("class", "pp_pic_holder " + settings.theme); $pp_overlay.css({ opacity: 0, height: a(document).height(), width: a(document).width() }).bind("click", function() { if (!settings.modal) { a.prettyPhoto.close() } }); a("a.pp_close").bind("click", function() { a.prettyPhoto.close(); return false }); a("a.pp_expand").bind("click", function(C) { if (a(this).hasClass("pp_expand")) { a(this).removeClass("pp_expand").addClass("pp_contract"); doresize = false } else { a(this).removeClass("pp_contract").addClass("pp_expand"); doresize = true } j(function() { a.prettyPhoto.open() }); return false }); $pp_pic_holder.find(".pp_previous, .pp_nav .pp_arrow_previous").bind("click", function() { a.prettyPhoto.changePage("previous"); a.prettyPhoto.stopSlideshow(); return false }); $pp_pic_holder.find(".pp_next, .pp_nav .pp_arrow_next").bind("click", function() { a.prettyPhoto.changePage("next"); a.prettyPhoto.stopSlideshow(); return false }); l() } return this.unbind("click").click(a.prettyPhoto.initialize) }; function b(e, d) { e = e.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var c = "[\\?&]" + e + "=([^&#]*)"; var g = new RegExp(c); var f = g.exec(d); return (f == null) ? "" : f[1] } })(jQuery);

