PageSourceSearch

https://apaa.info/files/stacks_page_page0.js

js apaa.info collected 2026-10-02 10:22:39 UTC 33,918 bytes, 897 lines download raw bytes

1
2// 'stacks' is the Stacks global object.
3// All of the other Stacks related Javascript will 
4// be attatched to it.
5var stacks = {};
6
7
8// this call to jQuery gives us access to the globaal
9// jQuery object. 
10// 'noConflict' removes the '$' variable.
11// 'true' removes the 'jQuery' variable.
12// removing these globals reduces conflicts with other 
13// jQuery versions that might be running on this page.
14stacks.jQuery = jQuery.noConflict(true);
15
16// Javascript for stacks_in_79_page0
17// ---------------------------------------------------------------------
18
19// Each stack has its own object with its own namespace.  The name of
20// that object is the same as the stack's id.
21stacks.stacks_in_79_page0 = {};
22
23// A closure is defined and assigned to the stack's object.  The object
24// is also passed in as 'stack' which gives you a shorthand for referring
25// to this object from elsewhere.
26stacks.stacks_in_79_page0 = (function(stack) {
27
28	// When jQuery is used it will be available as $ and jQuery but only
29	// inside the closure.
30	var jQuery = stacks.jQuery;
31	var $ = jQuery;
32	
33/* ------------------------------------------------------------------------
34	Class: prettyPhoto
35	Use: Lightbox clone for jQuery
36	Author: Stephane Caron (http://www.no-margin-for-errors.com)
37	Version: 3.0
38------------------------------------------------------------------------- */
39
40(function($) {
41	$.prettyPhoto = {version: '3.0'};
42	
43	$.fn.prettyPhoto = function(pp_settings) {
44		pp_settings = jQuery.extend({
45			animation_speed: 'fast', /* fast/slow/normal */
46			slideshow: false, /* false OR interval time in ms */
47			autoplay_slideshow: false, /* true/false */
48			opacity: 0.80, /* Value between 0 and 1 */
49			show_title: false, /* true/false */
50			allow_resize: true, /* Resize the photos bigger than viewport. true/false */
51			default_width: 500,
52			default_height: 344,
53			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
54			theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
55			hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
56			wmode: 'opaque', /* Set the flash wmode attribute */
57			autoplay: true, /* Automatically start videos: True/False */
58			modal: false, /* If set to true, only the close button will close the window */
59			overlay_gallery: true, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
60			keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
61			changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
62			callback: function(){}, /* Called when prettyPhoto is closed */
63			markup: '<div class="pp_pic_holder"> \
64						<div class="ppt">&nbsp;</div> \
65						<div class="pp_top"> \
66							<div class="pp_left"></div> \
67							<div class="pp_middle"></div> \
68							<div class="pp_right"></div> \
69						</div> \
70						<div class="pp_content_container"> \
71							<div class="pp_left"> \
72							<div class="pp_right"> \
73								<div class="pp_content"> \
74									<div class="pp_loaderIcon"></div> \
75									<div class="pp_fade"> \
76										<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
77										<div class="pp_hoverContainer"> \
78											<a class="pp_next" href="#">next</a> \
79											<a class="pp_previous" href="#">previous</a> \
80										</div> \
81										<div id="pp_full_res"></div> \
82										<div class="pp_details clearfix"> \
83											<p class="pp_description"></p> \
84											<a class="pp_close" href="#">Close</a> \
85											<div class="pp_nav"> \
86												<a href="#" class="pp_arrow_previous">Previous</a> \
87												<p class="currentTextHolder">0/0</p> \
88												<a href="#" class="pp_arrow_next">Next</a> \
89											</div> \
90										</div> \
91									</div> \
92								</div> \
93							</div> \
94							</div> \
95						</div> \
96						<div class="pp_bottom"> \
97							<div class="pp_left"></div> \
98							<div class="pp_middle"></div> \
99							<div class="pp_right"></div> \
100						</div> \
101					</div> \
102					<div class="pp_overlay"></div>',
103			gallery_markup: '<div class="pp_gallery"> \
104								<a href="#" class="pp_arrow_previous">Previous</a> \
105								<ul> \
106									{gallery} \
107								</ul> \
108								<a href="#" class="pp_arrow_next">Next</a> \
109							</div>',
110			image_markup: '<img id="fullResImage" src="" />',
111			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>',
112			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>',
113			iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',
114			inline_markup: '<div class="pp_inline clearfix">{content}</div>',
115			flv_markup: '<object id="myFLV"  type="application/x-shockwave-flash" data="{fplayerloc}" width="{width}" height="{height}" /><param name="movie" value="{fplayerloc}" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="quality" value="high" /><param name="flashvars" value="config={&quot;clip&quot;:{&quot;url&quot;:&quot;{path}&quot;}, &quot;playlist&quot;:[{&quot;url&quot;:&quot;{path}&quot;}]}" /></object>',
116			custom_markup: ''
117		}, pp_settings);
118		
119		// Global variables accessible only by prettyPhoto
120		var matchedObjects = this, percentBased = false, correctSizes, pp_open,
121		
122		// prettyPhoto container specific
123		pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
124		
125		// Window size
126		windowHeight = $(window).height(), windowWidth = $(window).width(),
127
128		// Global elements
129		pp_slideshow;
130		
131		doresize = true, scroll_pos = _get_scroll();
132	
133		// Window/Keyboard events
134		$(window).unbind('resize').resize(function(){ _center_overlay(); _resize_overlay(); });
135		
136		if(pp_settings.keyboard_shortcuts) {
137			$(document).unbind('keydown').keydown(function(e){
138				if(typeof $pp_pic_holder != 'undefined'){
139					if($pp_pic_holder.is(':visible')){
140						switch(e.keyCode){
141							case 37:
142								$.prettyPhoto.changePage('previous');
143								break;
144							case 39:
145								$.prettyPhoto.changePage('next');
146								break;
147							case 27:
148								if(!settings.modal)
149								$.prettyPhoto.close();
150								break;
151						};
152						return false;
153					};
154				};
155			});
156		}
157		
158		
159		/**
160		* Initialize prettyPhoto.
161		*/
162		$.prettyPhoto.initialize = function() {
163			settings = pp_settings;
164			
165			if($.browser.msie && parseInt($.browser.version) == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
166			
167			_buildOverlay(this); // Build the overlay {this} being the caller
168			
169			if(settings.allow_resize)
170				$(window).scroll(function(){ _center_overlay(); });
171				
172			_center_overlay();
173			
174			set_position = jQuery.inArray($(this).attr('href'), pp_images); // Define where in the array the clicked item is positionned
175			
176			$.prettyPhoto.open();
177			
178			return false;
179		}
180
181
182		/**
183		* Opens the prettyPhoto modal box.
184		* @param image {String,Array} Full path to the image to be open, can also be an array containing full images paths.
185		* @param title {String,Array} The title to be displayed with the picture, can also be an array containing all the titles.
186		* @param description {String,Array} The description to be displayed with the picture, can also be an array containing all the descriptions.
187		*/
188		$.prettyPhoto.open = function() {
189			if(typeof settings == "undefined"){ // Means it's an API call, need to manually get the settings and set the variables
190				settings = pp_settings;
191				if($.browser.msie && $.browser.version == 6) settings.theme = "light_square"; // Fallback to a supported theme for IE6
192				_buildOverlay(this); // Build the overlay {this} being the caller
193				pp_images = $.makeArray(arguments[0]);
194				pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
195				pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
196				isSet = (pp_images.length > 1) ? true : false;
197				set_position = 0;
198			}
199
200			if($.browser.msie && $.browser.version == 6) $('select').css('visibility','hidden'); // To fix the bug with IE select boxes
201			
202			if(settings.hideflash) $('object,embed').css('visibility','hidden'); // Hide the flash
203
204			_checkPosition($(pp_images).size()); // Hide the next/previous links if on first or last images.
205		
206			$('.pp_loaderIcon').show();
207		
208			// Fade the content in
209			if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
210			$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);
211
212			// Display the current position
213			$pp_pic_holder.find('.currentTextHolder').text((set_position+1) + settings.counter_separator_label + $(pp_images).size());
214
215			// Set the description
216			$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
217
218			// Set the title
219			(settings.show_title && pp_titles[set_position] != "") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html('&nbsp;');
220			
221			// Get the dimensions
222			movie_width = ( parseFloat(grab_param('width',pp_images[set_position])) ) ? grab_param('width',pp_images[set_position]) : settings.default_width.toString();
223			movie_height = ( parseFloat(grab_param('height',pp_images[set_position])) ) ? grab_param('height',pp_images[set_position]) : settings.default_height.toString();
224			
225			// If the size is % based, calculate according to window dimensions
226			if(movie_width.indexOf('%') != -1 || movie_height.indexOf('%') != -1){
227				movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 150);
228				movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 150);
229				percentBased = true;
230			}else{
231				percentBased = false;
232			}
233			
234			// Fade the holder
235			$pp_pic_holder.fadeIn(function(){
236				imgPreloader = "";
237				
238				// Inject the proper content
239				switch(_getFileType(pp_images[set_position])){
240					case 'image':
241						imgPreloader = new Image();
242
243						// Preload the neighbour images
244						nextImage = new Image();
245						if(isSet && set_position > $(pp_images).size()) nextImage.src = pp_images[set_position + 1];
246						prevImage = new Image();
247						if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
248
249						$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup;
250						$pp_pic_holder.find('#fullResImage').attr('src',pp_images[set_position]);
251
252						imgPreloader.onload = function(){
253							// Fit item to viewport
254							correctSizes = _fitToViewport(imgPreloader.width,imgPreloader.height);
255
256							_showContent();
257						};
258
259						imgPreloader.onerror = function(){
260							alert('Image cannot be loaded. Make sure the path is correct and image exist.');
261							$.prettyPhoto.close();
262						};
263					
264						imgPreloader.src = pp_images[set_position];
265					break;
266				
267					case 'youtube':
268						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
269
270						movie = 'http://www.youtube.com/v/'+grab_param('v',pp_images[set_position]);
271						if(settings.autoplay) movie += "&autoplay=1";
272					
273						toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
274					break;
275				
276					case 'vimeo':
277						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
278					
279						movie_id = pp_images[set_position];
280						var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/;
281						var match = movie_id.match(regExp);
282						
283						movie = 'http://player.vimeo.com/video/'+ match[2] +'?title=0&amp;byline=0&amp;portrait=0';
284						if(settings.autoplay) movie += "&autoplay=1;";
285				
286						vimeo_width = correctSizes['width'] + '/embed/?moog_width='+ correctSizes['width'];
287				
288						toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,movie);
289					break;
290				
291					case 'quicktime':
292						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
293						correctSizes['height']+=15; correctSizes['contentHeight']+=15; correctSizes['containerHeight']+=15; // Add space for the control bar
294				
295						toInject = settings.quicktime_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}
295/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
296					break;
297				
298					case 'flash':
299						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
300					
301						flash_vars = pp_images[set_position];
302						flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
303
304						filename = pp_images[set_position];
305						filename = filename.substring(0,filename.indexOf('?'));
306					
307						toInject =  settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
308					break;
309				
310					case 'iframe':
311						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
312				
313						frame_url = pp_images[set_position];
314						frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
315				
316						toInject = settings.iframe_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,frame_url);
317					break;
318					
319					case 'custom':
320						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
321					
322						toInject = settings.custom_markup;
323					break;
324
325					case 'flv':
326						correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
327					//	correctSizes['height']+=25; correctSizes['contentHeight']+=25; correctSizes['containerHeight']+=25; // Add space for the control bar
328						filename = pp_images[set_position];
329						pos = filename.indexOf('?');
330						if(pos != -1){
331						filename = filename.substring(0,pos);
332						}
333						toInject = settings.flv_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,filename).replace(/{fplayerloc}/g,settings.fplayer);
334						break;
335				
336					case 'inline':
337						// to get the item height clone it, apply default width, wrap it in the prettyPhoto containers , then delete
338						myClone = $(pp_images[set_position]).clone().css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($('body'));
339						correctSizes = _fitToViewport($(myClone).width(),$(myClone).height());
340						$(myClone).remove();
341						toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
342					break;
343				};
344
345				if(!imgPreloader){
346					$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
347				
348					// Show content
349					_showContent();
350				};
351			});
352
353			return false;
354		};
355
356	
357		/**
358		* Change page in the prettyPhoto modal box
359		* @param direction {String} Direction of the paging, previous or next.
360		*/
361		$.prettyPhoto.changePage = function(direction){
362			currentGalleryPage = 0;
363			
364			if(direction == 'previous') {
365				set_position--;
366				if (set_position < 0){
367					set_position = 0;
368					return;
369				};
370			}else if(direction == 'next'){
371				set_position++;
372				if(set_position > $(pp_images).size()-1) {
373					set_position = 0;
374				}
375			}else{
376				set_position=direction;
377			};
378
379			if(!doresize) doresize = true; // Allow the resizing of the images
380			$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
381
382			_hideContent(function(){ $.prettyPhoto.open(); });
383		};
384
385
386		/**
387		* Change gallery page in the prettyPhoto modal box
388		* @param direction {String} Direction of the paging, previous or next.
389		*/
390		$.prettyPhoto.changeGalleryPage = function(direction){
391			if(direction=='next'){
392				currentGalleryPage ++;
393
394				if(currentGalleryPage > totalPage){
395					currentGalleryPage = 0;
396				};
397			}else if(direction=='previous'){
398				currentGalleryPage --;
399
400				if(currentGalleryPage < 0){
401					currentGalleryPage = totalPage;
402				};
403			}else{
404				currentGalleryPage = direction;
405			};
406			
407			// Slide the pages, if we're on the last page, find out how many items we need to slide. To make sure we don't have an empty space.
408			itemsToSlide = (currentGalleryPage == totalPage) ? pp_images.length - ((totalPage) * itemsPerPage) : itemsPerPage;
409			
410			$pp_pic_holder.find('.pp_gallery li').each(function(i){
411				$(this).animate({
412					'left': (i * itemWidth) - ((itemsToSlide * itemWidth) * currentGalleryPage)
413				});
414			});
415		};
416
417
418		/**
419		* Start the slideshow...
420		*/
421		$.prettyPhoto.startSlideshow = function(){
422			if(typeof pp_slideshow == 'undefined'){
423				$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
424					$.prettyPhoto.stopSlideshow();
425					return false;
426				});
427				pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);
428			}else{
429				$.prettyPhoto.changePage('next');	
430			};
431		}
432
433
434		/**
435		* Stop the slideshow...
436		*/
437		$.prettyPhoto.stopSlideshow = function(){
438			$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
439				$.prettyPhoto.startSlideshow();
440				return false;
441			});
442			clearInterval(pp_slideshow);
443			pp_slideshow=undefined;
444		}
445
446
447		/**
448		* Closes prettyPhoto.
449		*/
450		$.prettyPhoto.close = function(){
451
452			clearInterval(pp_slideshow);
453			
454			$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
455			
456			$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
457			
458			$pp_overlay.fadeOut(settings.animation_speed, function(){
459				if($.browser.msie && $.browser.version == 6) $('select').css('visibility','visible'); // To fix the bug with IE select boxes
460				
461				if(settings.hideflash) $('object,embed').css('visibility','visible'); // Show the flash
462				
463				$(this).remove(); // No more need for the prettyPhoto markup
464				
465				$(window).unbind('scroll');
466				
467				settings.callback();
468				
469				doresize = true;
470				
471				pp_open = false;
472				
473				delete settings;
474			});
475		};
476	
477		/**
478		* Set the proper sizes on the containers and animate the content in.
479		*/
480		_showContent = function(){
481			$('.pp_loaderIcon').hide();
482			
483			$ppt.fadeTo(settings.animation_speed,1);
484
485			// Calculate the opened top position of the pic holder
486			projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (correctSizes['containerHeight']/2));
487			if(projectedTop < 0) projectedTop = 0;
488
489			// Resize the content holder
490			$pp_pic_holder.find('.pp_content').animate({'height':correctSizes['contentHeight']},settings.animation_speed);
491			
492			// Resize picture the holder
493			$pp_pic_holder.animate({
494				'top': projectedTop,
495				'left': (windowWidth/2) - (correctSizes['containerWidth']/2),
496				'width': correctSizes['containerWidth']
497			},settings.animation_speed,function(){
498				$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(correctSizes['height']).width(correctSizes['width']);
499
500				$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed); // Fade the new content
501
502				// Show the nav
503				if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
504			
505				if(correctSizes['resized']) $('a.pp_expand,a.pp_contract').fadeIn(settings.animation_speed); // Fade the resizing link if the image is resized
506				
507				if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
508				
509				settings.changepicturecallback(); // Callback!
510				
511				pp_open = true;
512			});
513			
514			_insert_gallery();
515		};
516		
517		/**
518		* Hide the content...DUH!
519		*/
520		function _hideContent(callback){
521			// Fade out the current picture
522			$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
523			$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
524				$('.pp_loaderIcon').show();
525				
526				callback();
527			});
528		};
529	
530		/**
531		* Check the item position in the gallery array, hide or show the navigation links
532		* @param setCount {integer} The total number of items in the set
533		*/
534		function _checkPosition(setCount){
535			// If at the end, hide the next link
536			if(set_position == setCount-1) {
537				$pp_pic_holder.find('a.pp_next').css('visibility','hidden');
538				$pp_pic_holder.find('a.pp_next').addClass('disabled').unbind('click');
539			}else{ 
540				$pp_pic_holder.find('a.pp_next').css('visibility','visible');
541				$pp_pic_holder.find('a.pp_next.disabled').removeClass('disabled').bind('click',function(){
542					$.prettyPhoto.changePage('next');
543					return false;
544				});
545			};
546		
547			// If at the beginning, hide the previous link
548			if(set_position == 0) {
549				$pp_pic_holder
550					.find('a.pp_previous')
551					.css('visibility','hidden')
552					.addClass('disabled')
553					.unbind('click');
554			}else{
555				$pp_pic_holder.find('a.pp_previous.disabled')
556					.css('visibility','visible')
557					.removeClass('disabled')
558					.bind('click',function(){
559						$.prettyPhoto.changePage('previous');
560						return false;
561					});
562			};
563			
564			(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide(); // Hide the bottom nav if it's not a set.
565		};
566	
567		/**
568		* Resize the item dimensions if it's bigger than the viewport
569		* @param width {integer} Width of the item to be opened
570		* @param height {integer} Height of the item to be opened
571		* @return An array containin the "fitted" dimensions
572		*/
573		function _fitToViewport(width,height){
574			resized = false;
575
576			_getDimensions(width,height);
577			
578			// Define them in case there's no resize needed
579			imageWidth = width, imageHeight = height;
580
581			if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
582				resized = true, fitting = false;
583			
584				while (!fitting){
585					if((pp_containerWidth > windowWidth)){
586						imageWidth = (windowWidth - 200);
587						imageHeight = (height/width) * imageWidth;
588					}else if((pp_containerHeight > windowHeight)){
589						imageHeight = (windowHeight - 200);
590						imageWidth = (width/height) * imageHeight;
591					}else{
592						fitting = true;
593					};
594
595					pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
596				};
597			
598				_getDimensions(imageWidth,imageHeight);
599			};
600
601			return {
602				width:Math.floor(imageWidth),
603				height:Math.floor(imageHeight),
604				containerHeight:Math.floor(pp_containerHeight),
605				containerWidth:Math.floor(pp_containerWidth) + 40, // 40 behind the side padding
606				contentHeight:Math.floor(pp_contentHeight),
607				contentWidth:Math.floor(pp_contentWidth),
608				resized:resized
609			};
610		};
611		
612		/**
613		* Get the containers dimensions according to the item size
614		* @param width {integer} Width of the item to be opened
615		* @param height {integer} Height of the item to be opened
616		*/
617		function _getDimensions(width,height){
618			width = parseFloat(width);
619			height = parseFloat(height);
620			
621			// Get the details height, to do so, I need to clone it since it's invisible
622			$pp_details = $pp_pic_holder.find('.pp_details');
623			$pp_details.width(width);
624			detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
625			$pp_details = $pp_details.clone().appendTo($('body')).css({
626				'position':'absolute',
627				'top':-10000
628			});
629			detailsHeight += $pp_details.height();
630			detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight; // Min-height for the details
631			if($.browser.msie && $.browser.version==7) detailsHeight+=8;
632			$pp_details.remove();
633			
634			// Get the container size, to resize the holder to the right dimensions
635			pp_contentHeight = height + detailsHeight;
636			pp_contentWidth = width;
637			pp_containerHeight = pp_contentHeight + $ppt.height() + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
638			pp_containerWidth = width;
639		}
640	
641		function _getFileType(itemSrc){
642			if (itemSrc.match(/youtube\.com\/watch/i)) {
643				return 'youtube';
644			}else if (itemSrc.match(/vimeo\.com/i)) {
645				return 'vimeo';
646			}else if(itemSrc.indexOf('.mov') != -1){ 
647				return 'quicktime';
648			}else if(itemSrc.indexOf('.swf') != -1){
649				return 'flash';
650			}else if(itemSrc.indexOf('iframe') != -1){
651				return 'iframe';
652			}else if(itemSrc.indexOf('custom') != -1){
653				return 'custom';				
654			}else if(itemSrc.indexOf('.mp4') != -1)	{ 
655				return 'flv';				
656			}else if(itemSrc.indexOf('.m4v') != -1)	{ 
657				return 'flv';
658			}else if(itemSrc.indexOf('.flv') != -1)	{
659				return 'flv';
660			}else if(itemSrc.substr(0,1) == '#'){
661				return 'inline';
662			}else{
663				return 'image';
664			};
665		};
666	
667		function _center_overlay(){
668			if(doresize && typeof $pp_pic_holder != 'undefined') {
669				scroll_pos = _get_scroll();
670				
671				titleHeight = $ppt.height(), contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
672				
673				projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
674				
675				$pp_pic_holder.css({
676					'top': projectedTop,
677					'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
678				});
679			};
680		};
681	
682		function _get_scroll(){
683			if (self.pageYOffset) {
684				return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
685			} else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
686				return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
687			} else if (document.body) {// all other Explorers
688				return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
689			};
690		};
691	
692		function _resize_overlay() {
693			windowHeight = $(window).height(), windowWidth = $(window).width();
694			
695			if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height());
696		};
697	
698		function _insert_gallery(){
699			if(isSet && settings.overlay_gallery && _getFileType(pp_images[set_position])=="image") {
700				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
701				navWidth = (settings.theme == "facebook") ? 58 : 38; // Define the arrow width depending on the theme
702				
703				itemsPerPage = Math.floor((correctSizes['containerWidth'] - 100 - navWidth) / itemWidth);
704				itemsPerPage = (itemsPerPage < pp_images.length) ? itemsPerPage : pp_images.length;
705				totalPage = Math.ceil(pp_images.length / itemsPerPage) - 1;
706
707				// Hide the nav in the case there's no need for links
708				if(totalPage == 0){
709					navWidth = 0; // No nav means no width!
710					$pp_pic_holder.find('.pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous').hide();
711				}else{
712					$pp_pic_holder.find('.pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous').show();
713				};
714
715				galleryWidth = itemsPerPage * itemWidth + navWidth;
716				
717				// Set the proper width to the gallery items
718				$pp_pic_holder.find('.pp_gallery')
719					.width(galleryWidth)
720					.css('margin-left',-(galleryWidth/2));
721					
722				$pp_pic_holder
723					.find('.pp_gallery ul')
724					.width(itemsPerPage * itemWidth)
725					.find('li.selected')
726					.removeClass('selected');
727				
728				goToPage = (Math.floor(set_position/itemsPerPage) <= totalPage) ? Math.floor(set_position/itemsPerPage) : totalPage;
729				
730				
731				if(itemsPerPage) {
732					$pp_pic_holder.find('.pp_gallery').hide().show().removeClass('disabled');
733				}else{
734					$pp_pic_holder.find('.pp_gallery').hide().addClass('disabled');
735				}
736				
737				$.prettyPhoto.changeGalleryPage(goToPage);
738				
739				$pp_pic_holder
740					.find('.pp_gallery ul li:eq('+set_position+')')
741					.addClass('selected');
742			}else{
743				$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');
744				$pp_pic_holder.find('.pp_gallery').hide();
745			}
746		}
747	
748		function _buildOverlay(caller){
749			// Find out if the picture is part of a set
750			theRel = $(caller).attr('rel');
751			galleryRegExp = /\[(?:.*)\]/;
752			isSet = (galleryRegExp.exec(theRel)) ? true : false;
753			
754			// Put the SRCs, TITLEs, ALTs into an array.
755			pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr('rel').indexOf(theRel) != -1) return $(n).attr('href'); }) : $.makeArray($(caller).attr('href'));
756			pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr('rel').indexOf(theRel) != -1) return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : ""; }) : $.makeArray($(caller).find('img').attr('alt'));
757			pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i){ if($(n).attr('rel').indexOf(theRel) != -1) return ($(n).attr('title')) ? $(n).attr('title') : ""; }) : $.makeArray($(caller).attr('title'));
758			
759			$('body').append(settings.markup); // Inject the markup
760			
761			$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay 
761= $('div.pp_overlay'); // Set my global selectors
762			
763			// Inject the inline gallery!
764			if(isSet && settings.overlay_gallery) {
765				currentGalleryPage = 0;
766				toInject = "";
767				for (var i=0; i < pp_images.length; i++) {
768					var regex = new RegExp("(.*?)\.(jpg|jpeg|png|gif)$");
769					var results = regex.exec( pp_images[i] );
770					if(!results){
771						classname = 'default';
772					}else{
773						classname = '';
774					}
775					toInject += "<li class='"+classname+"'><a href='#'><img src='" + pp_images[i] + "' width='50' alt='' /></a></li>";
776				};
777				
778				toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
779				
780				$pp_pic_holder.find('#pp_full_res').after(toInject);
781				
782				$pp_pic_holder.find('.pp_gallery .pp_arrow_next').click(function(){
783					$.prettyPhoto.changeGalleryPage('next');
784					$.prettyPhoto.stopSlideshow();
785					return false;
786				});
787				
788				$pp_pic_holder.find('.pp_gallery .pp_arrow_previous').click(function(){
789					$.prettyPhoto.changeGalleryPage('previous');
790					$.prettyPhoto.stopSlideshow();
791					return false;
792				});
793				
794				$pp_pic_holder.find('.pp_content').hover(
795					function(){
796						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();
797					},
798					function(){
799						$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();
800					});
801
802				itemWidth = 52+5; // 52 beign the thumb width, 5 being the right margin.
803				$pp_pic_holder.find('.pp_gallery ul li').each(function(i){
804					$(this).css({
805						'position':'absolute',
806						'left': i * itemWidth
807					});
808
809					$(this).find('a').unbind('click').click(function(){
810						$.prettyPhoto.changePage(i);
811						$.prettyPhoto.stopSlideshow();
812						return false;
813					});
814				});
815			};
816			
817			
818			// Inject the play/pause if it's a slideshow
819			if(settings.slideshow){
820				$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
821				$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
822					$.prettyPhoto.startSlideshow();
823					return false;
824				});
825			}
826			
827			$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme); // Set the proper theme
828			
829			$pp_overlay
830				.css({
831					'opacity':0,
832					'height':$(document).height(),
833					'width':$(document).width()
834					})
835				.bind('click',function(){
836					if(!settings.modal) $.prettyPhoto.close();
837				});
838
839			$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
840
841			$('a.pp_expand').bind('click',function(e){
842				// Expand the image
843				if($(this).hasClass('pp_expand')){
844					$(this).removeClass('pp_expand').addClass('pp_contract');
845					doresize = false;
846				}else{
847					$(this).removeClass('pp_contract').addClass('pp_expand');
848					doresize = true;
849				};
850			
851				_hideContent(function(){ $.prettyPhoto.open(); });
852		
853				return false;
854			});
855		
856			$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){
857				$.prettyPhoto.changePage('previous');
858				$.prettyPhoto.stopSlideshow();
859				return false;
860			});
861		
862			$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){
863				$.prettyPhoto.changePage('next');
864				$.prettyPhoto.stopSlideshow();
865				return false;
866			});
867			
868			_center_overlay(); // Center it
869		};
870		
871		return this.unbind('click').click($.prettyPhoto.initialize); // Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
872	};
873	
874	function grab_param(name,url){
875	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
876	  var regexS = "[\\?&]"+name+"=([^&#]*)";
877	  var regex = new RegExp( regexS );
878	  var results = regex.exec( url );
879	  return ( results == null ) ? "" : results[1];
880	}
881	
882})(jQuery);
883
884jQuery(document).ready(function($){
885var seltheme = 3;
886	if (seltheme == 1) {var pptheme = 'light_rounded';}
887	if (seltheme == 2) {var pptheme = 'light_square';}
888	if (seltheme == 3) {var pptheme = 'dark_rounded';}
889	if (seltheme == 4) {var pptheme = 'dark_square';}
890	if (seltheme == 5) {var pptheme = 'facebook';}
891$('a[rel^="prettyPhoto"]').prettyPhoto({theme: pptheme, animationSpeed: 'fast', opacity: 0.7, counter_separator_label: ' / ',default_width: 500, fplayer: 'http://releases.flowplayer.org/swf/flowplayer-3.2.3.swf'
892, slideshow:  3000, autoplay_slideshow: true });
893});
894	return stack;
895})(stacks.stacks_in_79_page0);
896
897

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.