
	var calendarSchedules= [{"date":"01/13/2012","description":"Protocol6","image":"Protocol-small.jpg"},{"date":"01/17/2012","description":"NYTU Day 1","image":"NYTU-small.jpg"},{"date":"01/18/2012","description":"NYTU Day 2","image":"NYTU-small.jpg"},{"date":"01/19/2012","description":"WRR2","image":"WRR-small.jpg"},{"date":"01/26/2012","description":"LT2 Day 1","image":"LT-small.jpg"},{"date":"01/27/2012","description":"Ejectment7","image":"Ejectment7-small.gif"},{"date":"01/27/2012","description":"LT2 Day 2","image":"LT-small.jpg"},{"date":"02/10/2012","description":"CTAR2","image":"CTAR-small.jpg"},{"date":"02/16/2012","description":"FB Day 1","image":"FB-small.jpg"},{"date":"02/17/2012","description":"FB Day 2","image":"FB-small.jpg"},{"date":"02/24/2012","description":"TRR4","image":"TRR-small.jpg"},{"date":"03/08/2012","description":"AC Day 1","image":"AC-small.jpg"},{"date":"03/09/2012","description":"AC Day 2","image":"AC-small.jpg"},{"date":"03/23/2012","description":"SRC","image":"SRC-small.jpg"},{"date":"03/30/2012","description":"PPP4","image":"PPP4-small.jpg"},{"date":"04/19/2012","description":"LC6 Day 1","image":"LC-small.jpg"},{"date":"04/20/2012","description":"LC6 Day 2","image":"LC-small.jpg"},{"date":"04/26/2012","description":"CH4 Day 1","image":"CH-small.jpg"},{"date":"04/27/2012","description":"CH4 Day 2","image":"CH-small.jpg"},{"date":"05/04/2012","description":"BPGVD","image":"BPGVD-small.jpg"},{"date":"05/09/2012","description":"STH5 Day 1","image":"SixHats-small.jpg"},{"date":"05/10/2012","description":"STH5 Day 2","image":"SixHats-small.jpg"},{"date":"06/15/2012","description":"CT4","image":"BPP3-small.jpg"},{"date":"06/21/2012","description":"TET2 Day 1","image":"TET-small.jpg"},{"date":"06/22/2012","description":"TET2 Day 2","image":"TET-small.jpg"},{"date":"06/28/2012","description":"HRP3 Day 1","image":"HRP-small.jpg"},{"date":"06/29/2012","description":"HRP3 Day 2","image":"HRP-small.jpg"},{"date":"07/04/2012","description":"Incoterms9","image":"Incoterms4-small.jpg"},{"date":"08/08/2012","description":"CI Day 1","image":"CI-small.jpg"},{"date":"08/09/2012","description":"UCP4 Day 1","image":"UCP3-small.jpg"},{"date":"08/10/2012","description":"UCP4 Day 2","image":"UCP3-small.jpg"},{"date":"08/23/2012","description":"BPSR2 Day 1","image":"BPSR-small.jpg"},{"date":"08/24/2012","description":"BPSR2 Day 2","image":"BPSR-small.jpg"},{"date":"09/27/2012","description":"ECBP3 Day 1","image":"ECBP-small.jpg"},{"date":"09/28/2012","description":"ECBP3 Day 2","image":"ECBP-small.jpg"},{"date":"09/29/2012","description":"","image":""}]	
	YAHOO.namespace("cgbp.calendar");
	YAHOO.cgbp.calendar.init = function() {
		var eLog = YAHOO.util.Dom.get("evtentries");
		var eCount = 1;
 
		function dateToLocaleString(dt, cal) {
                	var wStr = cal.cfg.getProperty("WEEKDAYS_LONG")[dt.getDay()];
                	var dStr = dt.getDate();
                	var mStr = cal.cfg.getProperty("MONTHS_LONG")[dt.getMonth()];
               	 	var yStr = dt.getFullYear();
                	return (wStr + ", " + dStr + " " + mStr + " " + yStr);
		}
 
		function mySelectHandler(type,args,obj) {
			var selected = args[0];
			var selDate = this.toDate(selected[0]);
			var strMonth = (selDate.getMonth()+1)<10 ? "0"+(selDate.getMonth()+1) : (selDate.getMonth()+1);
			var strDay = (selDate.getDate())<10 ? "0"+(selDate.getDate()) : (selDate.getDate());
			var strDate=strMonth+"/"+strDay+"/"+selDate.getFullYear();
			showPanel(strDate,getDescription(strDate));
		};
 
		function myDeselectHandler(type, args, obj) {
			var deselected = args[0];
			var deselDate = this.toDate(deselected[0]);
		};
 
		function getDescription(strDate) {
			for (var i=0;i<calendarSchedules.length;i++) {
				if (calendarSchedules[i]["date"]==strDate) {
					return calendarSchedules[i];
				}
			}
			return "{ no activity}";
		}
		
		YAHOO.cgbp.calendar.cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");


 
		YAHOO.cgbp.calendar.cal1.selectEvent.subscribe(mySelectHandler, YAHOO.cgbp.calendar.cal1, true);
		YAHOO.cgbp.calendar.cal1.deselectEvent.subscribe(myDeselectHandler, YAHOO.cgbp.calendar.cal1, true);
 
		//get Calendar Schedule from CGBP db
		for (var i=0;i<calendarSchedules.length-1;i++) {
			YAHOO.cgbp.calendar.cal1.addRenderer(calendarSchedules[i]["date"], YAHOO.cgbp.calendar.cal1.renderCellStyleHighlight1);
		}
		//end get Calendar Schedule from CGBP db		
		
		YAHOO.cgbp.calendar.cal1.render();
	}
 
	YAHOO.util.Event.onDOMReady(YAHOO.cgbp.calendar.init);
	
	YAHOO.namespace("cgbp.container");
	function showPanel(dateCalendar,oActivity) {
			// Instantiate a Panel from markup
			YAHOO.cgbp.container.panel1 = new YAHOO.widget.Panel("panel1", { width:"330px", visible:false, constraintoviewport:true } );
 
			YAHOO.cgbp.container.panel1.setHeader("Date: "+dateCalendar);
			YAHOO.cgbp.container.panel1.setBody("<table border=0 cellpadding=3 cellspacing=5><tr><td><img src='images/banners-index/"+oActivity["image"]+"'"+"</td></tr></table>");



			YAHOO.cgbp.container.panel1.setFooter("");
 
			YAHOO.cgbp.container.panel1.render();
			YAHOO.cgbp.container.panel1.show();
	}

