function Gallery(args){	var arg=0;	var fields={				'start_image':0,				'transition':'SLIDE', 				'transition_speed':500, 				'gallery_div':'div#photo_gallery', 				'image_div':'div#images', 				'image_array':null, 				'widths':null, 				'heights':null, 				'use_ratings':false, 				'rate_script_location':'rate.php', 				'play_speed':3000, 				'use_overlay_arrows':false, 				'captions':[], 				'original_image_array':[], 				'large_image_array':[], 				'large_widths_array':[], 				'large_heights_array':[], 				'action_function':false, 				'lightbox_opacity':.5, 				'transtions':['SLIDE','FADE','RANDOM'], 				'no_rating_display':'--', 				'file_series':[], 				'use_rating_stars':false, 				'series_play_speed':1000, 				'series_position':0,				'counter_div':'div#counter',				'now_playing_div':'div#now_playing',				'play_pause_button':'a.play_pause',				'caption_div':'div#caption',				'rating_div':'div#rating',				'rating_block_div':'div#rating_block',				'go_left_overlay_div':'a#go_left_overlay',				'go_right_overlay_div':'a#go_right_overlay',				'go_left_button':'#go_left',				'go_right_button':'#go_right',				'enlarge_button':'a#enlarge',				'rate_wait_message':'Please Wait...',				'now_playing_message':'Now Playing'				};	var action_function;	for(var f in fields)	{		if(fields[f]===null && args[f]===undefined)		{			throw "Gallery:Argument "+f+" is missing";		}		if(args[f]!==undefined)		{			this[f]=args[f];		}		else		{			this[f]=fields[f];		}	}	if(typeof this.action_function == 'function')	{		var af=this.action_function;		this.action_function=function(){setTimeout(af,this.transition_speed);};	}	else	{		this.action_function=function(){};	}	this.bound_ie_href=false;	this.image_div_width=jQuery(this.image_div).width();	this.image_div_height=jQuery(this.image_div).height();	this.personUUID='';	this.rated=[];	this.ratings=[];	this.timeout_ids=[];	this.interval_ids=[];	this.running='';	this.add_overlay_arrows();	if(this.large_image_array.length>0 && this.large_image_array[0]!='')	{		this.can_enlarge=true;	}	else	{		this.can_enlarge=false;	}	this.total_images=this.image_array.length;	if(!(this.start_image>=0 && this.start_image<this.total_images))	{		this.at_image=0	}	else	{		this.at_image=this.start_image;	}		//check to see if we have a counter div	if(jQuery(this.counter_div).length > 0){this.has_counter=true;}else{this.has_counter=false;}	//check to see if there is a now playing div	if(jQuery(this.now_playing_div).length > 0){this.has_now_playing=true;}else{this.has_now_playing=false;}	//check to see if we have a play button	if(jQuery(this.play_pause_button).length > 0){this.has_play=true;}else{this.has_play=false;}			jQuery(this.image_div).append('<div id="G_current_image"></div>');	jQuery(this.image_div).append('<div id="G_previous_image"></div>');	jQuery(this.image_div).append('<div id="G_next_image"></div>');	this.display_image(this.at_image,'div#G_current_image');	this.display_image(this.get_previous(this.at_image),'div#G_previous_image');	this.display_image(this.get_next(this.at_image),'div#G_next_image');	this.bind_actions();	this.select_thumbnail(this.start_image);	if(this.captions.length>0)	{		this.has_captions=true;		jQuery(this.caption_div).css('display','block');		//using css to get the height, because if it is not set, we set		//it from the longest string length		this.caption_div_height=parseInt(jQuery(this.caption_div).css('height'));		this.caption_div_width=jQuery(this.caption_div).width();		if(this.caption_div_height==0 || isNaN(this.caption_div_height))		{			var longest='';			for(var i=0;i<this.captions.length;i++)			{				if(this.captions[i].length>longest.length)				{					longest=this.captions[i];				}			}			jQuery('body').append('<div id="G_caption_sizer"><div>');			jQuery('div#G_caption_sizer').css({'position':'absolute','width':this.caption_div_width,'top':-99999});			jQuery('div#G_caption_sizer').html(longest+'<br/>');			this.caption_div_height=jQuery('div#G_caption_sizer').height();			if(this.caption_div_height>1000){this.caption_div_height=1000;}			var caption_margin_bottom=parseInt(jQuery(this.caption_div).css('margin-bottom'));			if(!isNaN(caption_margin_bottom) && caption_margin_bottom!=0){				this.caption_div_height+=caption_margin_bottom;			}						jQuery(this.caption_div).css('height',this.caption_div_height);			jQuery('div#G_caption_sizer').remove();								}		jQuery(this.caption_div).html('<div id="G_current_caption">'+this.captions[this.at_image]+'</div><div id="G_next_caption"></div>');		jQuery('div#G_next_caption').css('display','none');	}	else	{		this.has_captions=false;	}	if(this.use_ratings)	{		jQuery(this.rating_div).html('<div id="G_current_rating" /><div id="G_next_rating" />')		jQuery(this.rating_block_div).css('display','block');		jQuery(this.rating_div).css('display','block');		this.get_rating(this.at_image,true);	}	this.change_counter();	}//clears any intervals or timeoutsGallery.prototype.clear_timers = function(){	while(this.timeout_ids.length)	{		clearTimeout(this.timeout_ids.pop());	}	while(this.interval_ids.length)	{		clearInterval(this.interval_ids.pop());	}}Gallery.prototype.add_overlay_arrows = function(){	if(this.use_overlay_arrows)	{		jQuery(this.image_div).append('<a id="'+this.go_left_overlay_div+'" /><a id="'+this.go_right_overlay_div+'" />');		var width=Math.floor(this.image_div_width/2);		jQuery(this.go_left_overlay_div).css({'display':'block','position':'absolute','top':0,'left':0,'width':width,'height':this.image_div_height});		jQuery(this.go_right_overlay_div).css({'display':'block','position':'absolute','top':0,'left':width,'width':width,'height':this.image_div_height});	}}Gallery.prototype.remove_overlay_arrows = function(){	if(this.use_overlay_arrows)	{		jQuery(this.go_left_overlay_div).remove();		jQuery(this.go_right_overlay_div).remove();	}}Gallery.prototype.add_enlarge_link = function(){	if(this.can_enlarge)	{		//check to see if there is a link specifically used to enlarge		if(jQuery(this.enlarge_button).length > 0)		{			var self=this;			jQuery(this.enlarge_button).bind('click',function(){self.enlarge(self.at_image);return false;});		}		else if(jQuery(this.image_div+' #current_image img').length > 0)		{			jQuery(this.image_div+' #current_image img').wrap('<a id="G_enlarge_link" href="#"></a>');			var self=this;			jQuery('#G_enlarge_link').bind('click',function(){self.enlarge(self.at_image);return false;});		}			}}Gallery.prototype._get_window_offset = function(){	return jQuery.browser.msie?document.body.scrollTop:window.pageYOffset;}Gallery.prototype.move_enlarge = function(){	var offset=this._get_window_offset();	jQuery('div#G_lightbox').css('top',offset);	var eh=jQuery('div#G_enlarged').height();	var wh=jQuery(window).height();	jQuery('div#G_enlarged').css('top',Math.ceil((wh-eh)/2)+offset)}Gallery.prototype.enlarge = function(at){	this.pause();	jQuery('body').append('<div id="G_lightbox"></div><div id="G_enlarged"><div id="G_enlarged_image" /><div id="G_enlarged_caption" /></div>');	var ww=jQuery(window).width();	var wh=jQuery(window).height();	var w=this.large_widths_array[at];	var h=this.large_heights_array[at];	var end_opacity=this.lightbox_opacity;	if(!(end_opacity>=0 && end_opacity<=1))	{		end_opacity=0.5;	}	jQuery('div#G_lightbox').width(ww);	jQuery('div#G_lightbox').height(wh);	jQuery('div#G_lightbox').css({'top':-10000})	if(this.has_captions)	{		jQuery('div#G_enlarged_caption').html(this.captions[at]);	}		jQuery('div#G_enlarged').css({'display':'block','top':-10000});	this.display_image(at,'div#G_enlarged_image',true);	jQuery('div#G_enlarged_image').css({'display':'block','width':w});	if(this.has_captions)	{		jQuery('div#G_enlarged_caption').css('display','block');	}	var ew=jQuery('div#G_enlarged').width();	var eh=jQuery('div#G_enlarged').height();	var offset=this._get_window_offset();	var lightbox_top=0;	var enlarged_left=Math.ceil((ww-ew)/2);	var enlarged_top=Math.ceil((wh-eh)/2);	if(!(jQuery.browser.msie && parseInt(jQuery.browser.version)<=6))	{		jQuery('div#G_lightbox').css({'position':'fixed'});		jQuery('div#G_enlarged').css({'position':'fixed'});	}	else	{		lightbox_top+=offset;		enlarged_top+=offset;	}	jQuery('div#G_enlarged').css({'left':enlarged_left});	var trans=this.get_transition();	var self=this;	if(trans=='FADE')	{		jQuery('div#G_lightbox').css({'opacity':0,'display':'block'});		jQuery('div#G_lightbox').fadeTo(1,0.01,function(){			jQuery('div#G_lightbox').css({'top':lightbox_top});			jQuery('div#G_lightbox').fadeTo(self.transition_speed,end_opacity);			});		jQuery('div#G_enlarged').fadeTo(1,0.01,function(){			jQuery('div#G_enlarged').css({'top':enlarged_top});			jQuery('div#G_enlarged').fadeTo(self.transition_speed,1);			});	}	else if(trans=='SLIDE')	{				jQuery('div#G_lightbox').css({'top':-wh,'opacity':end_opacity,'display':'block'});		jQuery('div#G_enlarged').css({'top':-(wh-enlarged_top)});		jQuery('div#G_lightbox').animate({'top':offset},this.transition_speed);		jQuery('div#G_enlarged').animate({'top':enlarged_top},this.transition_speed);	}	jQuery('div#G_lightbox').wrap('<a href="#" class="G_delarge"></a>');	jQuery('div#G_enlarged').wrap('<a href="#" class="G_delarge"></a>');	if(jQuery.browser.msie && parseInt(jQuery.browser.version)<=6)	{		jQuery(window).scroll(function(){self.move_enlarge(); return false;});	}	jQuery('.delarge').bind('click',function(){self.delarge();return false;});	return false;}Gallery.prototype.delarge = function(){	var trans=this.get_transition();	jQuery(window).unbind('scroll');	if(trans=='FADE')	{		jQuery('div#G_lightbox').fadeOut(this.transition_speed);		if(this.has_captions)		{			jQuery('div#G_enlarged_caption').fadeOut(this.transition_speed);		}		jQuery('div#G_enlarged_image img').fadeOut(this.transition_speed,function(){			jQuery('div#G_lightbox').remove();			jQuery('div#G_enlarged').remove();		})	}	else if(trans=='SLIDE')	{		var wh=jQuery(window).height();		var enlarged_top=parseInt(jQuery('div#G_enlarged').css('top'));		jQuery('div#G_lightbox').animate({'top':wh},this.transition_speed);		jQuery('div#G_enlarged').animate({'top':wh+enlarged_top},this.transition_speed,function(){			jQuery('div#G_lightbox').remove();			jQuery('div#G_enlarged').remove();		})			}}Gallery.prototype.get_transition =function(){	if(this.transition=='RANDOM')	{		var ret='RANDOM';		while(ret=='RANDOM')		{			var i=Math.round(Math.random()*(this.transitions.length-1))			ret=this.transitions[i];		}		return ret;	}	else	{		return this.transition	}}Gallery.prototype.get_previous = function(at){	return at==0?this.image_array.length-1:at-1}Gallery.prototype.get_next = function(at){	return (at==this.image_array.length-1)?0:at+1;	}Gallery.prototype.display_image = function(){	var image_num=arguments[0];	var image_div=arguments[1];	var enlarged=arguments[2]?arguments[2]:false;	var i=new Image();	var w=0;	var h=0;	var divw=0;	var divh=0;	if(!enlarged)	{		i.src=this.image_array[image_num];		w=this.widths[image_num];		h=this.heights[image_num];		divh=this.image_div_height;		divw=this.image_div_width;	}	else	{		i.src=this.large_image_array[image_num];		w=this.large_widths_array[image_num];		h=this.large_heights_array[image_num];		var divh=jQuery(window).height()*.9;		var divw=jQuery(window).width()*.9;	}	var ratio=w/h;	if(w>divw && h>divh)	{		if(w-divw > h-divh)		{			w=divw;			h=w*(1/ratio);		}		else if(h-divh > w-divw)		{			h=divh;			w=h*(ratio);		}		else if(h-divh==w-divw)		{			h=divh;			w=divw;		}	}	else if(w>divw && h<=divh)	{		w=divw;		h=w*(1/ratio);	}	else if(w<=divw && h>divh)	{		h=divh;		w=h*(ratio);	}	i.width=Math.ceil(w);	i.height=Math.ceil(h);	jQuery(image_div).empty();	jQuery(image_div).append(i);	if(!enlarged)	{		if(w<divw)		{			jQuery(image_div+' img').css('left',Math.ceil((divw-w)/2));		}		if(h<divh)		{			jQuery(image_div+' img').css('top',Math.ceil((divh-h)/2));		}	}}Gallery.prototype.select_thumbnail =function(){	var selected=arguments[0];	var unselected=arguments[1]>=0?arguments[1]:'';	if(unselected>=0)	{		if(jQuery('#thumb_'+unselected))		{			jQuery('#thumb_'+unselected).removeClass('selected');		}	}	if(jQuery('#thumb_'+selected))	{		jQuery('#thumb_'+selected).addClass('selected');	}}Gallery.prototype.go_left = function(){	var old_id=this.at_image;	var new_id=this.get_previous(this.at_image);	this.select_thumbnail(new_id,old_id);	this.at_image=new_id;	this.get_rating(this.at_image);	switch(this.get_transition())	{		case 'SLIDE':			this.slide_image('left',this.at_image,this.get_previous(this.at_image),this.get_next(this.at_image),'#G_previous_image','#G_next_image');			break;		default:			this.fade_image(this.at_image,this.get_previous(this.at_image),this.get_next(this.at_image),'#G_previous_image','#G_next_image');	}	this.change_counter();}Gallery.prototype.go_right = function(){	var old_id=this.at_image;	var new_id=this.get_next(this.at_image);	this.select_thumbnail(new_id,old_id);	this.at_image=new_id;	this.get_rating(this.at_image);	switch(this.get_transition())	{		case 'SLIDE':			this.slide_image('right',this.at_image,this.get_next(this.at_image),this.get_previous(this.at_image),'#G_next_image','#G_previous_image');			break;		default:			this.fade_image(this.at_image,this.get_next(this.at_image),this.get_previous(this.at_image),'#G_next_image','#G_previous_image');	}	this.change_counter();	}Gallery.prototype.play_pause = function(){	if(jQuery('a#G_play').length > 0)	{		this.play();		return;	}	else if(jQuery('a#G_pause').length > 0)	{		this.pause();		return;	}}//starts the image play featureGallery.prototype.play = function(){	if(jQuery('a#G_play').length > 0)	{		var self=this;		this.interval_ids.push(setInterval(function(){self.go_right()},this.play_speed));		this.running='image_play';		this.set_now_playing_message(this.now_playing_message);		jQuery('a#G_play').attr('id','G_pause');	}}//stops anything that is playingGallery.prototype.pause = function(){	if(jQuery('a#G_pause').length > 0)	{		this.clear_timers();		this.running=false;		this.set_now_playing_message('');		jQuery('a#G_pause').attr('id','G_play');	}}Gallery.prototype.set_now_playing_message = function(message){	if(this.has_now_playing)	{		jQuery(this.now_playing_div).html(message);	}}Gallery.prototype.go_series = function(series_name){	this.pause();	if(this.file_series[series_name])	{		this.go_picture(this.file_series[series_name][0]);		var self=this;		this.running='series_play';		this.set_now_playing_message('Playing: '+series_name.replace(/_/g,' '));		jQuery('a#G_play').attr('id','G_pause');			this.timeout_ids.push(setTimeout(function(){self.interval_ids.push(setInterval(function(){self.play_series(series_name)},self.series_play_speed))},this.transition_speed));	}}Gallery.prototype.play_series = function(series_name){	this.series_position++;	if(this.series_position>=this.file_series[series_name].length)	{		this.series_position=0;	}		this.at_image=this.file_series[series_name][this.series_position];	this.change_counter();	this.display_image(this.at_image,'div#G_current_image');}Gallery.prototype.go_picture = function(image_num){	this.pause();	if(image_num!=this.at_image)	{		this.action_function();		var old_id=this.at_image;		var new_id=image_num;		this.select_thumbnail(new_id,old_id);		this.at_image=image_num;		this.get_rating(this.at_image);		switch(this.get_transition())		{			case 'SLIDE':				this.slide_go_picture();				break;			default:				this.fade_go_picture();		}	}	this.change_counter();	}Gallery.prototype.unbind_actions = function(){	jQuery(this.go_left_button).unbind('click');	jQuery(this.go_right_button).unbind('click');	if(this.can_enlarge)	{		jQuery('#G_enlarge_link').unbind('click');		jQuery(this.enlarge_button).unbind('click');	}	if(this.has_play)	{		jQuery(this.play_pause_button).unbind('click');		jQuery(this.play_pause_button).addClass('G_disabled');	}	if(this.use_overlay_arrows)	{		jQuery(this.go_left_overlay_div).unbind('click');		jQuery(this.go_right_overlay_div).unbind('click');	}	jQuery(this.go_left_button).addClass('G_disabled');	jQuery(this.go_right_button).addClass('G_disabled');		this.unbind_ratings()}Gallery.prototype.bind_actions =function(){	var self=this;	jQuery(this.go_left_button).bind('click',function(){self.action_function(); self.go_left(); return false;});	jQuery(this.go_right_button).bind('click',function(){self.action_function();self.go_right(); return false; });	this.add_enlarge_link();	if(this.use_ratings) this.bind_ratings();	if(this.has_play)	{		jQuery(this.play_pause_button).bind('click',function(){self.play_pause(); return false;});		jQuery(this.play_pause_button).removeClass('G_disabled');	}	if(this.use_overlay_arrows)	{		jQuery(this.go_left_overlay_div).bind('click',function(){self.action_function(); self.go_left(); return false;});		jQuery(this.go_right_overlay_div).bind('click',function(){self.action_function(); self.go_right(); return false;});	}	if(jQuery.browser.msie) //add hrefs to all the links we bind so it properly does the hover	{		if(!this.bound_ie_href)		{			var ids=[this.go_left_button,this.go_right_button,this.play_pause_button,this.go_left_overlay_div,this.go_right_overlay_div];			for(var i=0;i<ids.length;i++)			{				if(jQuery(ids[i]).length > 0)				{					jQuery(ids[i]).attr('href','javascript:;');				}			}			if(this.use_ratings)			{				for(var i=1;i<=5;i++)				{					var id='#rate_'+i;					if(jQuery(id).length>0)					{						jQuery(id).attr('href','javascript:;');					}				}			}			this.bound_ie_href=true;		}	}	jQuery(this.go_left_button).removeClass('G_disabled');	jQuery(this.go_right_button).removeClass('G_disabled');}Gallery.prototype.unbind_ratings = function(){	if(this.use_ratings)	{		for(var i=1;i<=5;i++)		{			jQuery('#rate_'+i).unbind('click');		}	}	}Gallery.prototype.bind_ratings = function(){	if(this.use_ratings)	{		var self=this;		jQuery('#rate_1').bind('click',function(){self.action_function();self.rate(1); return false;});		jQuery('#rate_2').bind('click',function(){self.action_function();self.rate(2); return false;});		jQuery('#rate_3').bind('click',function(){self.action_function();self.rate(3); return false;});		jQuery('#rate_4').bind('click',function(){self.action_function();self.rate(4); return false;});		jQuery('#rate_5').bind('click',function(){self.action_function();self.rate(5); return false;});		if(this.use_rating_stars)		{			jQuery('#rate_1').bind('mouseenter',function(){self.action_function();self.rate_hover(1,'enter'); return false;});			jQuery('#rate_1').bind('mouseleave',function(){self.action_function();self.rate_hover(1,'leave'); return false;});			jQuery('#rate_2').bind('mouseenter',function(){self.action_function();self.rate_hover(2,'enter'); return false;});			jQuery('#rate_2').bind('mouseleave',function(){self.action_function();self.rate_hover(2,'leave'); return false;});			jQuery('#rate_3').bind('mouseenter',function(){self.action_function();self.rate_hover(3,'enter'); return false;});			jQuery('#rate_3').bind('mouseleave',function(){self.action_function();self.rate_hover(3,'leave'); return false;});			jQuery('#rate_4').bind('mouseenter',function(){self.action_function();self.rate_hover(4,'enter'); return false;});			jQuery('#rate_4').bind('mouseleave',function(){self.action_function();self.rate_hover(4,'leave'); return false;});			jQuery('#rate_5').bind('mouseenter',function(){self.action_function();self.rate_hover(5,'enter'); return false;});			jQuery('#rate_5').bind('mouseleave',function(){self.action_function();self.rate_hover(5,'leave'); return false;});		}	}	}Gallery.prototype.slide_go_picture =function(){	jQuery('#G_next_image').remove();	jQuery(this.image_div).append('<div id="G_next_image"></div>');	this.display_image(this.at_image,'#G_next_image');	this.slide_image('up',this.at_image,this.get_next(this.at_image),this.get_previous(this.at_image),'#G_next_image','#G_previous_image');}Gallery.prototype.fade_go_picture =function(){	jQuery('#G_next_image').remove();	jQuery(this.image_div).append('<div id="G_next_image"></div>');	this.display_image(this.at_image,'#G_next_image');	this.fade_image(this.at_image,this.get_next(this.at_image),this.get_previous(this.at_image),'#G_next_image','#G_previous_image');}Gallery.prototype.get_id_name = function(from_id){	return from_id.replace(/^.*#/,'');}Gallery.prototype.fade_captions =function(at_image){	if(this.has_captions)	{		jQuery('div#G_next_caption').html(this.captions[at_image]);		jQuery('div#G_current_caption').fadeOut(this.transition_speed);		var self=this;		jQuery('div#G_next_caption').fadeIn(this.transition_speed,function(){			jQuery('div#G_current_caption').remove();			jQuery('div#G_next_caption').attr('id','G_current_caption');			jQuery('div#G_current_caption').after('<div id="G_next_caption"></div>');		})	}}Gallery.prototype.slide_captions =function(direction,at_image){	if(this.has_captions)	{		jQuery('div#G_next_caption').html(this.captions[at_image]);		var ahead_caption_animate;		var from_caption_animate;		if(direction=='left')		{			jQuery('#G_next_caption').css('left',this.caption_div_width);			from_caption_animate={'left':-(this.caption_div_width*1.1)};			ahead_caption_animate={'left':"0"};		}		else if(direction=='right')		{			jQuery('#G_next_caption').css('left',-this.caption_div_width);			from_caption_animate={'left':this.caption_div_width*1.1};			ahead_caption_animate={'left':"0"};					}		else if(direction=='up')		{			jQuery('#G_next_caption').css('top',this.caption_div_height);			from_caption_animate={'top':-this.caption_div_height};			ahead_caption_animate={'top':0};		}		else if(direction=='down')		{			jQuery('#G_next_caption').css('bottom',0);			from_caption_animate={'bottom':this.caption_div_height};			ahead_caption_animate={'bottom':-this.caption_div_height};		}		jQuery('#G_next_caption').css("display","block");		jQuery('#G_next_caption').html(this.captions[at_image]);		jQuery('#G_current_caption').animate(from_caption_animate,this.transition_speed);		var self=this;		jQuery('#G_next_caption').animate(ahead_caption_animate,this.transition_speed,'',function(){			jQuery('#G_current_caption').remove();			jQuery('#G_next_caption').attr('id','G_current_caption');			jQuery(this.caption_div).append('<div id="G_next_caption"></div>');		});	}}Gallery.prototype.fade_image = function(at_image,ahead_image,behind_image,ahead_div,behind_div){	from_div='#G_current_image';	var from_div_fade=from_div;	var ahead_div_fade=ahead_div;	if(jQuery.browser.msie)	{		from_div_fade+=' img';		ahead_div_fade+=' img';		jQuery(ahead_div).css('display','block');		jQuery(ahead_div_fade).css('display','none');	}	this.unbind_actions();	this.fade_captions(at_image);	jQuery(ahead_div_fade).fadeIn(this.transition_speed);	var self=this;	jQuery(from_div_fade).fadeOut(this.transition_speed,function(){		jQuery(from_div).remove();		jQuery(behind_div).remove();		jQuery(ahead_div).attr('id','G_current_image');		jQuery(self.image_div).append('<div id="'+self.get_id_name(ahead_div)+'"></div>');		self.display_image(ahead_image,ahead_div);		jQuery(self.image_div).append('<div id="'+self.get_id_name(behind_div)+'"></div>');		self.display_image(behind_image,behind_div);		self.bind_actions();	});}Gallery.prototype.slide_image = function(direction,at_image,ahead_image,behind_image,ahead_div,behind_div){		from_div='#G_current_image';	this.slide_captions(direction,at_image);	//this.slide_ratings(direction,at_image);	var from_div_animate;	var ahead_div_animate;	if(direction=='left')	{		jQuery(ahead_div).css('left',this.image_div_width);		from_div_animate={'left':-(this.image_div_width*1.1)};		ahead_div_animate={'left':"0"};	}	else if(direction=='right')	{		jQuery(ahead_div).css('left',-this.image_div_width);		from_div_animate={'left':this.image_div_width*1.1};		ahead_div_animate={'left':"0"};				}	else if(direction=='up')	{		jQuery(ahead_div).css('top',this.image_div_height);		from_div_animate={'top':-this.image_div_height};		ahead_div_animate={'top':0};	}	else if(direction=='down')	{		jQuery(ahead_div).css('bottom',0);		from_div_animate={'bottom':this.image_div_height};		ahead_div_animate={'bottom':-this.image_div_height};	}	jQuery(ahead_div).css("display","block");	this.unbind_actions();	jQuery(from_div).animate(from_div_animate,this.transition_speed);	var self=this;	jQuery(ahead_div).animate(ahead_div_animate,this.transition_speed,'',function(){		jQuery(from_div).remove();		jQuery(behind_div).remove();		jQuery(ahead_div).attr('id','G_current_image');		jQuery(self.image_div).append('<div id="'+self.get_id_name(ahead_div)+'"></div>');		self.display_image(ahead_image,ahead_div);		jQuery(self.image_div).append('<div id="'+self.get_id_name(behind_div)+'"></div>');		self.display_image(behind_image,behind_div);		self.bind_actions();	});}Gallery.prototype.change_counter = function(){	if(this.has_counter)	{		jQuery(this.counter_div).html((this.at_image+1)+' of '+(this.total_images));	}}Gallery.prototype.display_rating = function(){	var value=arguments[0];	if(value==0){value=this.no_rating_display;}	var init=arguments[1]?arguments[1]:false;	if(init)	{		jQuery('div#G_current_rating').html(value);		this.display_rating_stars(value,true);	}	else	{		this.display_rating_stars(value,false);		var trans=this.get_transition();		if(trans=='SLIDE')		{			var rh=jQuery(this.rating_div).height();			var self=this;			jQuery('div#G_next_rating').css({'top':rh,'display':'block'});			jQuery('div#G_next_rating').html(value);			jQuery('div#G_current_rating').animate({'top':-rh},this.transition_speed);			jQuery('div#G_next_rating').animate({'top':0},this.transition_speed,function(){				jQuery('div#G_current_rating').remove();				jQuery('div#G_next_rating').attr('id','G_current_rating');				jQuery(this.rating_div).append('<div id="G_next_rating" />');			})					}		if(trans=='FADE')		{			jQuery('div#G_next_rating').html(value);			jQuery('div#G_next_rating').fadeIn(this.transition_speed);			jQuery('div#G_current_rating').fadeOut(this.transition_speed,function(){				jQuery('div#G_current_rating').remove();				jQuery('div#G_next_rating').attr('id','G_current_rating');				jQuery(this.rating_div).append('<div id="G_next_rating" />');							});		}	}}Gallery.prototype.display_rating_stars = function(value,is_init){	if(this.use_rating_stars)	{			var id='';		for(var i=1;i<=5;i++)		{			id='#rate_'+i;			jQuery(id).removeClass('G_rated_value');			jQuery(id).removeClass('G_rated_half_value');		}		var i=0;		var last_half=Math.round(value-Math.floor(value));		var floor=Math.floor(value)		for(i=0;i<=floor;i++)		{			id='#rate_'+i;			jQuery(id).addClass('G_rated_value');		}		id='#rate_'+i;		if(last_half && i<=5)		{			jQuery(id).removeClass('G_rated_value');			jQuery(id).addClass('G_rated_half_value');		}	}}Gallery.prototype.rate = function(value){	if(this.rated[this.at_image])	{		this.display_rating(this.ratings[this.at_image]);		return;	}	this.unbind_actions();	this.wait_start('div#G_current_rating');	var self=this;	data="value="+value+'&path='+escape(this.original_image_array[this.at_image]);	data+='&personUUID='+this.personUUID;	jQuery.ajax({		type: "GET",		url: this.rate_script_location,		data: data,		dataType: "json",		timeout: 5000,		success: function(val){			self.wait_complete('div#G_current_rating');			if(val['personUUID'])			{				self.personUUID=val['personUUID'];			}			self.ratings[self.at_image]=val['rating'];			self.rated[self.at_image]=true;			self.display_rating(val['rating']);			self.bind_actions();		}	});	}Gallery.prototype.rate_hover = function(value,type){	for(var i=1;i<=value;i++)	{		var id='#rate_'+i		if(type=='enter')		{			jQuery(id).addClass('G_rate_hover')		}		else		{			jQuery(id).removeClass('G_rate_hover');		}	}}Gallery.prototype.get_rating = function(){	var at=arguments[0];	var init=arguments[1]?arguments[1]:false;	if(this.use_ratings)	{		if(this.ratings[this.at_image])		{			this.display_rating(this.ratings[this.at_image]);			return;		}		var data='path='+escape(this.original_image_array[this.at_image]);		var self=this;		jQuery.ajax({			type: "GET",			url: this.rate_script_location,			data: data,			dataType: "json",			success: function(val){				self.ratings[self.at_image]=val['rating'];				self.display_rating(val['rating'],init);			}		});	}}Gallery.prototype.wait_start = function(div){	jQuery(div).addClass('wait');	jQuery(div).html(this.rate_wait_message);}Gallery.prototype.wait_complete = function(div){	jQuery(div).empty();	jQuery(div).removeClass('wait');}