All pastes #193983 Raw Edit

Anonymous

public javascript v1 · immutable
·published 2006-10-07 12:40 UTC
rendered paste body
<? header('Content-Type: text/javascript'); ?>function CalendarEvent(id_event, id_title, event_text, start_time, end_time){	//id, title, desc, start_time, duration)	this.idEvent = id_event;	this.title = id_title;	this.cEvent = event_text;	this.startTime = start_time;	this.endTime = end_time;	this.generateHTML = event_HTML;	this.node = null;}function event_HTML(idx){	//alert("po");	//alert(this.event_list.length);	//poo();	var parent = document.getElementById("events_list");	var d_row = document.createElement("DIV");	var p_text = document.createElement("P");		if ( idx % 2 == 0 )	{		d_row.setAttribute("row_count", "1");		d_row.className = "event row_1";	} else {		d_row.setAttribute("row_count", "2");		d_row.className = "event row_2";	}		d_row.setAttribute("id", "event_"+ this.idEvent);	d_row.setAttribute("title", this.title);	d_row.onmouseover = over_event;	d_row.onmouseout = off_event;	//d_row.onclick = click_event(this.idEvent);		p_text.appendChild( document.createTextNode(idx + 1 +".  "+ this.title) );	p_text.setAttribute("title", this.title);	d_row.appendChild( p_text );		parent.appendChild( d_row );		this.node = document.getElementById("event_"+ this.idEvent);	alert(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(eid){	var id = eid;	//var i, len = calendar[eid].event_list.length;	//alert(eid);		for (i = 0; i < len; i++)	{		if ( this.event_list[i].idEvent == id )		{			//alert(this.event_list[i].cEvent);			break;		}	}}function stack_event(id_event, id_title, event_text){	var i, len = event_tmp.length;		event_tmp.push( new EventClass(id_event, id_title, event_text, len) );	event_tmp[len].generateHTML();	scrollMax = (event_tmp.length > 30) ? 12 : 6;}// ceev's suggested classfunction CalendarDay(d){	this.date = new Date(d);	this.ldate = d;	this.event_list = [];	this.addEvent = CalendarEvent_AddEvent;	this.removeEvent = CalendarEvent_RemoveEvent;	this.createEvent = CalendarEvent_CreateEvent;	}function CalendarEvent_AddEvent(id, title, desc, start_time, duration){	this.event_list.push( new CalendarEvent(id, title, desc, start_time, duration,"0") );}function CalendarEvent_RemoveEvent(id){	var tmp = [], i, len = this.event_list.length;		for (i = 0; i < len; i++)		if (this.event_list[i].id != id)			tmp.push( this.event_list[i] );		this.event_list = tmp;}function CalendarEvent_CreateEvent(id){	// ajax stuff here to insert event into db and then	// call the addEvent method to add it to the events array}