var st;

function Layout (id) {
}

function Box (pid, box, h) {

	if (!getid(pid)) {
		alert(' '+_lang['lang_container']+': '+pid+' '+_lang['lang_doesnotexi']+'!');
		return false;
	}

	var body_id	= box+'_body';
	var boxn	= box;
	
	box		= document.createElement('div');
	getid(pid).appendChild(box);

	box.id		= boxn;
		
	box.innerHTML = "<div><div></div><div></div><div></div></div><div></div><div id='"+body_id+"'></div><div></div>";
	//box.innerHTML = "<div><div></div><div></div><div></div></div><div></div><div class='loading' id='"+body_id+"'><center><img src='"+_desktop.imgs[17].src+"'></center></div><div></div>";

	box.title_box		= box.childNodes[0];
	box.subject		= box.childNodes[0].childNodes[0];
	box.button		= box.childNodes[0].childNodes[1];
	box.stat		= box.childNodes[0].childNodes[2];
	box.subtitle		= box.childNodes[1];
	box.body		= box.childNodes[2];
	box.foot		= box.childNodes[3];
	box.body_id		= body_id;
	box.button.className	= 'box_button';
	box.button.innerHTML	= '<a title="Minimize" onclick="parentNode.parentNode.parentNode.show();"><img src="/img/windows/mini.png"></a>';

	if (h>0) box.body.style.height = h+'px';
	
	box.classes		= new Array (
		'box_title_box',	// Base Div
		'box_title1',		// Title Box
		'box_left',		// Subject Side
		'box_right',		// Stat Side
		'box_body_box',		// Body Div (Full Scale)
		'box_side_box', 	// Body Div (Side Box)
		'box_foot',	// Subtitle Div
		'box_subtitle');		// Foot Div

	box.sidebox		= 1;

	box.show = function () {
		if (box.body.style.display=='none') {
			box.body.style.display = 'block';
			box.button.innerHTML = '<a title="'+_lang['min']+'" onclick="parentNode.parentNode.parentNode.show();"><img src="/img/windows/mini.png"></a>';
			if (box.subtitle.innerHTML > '') {
				box.subtitle.style.display = 'block';
			}
			if (box.foot.innerHTML > '') {
				box.foot.style.display = 'block';
			}
		} else {
			box.body.style.display = 'none';
			box.button.innerHTML = '<a title="'+_lang['min']+'" onclick="parentNode.parentNode.parentNode.show();"><img src="/img/windows/max.png"></a>';
			if (box.subtitle.innerHTML > '') {
				box.subtitle.style.display = 'none';
			}
			if (box.foot.innerHTML > '') {
				box.foot.style.display = 'none';
			}
		}
	}

	box.open = function () {
	}

	box.side = function (t) {
		box.body.className = (t) ? this.classes[5]:this.classes[4];
	}

	box.set_classes = function (t) {

		Classes_Update (t, box.classes);

		box.className			= this.classes[0];
		box.title_box.className		= this.classes[1];
		box.subtitle.className		= this.classes[7];
		box.subject.className		= this.classes[2];
		box.stat.className		= this.classes[3];
		box.foot.className		= this.classes[6];
		box.side (this.sidebox);
		if(_mem_style['titb_color']){box.title_box.style.background = _mem_style['titb_color']}
		if(_mem_style['titt_color']){box.title_box.style.color = _mem_style['titt_color']}
		if(_mem_style['tab_color']){box.style.background = _mem_style['tab_color']}
		if(_mem_style['bodytc_color']){box.style.color = _mem_style['bodytc_color']}
	}

	box.set_classes ();

	box.set_blank	= function (t) {
		if (box.childNodes.length<1) {
			alert(_lang['lang_boxremoved']);
		} else {
			box.removeChild(box.title_box);
			box.body = box.childNodes[0];
		}
	}

	box.set_title = function (t) {
		if (t==false) {
		} else {	
			this.subject.innerHTML = t;
		}
		
	}

	box.set_subtitle = function (t) {
		if (t==false) {
			this.subtitle.style.display = 'none';
		} else {	
			this.subtitle.innerHTML = t;
		}
	}

	box.set_foot = function (t) {
		if (t==false) {
			this.foot.style.display = 'none';
		} else {	
			this.foot.innerHTML = t;
			if (ie){
				this.foot.style.height = '22px';
			}
		}
	}

	box.set_stat = function (t) {
		f = t.split("|");				
		if(f[1]){
			this.stat.innerHTML =
				"<a style='color:#ffffff;' href='"+f[0]+"'>"+f[1]+"</a>";}
		else{
			this.stat.innerHTML = t;
		}
	}
	
	box.set_content = Object_set_content;

	box.get_body_id = function () {
		return this.body_id;
	}

	box.destroy = function () {
		clear_children(this.body);
	}

	box.output_html = function () {
		return this.body.innerHTML;
	}

	return box;
}

function Object_set_content (t, c, o) {

	if (o && o.nodeName) {
	} else if (o) { 
		o = getid(o+'_body');
	} else {
		o = this.body;
	}
	if (!o) return alert(_lang['lang_plsspecon']);
	if (t == 'url' || t == 'http') {

		if (c == 'refresh') c = o.cbody;
		if (c) {
			new Http_Async (c, o);
			o.ctype = 'url';
			o.cbody = c;
		}

	} else if (t == 'obj' || t == 'object') {
		if (c == 'refresh')
		       	return alert(_lang['lang_contypdo']);;
		o.innerHTML = '';
		o.appendChild(c);
		o.content_type = 'obj';

	} else if (t == 'html' || t == 'text') {
		if (c == 'refresh')
		       	return alert(_lang['lang_contypdo']);;
		o.innerHTML = c;
		o.content_type = 'html';

	} else {
		alert(' '+_lang['Type']+' "'+t+'" '+_lang['lang_isnotallow']+' ');

	}
}
function Http_Async (url, obj) {

	var self = this;
	this.obj = obj;

	this.get = function () {
		this.req = http_request();
		this.req.onreadystatechange = this.rtn;
		this.req.open("GET", url, true);
		this.req.send(null);
	}

	this.rtn = function () {
		if (self.req.readyState == 4) {
			if (self.req.status == 200) {
				self.obj.innerHTML = self.req.responseText;
				self.req = null;
				self = null;
			}
		}
	}

	this.get();
}

function Classes_Update (t, ca) {

	if (!ca) return alert(_lang['lang_clasarraydoes']);

	if (t) {
		for (var i=0; i<ca.length; i++) {
			if (t[i]) ca[i] = t[i];
		}
	} else {
		// Default style
	}
}

function Tab (pid, tabs, tab) {

	var tabarea, tabbox, tabmenu, tabul, tabtitle, li, tabbody,_aa;
	var nt, disp, act;

	tabs	 	= addobj ('div', ['tabs', tabs]);
	tabs.tab	= tab;
	tabs.tabn	= new Array();
	for (var i=0; i<tabs.tab.length; i++) tabs.tabn[tabs.tab[i]] = i;
	tabs.titles	= new Array();
	tabs.bodys	= new Array();
	tabs.bodyn	= new Array();
	for (i=0; i<tabs.tab.length; i++) tabs.bodyn[tabs.tab[i]] = i;
		
	tabs.classes = new Array (
		'body01',		// Base Div
	       	'menuA2',		// Menu Box
	       	'title',		// Title Div
	       	'normal',		// Title LI (Inactive State)
	       	'active',		// Title LI (Active State)
	       	'content1',		// Body Div
		'brief_item' );		// Reserved

	for (i=1; i<=tab.length; i++) {

		if (i==1)	disp	= 'block';
		else 		disp	= 'none';

		tabbox			= addobj ('div', ['id', tab[i-1]]);
		tabbox.style.display	= disp;

		tabmenu			= addobj ('div');
		tabul			= addobj ('ul');
		tabtitle		= addobj ('div');
	
		tabbody			= addobj ('div', ['id', tab[i-1]+'_body']);
		tabs.bodys[i-1]		= tabbody;
		tabs.bodyn[tab[i-1]]	= tabbody;
		tabs.titles[i-1]	= new Array();
		for (var j=1; j<=tab.length; j++) {
			
			li=addobj ('li');
			li.idx = j-1;
			li.pid = tab[j-1];
			li.onclick = function () {
				this.parentNode.parentNode.parentNode.
					parentNode.style.display = 'none';
				getid(this.pid).style.display = 'block';
			}

			li.ondblclick = function () {
				tabs.refresh(this.parentNode.parentNode.
					parentNode.parentNode.childNodes[1]);
			}
			tabtitle.appendChild (li);
			tabs.titles[i-1][j-1] = li;
		}

		tabul.appendChild	(tabtitle);
		tabmenu.appendChild	(tabul);
		tabbox.appendChild	(tabmenu);
		tabtitle.appendChild	(document.createElement('br'));
		tabbox.appendChild	(tabbody);
		tabs.appendChild	(tabbox);

	}

	getid(pid).appendChild (tabs);

	tabs.set_classes = function (t) {
		
		var a;
		Classes_Update (t, tabs.classes);

		for (var i=1; i<=tabs.tab.length; i++) {

			t = getid(tab[i-1]);
			t.className			= this.classes[0];
			t.childNodes[0].className	= this.classes[1];
			t.childNodes[0].childNodes[0].
			  childNodes[0].className	= this.classes[2];

			for (var j=1; j<=tabs.tab.length; j++) {
				if (i==j)	a = tabs.classes[4];
				else		a = tabs.classes[3];
				t.childNodes[0].childNodes[0].childNodes[0].
				  childNodes[j-1].className = a;
			}

			t.childNodes[1].className = this.classes[5];
		}
	}

	tabs.set_classes();

	tabs.set_title = function (n, t) {
		if (n>0)	n-=1;
		else		n = tabs.tabn[n];
		if (n==undefined) return alert(_lang['lang_tab_dne']);

		for (var i=0; i<tabs.titles.length; i++)
			tabs.titles[i][n].innerHTML += t;
			//tabs.titles[i][n].childNodes[5].innerHTML += t;
	}

	tabs.set_content  = Object_set_content;

	tabs.refresh = function (o) {
		Object_set_content ('url', 'refresh', o);
	}

	tabs.destroy = function (n) {
		if (n) {
			if (getid(n+'_body')) {
				clear_children(n+'_body');
			} else {
				alert(' '+_lang['lang_tab']+': '+n+' '+_lang['lang_doesnotexi']+'!');
				return false;
			}
		} else {
			alert(_lang['lang_plsspetdtd']);
		}
	}

	tabs.output = function (n) {
		if (n) {
			if (getid(n+'_body')) {
				return getid(n+'_body').innerHTML;
			} else {
				alert(' '+_lang['lang_tab']+': '+n+' '+_lang['lang_doesnotexi']+'!');
				return false;
			}
		} else {
			alert(_lang['lang_plsspetdtd']);
		}
	}

	return tabs;

}

function Brief (n) {
	
	this.pl			= 10;
	this.tno		= 3;
	this.pid		= 'pager1';
	this.lid		= 'list';
	this.pager		= 1;
	this.p1			= 1;
	this.p2			= 1;
	this.name		= n;
	this.orientation	= 'horizontal';
	this.alignment		= 'bottom';
	this.logo_width		= '150px';
	this.class_box_list	= 'box_list';
	this.class_box		= 'list_box';
	this.class_logo		= 'list_logo';
	this.class_content	= 'list_content';
	this.class_brief	= 'list_brief';
	this.class_title_line	= 'list_title_line';
	this.class_stats	= 'list_stats';
	this.class_pager	= 'box_pager';
	this.class_vertical	= 'brief_box_vertical';
	this.class_horizontal	= 'brief_box_horizontal';
	this.class_left		= 'brief_text_normal'	;
	this.class_right	= 'brief_text_right'	;
	this.def_nophoto	= '/img/nophoto.jpg';
	this.pid2		= 'pager2';
	this.type		= 'full';
	this.cat		= 1;
	this.headings		= new Array();

	this.img_title		= '';
	this.linkp		= '';
	this.link1		= '';
	this.link2		= '';
	this.link3		= ''; 
	this.filter		= '';
	this.count		= 'fn=groups_count';
	this.query		= 'fn=groups_list';
	this.extra		= '';
	this.cases 		= null;
	this.person		= 0;
	this.fixed_height	= 0;
	this.fixed_width	= 0;
	this.stats		= 0;
	this.stats_float	= '';
	this.stats_top		= '';
	this.stats_left		= '';
	this.stats_bottom	= '';
	this.stats_right	= '';
	this.array		= '';
	this.empty		= '';
	this.imode		= 0;
	this.rich		= 0;

	var list;
	var a = new Array();
	var t;
	var pindex;

	this.len = function () {
		return list.length;
	}

	this.init = function () {

		if (!getid(this.lid)) {
			alert(_lang['lang_container']+': '+this.lid+' '+_lang['lang_dosenotexist']);
			return;
		}
		list			= getid(this.lid);
		list.pno		= 1;
		list.sum		= 0;
		list.st			= 0;	
		list.ttl		= 0;	
		list.length		= 0;
	
		list.lid		= this.lid;
		list.pl			= this.pl;
		list.orientation	= this.orientation	;
		list.alignment		= this.alignment	;
		list.tno		= this.tno	;
		list.pid		= this.pid	;
		list.pager		= this.pager	  ;
		list.p1			= this.p1		  ;
		list.p2			= this.p2		  ;
		list.cat		= this.cat	  ;
		list.name		= this.name	  ;
		list.logo_width		= this.logo_width	  ;
		list.class_box_list	= this.class_box_list	;
		list.class_box		= this.class_box	  ;
		list.class_logo		= this.class_logo	  ;
		list.class_report	= this.class_report  ;
		list.class_content	= this.class_content;
		list.class_brief	= this.class_brief;
		list.class_title_line	= this.class_title_line	;
		list.class_stats	= this.class_stats	;
		list.class_pager	= this.class_pager	;
		list.class_vertical	= this.class_vertical	;
		list.class_horizontal	= this.class_horizontal	;
		list.class_left		= this.class_left	;
		list.class_right	= this.class_right	;
		list.def_nophoto	= this.def_nophoto	;
		list.pid2		= this.pid2	;	
		list.type		= this.type	;
		list.img_title		= this.img_title	;
		list.linkp		= this.linkp	;	
		list.link1		= this.link1	;	
		list.link2		= this.link2	;	
		list.link3		= this.link3	;	
		list.filter		= this.filter	;	
		list.count		= this.count	;	
		list.query		= this.query	;	
		list.extra		= this.extra	;	
		list.cases		= this.cases	;	
		list.headings		= this.headings	;
		list.person		= this.person	;
		list.fixed_height	= this.fixed_height;
		list.fixed_width	= this.fixed_width;
		list.stats		= this.stats	;
		list.stats_float	= this.stats_float	;
		list.stats_top		= this.stats_top	;
		list.stats_left		= this.stats_left	;
		list.stats_bottom	= this.stats_bottom	;
		list.stats_right	= this.stats_right	;
		list.array		= this.array	;
		list.empty		= this.empty	;
		list.imode		= this.imode	;
		list.rich		= this.rich	;

		list.clear = function () {
//			list.style.height = list.clientHeight + 'px';
			list.style.height = 'auto';
			for (var s=list.getElementsByTagName('table');
				       	s.length; list.removeChild(s[0]) );
		}
	
		list.destroy = function () {
			for (var s=list.getElementsByTagName('table');
				       	s.length; list.removeChild(s[0]) );
		}

		list.make_query = function (s, l) {
			var q;
			q = list.query + '&s='+_sess+'&start='+s+'&limit='+l;
			if (list.filter) {
				q += '&filter=' + list.filter;
			}
			return q;
		}

		list.bar_clear = function () {
			if (list.pager) 
				clear_child(getid(list.pid));
			if (list.pid2)
				clear_child(getid(list.pid2));

		}

		list.get_page_count = function () {

			var q = list.count;
			if ((q-0) > 0) {
				list.ttl = q-0;
			} else {
				a.length = 0;
				if (list.filter != ' ') {
					q += '&filter=' + list.filter;
				}
				fetch_lists (q, a);	
				if	(a && a[0])	list.ttl = a[0][0];
				else			list.ttl = 0;
			}
			list.psum=Math.ceil(list.ttl / list.pl);        
		}

		list.brief = function () {
			var o, i, c, box, logo, content, stats, item, ti;
			var lp, l1;

			a.length	= 0;
			list.destroy ();
			getid(list.lid).className = list.class_box_list;

			list.get_page_count();

			if (list.array) {
				if (!list.array) {
					setTimeout(list.brief(), 100);
					return;
				}
				a = list.array;
			} else  {
				if (list.array != undefined)
				fetch_lists (list.make_query(list.st, list.pl), a);
			}

			list.length = a.length;

//alert(a.length + ' ' + list.ttl);
			list.ttl = a.length;
	//		alert(this.make_query(st, list.pl));
			box	= addobj ('div', ['id','listbox','class',list.class_box,
					'style','text-align: center; margin-left: auto; margin-right: auto;']);
			if (list.fixed_height) {
				box.style.height	= list.fixed_height + 'px';
				box.style.overflow	= 'hidden';
			} else {
				box.style.height	= 'auto';
			}

			if (list.count) list.ttl = (a.length<list.count)?a.length:list.count;


// Normal !list.empty: No data
// if (list.empty) : list.empty
// addobj ('span' ...)
// item.appendChild(span)

			if (list.ttl <= 0) {
				box.innerHTML = (list.empty) ? list.empty : 'No data';
				box.style.textAlign = "center";
			}

			for (var i=0; i<list.ttl; i++) {

				lp=list.linkp;
				if (lp.indexOf('##')>-1) lp=lp.replace(/##/g,a[i][0]);
				l1=list.link1;
				if (l1.indexOf('##')>-1) l1=l1.replace(/##/g,a[i][0]);
				
				if (list.orientation == 'vertical') {
					item = addobj ('div',['class',list.class_vertical]);
				} else {
					item = addobj ('div',['class',list.class_horizontal]);
				}
				box.appendChild(item);

				if (lp.indexOf('javascript:')>-1) {
					ti = addobj ('a', ['onclick', lp+a[i][0]]);
				} else {
					ti = addobj ('a', ['href', lp+a[i][0]]);
				}
				item.appendChild (ti);

	//			ti.className = list.class_brief;
//				alert(list.class_brief_item);
				if (list.alignment == 'right') {
					c = addobj ('img',['class',list.class_logo,'border','0']);
					c.style.float	 = 'left';
					c.style.cssFloat = 'left';
				} else {
					c = addobj ('img',['class',list.class_logo,'border','0']);
				}
					
				if (list.img_title) c.title = list.img_title;

				a[i][1] = thumbnail (a[i][1]);
				if (list.person ==1) {
					c.src = get_photo (a[i][1], a[i][6]);
				} 	
				else if (list.person==2) {
					c.src = get_photo (a[i][1],'',1);
					}
				else if (list.person==3) {
                                        c.src = get_photo (a[i][1],'',3);
                                        }
                                else if (list.person==4) {
                                        c.src = get_photo (a[i][1],'',4);
                                        }
                                else if (list.person==5) {
                                        c.src = get_photo (a[i][1],'',2);
                                        }
				else {
					c.src = get_photo (a[i][1], 0);
				}
		/*		
				if (a[i][1]==""|| !a[i][1]) {
					c.src = list.def_nophoto;
				} else {
					c.src = a[i][1];
				}
		*/
			//	alert(a[i][1]);
				ti.appendChild (c);
				var alignment = '';

				if (l1.indexOf('javascript:')>-1) {
					ti = addobj ('a', ['onclick', l1+a[i][0]]);
				} else {
					ti = addobj ('a', ['href', l1+a[i][0]]);
				}
				item.appendChild (ti);
				if (a[i][2]==null) a[i][2]='';	
				if (list.alignment == 'right') {
					c = addobj('div', ['class',list.clsss_right]);
//					t = addobj('a', ['href', l1+a[i][0]])
					c.innerHTML += a[i][2];
					if(list.imode==5&&top._desktop.query){c.style.color = top._desktop.query['new_grp_info'][0][12]}else{c.style.color='' }
					//if(list.imode==5&&top._desktop.query){t.style.color = top._desktop.query['new_grp_info'][0][12]}else{t.style.color='' }
					
			//		c.innerHTML += a[i][2];
			//		c.appendChild (t)
					ti.appendChild (c);
					ti.appendChild (addobj('div',['class','float_terminator']));
					//ti.innerHTML += "<div class='float_terminator'>.</div>";
				} else {
					c = addobj('div', ['class',list.class_left,'text',a[i][2]]);
			//		c.innerHTML += a[i][2];
					if(list.imode==5&&top._desktop.query){c.style.color = top._desktop.query['new_grp_info'][0][12]}else{c.style.color='' }
					ti.appendChild (c);
				}

				if (list.cases) {
					if (a[i][5]>list.cases.length-1) {
						a[i][5] = list.cases.length-1;
					}
					c = list.cases[a[i][5]];
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
					item.innerHTML += c;

				} else if (list.extra) {
					c = list.extra;
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
					item.innerHTML += c;
				}

				if (list.stats) {
					c = addobj ('div', ['class', 'list_brief_stats']);
					if (list.stats_float) c.style.cssFloat= list.stats_float;
					if (list.stats_float) c.style.styleFloat= list.stats_float;
					if (list.stats_top) c.style.top       = list.stats_top;
					if (list.stats_left) c.style.left     = list.stats_left;
					if (list.stats_bottom) c.style.bottom = list.stats_bottom;
					if (list.stats_right) c.style.right   = list.stats_right;

					c.appendChild (
						Slide_Bar('p'+i,list.stats,
							a[i][8],a[i][9],function(){}));
					item.appendChild(c);
				}

			}
			
			box.innerHTML += "<div class='float_terminator'>.</div>";
			getid(list.lid).appendChild(box);
		}

		list.showpage = function (pn) {

		//	if	(list.type == 'brief')
		//		{ list.brief (); }
			list.brief ();
		}
	}

}


function List (n) {

	this.pl			= 10;
	this.tno		= 3;
	this.pid		= 'pager1';
	this.lid		= 'list';
	this.pager		= 1;
	this.p1			= 1;
	this.p2			= 1;
	this.name		= n;
	this.orientation	= 'horizontal';
	this.alignment		= 'bottom';
	this.logo_width		= '150px';
	this.class_box_list	= 'box_list';
	this.class_box		= 'list_box';
	this.class_logo		= 'list_logo';
	this.class_content	= 'list_content';
	this.class_brief	= 'list_brief';
	this.class_title_line	= 'list_title_line';
	this.class_stats	= 'list_stats';
	this.class_pager	= 'box_pager';
	this.class_vertical	= 'brief_box_vertical';
	this.class_horizontal	= 'brief_box_horizontal';
	this.class_left		= 'brief_text_normal'	;
	this.class_right	= 'brief_text_right'	;
	this.def_nophoto	= '/img/nophoto.jpg';
	this.pid2		= 'pager2';
	this.type		= 'full';
	this.cat		= 1;
	this.headings		= new Array();

	this.img_title		= '';
	this.linkp		= '';
	this.link1		= '';
	this.link2		= '';
	this.link3		= ''; 
	this.filter		= '';
	this.count		= 'fn=groups_count';
	this.query		= 'fn=groups_list';
	this.extra		= '';
	this.cases 		= null;
	this.person		= 0;
	this.fixed_height	= 0;
	this.fixed_width	= 0;
	this.stats		= 0;
	this.stats_float	= '';
	this.stats_top		= '';
	this.stats_left		= '';
	this.stats_bottom	= '';
	this.stats_right	= '';
	this.array		= '';
	this.empty		= '';
	this.imode		= 0;
	this.rich		= 0;

	var list;
	var a = new Array();
	var t;
	var pindex;

	this.len = function () {
		return list.length;
	}

	this.init = function () {

		if (!getid(this.lid)) {
			alert(_lang['lang_container']+': '+this.lid+' '+_lang['lang_dosenotexist']);
			return;
		}
		list			= getid(this.lid);
		list.pno		= 1;
		list.sum		= 0;
		list.st			= 0;	
		list.ttl		= 0;	
		list.length		= 0;
	
		list.lid		= this.lid;
		list.pl			= this.pl;
		list.orientation	= this.orientation	;
		list.alignment		= this.alignment	;
		list.tno		= this.tno	;
		list.pid		= this.pid	;
		list.pager		= this.pager	  ;
		list.p1			= this.p1		  ;
		list.p2			= this.p2		  ;
		list.cat		= this.cat	  ;
		list.name		= this.name	  ;
		list.logo_width		= this.logo_width	  ;
		list.class_box_list	= this.class_box_list	;
		list.class_box		= this.class_box	  ;
		list.class_logo		= this.class_logo	  ;
		list.class_report	= this.class_report  ;
		list.class_content	= this.class_content;
		list.class_brief	= this.class_brief;
		list.class_title_line	= this.class_title_line	;
		list.class_stats	= this.class_stats	;
		list.class_pager	= this.class_pager	;
		list.class_vertical	= this.class_vertical	;
		list.class_horizontal	= this.class_horizontal	;
		list.class_left		= this.class_left	;
		list.class_right	= this.class_right	;
		list.def_nophoto	= this.def_nophoto	;
		list.pid2		= this.pid2	;	
		list.type		= this.type	;
		list.img_title		= this.img_title	;
		list.linkp		= this.linkp	;	
		list.link1		= this.link1	;	
		list.link2		= this.link2	;	
		list.link3		= this.link3	;	
		list.filter		= this.filter	;	
		list.count		= this.count	;	
		list.query		= this.query	;	
		list.extra		= this.extra	;	
		list.cases		= this.cases	;	
		list.headings		= this.headings	;
		list.person		= this.person	;
		list.fixed_height	= this.fixed_height;
		list.fixed_width	= this.fixed_width;
		list.stats		= this.stats	;
		list.stats_float	= this.stats_float	;
		list.stats_top		= this.stats_top	;
		list.stats_left		= this.stats_left	;
		list.stats_bottom	= this.stats_bottom	;
		list.stats_right	= this.stats_right	;
		list.array		= this.array	;
		list.empty		= this.empty	;
		list.imode		= this.imode	;
		list.rich		= this.rich	;

		list.clear = function () {
//			list.style.height = list.clientHeight + 'px';
			list.style.height = 'auto';
			for (var s=list.getElementsByTagName('table');
				       	s.length; list.removeChild(s[0]) );
		}
	
		list.destroy = function () {
			for (var s=list.getElementsByTagName('table');
				       	s.length; list.removeChild(s[0]) );
		}

		list.make_query = function (s, l) {
			var q;
			q = list.query + '&s='+_sess+'&start='+s+'&limit='+l;
			if (list.filter) {
				q += '&filter=' + list.filter;
			}
			return q;
		}

		list.bar_clear = function () {
			if (list.pager) 
				clear_child(getid(list.pid));
			if (list.pid2)
				clear_child(getid(list.pid2));

		}

		list.get_page_count = function () {

			var q = list.count;
			if ((q-0) > 0) {
				list.ttl = q-0;
			} else {
				a.length = 0;
				if (list.filter != ' ') {
					q += '&filter=' + list.filter;
				}
				fetch_lists (q, a);	
				if	(a && a[0])	list.ttl = a[0][0];
				else			list.ttl = 0;
			}
			list.psum=Math.ceil(list.ttl / list.pl);        
		}

		list.page_bar = function (p2){
			
			if (list.pager == 0) return;

			var aa, c, o, p, x, y;
			this.get_page_count();

			if (p2 == 2 && this.pid2) {
				o = getid(this.pid2);
				if (ie4) {}
			       	else o.style.textAlign = 'right;';
			} else {
				o = getid(this.pid);
			}
			o.innerHTML ='';
			o.className = this.class_pager;
			
			if (!p2) {
				x = (list.st-0)+1;
				y = (list.st-0)+(list.pl-0);
				if (y>list.ttl) y=list.ttl;
				aa= addobj ('span', ['style','margin-right: 30px;']);
				aa.innerHTML=_lang['lang_display']+x+' - '+y+' '+_lang['lang_of']+' '+(list.ttl-0);
				o.appendChild(aa);
			}

			aa = addobj ('a');
			aa.first = function ()	{ list.showpage (1)	};
			aa.onclick = aa.first;
			aa.innerHTML = "[&lt;&lt;]";
			o.appendChild(aa);
		      
			aa = addobj ('a');
			aa.prev = function () {
				list.pno = (list.pno<1) ? list.pno=1:list.pno-=1;
				list.showpage (list.pno);
			}
			aa.onclick = aa.prev;
			aa.innerHTML = "[&lt;]";
			o.appendChild(aa);

			x = list.pno-1;
			y = list.pno+1;
			if ( x < 1 )		x = 1;
			if ( y > list.psum )	x--;
	
			for (i=0; i<list.tno; i++) {
				list.pindex = x+i;
				if (list.pindex>0 && list.pindex<=list.psum) {
					if (list.pno == list.pindex) {
						aa = addobj ('p');
						aa.innerHTML  = list.pindex;
					} else {
						aa = addobj ('a');
						aa.innerHTML  = list.pindex;
						aa.pageNo     = list.pindex;
						aa.onclick = function () {
							list.showpage(this.pageNo);
						}
					}
					o.appendChild(aa);
				}
			}
		 
			aa = addobj ('a');
			aa.next = function () {list.pno=(list.pno>list.psum)?list.pno=list.psum:list.pno+=1;list.showpage(list.pno)};
			aa.onclick=aa.next;
			aa.innerHTML = "[&gt;]";
			o.appendChild(aa);

			aa = addobj ('a');
			aa.last = function ()	{ list.showpage (list.psum)	};
			aa.onclick = aa.last;
			aa.innerHTML = "[&gt;&gt;]";
			o.appendChild(aa);

			if (!p2) {
				aa = addobj('span',['style','margin-left: 10px;']);
				aa.innerHTML = _lang['top_search_box'];
				o.appendChild(aa);
				aa = addobj ('input', ['id','box_filter','class','box_filter']);
			//	aa.onkeypress = function (e) {e=e?e:event; if (e.keyCode==13) {getid("list").filter=this.value; getid("list").showpage(0); }};
				aa.onkeypress = function (e) {e=e?e:event; if (e.keyCode==13) {list.filter=this.value; list.showpage(0); }};
				if (this.filter)
					aa.value = this.filter;
				o.appendChild(aa);
			}

			if (this.cat) {
				aa = new Categories ('','',function (c1,c2,c3) {});
				aa.style.display = "inline";
				aa.style.marginLeft = '10px';
//				if (!p2) o.innerHTML += '<br>';
				o.appendChild (aa);
			}
		}

		list.detail = function () {
			var o, i, c, box, logo, content, stats, item, ti;
			var lp, l1;

			a.length	= 0;
			list.destroy ();
			getid(list.lid).className = list.class_box_list;

			list.get_page_count();

			if (list.array) {
				if (!list.array) {
					setTimeout(list.brief(), 100);
					return;
				}
				a = list.array;
			} else  {
				if (list.array != undefined)
				fetch_lists (list.make_query(list.st, list.pl), a);
			}

			list.length = a.length;
	//		alert(this.make_query(st, list.pl));
			box	= addobj ('div', ['id','listbox','class',list.class_box,'style','text-align: center; margin-left: auto; margin-right: auto;']);
			box.style.height = 'auto';
			list.ttl = a.length;
	
			if (list.count) list.ttl = (a.length<list.count)?a.length:list.count;
	
			for (var i=0; i<list.ttl; i++) {
				lp=list.linkp;
				if (lp.indexOf('##')>-1) lp=lp.replace(/##/g,a[i][0]);
				l1=list.link1;
				if (l1.indexOf('##')>-1) l1=l1.replace(/##/g,a[i][0]);
				
				if (list.orientation == 'vertical') {
					item = addobj ('div',['class',list.class_vertical]);
				} else {
					item = addobj ('div',['class',list.class_horizontal]);
				}
				box.appendChild(item);

				if (lp.indexOf('javascript:')>-1) {
					ti = addobj ('a', ['onclick', lp+a[i][0]]);
				} else {
					ti = addobj ('a', ['href', lp+a[i][0]]);
				}
				item.appendChild (ti);

	//			ti.className = list.class_brief;
//				alert(list.class_brief_item);
				if (list.alignment == 'right') {
					c = addobj ('img', ['class',list.class_logo,'border','0']);
					c.style.float	 = 'left';
					c.style.cssFloat = 'left';
				} else {
					c = addobj ('img', ['class',list.class_logo,'border','0']);
				}
					
				if (list.img_title) c.title = list.img_title;

				a[i][1] = thumbnail (a[i][1]);

				if (list.person ==1) {
					c.src = get_photo (a[i][1], a[i][6]);
				} 	
				else if (list.person==2) {
					c.src = get_photo (a[i][1],'',1);
					}
				else if (list.person==3) {
					c.src = get_photo (a[i][1],'',3);
					}
				else if (list.person==4) {
					c.src = get_photo (a[i][1],'',4);
					}
				else if (list.person==5) {
					c.src = get_photo (a[i][1],'',2);
					}
				else {
					c.src = get_photo (a[i][1], 0);
				}
		/*		
				if (a[i][1]==""|| !a[i][1]) {
					c.src = list.def_nophoto;
				} else {
					c.src = a[i][1];
				}
		*/
			//	alert(a[i][1]);
				ti.appendChild (c);
				var alignment = '';

				if (l1.indexOf('javascript:')>-1) {
					ti = addobj ('a', ['onclick', l1+a[i][0]]);
				} else {
					ti = addobj ('a', ['href', l1+a[i][0]]);
				}
				item.appendChild (ti);
				if (a[i][2]==null) a[i][2]='';	
				if (list.alignment == 'right') {
					c = addobj('div', ['class',list.clsss_right,'text',a[i][2]]);

			//		c.innerHTML += a[i][2];
					ti.appendChild (c);
					ti.innerHTML += "<div class='float_terminator'>.</div>";
				} else {
					c = addobj('div', ['class',list.class_left,'text',a[i][2]]);
			//		c.innerHTML += a[i][2];
					ti.appendChild (c);
				}

				if (list.cases) {
					if (a[i][5]>list.cases.length-1) {
						a[i][5] = list.cases.length-1;
					}
					c = list.cases[a[i][5]];
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
					item.innerHTML += c;

				} else if (list.extra) {
					c = list.extra;
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
					item.innerHTML += c;
				}	
				if (list.stats) {
					item.appendChild(
						Slide_Bar('p'+i, list.stats, a[i][8], a[i][9], function(){}));
				}	

			}

	//		ti = addobj ('div',['class','float_terminator']);
	//		ti.innerHTML = '.';
			box.innerHTML += "<div class='float_terminator'>.</div>";
	//		box.appendChild(ti);
			getid(list.lid).appendChild(box);
		}

		list.brief = function () {
			var o, i, c, box, logo, content, stats, item, ti, di;
			var lp, l1;

			a.length	= 0;
			list.destroy ();
			getid(list.lid).className = list.class_box_list;

			list.get_page_count();

			if (list.array) {
				if (!list.array) {
					setTimeout(list.brief(), 100);
					return;
				}
				a = list.array;
			} else  {
				if (list.array != undefined)
				fetch_lists (list.make_query(list.st, list.pl), a);
			}

			list.length = a.length;

//alert(a.length + ' ' + list.ttl);
			list.ttl = a.length;
	//		alert(this.make_query(st, list.pl));
			box	= addobj ('div', ['id','listbox','class',list.class_box,
					'style','text-align: center; margin-left: auto; margin-right: auto;']);
			if (list.fixed_height) {
				box.style.height	= list.fixed_height + 'px';
				box.style.overflow	= 'hidden';
			} else {
				box.style.height	= 'auto';
			}

			if (list.count) list.ttl = (a.length<list.count)?a.length:list.count;


// Normal !list.empty: No data
// if (list.empty) : list.empty
// addobj ('span' ...)
// item.appendChild(span)

			if (list.ttl <= 0) {
				box.innerHTML = (list.empty) ? list.empty : 'No data';
				box.style.textAlign = "center";
			}

			for (var i=0; i<list.ttl; i++) {

				lp=list.linkp;
				if (lp.indexOf('##')>-1) lp=lp.replace(/##/g,a[i][0]);
				l1=list.link1;
				if (l1.indexOf('##')>-1) l1=l1.replace(/##/g,a[i][0]);
				
				if (list.orientation == 'vertical') {
					item = addobj ('div',['class',list.class_vertical]);
				} else {
					item = addobj ('div',['class',list.class_horizontal]);
				}
				box.appendChild(item);

				if (lp.indexOf('javascript:')>-1) {
					ti = addobj ('a', ['onclick', lp+a[i][0]]);
				} else {
					ti = addobj ('a', ['href', lp+a[i][0]]);
				}
				item.appendChild (ti);

	//			ti.className = list.class_brief;
//				alert(list.class_brief_item);

		/*#########################################*/		
				di = addobj ('div',['style','text-align: center; width: 85px; height: 85px; border: 1px solid silver;']);

				di.style.width 		= '85px';
				di.style.height 	= '85px';
				di.style.textAlign 	= 'center';
				di.style.border 	= '1px solid silver';

				ti.appendChild (di);		
		/*#########################################*/
		
				if (list.alignment == 'right') {
					c = addobj ('img',['class',list.class_logo,'border','0']);
				//	c = addobj ('img',['style','width: 80px; height: auto;','border','0']);
					c.style.float	 = 'left';
					c.style.cssFloat = 'left';
				} else {
					c = addobj ('img',['class',list.class_logo,'border','0']);
				//	c = addobj ('img',['style','width: 80px; height: auto;','border','0']);
				}

				if (list.img_title) c.title = list.img_title;

				a[i][1] = thumbnail (a[i][1]);
				if (list.person ==1) {
					c.src = get_photo (a[i][1], a[i][6]);
				} 	
				else if (list.person==2) {
					c.src = get_photo (a[i][1],'',1);
					}
				else if (list.person==3) {
                                        c.src = get_photo (a[i][1],'',3);
                                        }
                                else if (list.person==4) {
                                        c.src = get_photo (a[i][1],'',4);
                                        }
                                else if (list.person==5) {
                                        c.src = get_photo (a[i][1],'',2);
                                        }
				else {
					c.src = get_photo (a[i][1], 0);
				}
		/*		
				if (a[i][1]==""|| !a[i][1]) {
					c.src = list.def_nophoto;
				} else {
					c.src = a[i][1];
				}
		*/
			//	alert(a[i][1]);

		/*#########################################*/		
				di.appendChild (c);
		/*#########################################*/		

				var alignment = '';

				if (l1.indexOf('javascript:')>-1) {
					ti = addobj ('a', ['onclick', l1+a[i][0]]);
				} else {
					ti = addobj ('a', ['href', l1+a[i][0]]);
				}
				item.appendChild (ti);
				if (a[i][2]==null) a[i][2]='';	
				if (list.alignment == 'right') {
					c = addobj('div', ['class',list.clsss_right]);
//					t = addobj('a', ['href', l1+a[i][0]])
					c.innerHTML += a[i][2];
					if(list.imode==5&&top._desktop.query){c.style.color = top._desktop.query['new_grp_info'][0][12]}else{c.style.color='' }
					//if(list.imode==5&&top._desktop.query){t.style.color = top._desktop.query['new_grp_info'][0][12]}else{t.style.color='' }
					
			//		c.innerHTML += a[i][2];
			//		c.appendChild (t)
					ti.appendChild (c);
					ti.appendChild (addobj('div',['class','float_terminator']));
					//ti.innerHTML += "<div class='float_terminator'>.</div>";
				} else {
					c = addobj('div', ['class',list.class_left,'text',a[i][2]]);
			//		c.innerHTML += a[i][2];
					if(list.imode==5&&top._desktop.query){c.style.color = top._desktop.query['new_grp_info'][0][12]}else{c.style.color='' }
					ti.appendChild (c);
				}

				if (list.cases) {
					if (a[i][5]>list.cases.length-1) {
						a[i][5] = list.cases.length-1;
					}
					c = list.cases[a[i][5]];
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
					item.innerHTML += c;

				} else if (list.extra) {
					c = list.extra;
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
					item.innerHTML += c;
				}

				if (list.stats) {
					c = addobj ('div', ['class', 'list_brief_stats']);
					if (list.stats_float) c.style.cssFloat= list.stats_float;
					if (list.stats_float) c.style.styleFloat= list.stats_float;
					if (list.stats_top) c.style.top       = list.stats_top;
					if (list.stats_left) c.style.left     = list.stats_left;
					if (list.stats_bottom) c.style.bottom = list.stats_bottom;
					if (list.stats_right) c.style.right   = list.stats_right;

					c.appendChild (
						Slide_Bar('p'+i,list.stats,
							a[i][8],a[i][9],function(){}));
					item.appendChild(c);
				}

			}
			
			box.innerHTML += "<div class='float_terminator'>.</div>";
			getid(list.lid).appendChild(box);
		}

/*		list.full_html = function () {
		}
*/
		list.full_html = function (a) {

			var s, c, box, logo, content, stats;
			var a = new Array();
			var lp, l1, l2, l3;
			if (list.array) {
			//	list.full_html_render(list.array);
				a = list.array;
			} else  {
				fetch_lists (this.make_query(list.st, list.pl), a);
			}

//			this.destroy ();
			list.className = 'box_list';
			var li = "<table class='box_list'><tbody class='box_list'>";	

/*	
			if (list.array) {
				a = list.array;
			} else  {
				fetch_lists (this.make_query(list.st, list.pl), a);
			}
*/

			list.get_page_count();
			list.length = a.length;
			for(var i=0; i<list.ttl; i++) {

				if (!a[i] || !a[i][0]) continue;

				lp=list.linkp;
				if (lp.indexOf('##')>-1) lp=lp.replace(/##/g,a[i][0]);
				l1=list.link1;
				if (l1.indexOf('##')>-1) l1=l1.replace(/##/g,a[i][0]);
				l2=list.link2;
				if (l2.indexOf('##')>-1) l2=l2.replace(/##/g,a[i][0]);
				l3=list.link3;
				if (l3.indexOf('##')>-1) l3=l3.replace(/##/g,a[i][0]);
	
				logo = '';
		
				if (a[i][1] != -1) {

					a[i][1] = thumbnail (a[i][1]);
					if (list.person ==1) {
						c = get_photo (a[i][1], a[i][6]);
					} else if (list.person==2) {
						c = get_photo (a[i][1],'',1);
					} else if (list.person==3) {
                                        	c.src = get_photo (a[i][1],'',3);
                                        } else if (list.person==4) {
                                       		c.src = get_photo (a[i][1],'',4);
                                        } else if (list.person==5) {
                                        	c.src = get_photo (a[i][1],'',2);
                                        } else {
						c = get_photo (a[i][1], 0);
					}
					
					c = "src='"+c+"'";
					if (list.img_title) c = c + " title='"+list.img_title+"'";
					logo = "<a href='"+lp+a[i][0]+"'><img border='0' class='"+list.class_logo+"' "+c+"></a>";
				}
				content = "<div class='"+list.class_title_line+"'><a href='"+l1+a[i][0]+"'>"+a[i][2]+"</a></div>";

				a[i][3] = rich_unescape(a[i][3]);
				if (a[i][3]!=null && a[i][3].length > 300) {
					a[i][3] = a[i][3].substring(0,300) + ' ...';
				}

				//content += "<div class='list_content_real'><p href='"+l2+a[i][0]+"'>"+a[i][3]+"</p></div>";
				if (a[i][3] == null) a[i][3] = "";
				if(list.imode==5&&top._desktop.query){var g1_cr = top._desktop.query['new_grp_info'][0][12]}else{var g1_cr='' }
				content += "<div class='list_content_real'><p style='color:"+g1_cr+"' href='"+l2+a[i][0]+"'>"+a[i][3]+"</p></div>";
				c = '';
				if (list.cases) {
					if (a[i][5]>list.cases.length-1) {
						a[i][5] = list.cases.length-1;
					}
					c = list.cases[a[i][5]];
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);

				} else 	if (list.extra) {
					c = list.extra;
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
				}
var o;
				if (list.stats) {
					o = addobj ('div');
					s = addobj ('div', ['class', 'list_brief_stats']);
					if (list.stats_float) s.style.cssFloat= list.stats_float;
					if (list.stats_top) s.style.top       = list.stats_top;
					if (list.stats_left) s.style.left     = list.stats_left;
					if (list.stats_bottom) s.style.bottom = list.stats_bottom;
					if (list.stats_right) s.style.right   = list.stats_right;
					s.appendChild (
						Slide_Bar('p'+i,list.stats,a[i][8],a[i][9],'') );
					o.appendChild(s);
					c += o.innerHTML;
				}	
				if(list.imode==5&&top._desktop.query){var g_cr = top._desktop.query['new_grp_info'][0][12]}else{var g_cr='' }	
				a[i][4] = rich_unescape(a[i][4]);
				stats = "<div><p style='color:"+g_cr+"' href='"+l3+a[i][0]+"'>"+a[i][4]+"</p>"+c+"</div>";
				
				if (a[i][1] == -1) {
					box = "<tr id='listbox' class='"+list.class_box+"'><td style='width: 0px;'></td><td class='"+list.class_content+"'>"+content+"</td><td class='"+list.class_stats+"'>"+stats+"</td></tr>";
				} else {
					box = "<tr id='listbox' class='"+list.class_box+"'><td class='"+list.class_logo+"'>"+logo+"</td><td class='"+list.class_content+"'>"+content+"</td><td class='"+list.class_stats+"'>"+stats+"</td></tr>";
				}

				li += box;

			}

			li += "</tbody></table>";
			list.innerHTML = li;
		}

		list.full_report = function () {

			var c, box, logo, content1, content2, stats;
			var a = new Array();
			var lp, l1, l2, l3;
		
//			this.destroy ();
			list.className = 'box_list';
			var li = "<table class='box_list'><tbody class='box_list'>";	
			this.get_page_count();
			if (list.array) {
				a = list.array;
			} else  {
				fetch_lists (this.make_query(list.st, list.pl), a);
			}
			list.length = a.length;

			if (list.headings.length) {
				logo = "<tr>";
				logo += "<td>"+list.headings[0]+"</td>";
				logo += "<td>"+list.headings[1]+"</td>";
				logo += "<td>"+list.headings[2]+"</td>";
				logo += "<td>"+list.headings[3]+"</td>";
				logo +="</tr>";
				li += logo;
			}
			for(var i=0; i<list.ttl; i++) {

				if (!a[i] || !a[i][0]) continue;

				lp=this.linkp;
				if (lp.indexOf('##')>-1) lp=lp.replace(/##/g,a[i][0]);
				l1=this.link1;
				if (l1.indexOf('##')>-1) l1=l1.replace(/##/g,a[i][0]);
				l2=this.link2;
				if (l2.indexOf('##')>-1) l2=l2.replace(/##/g,a[i][0]);
				l3=this.link3;
				if (l3.indexOf('##')>-1) l3=l3.replace(/##/g,a[i][0]);
		

					a[i][1] = thumbnail (a[i][1]);
					if (list.person ==1) {
						c = get_photo (a[i][1], a[i][6]);
					} 	
					else if (list.person=2) {
						c = get_photo (a[i][1],'',1);
						}
					else if (list.person==3) {
                                        	c.src = get_photo (a[i][1],'',3);
                                        }
                                	else if (list.person==4) {
                                        	c.src = get_photo (a[i][1],'',4);
                                        }
                                	else if (list.person==5) {
                                        	c.src = get_photo (a[i][1],'',2);
                                        }
					else {
						c = get_photo (a[i][1], 0);
					}

				if (lp.length>0) {
					logo = "<a href='"+lp+a[i][0]+"'>"+c+"</a>";
				} else {
					logo = "<span>"+c+"</span>";
				}

				if (l1.length>0) {
					content1 = "<a href='"+l1+a[i][0]+"'>"+a[i][2]+"</a>";
				} else {
					content1 = "<span>"+a[i][2]+"</span>";
				}
				if (a[i][3]==null) a[i][3] = '';
				if (a[i][3].length > 300) {
					a[i][3] = a[i][3].toString().substring(0,80) + ' ...';
				}

				content2 = "<p href='"+l2+a[i][0]+"'>"+a[i][3]+"</p>";

				c = '';
				if (list.cases) {
					if (a[i][5]>list.cases.length-1) {
						a[i][5] = list.cases.length-1;
					}
					c = list.cases[a[i][5]];
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);

				} else 	if (list.extra) {
					c = list.extra;
					if (c.indexOf('##') > -1) 
						c = c.replace (/##/g,a[i][0]);
				}
				if (a[i][4]==null) a[i][4] = '';
				stats = "<div><p href='"+l3+a[i][0]+"'>"+a[i][4]+"</p>"+c+"</div>";
				content1 = rich_unescape (content1);			// rich_unescape 
				box = "<tr id='listbox' class='"+this.class_report+"'><td class='"+this.class_report+"'>"+logo+"</td><td class='"+this.class_report+"'>"+content1+"</td><td class='"+this.class_report+"'>"+content2+"</td><td class='"+this.class_report+"'>"+stats+"</td></tr>";


				li += box;
			}
			li += "</tbody></table>";
			list.innerHTML = li;
		}

		list.showpage = function (pn) {
			if (pn > list.psum) {
				pn = list.psum;
			} else if (pn < 1) {
				pn = 1;
			}
			list.pno = pn;
			list.st = (pn-1) * list.pl;
			if (this.pager) {
				this.bar_clear();
				this.page_bar();
			}

			if (this.pid2) {
				this.page_bar(2);
			}

			list.clear();

			if	(list.type == 'brief')		{ list.brief (); }
			else if	(list.type == 'report')		{ list.full_report (); }
			else					{ list.full_html (); }

		}

		list.prev = function () {
			list.pno = (list.pno<1) ? list.pno=1:list.pno-=1;
			list.showpage (list.pno);
		}

		list.next = function () {
			list.pno = (list.pno>list.psum) ? list.pno=list.psum:list.pno+=1;
			list.showpage (list.pno);
		}


		if (list.pager) list.page_bar  ();
		if (list.type == 'brief') {
			list.brief ();
		} else if (list.type == 'report') {
			list.full_report ();
		} else {
			list.full_html ();
		}
		if (list.pager && list.pid2) list.page_bar  (2);
	}

}

function fetch_lists (url, fa) {

	var d = new Date();
	var req;
	var sxml, doc, item, i, j, k, rows, cols;
	
	url = url_ss(url);

	req = http_request();
	req.open("GET", _url_root+'/l.php?'+url+'&__='+d, false);
	req.send(null);

	sxml = unescape(req.responseText);	
	sxml = dom_parser(sxml);
	doc  = sxml.documentElement;
	item = doc.getElementsByTagName('item');
	fa.length = 0;
	rows = item.length;
	
	if (item.length) cols = (item[0].childNodes.length);
	else return "XML Form Error";

	for (i=0; i<rows; i++) {
		fa[i] = new Array();
		for (j=0; j<cols; j++) {
			if (document.implementation.createDocument) {
				fa[i][j] = item[i].childNodes[j].textContent;
			} else if (window.ActiveXObject) {
				if (item[i].childNodes[j].firstChild) {
					fa[i][j] =
					item[i].childNodes[j].firstChild.nodeValue;
				} else {
					fa[i][j] = null;
				}
			}
			if (fa[i][j]!=null) {
				if (fa[i][j].match(/\[nl\]|\n/))
					fa[i][j] = fa[i][j].replace(/\[nl\]|\n/g,'<br>');
//				fa[i][j] = fa[i][j].replace(/\n/g,'<br>');
				if (fa[i][j].match(/\[\[/))
					fa[i][j] = fa[i][j].replace(/\[\[/g,'<');
				if (fa[i][j].match(/\]\]/))
					fa[i][j] = fa[i][j].replace(/\]\]/g,'>');
			}
		}
	}
}

function Style (s) {
	this.change = function () {
		if (document.styleSheets[0].disabled) {
			document.styleSheets[0].disabled = false;
			document.styleSheets[0].disabled = true;
			document.styleSheets[1].disabled = false;
			document.styleSheets[2].disabled = true;
			document.styleSheets[3].disabled = false;
		}
	}
}

function Head_Title (t,s) {

	if (t && getid('header_title')) {
		getid('header_title').innerHTML = t;
	}
	if (s && getid('header_desc')) {
		getid('header_desc').innerHTML = s;
	}
}

function Head_Menu () {
}

function box_show (box) {
	
	if (typeof(box) != 'object') {
		box = getid(box);
	}

	if (box.body) {
	} else {
		box_init(box);
	}
	var h = getid(box.id + '_head');
	var f = getid(box.id + '_foot');

	if (box.body.style.display=='none') {
		box.body.style.display = 'block';
		box.button.innerHTML = '<a title="'+_lang['min']+'" onclick="box_show(\''+box.id+'\');"><img src="/img/windows/mini.png"></a>';
		if (h.innerHTML) h.style.display = 'block';
		if (f.innerHTML) f.style.display = 'block';
		
	} else {
		box.body.style.display = 'none';
		box.button.innerHTML = '<a title="'+_lang['max']+'" onclick="box_show(\''+box.id+'\');"><img src="/img/windows/max.png"></a>';
		h.style.display	= 'none';
		f.style.display	= 'none';
	}
}

function box_init (box) {
	if (typeof(box) != 'object') {
		box = getid(box);
	}

	box.title_box		= box.childNodes[0];
	box.subject		= box.childNodes[0].childNodes[0];
	box.button		= box.childNodes[0].childNodes[2];
	box.stat		= box.childNodes[0].childNodes[3];
	box.subtitle		= box.childNodes[1];
	box.body		= box.childNodes[2];
	box.foot		= box.childNodes[3];
}	
