// prototype.js use $();
// jQuery       use ga$();
jQuery.noConflict();
var ga$ = jQuery;

var frame = 7;
var num = 0;

// Initialization

ga$.gif_animation = {
	init: function() {
		for (module in ga$.gif_animation) {
			if (ga$.gif_animation[module].init)
				ga$.gif_animation[module].init();
		}
	}
};

ga$(document).ready(ga$.gif_animation.init);


// Auto-hidden elements

ga$.gif_animation.hide = {
	init: function() {
		ga$('.Hide').hide();
	}
};


ga$.gif_animation.start = {

	init: function() {
		ga$('IMG.GifAnimation')
			.each(this.preload);
	},

	preload: function() {
		var target = this;
		this.preloaded = new Image;
		for (i=1;i<=frame;i++){
			this.preloaded.src = this.src.replace(/^(.+)([0-9]+)(\.[a-z]+)$/, "$1"+i+"$3");
//			this.preloaded.src = name+extention;
		}

		ga$.timer(125, function (timer) {
			num = (num<7)?num+1:0;
			target.src=target.src.replace(/^(.+)([0-9]+)(\.[a-z]+)$/, "$1"+num+"$3")
		});
	}
};

