function CalendarData() {
	//alert("A");
	this.item = new Array();
	this.item2 = new Array();
	this.item3 = new Array();
	this.item4 = new Array();
	this.wrapper;
	//加入
	
	this.add = function(id,no,name,num,check,nuit,act_date,month,act_url) {
		temp_nuit=nuit;
		if(nuit==1 || nuit==16){
			nuit="天下";
		}else if(nuit==2){
			nuit="Cheers";
		}else if(nuit==4){
			nuit="康健";
		}else if(nuit==8){
			nuit="eCW";
		}else if(nuit==32){
			nuit="天下雜誌出版";
		}else if(nuit==64){
			nuit="edu";
		}else if(nuit==256){
			nuit="國際大師";
		}else if(nuit==512){
			nuit="親子天下";
		}
		
		temp = new Object();
		temp2 = new Object();
		temp3 = new Object();
		temp4 = new Object();
		//document.write(nuit);
		unit_color=this.color(nuit);
		if(name==""){
	     act_name="";
		}else{
		   act_name=""+name+"";
		   //act_name=name";
		}
		//document.write(unit_color);
	  //check=1是講座
   if(check==0){
		  temp.name = "<a href="+act_url+ " target=_blank><span class=" + unit_color + ">" + act_name+ "</span></a>";
		  temp2.name=act_date;
		  temp3.name=nuit;
		  temp4.name=month;
   }else{
		  if(temp_nuit==16 || temp_nuit==256){
      		temp.name = "<a href=special_event.asp?act_no=" + num +"&unit=" + temp_nuit + " class=" + unit_color + "><span class=" + unit_color + ">" + act_name + "</span></a>";  
      }else{
        	temp.name = "<a href="+act_url+ " target=_blank><span class=" + unit_color + ">" + act_name+ "</span></a>";
      }		
       temp2.name=act_date; 
       temp3.name=nuit; 
       temp4.name=month; 
	 }
   this.item[id] = temp;
   this.item2[id] = temp2;
   this.item3[id] = temp3;
   this.item4[id] = temp4;
	};
	//顯示
	this.build = function(ob) {
		this.wrapper = ob;
		ob.options.length = 0;
		try {
			for(var i=0;i<this.item.length;i++) {
				ob.options[i] = new Option(this.item[i].name, this.item[i].id);
			}
		} catch(e) { alert(e.description); }
	};
	this.color = function(belong){
		//alert(belong);
		switch (belong){
	 	  case 1: //天下
	 	       return "cw";
	 	       //return "#990000";
	 	  case 2: //Cheers
	 	       return "cheers";
	 	       //return "#FF9900";          
	 	  case 4: //CH
	 	       return "ch";
	 	       //return "#006600";          
	 	  case 8://eCW
	 	       return "ecw";
	 	       //return "#999999";          
	 	  case 32: //publish
	 	       return "publish";
	 	       //return "#99CCFF";          
	 	  case 64: //edu
	 	       return "edu";
                       //return "#663366";    
	 	  case 16: //l2l
	 	       return "cw";
	 	       //return "#990000";
	 	  case 256: //國際大師
	 	       return "cw";
	 	       //return "#990000";
	 	  
	 	}	
	};
	this.setSelected = function(id) {
		try {
			for(var i=0;i<this.item.length;i++) {
				if(this.item[i].id == id) {
					this.wrapper.options[i].selected=true;
				}
				
			}
		} catch(e) { alert(e.description); }
	}
	this.clean = function() {
		this.item.length=0;
	}
	
}
calendarData = new CalendarData();










