<!--

function internal_IS_Gallery_getAlbumObject(id)
{
	return eval("document.photo_album_"+id);
}

function internal_IS_Gallery_getThumbnailImage(id,n)
{
	return document.images['is_gallery_img_'+id+"_"+n];
}

function internal_IS_Gallery_getThumbnail(id,n)
{
	return getElementByKey('is_gallery_'+id+"_"+n);
}

function internal_IS_Gallery_getCurrentPage(id)
{
	var o = internal_IS_Gallery_getAlbumObject(id);
	if (!isDefined(o.current_page))
	{
		o.current_page=0;
	}	
	return o.current_page;
}

function internal_IS_Gallery_getAlbumPrevBouton(id)
{
	return getElementByKey('album_'+id+'_prev_button')
}

function internal_IS_Gallery_getAlbumNextBouton(id)
{
	return getElementByKey('album_'+id+'_next_button')
}


function internal_IS_Gallery_refreshNavButtons(id)
{
	var o = internal_IS_Gallery_getAlbumObject(id);
	var but_prev = internal_IS_Gallery_getAlbumPrevBouton(id);
	var but_next = internal_IS_Gallery_getAlbumNextBouton(id);
	
	var nb_max = o.photos.length / (o.nb_rows *o.nb_columns);
	
	if (nb_max>Math.floor(nb_max))
	{
		nb_max++;
	}
	nb_max = Math.floor(nb_max);

	var firstIndex = 0;
	var lastIndex = nb_max-1;
	
	var max_range=o.navigator.page_range[o.current_page]

	var range = Math.floor(max_range/2);

	firstIndex = Math.max(0,Math.min(nb_max-1,o.current_page+range)-(max_range-1));
	lastIndex = Math.min(nb_max-1,firstIndex + (max_range-1));


	if (o.current_page==0)
	{
		displayElement(but_prev,false);
	}
	else
	{
		displayElement(but_prev,true);
	}	
	
	if (o.current_page>=lastIndex)
	{
		displayElement(but_next,false);
	}
	else
	{
		displayElement(but_next,true);
	}

	var selector = getElementByKey('album_'+id+'_selector_zone');
	
	var html_selector="";
	
	for (var i = firstIndex;i<lastIndex+1;i++)
	{
		if (i != o.current_page)
		{
			var st_page = "\"IS_Gallery_goPage('"+id+"',"+i+")\"";
			html_selector+="<a href='javascript:void(0)' onclick="+st_page+"><font color=#0000ff>"+(i+1)+"</font></a>&nbsp;";
		}
		else
		{
			html_selector+="<b>"+(i+1)+"</b>&nbsp;";
		}
	}

	IS_writeLayer(selector,html_selector);
	
	
}


function IS_Gallery_openThumbnail(id,url,n_image)
{
	var o = internal_IS_Gallery_getAlbumObject(id);

	var n_page = internal_IS_Gallery_getCurrentPage(id);

	var n = ((n_page*o.nb_rows*o.nb_columns)+n_image)

	window.location.replace(url+"?n_album_img="+n)

}

function IS_Gallery_onloadPhotoAlbum(id)
{
	var id_album = IS_getUrlParameter('id_album');
	if (id_album=="null") return;
	if (id!=id_album)return;
	var n_page = IS_getIntegerUrlParameter('n_page_album');
	if (n_page=="null") return;
	
	
	var o = internal_IS_Gallery_getAlbumObject(id);
	o.current_page=n_page;
	
	
	IS_Gallery_goPage(id,o.current_page);
}

function IS_Gallery_goPrevPage(id)
{
	var o = internal_IS_Gallery_getAlbumObject(id);
	internal_IS_Gallery_getCurrentPage(id);
	
	o.current_page--;
	if (o.current_page<0)
	o.current_page=0;
	IS_Gallery_goPage(id,o.current_page);
}

function IS_Gallery_goNextPage(id)
{
	
	var o = internal_IS_Gallery_getAlbumObject(id);
	
	internal_IS_Gallery_getCurrentPage(id);
	o.current_page++;
	

	IS_Gallery_goPage(id,o.current_page);
}

function IS_Gallery_goPage(id,n)
{
	var o = internal_IS_Gallery_getAlbumObject(id);
	o.current_page = n;
	internal_IS_Gallery_refreshNavButtons(id);
	
	var r = 0;
	var c = 0;
	var index_img = (o.nb_rows *o.nb_columns)*n;
	var index_thumb = 0;
	for (r=0;r<o.nb_rows;r++)
	{
		for (c=0;c<o.nb_columns;c++)
		{

			var th = internal_IS_Gallery_getThumbnail(id,index_thumb);
			var img = internal_IS_Gallery_getThumbnailImage(id,index_thumb);
			
			
			if (index_img<o.photos.length)
			{
				img.src = o.photos[index_img];
				displayElement(th,true);
			}
			else
			{
				img.src = "";
				displayElement(th,false);
			}

			index_img++;
			index_thumb++;

		}
	}
}


function IS_overThumbnail(e,id,n)
{
	var o = internal_IS_Gallery_getAlbumObject(id);
	internal_IS_Gallery_getCurrentPage(id);
	var index_img = o.current_page*(o.nb_rows *o.nb_columns)+n;
	
	IS_displayTooltip(e,o.desc[index_img]);
}

function IS_outThumbnail()
{
	IS_hideTooltip()
}


function IS_Gallery_goPrevPhoto(apply_filter)
{
	if (document.photo_album.current_index<1)
	{
		return;
	}
	document.photo_album.current_index-=1;
	IS_Gallery_loadCurrentPhoto(apply_filter)
}

function IS_Gallery_goParent()
{
	var url
	var n_page = roundTowardsZero(document.photo_album.current_index/(document.photo_album.nb_columns * document.photo_album.nb_rows))
	url = replaceSubstring(document.photo_album.parent_url,"_(CUSTOM)","")+"?id_album="+document.photo_album.unid+"&n_page_album="+n_page;
	window.location.replace(url)
}

function IS_Gallery_goNextPhoto(apply_filter)
{
	if (document.photo_album.current_index>=document.photo_album.length-1)
	{
		//IS_Gallery_stopSlideshow();
		return;
	}	
	document.photo_album.current_index+=1;
	IS_Gallery_loadCurrentPhoto(apply_filter);
}


function IS_Gallery_handler_keypressed(e)
{
	var key = e.keyCode
	if (document.photo_album.slideshow_running)
	{
		IS_Gallery_stopSlideshow();
		return false;
	}
	else
	{	
		if (key==27)
		{
			IS_Gallery_goParent();
		}
		if ((key==37)||(key==39))
		{
			return false;
		}				
	}
	return true;
}

function IS_Gallery_handler_keydown(e)
{
	var key = e.keyCode
	if (document.photo_album.slideshow_running)
	{
		IS_Gallery_stopSlideshow();
	}
	else
	{
		if (key==27)
		{
			IS_Gallery_goParent();
		}
		else
		if ((key==37))
		{
			IS_Gallery_goPrevPhoto(false);
			//return false
		}
		if ((key==39))
		{
			IS_Gallery_goNextPhoto(false);
			//return false
		}				
	}
	return false;
}

function IS_Gallery_handler_mousewheel(e)
{
	if (document.photo_album.slideshow_running)
	{
	}
	else
	{
		var n_offset = 0;
		if (isDefined(e.wheelDelta))
		{
			n_offset = (e.wheelDelta<0)?1:-1; 
		}
		else
		{
			if (isDefined(e.detail))
			{
				n_offset = (e.detail<0)?-1:1; 
			}			
		}
		
		if (document.photo_album.flag_wheel_can_slide_images)
		{
		
			if (n_offset<0)
			{
				IS_Gallery_goPrevPhoto(false);
			}
			if (n_offset>0)
			{
				IS_Gallery_goNextPhoto(false);
			}	
			return false
		}
	}
	return true
}

function IS_Gallery_handler_mousemove(e)
{
	var x = e.clientX;
	var y = e.clientY;
	if (document.photo_album.initialized)
	{
	document.photo_album.current_mouse_position.x=x;
	document.photo_album.current_mouse_position.y=y;
	}
		
	if (document.photo_album.slideshow_running)
	{
		var delta = 200;
		var x0 = document.photo_album.slideshow_initial_mouse_position.x;
		var y0 = document.photo_album.slideshow_initial_mouse_position.y;
		
		var dx = x-x0;
		var dy = y-y0;
		if (dx<0) dx =-dx;
		if (dy<0) dy =-dy;
		if ((dx>=delta)||(dy>delta))
		{
			IS_Gallery_stopSlideshow();
		}
	}
	return true;
}

function IS_Gallery_onmouseover_big_photo()
{
	document.photo_album.flag_wheel_can_slide_images =true
	return false;
}

function IS_Gallery_onmouseout_big_photo()
{
	document.photo_album.flag_wheel_can_slide_images =false
	return false;
}

function IS_Gallery_SlideshowIsRunning()
{
	return document.photo_album.slideshow_running;
}

function IS_Gallery_stopSlideshow()
{
	if (document.photo_album.slideshow_running==true)
	{
		document.photo_album.slideshow_running = false;
		
		
		if (document.images['big_photo_album'].IS_b_apply_filter == true)
		{
			document.images['big_photo_album'].IS_b_apply_filter=false;
			if (document.images['big_photo_album'].filters)
			{
				document.images['big_photo_album'].filters.blendTrans.Stop() ;	
			}
		}		
		
		internal_IS_Gallery_slideshow_stopTimer();
		
		internal_IS_Gallery_displayNavBar(true);
		//var l =document.photo_album.widgets.nav_bar.main;
		//displayElement(l,true);	
		internal_IS_Gallery_initializeNavBarPosition();	
	}	
}


function IS_Gallery_playSlideshow2()
{
	//to avoit to stop music or gif
	setTimeout("IS_Gallery_playSlideshow()",0);
}

function IS_Gallery_playSlideshow()
{
	if (document.photo_album.slideshow_running==false)
	{
		document.photo_album.slideshow_running = true;
		
		internal_IS_Gallery_displayNavBar(false);
	
		//dump(window)
		internal_IS_Gallery_playSlideshow_launchTimer();
		internal_IS_Gallery_playSlideshow_launchTimer_mousemovementDetection();
		
		internal_IS_Gallery_displayMessage(true,document.is_gallery_object.labels.launching_diaporama_in_progress,2000);
	}
}


function internal_IS_Gallery_playSlideshow_launchTimer_mousemovementDetection()
{

	document.photo_album.slideshow_object_timer_mousemovement_detection = setTimeout("internal_IS_Gallery_playSlideshow_launchTimer_mousemovementDetection()", 50);



	document.photo_album.slideshow_initial_mouse_position.x=document.photo_album.current_mouse_position.x;
	document.photo_album.slideshow_initial_mouse_position.y=document.photo_album.current_mouse_position.y;


}


function internal_IS_Gallery_slideshow_stopTimer_mousemovementDetection()
{
	if (document.photo_album.slideshow_object_timer_mousemovement_detection!=-1)
	{
		clearTimeout(document.photo_album.slideshow_object_timer_mousemovement_detection)
		document.photo_album.slideshow_object_timer_mousemovement_detection = -1;
	}
}


function internal_IS_Gallery_playSlideshow_launchTimer()
{
	if (document.photo_album.slideshow_running==true)
	{
		document.photo_album.slideshow_object_timer = setTimeout("internal_IS_Gallery_playSlideshow_getNext()", document.photo_album.slideshow_time*1000);
	}
}


function internal_IS_Gallery_slideshow_stopTimer()
{
	if (document.photo_album.slideshow_object_timer!=-1)
	{
		clearTimeout(document.photo_album.slideshow_object_timer);
		document.photo_album.slideshow_object_timer = -1;
	}
}


function IS_Gallery_playSlideshow_launchTimerNavbarPosition()
{
	document.photo_album.slideshow_object_timer_navbar_position = setTimeout("IS_Gallery_playSlideshow_launchTimerNavbarPosition()",400);
	internal_IS_Gallery_initializeNavBarPosition();
}


function internal_IS_Gallery_displayNavBar(b) 
{
	var l_bg_nav_bar = document.photo_album.widgets.nav_bar.bg;
	var l =document.photo_album.widgets.nav_bar.main;
	if (document.photo_album.b_display_nav_bar)
	{
		displayElement(l_bg_nav_bar,b);
		displayElement(l,b);
		if (b)
		{
			IS_setLayerTransparency(l_bg_nav_bar,80);
		}
	}
	IS_Gallery_refreshNavigationButtons()
}

function internal_IS_Gallery_initializeNavBarPosition() 
{
	
	var width = getWindowWidth();
	var height = getWindowHeight();
	var ly_navbar = 0;	
	var posy_navbar = 0;
	var posx_navbar = 0;	
	var dec_x_for_center_alignment = 0;
	
	if (document.photo_album.page_is_centered)
	{	
		if (width>document.photo_album.width_page)
		{
			dec_x_for_center_alignment = (width-document.photo_album.width_page)/2-5;
		}
	}	
	
	var l =document.photo_album.widgets.nav_bar.main;
	if (document.photo_album.slideshow_running==true)
	{
		internal_IS_Gallery_displayNavBar(false);	
	}
	else
	{
		internal_IS_Gallery_displayNavBar(true);
	}

	var x_image_center= document.photo_album.navbar_position[0]+dec_x_for_center_alignment;

	var l_nav_bar = document.photo_album.widgets.nav_bar.main;

	var lx = getWidth(l_nav_bar);
	ly_navbar = l_nav_bar.clientHeight;

	posy_navbar = getWindowScrollY()+(height - ly_navbar)-10;
	if (posy_navbar>document.photo_album.navbar_position[1])
	{
		posy_navbar = document.photo_album.navbar_position[1];
	}
	///
	posx_navbar = getWindowScrollX() + x_image_center-lx/2;
	var posx_navbar_max = getWindowScrollX()+width-lx-15;
	
	if (posx_navbar > posx_navbar_max)
	{
		posx_navbar = posx_navbar_max;
	}	
	if (posx_navbar<0)
	{
		posx_navbar = 0;
	}
	//
	var posy_navbar_min = getWindowScrollY()
	if (posy_navbar<posy_navbar_min)
	{
		posy_navbar = posy_navbar_min;
	}		
	
	moveElement(l_nav_bar,posx_navbar,posy_navbar);
	///

	
	//MessageWidget
	var waiting_widget = document.photo_album.widgets.message.main;
	var waiting_widget_bg = document.photo_album.widgets.message.bg;
	var left = getWindowScrollX()+(width - getWidth(waiting_widget))/2;
	var top = getWindowScrollY()+(height - getHeight(waiting_widget))/2;
	moveElement(waiting_widget,left,top);	
	moveElement(waiting_widget_bg,left,top);	
	
	internal_IS_Gallery_initializeCommentWindowPosition();	
	
	////////////////////
	
	var lx_snapshot = 100;
	var ly_snapshot = 100;
	var dec_snapshot = 5;
	
	var x_image=posx_navbar+(lx/2);
	var y_image= posy_navbar-document.photo_album.big_image_size[1]/2-ly_snapshot/2;
	
	var y_image_max = getWindowScrollY()+(document.photo_album.navbar_position[1]-document.photo_album.big_image_size[1])
	if (y_image<y_image_max)
	{
		y_image = y_image_max;
	}
	
	var x_image1= x_image_center-(document.photo_album.big_image_size[0]/2)-dec_snapshot-lx_snapshot;;
	var x_image2 = x_image_center+(document.photo_album.big_image_size[0]/2)+dec_snapshot;

	if (dec_x_for_center_alignment==0)
	{
		x_image1=x_image1 -3;
		x_image2=x_image2 +1;
	}
	else
	{
	}
	document.photo_album.widgets.prev_snapshot.b_hidden = (x_image1<0);
	document.photo_album.widgets.next_snapshot.b_hidden = (x_image2+lx_snapshot>getWindowScrollX()+width);

	moveElement(document.photo_album.widgets.prev_snapshot,x_image1,y_image);
	moveElement(document.photo_album.widgets.next_snapshot,x_image2,y_image);
	
	
	//IS_Gallery_loadSnapshot()
}

function internal_IS_Gallery_initializeCommentWindowPosition() 
{
	var comment_widget = document.photo_album.widgets.comment.main;
	var comment_widget2 = document.photo_album.widgets.comment.bg;
	
	var lx_comment_widget = comment_widget.clientWidth;
	var ly_comment_widget = comment_widget.clientHeight;		

	var width = eval(window.document.body.clientWidth);
	var height = eval(window.document.body.clientHeight);	
	var l_nav_bar = document.photo_album.widgets.nav_bar.main;
	
	var posx_navbar = getPositionX(l_nav_bar);
	var posy_navbar = getPositionY(l_nav_bar);
	
	if (document.photo_album.slideshow_running==true)
	{
		posy_navbar+=l_nav_bar.clientHeight;
	}
	if (posy_navbar>document.photo_album.navbar_position[1])
	{
		posy_navbar = document.photo_album.navbar_position[1];
	}	
	
	var lx = getWidth(comment_widget);
	var ly = getHeight(comment_widget);
	
	var left =   posx_navbar+l_nav_bar.clientWidth/2- lx_comment_widget/2;

	var top = posy_navbar-ly_comment_widget-10;
	moveElement(comment_widget,left,top);	
	moveElement(comment_widget2,left,top);	

}
				
function IS_Gallery_onerror_big_photo_album()
{
	internal_IS_Gallery_displayMessage(true,document.is_gallery_object.labels.error_loading_image);
	internal_IS_Gallery_displayMainImage(false);
	internal_IS_Gallery_playSlideshow_launchTimer();
	document.images['big_photo_album'].IS_b_errorOccured = true;
	internal_IS_Gallery_displayCurrentComment(false);
	
	
}


function internal_IS_Gallery_getCommentCheckbox()
{
	var form = getElementByKey('ISidPhotoAlbumForm');
	var checkbox = form.ISidPhotoAlbumButtonEnableCommentCheckbox;//getElementByKey('ISidPhotoAlbumButtonEnableCommentCheckbox');
	return	checkbox;
}

function IS_Gallery_SwitchCommentsDisplaying(b_invert)
{
	var checkbox = internal_IS_Gallery_getCommentCheckbox()
	var b = checkbox.checked;
	if (b_invert)
	{	
		b=!b;
	}
	IS_Gallery_EnabledCommentsDisplaying(b)
}

function IS_Gallery_EnabledCommentsDisplaying(b)
{
	var checkbox = internal_IS_Gallery_getCommentCheckbox()
	checkbox.checked=b
	document.photo_album.b_display_comments = b;
	internal_IS_Gallery_displayCurrentComment(b);
}

function internal_IS_Gallery_displayCurrentComment(b)
{
	var comment_widget = document.photo_album.widgets.comment.main;
	var comment_widget2 = document.photo_album.widgets.comment.bg;
	if (b)
	{
		if (document.photo_album.b_display_comments)
		{
			
			var n = document.photo_album.current_index;
			var mess =document.photo_album.comments[n];
			if (mess && (mess.length>0))
			{
				
				mess = replaceSubstring(mess," ","&nbsp;")
	
				displayElement(comment_widget,true);
				IS_setLayerTransparency(comment_widget,80);
				
				IS_writeLayer(comment_widget,mess);
				

				displayElement(comment_widget2,true);
	
				IS_setLayerTransparency(comment_widget2,100);
				IS_writeLayer(comment_widget2,mess);
				
				var lx_comment_widget = comment_widget.clientWidth;
				var ly_comment_widget = comment_widget.clientHeight;	

				///Comment Widget
				internal_IS_Gallery_initializeCommentWindowPosition();				
			
				return;
			}
		}
	}

	displayElement(comment_widget2,false);
	displayElement(comment_widget,false);
	
}

function internal_IS_Gallery_displayMainImage(b)
{
	displayElement(document.images['big_photo_album'],b);
}

function internal_IS_Gallery_displayMessage(b,mess,timer_stop)
{
	
	var waiting_widget = document.photo_album.widgets.message.main;
	var waiting_widget_bg = document.photo_album.widgets.message.bg;
	
	if (isDefined(timer_stop))
	{
		waiting_widget.temporized_message=timer_stop;
	}
	else
	{
		waiting_widget.temporized_message=-1;
	}
	
	//

	waiting_widget.current_message = mess;
	clearTimeout(waiting_widget.stop_timer);
	clearTimeout(waiting_widget.launcher_timer);
	if (b)
	{
		waiting_widget.launcher_timer = setTimeout("internal_IS_Gallery_playSlideshow_launchTimer_displayMessage()",50);
	}
	else
	{
		displayElement(waiting_widget,b);
		displayElement(waiting_widget_bg,b);		
	}
}

function internal_IS_Gallery_playSlideshow_launchTimer_displayMessage()
{
	var waiting_widget = document.photo_album.widgets.message.main;
	var waiting_widget_bg = document.photo_album.widgets.message.bg
	if (waiting_widget.temporized_message>-1)
	{
		waiting_widget.stop_timer = setTimeout("internal_IS_Gallery_displayMessage(false)",waiting_widget.temporized_message);
	}
	
	//
	displayElement(waiting_widget,true);
	displayElement(waiting_widget_bg,true);

	IS_writeLayer(waiting_widget,waiting_widget.current_message);
	IS_setLayerTransparency(waiting_widget_bg,80);	
}

function internal_IS_Gallery_playSlideshow_getNext()
{
	
	if (document.photo_album.slideshow_running==true)
	{
		if (document.photo_album.current_index>=document.photo_album.length-1)
		{
			document.photo_album.current_index=-1;
		}
		IS_Gallery_goNextPhoto(true);
	}	
}

function IS_Gallery_reduceSlideshowTime()
{
	if (document.photo_album.slideshow_time>1)
	{
		document.photo_album.slideshow_time--;
		internal_IS_Gallery_refreshSlideshowTime();	
	}
}

function IS_Gallery_increaseSlideshowTime()
{
	if (document.photo_album.slideshow_time<20)
	{
		document.photo_album.slideshow_time++;
		internal_IS_Gallery_refreshSlideshowTime();		
	}
}

function internal_IS_Gallery_refreshSlideshowTime()
{
	var l =document.photo_album.widgets.slideshow_time;
	var s = replaceSubstring(document.is_gallery_object.navigator.labels.n_delay_seconds,"%1",""+document.photo_album.slideshow_time);
	IS_writeLayer(l,s);	
}

function internal_IS_onload_navigation_snapshot_image()
{
	var l_snapshot = 98;
	var key=this.index_src 
	var obj_size = document.photo_album.original_image_size[key];
	if (isDefined(obj_size)==false)
	{
		document.photo_album.original_image_size[key]=new Object();
		obj_size = document.photo_album.original_image_size[key];
		
		obj_size.width = l_snapshot;
		obj_size.height = l_snapshot;			

		if (this.width > this.height)
		{
			obj_size.height = (this.height*l_snapshot)/this.width;
		}
		else
		if (this.width<this.height)			
		{
			obj_size.width = (this.width*l_snapshot)/this.height;	
		}	
	}
	var img_visible = this;
	img_visible.width = obj_size.width;
	img_visible.height = obj_size.height;
	
	internal_IS_Gallery_refreshSnapshot(this,document.images['is_gallery_prev_snapshot'],this.index_src);
	internal_IS_Gallery_refreshSnapshot(this,document.images['is_gallery_next_snapshot'],this.index_src);
}

function internal_IS_Gallery_refreshSnapshot(caching_img,img,n)
{
	if (img.image_to_load==caching_img)
	{	
		img.width=caching_img.width
		img.height=caching_img.height
		img.src = document.photo_album_thumbnails[n]
	}
}

function internal_IS_Gallery_loadSnapshotByIndex(img,n)
{
	var n_index=n;
	var image = document.photo_album.cache_snapshot_images[n_index];
	if (isDefined(image)==false)
	{
		document.photo_album.cache_snapshot_images[n_index]= new Image();
		image = document.photo_album.cache_snapshot_images[n_index];
	}

	img.image_to_load= image;
	
	image.onload=internal_IS_onload_navigation_snapshot_image;
	image.index_src = n_index
	image.src = document.photo_album_thumbnails[n_index]		
	
	if (image.complete)
	{
		//internal_IS_Gallery_refreshSnapshot(image,img,n_index);
	}
			
}

function IS_Gallery_loadSnapshot()
{
	var n = document.photo_album.current_index;
	if (n-1>=0)
	{
		internal_IS_Gallery_loadSnapshotByIndex(document.images['is_gallery_prev_snapshot'],n-1);	
	}
	if (n+1<document.photo_album.length)
	{	
		internal_IS_Gallery_loadSnapshotByIndex(document.images['is_gallery_next_snapshot'],n+1);		
	}
	
}

function IS_Gallery_loadCurrentPhoto(apply_filter)
{
	var n = document.photo_album.current_index;
	document.images['big_photo_album'].IS_b_apply_filter = false;
	
	try
	{
		document.images['big_photo_album'].filters;
	}
	catch (e)
	{
		apply_filter = false;
	}
	//apply_filter = false;
	if (apply_filter)
	{
		document.images['big_photo_album'].IS_b_apply_filter = true;
		document.images['big_photo_album'].style.filter="blendTrans(duration=1)" ;
		if (document.images['big_photo_album'].filters)
		document.images['big_photo_album'].filters.blendTrans.Apply(); 
	}
	
	var b_display_LoadingMessage = true;
	
	document.images['big_photo_album'].IS_b_errorOccured = false;
	document.images['big_photo_album'].IS_b_loading_finished = false;

	document.images['big_photo_album'].src = document.photo_album[n];

	//
	//

	if (document.photo_album.widgets)
	{
		var short_info_layer = document.photo_album.widgets.short_info;
		IS_writeLayer(short_info_layer,"[&nbsp;"+(n+1)+"&nbsp;/&nbsp;"+document.photo_album.length+"&nbsp;]");
	}
	IS_Gallery_refreshNavigationButtons()	;

	if (document.images['big_photo_album'].IS_b_loading_finished || document.images['big_photo_album'].IS_b_errorOccured )
	{
		b_display_LoadingMessage = false
	}
	
	if (b_display_LoadingMessage)
	{
		internal_IS_Gallery_displayMessage(true,document.is_gallery_object.labels.loading_image);
	}
	
	document.images['is_gallery_prev_snapshot'].loading=false;
	document.images['is_gallery_next_snapshot'].loading=false;
	
	
	//setTimeout("IS_Gallery_loadSnapshot()",100);
	IS_Gallery_loadSnapshot();
}

function IS_Gallery_refreshNavigationButtons()
{
	var prev_button = getElementByKey('big_photo_album_prev_button');
	var next_button = getElementByKey('big_photo_album_next_button');

	var b_is_visible_prev = (document.photo_album.current_index>=1);
	var b_is_visible_next = (document.photo_album.current_index<document.photo_album.length-1);
	
	prev_button.style.visibility = (b_is_visible_prev)?"inherit":"hidden";
	next_button.style.visibility = (b_is_visible_next)?"inherit":"hidden";
	
	if (document.photo_album.slideshow_running)
	{
		b_is_visible_prev = false;
		b_is_visible_next = false;
	}
	
	if (document.photo_album.widgets.prev_snapshot.b_hidden)
	{
		b_is_visible_prev = false;
	}
	
	if (document.photo_album.widgets.next_snapshot.b_hidden)
	{
		b_is_visible_next = false;
	}	

	displayElement(document.photo_album.widgets.prev_snapshot,b_is_visible_prev);
	displayElement(document.photo_album.widgets.next_snapshot,b_is_visible_next);
}


function IS_Gallery_mouseoverNavSnapshot(but)
{
	var img = document.images["is_gallery_"+but+"_snapshot"]
	IS_setLayerTransparency(img,100);
}

function IS_Gallery_mouseoutNavSnapshot(but)
{
	var img = document.images["is_gallery_"+but+"_snapshot"]
	IS_setLayerTransparency(img,70);
}

function IS_Gallery_preloadImages()
{
	//preload other images
	var n_preload=0;
	for (n_preload=0;n_preload<document.photo_album.length;n_preload++)
	{
		if (n_preload!=document.photo_album.current_index)
		{
			var preloadImage = new Image();
			preloadImage.src = document.photo_album[n_preload];
		}
	}
}





function IS_Gallery_onload_big_photo_album()
{
	document.images['big_photo_album'].IS_b_loading_finished = true;
	
	internal_IS_Gallery_displayMessage(false);
	internal_IS_Gallery_displayMainImage(true);
	internal_IS_Gallery_playSlideshow_launchTimer();
	
	
	if (document.images['big_photo_album'].IS_b_apply_filter == true)
	{
		document.images['big_photo_album'].IS_b_apply_filter=false;
		if (document.images['big_photo_album'].filters)
		{
			document.images['big_photo_album'].filters.blendTrans.Play() ;	
		}
	}
	internal_IS_Gallery_displayCurrentComment(true);
	return false;
}

function IS_Gallery_init_onload()
{
	document.photo_album.current_mouse_position=new Array();
	document.photo_album.slideshow_object_timer_navbar_position = -1;
	document.photo_album.slideshow_object_timer = -1;
	document.photo_album.slideshow_object_timer_mousemovement_detection = -1;
	document.photo_album.slideshow_initial_mouse_position=new Array();
	document.photo_album.slideshow_running = false;
	document.photo_album.flag_wheel_can_slide_images = false;
	document.photo_album.initialized = true;	
	document.photo_album.widgets = new Array();
	
	document.photo_album.cache_snapshot_images=new Array();
	
	
	document.photo_album.widgets.message = new Array();
	document.photo_album.widgets.message.main = getElementByKey('ISidPhotoAlbumWaitingLoading');
	document.photo_album.widgets.message.bg = getElementByKey('ISidPhotoAlbumWaitingLoadingBg');	
	////////
	document.photo_album.current_index=IS_getIntegerUrlParameter('n_album_img');;
	//	
	//
	document.photo_album.widgets.short_info = getElementByKey("ISidPhotoAlbumShortInfo");
	
	document.photo_album.widgets.nav_bar = new Array();
	document.photo_album.widgets.nav_bar.main = getElementByKey('ISidPhotoAlbumNavigationBar');
	document.photo_album.widgets.nav_bar.bg = getElementByKey('ISidPhotoAlbumNavigationBarBgLayer');
	
	
	document.photo_album.widgets.slideshow_time = getElementByKey('ISidPhotoAlbumSlideshowTime');
	
	document.photo_album.widgets.comment = new Array();
	document.photo_album.widgets.comment.main = getElementByKey('ISidPhotoAlbumCommentWindow');
	document.photo_album.widgets.comment.bg = getElementByKey('ISidPhotoAlbumCommentWindow2');	
	
	
	document.photo_album.widgets.prev_snapshot = getElementByKey('is-gallery-prev-snapshot');
	document.photo_album.widgets.next_snapshot= getElementByKey('is-gallery-next-snapshot');	
		
	document.photo_album.original_image_size = new Array();
	//alert('init')
	IS_Gallery_loadCurrentPhoto(false);	


	internal_IS_Gallery_refreshSlideshowTime();
	
	IS_Gallery_playSlideshow_launchTimerNavbarPosition();
	
	IS_Gallery_EnabledCommentsDisplaying(document.photo_album.b_display_comments);
	IS_Gallery_preloadImages();
	
	IS_setLayerTransparency(document.images['is_gallery_prev_snapshot'],70);
	IS_setLayerTransparency(document.images['is_gallery_next_snapshot'],70);
}



//-->