var slide = function(name){
	this.name = name;
	this.now = 0;
	this.items = new Array();
	this.timeoutid = 0;
	
	this.add = function(item){
		this.pre(item.id);
		this.items.push(item);
	};

	this.pre = function(id){
		var p = new Image;
		p.src = "./images/slide/" + id + ".jpg";
	};
	
	this.play = function(id){
		if(id){
			this.now = id - 1;
			clearTimeout(this.timeoutid);
		}else{
			this.now++;
		}
		if(this.now == this.items.length) this.now = 0;
		var sp = $("slide_pic");
		$("slide_text_title").innerHTML = this.items[this.now].title;
		$("slide_text_content").innerHTML = this.items[this.now].content;
		for(var i = 1;i <= this.items.length;i++){
			var spl = $("slide_pic_" + i);
			if(this.now + 1 == i){
				spl.className = "sel_on";
			}else{
				spl.className = "sel_off";
			}
		}
		try{
			sp.filters[0].apply();
			sp.src = "./images/slide/" + this.items[this.now].id + ".jpg";
			sp.filters[0].play();
		}catch(e){
			sp.src = "./images/slide/" + this.items[this.now].id + ".jpg";
		}
		this.timeoutid = setTimeout(this.name + ".play()", 5000);
	};

	this.open = function(){
		var u = "./topic/" + this.items[this.now].id;
		window.open(u,"_blank");
	};
};

var slide_items = function(){
	this.id = "";
	this.title = "";
	this.content = "";
};
