Projekt

Allgemein

Profil

GX-Bug #49113 » ButtonProductImagesHandler.js

Moritz Bunjes, 17.10.2016 11:14

 
1
/* ButtonProductImagesHandler.js <?php
2
#   --------------------------------------------------------------
3
#   ButtonProductImagesHandler.js 2016-10-17
4
#   Gambio GmbH
5
#   http://www.gambio.de
6
#   Copyright (c) 2016 Gambio GmbH
7
#   Released under the GNU General Public License (Version 2)
8
#   [http://www.gnu.org/licenses/gpl-2.0.html]
9
#   --------------------------------------------------------------
10
?>*/
11
/*<?php
12
if($GLOBALS['coo_debugger']->is_enabled('uncompressed_js') == false)
13
{
14
?>*/
15
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('8 1A(i,j,k){4(u)v.w(\'1A 2q\');s l=A;4(1h(i)==\'1Z\'){l=i}s m=A;4(1h(j)==\'1Z\'){m=j}s n=2r;4(21(k)!=\'2s\'){n=21(k)}s o=5,1i=0,15=1j 2t(),1k=A,1l=p,1B=0,16=\'\',1C=\'\';5.1b=8(){4(u)v.w(\'1A 1b\');5.1D();4(m){5.1E()}4(l){5.1F()}M{$(\'.17\').H(\'z\');$(\'.17\').I(\'z\',8(){4(u)v.w(\'.17 z\');4($(\'.t .x .y #R\').F>0&&$(\'.t .x .y #R\').7(\'1c\')!=\'1d\'){o.1e(5)}S p})}};5.1D=8(){4(u)v.w(\'1D\');s a=\'\';$(\'a.10\').H(\'T\');$(\'a.10\').I(\'T\',8(){4(u)v.w(\'a.10 T: \'+$(5).q(\'U\'));$(5).q(\'1m\',\'\');$(5).2u(\'22\').q(\'1m\',\'\');4($(\'.t .x .y #R\').F==0||$(\'.t .x .y #R\').7(\'1c\')==\'1d\'){16=\'#\'+$(5).q(\'U\');4(1l==p){o.1e(5)}}S p});$(\'.10\').H(\'W\');$(\'.10\').I(\'W\',8(){23(1i);4($(\'.t .x .y .J\').X()==\'1n...\'){$(\'.t .x .y .J\').X(1C);o.1b()}2v(1B);16=\'\';1l=A;1B=2w(o.1o,n);a=$(5).q(\'U\');a=a.r(\'1G\',\'\');$(\'.t .x .y #24\'+a).2x(\'a\').K(\'25\');S p})};5.1o=8(){1l=p;4(16!=\'\'){4(u)v.w(\'1o(): \'+16);o.1e(16)}M{4(u)v.w(\'1o(): 2y 2z\')}};5.1e=8(a){4(1h($(a).q(\'U\'))!=\'26\'&&$(a).q(\'U\').11(\'1G\')!=-1){$(\'.t .x .y #R\').27();$(\'a.10\').K(\'1H\');$(a).V(\'1H\');12=$(a).q(\'U\');12=12.r(\'1G\',\'\');15[12]=1j 28();15[12].1p=$(a).q(\'G\');29=5.1I(12,$(a).q(\'2a\'));4(29==p){1i=2A(8(){o.1I(12,$(a).q(\'2a\'))},2b)}}};5.1I=8(a,b){s c=N(a),1q=A;4(15[c].2B!=A){1q=p}4(1q){23(1i);s d=\'\';4(l==p){d=\' 1J="2C: 2D;"\'}s e=15[c].1p;e=e.2E(e.11(2F.2G.2H+\'2I\'),e.F);$(\'.t .x .y .J\').7(\'Y\',15[c].Y+\'E\');$(\'.t .x .y .J\').X(\'<a 2c="25" G="\'+b+\'"\'+d+\' 1m=""><22 U="24\'+c+\'" 1p="\'+e+\'" 2J="" 1m="" /></a>\');4(m){5.1E()}}M{4($(\'.t .x .y .J\').X()!=\'1n...\'){1C=$(\'.t .x .y .J\').X()}$(\'.t .x .y .J\').X(\'1n...\');4(u)v.w(\'1n 2K...\')}S 1q};5.1E=8(){4($(\'.t .x .y #R\').F==0||$(\'.t .x .y #R\').7(\'1c\')==\'1d\'){$(\'.t .x .y .J\').X($(\'.t .x .y .J\').X());4($(".J").F>0){$(".J").2L()}}};5.1F=8(){4(u)v.w(\'1F\');$(\'.17\').H(\'z\');$(\'.17\').I(\'z\',8(){4(u)v.w(\'.17 z\');4($(\'.t .x .y #R\').F>0&&$(\'.t .x .y #R\').7(\'1c\')!=\'1d\'){o.1e(5)}M 4($(\'.t .x .y .J\').F>0){$(\'.2M\').2N(\'<1r U="1s"></1r>\');$(\'#1s\').7({2O:\'2P\',1t:\'2Q\',1K:\'2R\',Y:\'2b%\'});$(\'#1s\').2S(\'2T.2U?2V=2W&U=\'+$("#2X").q(\'2Y\')+\'&2Z=\'+30,8(a){o.2d();o.2e()});4(31.32.33(/34 [0-6]\\./)){$(\'.35\').7({18:\'1L\'})}1M.36(\'#1s\');$(\'#37\').7({1c:\'1d\'});4($(2f).13()>$(\'#2g\').13()){s b=$(2f).13()}M{s b=$(\'#2g\').13()+38}$(\'#39\').7({13:b+\'E\'})}S p})};5.2d=8(){4(u)v.w(\'t 1b\');s c=N($(\'#B\').7(\'13\').r(\'E\',\'\')),1N=0;4($(\'#B .19:2h\').F>0){1N=N($(\'#B .19:2h\').7(\'13\').r(\'E\',\'\'))}s d=1O.2i(c/2)-1O.2i(1N/2);$(\'#B .19\').2j(\'<1r 1J="1P-1K:\'+d+\'E;2k:1t;" />\');$(\'#B .1u\').2j(\'<1r 1J="1P-1K:\'+d+\'E;2k:1v;" />\');$(\'#3\').H(\'1Q\');$(\'#3\').I(\'1Q\',8(){4(u)v.w(\'#3 1Q\');1k=p});$(\'#3\').H(\'1R\');$(\'#3\').I(\'1R\',8(){4(u)v.w(\'#3 1R\');1k=A});$(\'3a\').z(8(){4(1k&&1h(3b)==\'26\'){1M.2l()}});s e=0,1w=N($(\'#3 .9\').7(\'Y\').r(\'E\',\'\'))+N($(\'#3 .9\').7(\'1P-1v\').r(\'E\',\'\'))+N($(\'#3 .9\').7(\'2m-1t\').r(\'E\',\'\'))+N($(\'#3 .9\').7(\'2m-1v\').r(\'E\',\'\'))+N($(\'#3 .9\').7(\'2n-1t-Y\').r(\'E\',\'\'))+N($(\'#3 .9\').7(\'2n-1v-Y\').r(\'E\',\'\')),1S=N($(\'#3\').7(\'Y\').r(\'E\',\'\'));e=$(\'#3 .9\').F*1w;4(1S<e){s f=1O.3c(1S/1w);e=f*1w}$(\'#1T\').7(\'Y\',e+\'E\');s g=0,14=0;$(\'.t .3d .10\').1x(8(){4($(5).q(\'2c\').11(\'1H\')!=-1){g=14}14++});$(\'#B\').7(\'O-P\',\'Q("\'+$(\'#3 .9 a\').Z(g).q(\'G\')+\'")\');$(\'#3 .9\').Z(g).V(\'L\');$(\'#3 .9 a\').H(\'z\');$(\'#3 .9 a\').I(\'z\',8(){4(u)v.w(\'#3 .9 a z\');$(\'#3 .9\').K(\'L\');$(5).1f().V(\'L\');s a=$(5).q(\'G\');$(\'#B\').7(\'O-P\',\'Q("\'+a+\'")\');o.1g(A);S p});$(\'#3 .C, #3 .C a\').2o(\'z\');$(\'#3 .C, #3 .C a\').z(8(){4(u)v.w(\'#3 .C, #3 .C a z\');s b=$(\'#B\').7(\'O-P\').r(\'Q("\',\'\').r(\'")\',\'\'),1y=\'\',1U=3e,1a=p;$(\'#3 .9 a\').1x(8(){s a=$(5).q(\'G\').2p(\'?\')[0].r(\' \',\'%20\').r(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,"\\\\$&");4(b.11(a)!=-1){4(1y!=\'\'){$(\'#B\').7(\'O-P\',\'Q("\'+1y+\'")\');$(\'#3 .9\').K(\'L\');$(1U).1f().V(\'L\');1a=A}}M{1y=$(5).q(\'G\');1U=5}});4(1a==p){$(\'#B\').7(\'O-P\',\'Q("\'+$(\'#3 .9 a\').Z($(\'#3 .9 a\').F-1).q(\'G\')+\'")\');$(\'#3 .9\').K(\'L\');$(\'#3 .9 a\').Z($(\'#3 .9 a\').F-1).1f().V(\'L\')}o.1g(A);S p});$(\'#3 .D, #3 .D a\').2o(\'z\');$(\'#3 .D, #3 .D a\').z(8(){4(u)v.w(\'#3 .D, #3 .D a z\');s b=$(\'#B\').7(\'O-P\').r(\'Q("\',\'\').r(\'")\',\'\'),1z=p,1a=p;$(\'#3 .9 a\').1x(8(){4(1z==A){$(\'#B\').7(\'O-P\',\'Q("\'+$(5).q(\'G\')+\'")\');$(\'#3 .9\').K(\'L\');$(5).1f().V(\'L\');1z=p;1a=A}s a=$(5).q(\'G\').2p(\'?\')[0].r(\' \',\'%20\').r(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g,"\\\\$&");4(b.11(a)!=-1){1z=A}});4(1a==p){$(\'#B\').7(\'O-P\',\'Q("\'+$(\'#3 .9 a\').Z(0).q(\'G\')+\'")\');$(\'#3 .9\').K(\'L\');$(\'#3 .9 a\').Z(0).1f().V(\'L\')}o.1g(A);S p});s h=p;$(\'#3 .C\').H(\'T\');$(\'#3 .C\').I(\'T\',8(){4(u)v.w(\'#3 .C T\');4(!h){$(\'.19\').V(\'1V\');$(\'.1u\').K(\'1W\')}});$(\'#3 .C\').H(\'W\');$(\'#3 .C\').I(\'W\',8(){4(u)v.w(\'#3 .C W\');$(\'.19\').K(\'1V\')});$(\'#3 .D\').H(\'T\');$(\'#3 .D\').I(\'T\',8(){4(u)v.w(\'#3 .D T\');h=A;$(\'.1u\').V(\'1W\');$(\'.19\').K(\'1V\')});$(\'#3 .D\').H(\'W\');$(\'#3 .D\').I(\'W\',8(){4(u)v.w(\'#3 .D W\');h=p;$(\'.1u\').K(\'1W\')});$(\'#3 .1X\').H(\'z\');$(\'#3 .1X\').I(\'z\',8(){4(u)v.w(\'#3 .1X z\');1M.2l();S p});o.1g(A)};5.1g=8(a){4(a==p){4($(\'#B\').7(\'O-P\').r(\'Q("\',\'\').r(\'")\',\'\').11($(\'#3 .9 a\').Z(0).q(\'G\'))!=-1){$(\'#3 .C\').7(\'18\',\'1L\')}M{$(\'#3 .C\').7(\'18\',\'1Y\')}4($(\'#B\').7(\'O-P\').r(\'Q("\',\'\').r(\'")\',\'\').11($(\'#3 .9 a\').Z($(\'#3 .9 a\').F-1).q(\'G\'))!=-1){$(\'#3 .D\').7(\'18\',\'1L\')}M{$(\'#3 .D\').7(\'18\',\'1Y\')}}M{4($(\'#1T .9\').F>1){$(\'#3 .C, #3 .D\').7(\'18\',\'1Y\')}M{$(\'#1T\').27()}}};5.2e=8(){s a=1j 3f(),14=0;$(\'#3 .9 a\').1x(8(){a[14]=1j 28();a[14].1p=$(5).q(\'G\');14++})};5.1b()}',62,202,'|||lightbox_gallery|if|this||css|function|thumbnail||||||||||||||||false|attr|replace|var|gallery|fb|console|log|inside|stage|click|true|lightbox_gallery_main|lightbox_gallery_left|lightbox_gallery_right|px|length|href|die|live|info_image_box|removeClass|lightbox_thumbnail_active|else|Number|background|image|url|crossslide|return|mouseover|id|addClass|mouseout|html|width|eq|button_product_images|search|t_thumbnail_id|height|count_thumbnails|t_images_array|t_active_image_id|button_lightbox_gallery|visibility|icon_gallery_back|t_updated_image|init_binds|display|none|show_image|parent|update_navigation|typeof|t_interval|new|t_close_lightbox|t_wait|title|loading|show_image_after_delay|src|t_image_loaded|div|lightbox_gallery_box|left|icon_gallery_next|right|t_thumbnail_width|each|t_previous_image|t_current_image_reached|ButtonProductImagesHandler|t_timeout|t_last_image_html|bind_thumbnails|bind_zoom|bind_lightbox|gallery_inside_thumbnail_|active_thumbnail|load_image|style|top|hidden|gmLightBox|t_button_height|Math|margin|mouseenter|mouseleave|t_gallery_width|lightbox_gallery_thumbnails|t_previous_element|icon_gallery_back_active|icon_gallery_next_active|icon_lightbox_close|visible|boolean||parseInt|img|clearInterval|gallery_inside_main_|jqzoom|undefined|hide|Image|t_load_image|rel|100|class|gallery_init_binds|preload|document|popup_box|first|round|wrap|float|close_box|padding|border|unbind|split|ready|500|NaN|Object|find|clearTimeout|setTimeout|closest|no|element|setInterval|complete|cursor|default|substring|js_options|global|dir_ws_images|product_images|alt|images|zoom_plugin|wrap_shop|append|position|absolute|0px|60px|load|request_port|php|module|LightboxGallery|gm_products_id|value|XTCsid|gm_session_id|navigator|appVersion|match|MSIE|lightbox_visibility_hidden|load_box|menubox_gm_scroller|200|__dimScreen|body|gm_style_edit_mode_running|floor|thumbnails|null|Array'.split('|'),0,{}));
16
/*<?php
17
}
18
else
19
{
20
?>*/
21
function ButtonProductImagesHandler(p_lightbox, p_zoom, p_delay)
22
{
23
	if(fb)console.log('ButtonProductImagesHandler ready');
24

    
25
	var t_lightbox = true;
26
	if(typeof(p_lightbox) == 'boolean')
27
	{
28
		t_lightbox = p_lightbox;
29
	}
30
	var t_zoom = true;
31
	if(typeof(p_zoom) == 'boolean')
32
	{
33
		t_zoom = p_zoom;
34
	}
35
	var t_delay = 500;
36
	if(parseInt(p_delay) != 'NaN')
37
	{
38
		t_delay = parseInt(p_delay);
39
	}
40

    
41
	var coo_this = this;
42
	var t_interval = 0;
43
	var t_images_array = new Object();
44
	var t_close_lightbox = true;
45
	var t_wait = false;
46
	var t_timeout = 0;
47
	var t_active_image_id = '';
48
	var t_last_image_html = '';
49

    
50

    
51
	this.init_binds = function()
52
	{
53
		if(fb)console.log('ButtonProductImagesHandler init_binds');
54

    
55
		this.bind_thumbnails();
56
		if(t_zoom)
57
		{
58
			this.bind_zoom();
59
		}
60
		if(t_lightbox)
61
		{
62
			this.bind_lightbox();
63
		}
64
		else
65
		{
66
			$('.button_lightbox_gallery').die('click');
67
			$('.button_lightbox_gallery').live('click', function()
68
			{
69
				if(fb)console.log('.button_lightbox_gallery click');
70

    
71
				if($('.gallery .inside .stage #crossslide').length > 0 && $('.gallery .inside .stage #crossslide').css('display') != 'none')
72
				{
73
					coo_this.show_image(this);
74
				}
75

    
76
				return false;
77
			});
78
		}
79
	}
80

    
81

    
82
	this.bind_thumbnails = function()
83
	{
84
		if(fb)console.log('bind_thumbnails');
85

    
86
		var t_thumbnail_id = '';
87

    
88
		$('a.button_product_images').die('mouseover');
89
		$('a.button_product_images').live('mouseover', function()
90
		{
91
			if(fb)console.log('a.button_product_images mouseover: ' + $(this).attr('id'));
92

    
93
			$(this).attr('title', '');
94
			$(this).find('img').attr('title', '');
95

    
96
			if($('.gallery .inside .stage #crossslide').length == 0 || $('.gallery .inside .stage #crossslide').css('display') == 'none')
97
			{
98
				t_active_image_id = '#' + $(this).attr('id');
99

    
100
				if(t_wait == false)
101
				{
102
					coo_this.show_image(this);
103
				}
104

    
105
			}
106

    
107
			return false;
108
		});
109

    
110
		$('.button_product_images').die('mouseout');
111
		$('.button_product_images').live('mouseout', function()
112
		{
113
			clearInterval(t_interval);
114
			
115
			if($('.gallery .inside .stage .info_image_box').html() == 'loading...')
116
			{
117
				$('.gallery .inside .stage .info_image_box').html(t_last_image_html);
118
				coo_this.init_binds();
119
			}
120

    
121
			clearTimeout(t_timeout);
122
			t_active_image_id = '';
123
			t_wait = true;
124
			t_timeout = setTimeout(coo_this.show_image_after_delay, t_delay);
125

    
126
			t_thumbnail_id = $(this).attr('id');
127
			t_thumbnail_id = t_thumbnail_id.replace('gallery_inside_thumbnail_', '');
128

    
129
			$('.gallery .inside .stage #gallery_inside_main_' + t_thumbnail_id).closest('a').removeClass('jqzoom');
130

    
131

    
132
			return false;
133
		});
134
	}
135

    
136

    
137
	this.show_image_after_delay = function()
138
	{
139
		t_wait = false;
140

    
141
		if(t_active_image_id != '')
142
		{
143
			if(fb)console.log('show_image_after_delay(): ' + t_active_image_id);
144
			coo_this.show_image(t_active_image_id);
145
		}
146
		else
147
		{
148
			if(fb)console.log('show_image_after_delay(): no element');
149
		}
150
	}
151

    
152

    
153
	this.show_image = function(p_element)
154
	{
155
		if(typeof($(p_element).attr('id')) != 'undefined' && $(p_element).attr('id').search('gallery_inside_thumbnail_') != -1)
156
		{
157
			$('.gallery .inside .stage #crossslide').hide();
158

    
159
			$('a.button_product_images').removeClass('active_thumbnail');
160
			$(p_element).addClass('active_thumbnail');
161

    
162
			t_thumbnail_id = $(p_element).attr('id');
163
			t_thumbnail_id = t_thumbnail_id.replace('gallery_inside_thumbnail_', '');
164

    
165
			t_images_array[t_thumbnail_id] = new Image();
166

    
167
			t_images_array[t_thumbnail_id].src = $(p_element).attr('href');
168

    
169
			t_load_image = this.load_image(t_thumbnail_id, $(p_element).attr('rel'));
170

    
171
			if(t_load_image == false)
172
			{
173
				t_interval = setInterval(function(){coo_this.load_image(t_thumbnail_id, $(p_element).attr('rel'));}, 100);
174
			}
175
		}
176
	}
177

    
178

    
179
	this.load_image = function(p_id, p_zoom_url)
180
	{
181
		var c_id = Number(p_id);
182

    
183
		var t_image_loaded = true;
184
		if(t_images_array[c_id].complete != true)
185
		{
186
			t_image_loaded = false;
187
		}
188

    
189
		if(t_image_loaded)
190
		{
191
			clearInterval(t_interval);
192

    
193
			var t_style = '';
194
			if(t_lightbox == false)
195
			{
196
				t_style = ' style="cursor: default;"';
197
			}
198

    
199
			// create relative image path, to avoid problems with umlaut domains
200
			var t_image_url = t_images_array[c_id].src;
201
			t_image_url = t_image_url.substring(t_image_url.search(js_options.global.dir_ws_images + 'product_images'), t_image_url.length);
202

    
203
			$('.gallery .inside .stage .info_image_box').css('width', t_images_array[c_id].width + 'px');
204
			$('.gallery .inside .stage .info_image_box').html('<a class="jqzoom" href="' + p_zoom_url + '"' + t_style + ' title=""><img id="gallery_inside_main_' + c_id + '" src="' + t_image_url + '" alt="" title="" /></a>');
205

    
206
			if(t_zoom)
207
			{
208
				this.bind_zoom();
209
			}
210
		}
211
		else
212
		{
213
			if($('.gallery .inside .stage .info_image_box').html() != 'loading...')
214
			{
215
				t_last_image_html = $('.gallery .inside .stage .info_image_box').html();
216
			}
217
			$('.gallery .inside .stage .info_image_box').html('loading...');
218
			if(fb)console.log('loading images...');
219
		}
220

    
221
		return t_image_loaded;
222
	}
223

    
224

    
225
	this.bind_zoom = function()
226
	{
227
    
228
		if($('.gallery .inside .stage #crossslide').length == 0 || $('.gallery .inside .stage #crossslide').css('display') == 'none')
229
		{
230
			// workaround for chrome browser
231
			$('.gallery .inside .stage .info_image_box').html($('.gallery .inside .stage .info_image_box').html());
232

    
233
			if($(".info_image_box").length > 0)
234
			{
235
				$(".info_image_box").zoom_plugin();
236
			}
237
		}
238
	}
239

    
240

    
241
	this.bind_lightbox = function()
242
	{
243
		if(fb)console.log('bind_lightbox');
244

    
245
		$('.button_lightbox_gallery').die('click');
246
		$('.button_lightbox_gallery').live('click', function()
247
		{
248
			if(fb)console.log('.button_lightbox_gallery click');
249

    
250
			if($('.gallery .inside .stage #crossslide').length > 0 && $('.gallery .inside .stage #crossslide').css('display') != 'none')
251
			{
252
				coo_this.show_image(this);
253
			}
254
			else if($('.gallery .inside .stage .info_image_box').length > 0)
255
			{
256
				$('.wrap_shop').append('<div id="lightbox_gallery_box"></div>');
257

    
258
				$('#lightbox_gallery_box').css(
259
				{
260
					position: 	'absolute',
261
					left: 			'0px',
262
					top: 				'60px',
263
					width: 			'100%'
264
				});
265

    
266
				$('#lightbox_gallery_box').load('request_port.php?module=LightboxGallery&id=' + $("#gm_products_id").attr('value') + '&XTCsid=' + gm_session_id,
267
					function(lightbox_gallery)
268
					{
269
						coo_this.gallery_init_binds();
270
						coo_this.preload();
271
					}
272
				);
273

    
274
				if (navigator.appVersion.match(/MSIE [0-6]\./)) {
275
					$('.lightbox_visibility_hidden').css(
276
					{
277
						visibility: 	'hidden'
278
					});
279
				}
280

    
281
				gmLightBox.load_box('#lightbox_gallery_box');
282
				// BOF MOD by PT
283
				$('#menubox_gm_scroller').css({
284
					display: 'none'
285
				});
286

    
287
				if($(document).height() > $('#popup_box').height()) {
288
					var pt_height = $(document).height();
289
				} else {
290
					var pt_height = $('#popup_box').height() + 200;
291
				}
292
				$('#__dimScreen').css({height: pt_height + 'px'});
293
				// EOF MOD by PT
294
			}
295

    
296
			return false;
297
		});
298
	}
299

    
300
	this.gallery_init_binds = function()
301
	{
302
		if(fb)console.log('gallery init_binds');
303

    
304
		var t_main_height = Number($('#lightbox_gallery_main').css('height').replace('px', ''));
305
		var t_button_height = 0;
306
		if($('#lightbox_gallery_main .icon_gallery_back:first').length > 0)
307
		{
308
			t_button_height = Number($('#lightbox_gallery_main .icon_gallery_back:first').css('height').replace('px', ''));
309
		}
310
		var t_margin_top = Math.round(t_main_height / 2) - Math.round(t_button_height / 2);
311

    
312
		$('#lightbox_gallery_main .icon_gallery_back').wrap('<div style="margin-top:' +  t_margin_top + 'px;float:left;" />');
313
		$('#lightbox_gallery_main .icon_gallery_next').wrap('<div style="margin-top:' +  t_margin_top + 'px;float:right;" />');
314

    
315
		$('#lightbox_gallery').die('mouseenter');
316
		$('#lightbox_gallery').live('mouseenter', function()
317
		{
318
			if(fb)console.log('#lightbox_gallery mouseenter');
319

    
320
			t_close_lightbox = false;
321
		});
322

    
323
		$('#lightbox_gallery').die('mouseleave');
324
		$('#lightbox_gallery').live('mouseleave', function()
325
		{
326
			if(fb)console.log('#lightbox_gallery mouseleave');
327

    
328
			t_close_lightbox = true;
329
		});
330

    
331
		$('body').click(function()
332
		{
333
			if(t_close_lightbox && typeof(gm_style_edit_mode_running) == 'undefined')
334
			{
335
				gmLightBox.close_box();
336
			}
337
		});
338

    
339
		// centering thumbnails
340
		var t_thumbnails_width = 0;
341
		var t_thumbnail_width = Number($('#lightbox_gallery .thumbnail').css('width').replace('px', ''))
342
								+ Number($('#lightbox_gallery .thumbnail').css('margin-right').replace('px', ''))
343
								+ Number($('#lightbox_gallery .thumbnail').css('padding-left').replace('px', ''))
344
								+ Number($('#lightbox_gallery .thumbnail').css('padding-right').replace('px', ''))
345
								+ Number($('#lightbox_gallery .thumbnail').css('border-left-width').replace('px', ''))
346
								+ Number($('#lightbox_gallery .thumbnail').css('border-right-width').replace('px', ''));
347
		var t_gallery_width = Number($('#lightbox_gallery').css('width').replace('px', ''));
348
		t_thumbnails_width = $('#lightbox_gallery .thumbnail').length * t_thumbnail_width;
349
		if(t_gallery_width < t_thumbnails_width)
350
		{
351
			var t_thumbnails_per_row = Math.floor(t_gallery_width / t_thumbnail_width);
352
			t_thumbnails_width = t_thumbnails_per_row * t_thumbnail_width;
353
		}
354
		$('#lightbox_gallery_thumbnails').css('width', t_thumbnails_width + 'px');
355

    
356
		var t_active_image = 0;
357
		var count_thumbnails = 0;
358
		$('.gallery .thumbnails .button_product_images').each(function()
359
		{
360
			if($(this).attr('class').search('active_thumbnail') != -1)
361
			{
362
				t_active_image = count_thumbnails;
363
			}
364

    
365
			count_thumbnails++;
366
		});
367

    
368
		$('#lightbox_gallery_main').css('background-image', 'url("' + $('#lightbox_gallery .thumbnail a').eq(t_active_image).attr('href') + '")');
369
		$('#lightbox_gallery .thumbnail').eq(t_active_image).addClass('lightbox_thumbnail_active');
370

    
371
		$('#lightbox_gallery .thumbnail a').die('click');
372
		$('#lightbox_gallery .thumbnail a').live('click', function()
373
		{
374
			if(fb)console.log('#lightbox_gallery .thumbnail a click');
375

    
376
			$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
377
			$(this).parent().addClass('lightbox_thumbnail_active');
378

    
379
			var t_popup_image_url = $(this).attr('href');
380
			$('#lightbox_gallery_main').css('background-image', 'url("' + t_popup_image_url + '")');
381

    
382
			coo_this.update_navigation(true);
383

    
384
			return false;
385
		});
386

    
387
		$('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_left a').unbind('click');
388
		$('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_left a').click(function()
389
		{
390
			if(fb)console.log('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_left a click');
391

    
392
			var t_current_image = $('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '');
393
			var t_previous_image = '';
394
			var t_previous_element = null;
395
			var t_updated_image = false;
396

    
397
			$('#lightbox_gallery .thumbnail a').each(function()
398
			{
399
				var search_string = $(this).attr('href').split('?')[0].replace(' ', '%20').replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
400
				
401
				if(t_current_image.search(search_string) != -1)
402
				{
403
					if(t_previous_image != '')
404
					{
405
						$('#lightbox_gallery_main').css('background-image', 'url("' + t_previous_image + '")');
406

    
407
						$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
408
						$(t_previous_element).parent().addClass('lightbox_thumbnail_active');
409

    
410
						t_updated_image = true;
411
					}
412
				}
413
				else
414
				{
415
					t_previous_image = $(this).attr('href');
416
					t_previous_element = this;
417
				}
418
			});
419

    
420
			if(t_updated_image == false)
421
			{
422
				$('#lightbox_gallery_main').css('background-image', 'url("' + $('#lightbox_gallery .thumbnail a').eq($('#lightbox_gallery .thumbnail a').length - 1).attr('href') + '")');
423

    
424
				$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
425
				$('#lightbox_gallery .thumbnail a').eq($('#lightbox_gallery .thumbnail a').length - 1).parent().addClass('lightbox_thumbnail_active');
426
			}
427

    
428
			coo_this.update_navigation(true);
429

    
430
			return false;
431
		});
432

    
433
		$('#lightbox_gallery .lightbox_gallery_right, #lightbox_gallery .lightbox_gallery_right a').unbind('click');
434
		$('#lightbox_gallery .lightbox_gallery_right, #lightbox_gallery .lightbox_gallery_right a').click(function()
435
		{
436
			if(fb)console.log('#lightbox_gallery .lightbox_gallery_right, #lightbox_gallery .lightbox_gallery_right a click');
437

    
438
			var t_current_image = $('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '');
439
			var t_current_image_reached = false;
440
			var t_updated_image = false;
441

    
442
			$('#lightbox_gallery .thumbnail a').each(function()
443
			{
444
				if(t_current_image_reached == true)
445
				{
446
					$('#lightbox_gallery_main').css('background-image', 'url("' + $(this).attr('href') + '")');
447

    
448
					$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
449
					$(this).parent().addClass('lightbox_thumbnail_active');
450

    
451
					t_current_image_reached = false;
452
					t_updated_image = true;
453
				}
454
				
455
				var search_string = $(this).attr('href').split('?')[0].replace(' ', '%20').replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
456
				
457
				if(t_current_image.search(search_string) != -1)
458
				{
459
					t_current_image_reached = true;
460
				}
461
			});
462

    
463
			if(t_updated_image == false)
464
			{
465
				$('#lightbox_gallery_main').css('background-image', 'url("' + $('#lightbox_gallery .thumbnail a').eq(0).attr('href') + '")');
466

    
467
				$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
468
				$('#lightbox_gallery .thumbnail a').eq(0).parent().addClass('lightbox_thumbnail_active');
469
			}
470

    
471
			coo_this.update_navigation(true);
472

    
473
			return false;
474
		});
475

    
476
		var t_right_mouseover = false;
477

    
478
		// BOF previous image
479
		$('#lightbox_gallery .lightbox_gallery_left').die('mouseover');
480
		$('#lightbox_gallery .lightbox_gallery_left').live('mouseover', function()
481
		{
482
			if(fb)console.log('#lightbox_gallery .lightbox_gallery_left mouseover');
483

    
484
			if(!t_right_mouseover)
485
			{
486
				$('.icon_gallery_back').addClass('icon_gallery_back_active');
487
				$('.icon_gallery_next').removeClass('icon_gallery_next_active');
488
			}
489
		});
490

    
491
		$('#lightbox_gallery .lightbox_gallery_left').die('mouseout');
492
		$('#lightbox_gallery .lightbox_gallery_left').live('mouseout', function()
493
		{
494
			if(fb)console.log('#lightbox_gallery .lightbox_gallery_left mouseout');
495

    
496
			$('.icon_gallery_back').removeClass('icon_gallery_back_active');
497
		});
498
		// EOF previous image
499

    
500
		// BOF next image
501
		$('#lightbox_gallery .lightbox_gallery_right').die('mouseover');
502
		$('#lightbox_gallery .lightbox_gallery_right').live('mouseover', function()
503
		{
504
			if(fb)console.log('#lightbox_gallery .lightbox_gallery_right mouseover');
505

    
506
			t_right_mouseover = true;
507

    
508
			$('.icon_gallery_next').addClass('icon_gallery_next_active');
509
			$('.icon_gallery_back').removeClass('icon_gallery_back_active');
510
		});
511

    
512
		$('#lightbox_gallery .lightbox_gallery_right').die('mouseout');
513
		$('#lightbox_gallery .lightbox_gallery_right').live('mouseout', function()
514
		{
515
			if(fb)console.log('#lightbox_gallery .lightbox_gallery_right mouseout');
516

    
517
			t_right_mouseover = false;
518

    
519
			$('.icon_gallery_next').removeClass('icon_gallery_next_active');
520
		});
521
		// EOF next image
522

    
523
		// BOF close
524
		$('#lightbox_gallery .icon_lightbox_close').die('click');
525
		$('#lightbox_gallery .icon_lightbox_close').live('click', function()
526
		{
527
			if(fb)console.log('#lightbox_gallery .icon_lightbox_close click');
528

    
529
			gmLightBox.close_box();
530

    
531
			return false;
532
		});
533
		// EOF close
534

    
535
		coo_this.update_navigation(true);
536
	}
537

    
538

    
539
	this.update_navigation = function(p_loop)
540
	{
541
		if(p_loop == false)
542
		{
543
			if($('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '').search($('#lightbox_gallery .thumbnail a').eq(0).attr('href')) != -1)
544
			{
545
				$('#lightbox_gallery .lightbox_gallery_left').css('visibility', 'hidden');
546
			}
547
			else
548
			{
549
				$('#lightbox_gallery .lightbox_gallery_left').css('visibility', 'visible');
550
			}
551

    
552
			if($('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '').search($('#lightbox_gallery .thumbnail a').eq($('#lightbox_gallery .thumbnail a').length-1).attr('href')) != -1)
553
			{
554
				$('#lightbox_gallery .lightbox_gallery_right').css('visibility', 'hidden');
555
			}
556
			else
557
			{
558
				$('#lightbox_gallery .lightbox_gallery_right').css('visibility', 'visible');
559
			}
560
		}
561
		else
562
		{
563
			if($('#lightbox_gallery_thumbnails .thumbnail').length > 1)
564
			{
565
				$('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_right').css('visibility', 'visible');
566
			}
567
			else
568
			{
569
				$('#lightbox_gallery_thumbnails').hide();
570
			}
571
		}
572
	}
573

    
574
	this.preload = function()
575
	{
576
		var t_images = new Array();
577
		var count_thumbnails = 0;
578

    
579
		$('#lightbox_gallery .thumbnail a').each(function()
580
		{
581
			t_images[count_thumbnails] = new Image();
582
			t_images[count_thumbnails].src = $(this).attr('href');
583

    
584
			count_thumbnails++;
585
		});
586
	}
587

    
588
	this.init_binds();
589
}
590
/*<?php
591
}
592
?>*/
    (1-1/1)