function CalendarEvent(calendar_key, id_event, id_title, event_text, start_time, end_time) { //calendary array index, id, title, desc, start_time, duration) this.calendarKey = calendar_key; this.idEvent = id_event; this.title = id_title; this.cEvent = event_text; this.startTime = start_time; this.endTime = end_time; this.generateHTML = CalendarEvent_HTML; this.node = null; } function CalendarEvent_HTML(idx,id) { var parent = document.getElementById("events_list"); this.node = document.createElement("DIV"); var p_text = document.createElement("P"); if ( idx % 2 == 0 ) { this.node.className = "event row_1"; } else { this.node.className = "event row_2"; } this.node.setAttribute("id", "event_"+ this.calendarKey +"_"+ this.idEvent); this.node.setAttribute("title", this.title); this.node.onmouseover = over_event; this.node.onmouseout = off_event; this.node.onclick = click_event; p_text.appendChild( document.createTextNode(idx + 1 +". "+ this.title) ); p_text.setAttribute("title", this.title); this.node.appendChild( p_text ); parent.appendChild( this.node ); } function over_event() { // mouse rolls over div.event var id = this.getAttribute("id").replace("event_", ""); this.className = "event_hover"; } function off_event() { // mouse rolls off div.event var id = this.getAttribute("id").replace("event_", ""); this.className = "event row_"+ this.getAttribute("row_count"); } function click_event() { var id = this.getAttribute("id").replace("event_", ""); var arr = id.split("_"); var calendar_index = arr[0]; var event_index = arr[i]; var eventObj = calendar[calendar_index].event_list[event_index]; var parent = document.getElementById("events_list"); var tmpHTML = parent.innerHTML; var poo = this.getAttribute("id"); //parent.innerHTML = ""; this.node = document.createElement("DIV"); var p_text = document.createElement("P"); //p_text.setAttribute("id","displayed"); p_text.className = "displayed_event"; alert(poo); //p_text.appendChild( document.createTextNode(this.cEvent) ); this.node.appendChild( p_text ); parent.appendChild( this.node ); }