//*** This code is copyright 2003 by Gavin Kistner, gavin@refinery.com//*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt//*** Reuse or modification is free provided you abide by the terms of that license.//*** (Including the first two lines above in your source code mostly satisfies the conditions.)AttachEvent(window,'load',function(){	var codes = document.getElementsByTagName('pre');	var op = true; if( typeof( window.opera ) == "undefined"  ) { op = false; }	for (var i=0,len=codes.length;i<len;i++){		var code = codes[i];		if (!code.firstChild) continue;		var lines  ;		var cCode = SyntaxColored(code.firstChild.data)		cHTML = "";		if (document.all)		{			lines = cCode.split( "<br>" );			cHTML = "<ol>";			for( var j = 0; j < lines.length ;j++ )			{				if( op ){					if( lines[j] != "" ){  cHTML += "<li class=\"code\">" + lines[j] + "</li>";}				}				else				{					cHTML += "<li class=\"code\">" + lines[j] + "</li>";				}			}			code.innerHTML = cHTML + "</ol>";		}		else		{			lines = cCode.split( "\n" );			cHTML = "<ol>";			for( var j = 0; j < lines.length ; j++ )			{				cHTML += "<li class=\"code\">" + lines[j] + "</li>";			}			code.innerHTML = cHTML + "</ol>";		}	}		var codes = document.getElementsByTagName('xmp');	for (var i=0,len=codes.length;i<len;i++){		var code = codes[i];		if (!code.firstChild) continue;		var p = document.createElement("pre");		p.className = "xmp";		p.innerHTML=SyntaxColored(code.firstChild.data);		code.parentNode.replaceChild( p, code );	}	function SyntaxColored(js){		if (!js || !js.replace) return "";		js=js.replace(/\r/g,'\n');		js=js.replace(/</g,'&lt;').replace(/>/g,'&gt;');		var parens = /([\]\[(){}]+)/g;		var comments = /(\/\/.+|\/\*(.|\n)+?\*\/)/g;				var keywords = /\b(function|var|if|isNaN|return|if|else|for|while|new|continue|switch|case|true|false|prototype|constructor|caller|Number|Date|Object|String|Function|Array|RegExp|Boolean|Math)\b/g;		var strings = /((["'])(?:.*?(?:[^\\](?:\\\\)*|[^\\]))?\2)/g;		var numbers = /\b(-?(?:\d+|\d*\.\d+)\b)/g;		js=js.replace(strings,'<span class="string">$1<\/span>');		js=js.replace(parens,'<span class="paren">$1<\/span>');		js=js.replace(numbers,'<span class="number">$1<\/span>');		js=js.replace(keywords,'<span class="keyword">$1<\/span>');		js=js.replace(comments,'<span class="comment">$1<\/span>');		if (document.all) js=js.replace(/\n/g,"<br>").replace(/  /g," &nbsp;").replace(/\t/g," &nbsp; &nbsp;"); //IE-specific hack		js=js.replace(/<\/span>\n/g,"<\/span>&nbsp;\n");		return js;	}},false);function AttachEvent(obj,evt,fnc,useCapture){	if (!useCapture) useCapture=false;	if (obj.addEventListener){		obj.addEventListener(evt,fnc,useCapture);		return true;	} else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc);	else{		MyAttachEvent(obj,evt,fnc);		obj['on'+evt]=function(){ MyFireEvent(obj,evt) };	}} function MyAttachEvent(obj,evt,fnc){	if (!obj.myEvents) obj.myEvents={};	if (!obj.myEvents[evt]) obj.myEvents[evt]=[];	var evts = obj.myEvents[evt];	evts[evts.length]=fnc;}function MyFireEvent(obj,evt){	if (!obj || !obj.myEvents || !obj.myEvents[evt]) return;	var evts = obj.myEvents[evt];	for (var i=0,len=evts.length;i<len;i++) evts[i]();}