var Popo = function (id) {
	this.popo = document.getElementById(id);
	this.title = document.getElementById(id+"_title");
	this.body = document.getElementById(id+"_body");
	this.slider = document.getElementById(id+"_slider");
	this.showed = false;
}

Popo.prototype = {
	show: function() {
		this.popo.style.display = "block";
		this.showed = true;
	},
	hidden: function() {
		this.popo.style.display = "none";
		this.showed = false;
	},
	setTitle: function(titleTxt) {
		this.title.innerHTML = titleTxt;	
	},
	
	setBody: function(key, item) {
		if(!key)
			alert("the key parm cannot be none!");
		if(!this.body.itemList)
			this.body.itemList = {};
		if(this.body.selectedItem)
			this.body.selectedItem.style.display = "none";
		
		if(!this.body.itemList[key]) {
			if(item){
				this.body.itemList[key] = item;
				this.body.appendChild(item);
			}
			else{
				alert("can not find " + key);
				return;
			}
		}
		this.body.itemList[key].style.display = "block";
		this.body.selectedItem = this.body.itemList[key];
		if(!this.showed)
			this.show();
	},
	
	setSlider: function(key, item) {
		if(!key)
			alert("the key parm cannot be none!");
		if(!this.slider.itemList)
			this.slider.itemList = {};
		if(this.slider.selectedItem)
			this.slider.selectedItem.style.display = "none";
		
		if(!this.slider.itemList[key]) {
			if(item) {
				this.slider.itemList[key] = item;
				this.slider.appendChild(item);
			}
			else {
				alert("can not find " + key);
				return;
			}
		}
		this.slider.itemList[key].style.display = "block";
		this.slider.selectedItem = this.slider.itemList[key];
	}
}