var LANGA=	[
	{	code: "zh-TW", codePad: "_zh_TW", name: "", shortName: ""	},
	{	code: "zh-CN", codePad: "_zh_CN", name: "", shortName: ""	},
	{	code: "en-US", codePad: "_en_US", name: "", shortName: ""	},
	{	code: "ja-JP", codePad: "_ja_JP", name: "", shortName: ""	}
];
var MSG= new Object();
function fMsg(pat)	{
	if(!pat)	return "";
	pat= ""+ pat;
	for(var i= 1; i<arguments.length; i++)
		pat= pat.replace(new RegExp('%'+ i+ '%', 'g'), arguments[i]);
	return pat;
}



function initFontSize(fs)	{
	var op= "font_size", cp= "/css/tt", cc= "current",
		ary= "m|b|s".split("|"), obj= document.getElementById(op);
	if(!obj)	return;
	
	function x(s)	{
		if(obj.href==(cp+ '_'+ s+ ".css"))	return;
		var o;
		for(var i=0; i<ary.length; i++)	{
			o= document.getElementById(op+ '_'+ ary[i]);
			if(o)	o.className= "";
		}
		obj.href= cp+ '_'+ s+ ".css";
		if(o= document.getElementById(op+ '_'+ s))
			o.className= cc;
		document.cookie= op+ '='+ s+ ";path=/";
	}
	if(fs)	{
		x(fs);
		return;
	}
	
	for(var i= 0, o; i<ary.length; i++)
		if(o= document.getElementById(op+ '_'+ ary[i]))
			o.href= "javas"+ "cript: initFontSize('"+ ary[i]+ "');";
			
	var fs= ary[0];
	for(var i= 0, a= (""+ document.cookie).split(';'), a2; i<a.length; i++)
		if((a2= a[i].split('='))[0].replace(/^\s+|\s+$/g, "")==op)	{
			fs= a2[1].replace(/^\s+|\s+$/g, "");
			break;
		}
	x(fs);
}

var initSearch_text= "";
function initSearch()	{
	var frm= document.luceQ;
	initSearch_text= frm.qkw.value;
	frm.qkw.onfocus= function()	{
		frm.qkw.value= frm.qkw.value.replace(/^\s+|\s+$/g, "")
		if(frm.qkw.value==initSearch_text)	frm.qkw.value= "";
	}
	frm.qkw.onblur= function()	{
		frm.qkw.value= frm.qkw.value.replace(/^\s+|\s+$/g, "")
		if(!frm.qkw.value)	frm.qkw.value= initSearch_text;
	}
	frm.onsubmit= function()	{
		frm.qkw.value= frm.qkw.value.replace(/^\s+|\s+$/g, "");
		if(frm.qkw.value && frm.qkw.value!=initSearch_text)	return true;
		frm.qkw.focus();
		if(initSearch_text)	alert(initSearch_text);
		return false;
	}
}

function initMenu()	{
	var x= function(m, m2)	{
		if(!m || !m2)	return;
		
// 		m2.style.position= 'absolute';
		m.onmouseover=
		m2.onmouseover= function(e)	{
			if(m2.style.display=='')	return;
			var l= 0, t= m.offsetHeight;
			for(var o= m; o; o= o.offsetParent)	{
				l+= o.offsetLeft;
				t+= o.offsetTop;
			}
			m2.style.left= ''+ l+ 'px';
			m2.style.top= ''+ t+ 'px';
			m2.style.display= '';
		}
		m.onmouseout=
		m2.onmouseout= function(e)	{
			m2.style.display= 'none';
		}
	}
	for(var i= 1; i<=6; i++)
		x(document.getElementById("gt_menu_"+ i), document.getElementById("gt_submenu_"+ i));
}

function initDate(fld)	{
	if(!fld)	return false;
	var	d= new Date(),
		sy= 1900,
		ey= d.getFullYear()+ 10,
		cx= fld.value?new Date(fld.value):d,
		cy= cx.getFullYear(),
		cm= cx.getMonth()+1,
		cd= cx.getDate();
	if(cy<sy)	sy= cy;
	if(cy>ey)	ey= cy;
	
	var oy= document.getElementById(fld.id+ "y_") || document.getElementById(fld.name+ "_y"),
		om= document.getElementById(fld.id+ "m_") || document.getElementById(fld.name+ "_m"),
		od= document.getElementById(fld.id+ "d_") || document.getElementById(fld.name+ "_d");
	function initOpts(o, s, e, c, p)	{
		if(!o || !o.tagName || o.tagName.toUpperCase()!="SELECT")	return false;
		for(var i= s, o= o.options, opt, ii; i<=e; i++)	{
			ii= ""+ i;
			for(var i2= p-ii.length; i2>0; i2--)	ii= '0'+ ii;
			o.add(opt= document.createElement("option"));
			opt.value=
			opt.text= ii;
			opt.selected= i==c;
		}
		return true;
	}
	
	if(!initOpts(oy, sy, ey, cy, 4) ||
		!initOpts(om, 1, 12, cm, 2) ||
		(od && !initOpts(od, 1, 31, cd, 2)) )	return false;
	if(!od)	od= {"value": 1};
	oy.onchange=
	om.onchange=
	od.onchange= function(e)	{
		var t, tx= new Date(oy.value+ '/'+ om.value+ '/'+ od.value);
		if(om.selectedIndex!=tx.getMonth())	{
			tx= new Date(oy.value+ '/'+ (om.selectedIndex+2)+ '/0');
			if(od.options)	od.options[tx.getDate()-1].selected= true;
		}
		fld.value= ""+ tx.getFullYear()+ '/'+
			((t= tx.getMonth()+1)<10?('0'+t):t)+ '/'+
			((t= tx.getDate())<10?('0'+t):t);
	}
	oy.onchange();
	return true;
}
function initAddr(oArea, oZip, oAddr, zip, addr)	{
	function getPath(zip)	{
		var NOTFOUND= ['zh-CN', '2', null];
		if(!zip)	return NOTFOUND;
		for(var i1= 2, a1= Zip_AREA; i1<a1.length; i1++)
		for(var i2= 2, a2= a1[i1]; i2<a2.length; i2++)
		for(var i3= 2, a3= a2[i2]; i3<a3.length; i3++)
		if(a3[i3][1]==zip)	return [a1[i1][1], ''+ i2, zip];
		return NOTFOUND;
	}
	function setSelectTag(obj, sel)	{
		for(var i= 0, obj= obj.options; i<obj.length; i++)
			if(obj[i].value==sel)	return obj[i].selected= true;
	}
	function initSelectTag(obj, ary, sel, fv, ft)	{
		obj= obj.options;
		obj.length= 0;
		for(var i= 2, opt; i<ary.length; i++)	{
			obj.add(opt= document.createElement('option'));
			opt.value= fv?fv(ary[i]):i;
			opt.text= ft?ft(ary[i]):ary[i][0];
			opt.selected= opt.value==sel;
		}
	}
	function init(objs, f2, zip)	{
		objs[2].onchange= f2;
		objs[1].onchange= function()	{
			initSelectTag(objs[2], Zip_AREA[objs[0].selectedIndex+2][this.selectedIndex+2], this.value
				, function(ary){return ary[1];}
				, function(ary){return ary[1]+ ' '+ ary[0];}
			);
			objs[2].onchange();
		}
		objs[0].onchange= function()	{
			initSelectTag(objs[1], Zip_AREA[this.selectedIndex+2], this.value);
			objs[1].onchange();
		}
		
		initSelectTag(objs[0], Zip_AREA, '', function(ary){return ary[1];} );
		if(!zip)
			objs[0].onchange();
		else	{
			zip= getPath(zip);
			for(var i= 0; i<3; i++)	{
				setSelectTag(objs[i], zip[i]);
				objs[i].onchange();
			}
		}
	}
	var objs= [];
	for(var i= 0; i<3; i++)	objs[i]= document.getElementById(oAddr.id+ (i+1)+ '_');
	init(objs
		, function()	{
			var addr1= objs[1].options[objs[1].selectedIndex].text;
			var addr2= objs[2].options[objs[2].selectedIndex].text;
			addr2= addr2.replace(/^\d+\s+/g, '');
			oArea.value= objs[0].value;
			oAddr.value= addr1==addr2?addr1:(addr1+ addr2);
			oZip.value= objs[2].options[objs[2].selectedIndex].value;
		}
		, zip);
	if(addr)	oAddr.value= addr;
}
function initCalendar(fld)	{
/*	require:
	/common/calendar/calendar.js
	/common/calendar/calendar-${lang}.js
*/
	if(!fld)	return false;
	var oi= document.getElementById(fld.name+ "_img");
	if(!oi || !oi.tagName || oi.tagName!="IMG")	return false;
	Calendar.setup({inputField: fld, button: oi});
	oi.src= '/common/calendar/img.gif';
	oi.style.cursor= 'hand';
	return true;
}
function initHint(fld)	{
	if(!fld)	return false;
	var hint= fld.value;
	fld.onblur= function(e)	{	if(fld.value=="")	fld.value= hint;	}
	fld.onfocus= function(e)	{	if(fld.value==hint)	fld.value= "";	}
}
function initCharCount(fld)	{
	if(!fld)	return false;
	var cc= document.getElementById(fld.id+ "cc_") || document.getElementById(fld.name+ "_cc");
	if(cc)	fld.onblur= fld.onfocus= fld.onchange= fld.onkeyup= function(e)	{	cc.innerHTML= fld.value.length;	}
}
function initHintCharCount(fld)	{
	if(!fld)	return false;
	var hint= fld.value, cc= document.getElementById(fld.id+ "cc_") || document.getElementById(fld.name+ "_cc");
	fld.onblur= function(e)	{
		if(cc)	cc.innerHTML= fld.value.length;
		if(fld.value=="")	fld.value= hint;
	}
	fld.onfocus= function(e)	{
		if(fld.value==hint)	fld.value= "";
		if(cc)	cc.innerHTML= fld.value.length;
	}
	fld.onchange= fld.onkeyup= function(e)	{	if(cc)	cc.innerHTML= fld.value.length;	}
}
function rnIIds(o, i)	{
	if(!o || !o.childNodes || o.childNodes==0)	return;
	if(o.id)	o.id= '['+ i+ ']'+ o.id;
	for(var ii= 0, cn= o.childNodes, cl= cn.length; ii<cl; ii++)
		rnIIds(cn[ii], i);
}
function remParam(url, n)	{	return url.replace(new RegExp("((\\?|&)"+ n+ "=[^&]*&)|((\\?|&)"+ n+ "=[^&]*$)", "g"), "$2");	}
function repParam(url, n, v)	{
	var re= new RegExp("(\\?|&)"+ n+ "=[^&]*");
	if(re.test(url))	return url.replace(re, "$1"+ n+ '='+ v);
	else	return url+ (url.indexOf('?')<0?'?':'&')+ n+ '='+ v;
}
var cp= function(p)	{
	var url= location.href, re= /(_p\d+)?\.htm/;
	if(re.test(url))	url= p<=1?url.replace(re, ".htm"):url.replace(re, "_p"+ p+ ".htm");
	else	url= repParam(url, "p", p);
	location.href= remParam(url, "ps");
}
var cps= function(ps)	{	location.href= repParam(location.href, "ps", ps);	}
function initPageView(ps, pc, p)	{
	var	vpst= document.getElementById("viewpage_t"),
		vpsb= document.getElementById("viewpage_b"),
		vpt= document.getElementById("gotopage_t"),
		vpb= document.getElementById("gotopage_b"),
		opts= function(ot, ob, i, b)	{
			ot.options.add(ot= document.createElement('option'));
			ob.options.add(ob= document.createElement('option'));
			ot.value= ob.value= i;
			ot.text= ob.text= i;
			ot.selected= ob.selected= b;
		};
	if(vpst && vpsb)	{
		vpst.options.length= vpsb.options.length= 0;
		for(var i= 0, a= ['15', '30', '45'], ot, ob; i<a.length; i++)	opts(vpst, vpsb, a[i], ps==a[i]);
	}
	if(isNaN(pc= parseInt(pc)) || pc<0)	pc= 0;
	if(isNaN(p= parseInt(p)) || p<0)	p= 0;
	if(vpt && vpb)	{
		vpt.options.length= vpb.options.length= 0;
		if(pc==0)	opts(vpt, vpb, 0, true);
		else	for(var i= 1, ot, ob; i<=pc; i++)	opts(vpt, vpb, i, p==i);
	}
}

function setChecked(fld, val)	{
	if(fld)	{
		fld= isNaN(fld.length)?[fld]:fld;
		for(var i= 0; i<fld.length; i++)
			if(fld[i].checked= val==fld[i].value)	return;
		fld[0].checked= true;
	}
}
function setSelected(fld, val)	{
	if(fld)	{
		for(var i= 0, o= fld.childNodes; i<o.length; i++)
			if(o[i].selected= val==o[i].value)	return;
		if(fld.childNodes.length>0)	fld.childNodes[0].selected= true;
	}
}


var	_checkAlert_RETURN_TRUE= 1,
	_checkAlert_FOCUS= 2,
	_checkAlert_SELECT= 4,
	_checkAlert_DEFAULT= 6;
function _checkAlert(fld, nam, msg, f)	{
	if(!f)	f= _checkAlert_DEFAULT;
	if(nam)	{
		if((f&_checkAlert_FOCUS)>0)	fld.focus();
		if((f&_checkAlert_SELECT)>0)	fld.select();
		alert(msg);
	}
	return (f&_checkAlert_RETURN_TRUE)>0;
}
function checkSelect(fld, nam)	{
	if(fld.value!="")	return true;
	return _checkAlert(fld, nam, fMsg(MSG.CSELECT_UNSELECTED, nam), _checkAlert_FOCUS);
}
function checkCalendar(fld, nul, nam)	{
	fld.value= fld.value.replace(/^\s+|\s+$/g, "");
	if(fld.value=="")	{
		if(nul)	return true;
		return _checkAlert(fld, nam, fMsg(MSG.CCALENDAR_EMPTY, nam), _checkAlert_FOCUS);
	}
	 
	var d= new Date(fld.value);
	if(isNaN(d))	return _checkAlert(fld, nam, fMsg(MSG.CCALENDAR_INVALID, nam));
	var t;
	fld.value= ""+ d.getFullYear()+ '/'+
		((t= d.getMonth()+1)<10?('0'+t):t)+ '/'+
		((t= d.getDate())<10?('0'+t):t);
	return true;
}
function checkText(fld, mn, mx, nam)	{
	if(fld.onfocus)	fld.onfocus();
	if(!mn)	mn= 0;
	if(!mx)	mx= 0;
	fld.value= fld.value.replace(/^\s+|\s+$/g, "");
	var len= fld.value.length;
	if(len<mn)	return _checkAlert(fld, nam, fMsg(len==0?MSG.CTEXT_EMPTY:MSG.CTEXT_LBOUND, nam, mn, mx));
	if(mx>0 && len>mx)	return _checkAlert(fld, nam, fMsg(MSG.CTEXT_UBOUND, nam, mn, mx));
	if(fld.onblur)	fld.onblur();
	return true;
}
function checkTextarea(fld, mn, mx, nam)	{	return checkText(fld, mn, mx, nam);	}
function _checkNumber(fPsr, sEmpty, sInvalid, fld, nn, nam, fRng)	{
	if(fld.onfocus)	fld.onfocus();
	fld.value= fld.value.replace(/^\s+|\s+$/g, "");
	if(nn && fld.value=='')	return _checkAlert(fld, nam, fMsg(sEmpty, nam));
	var v= fPsr(fld.value);
	if(isNaN(v))	return _checkAlert(fld, nam, fMsg(sInvalid, nam));
	if(fRng && !fRng(v))	return false;
	
	fld.value= v;
	if(fld.onblur)	fld.onblur();
	return true;
}
function checkInt(fld, nn, nam)	{	return _checkNumber(parseInt, MSG.CINT_EMPTY, MSG.CINT_INVALID, fld, nn, nam);	}
function checkFloat(fld, nn, nam)	{	return _checkNumber(parseFloat, MSG.CFLOAT_EMPTY, MSG.CFLOAT_INVALID, fld, nn, nam);	}
function checkIntRange(fld, min, max, nam)	{	return _checkNumber(parseInt, MSG.CINT_EMPTY, MSG.CINT_INVALID, fld, true, nam, function(v) { return (min>v || v>max)?_checkAlert(fld, nam, fMsg(MSG.CINT_OUTOFRANGE, nam, min, max)):true } );	}
function checkMail(fld, nn, nam)	{
	if(fld.onfocus)	fld.onfocus();
	var max= 150;
	fld.value= fld.value.replace(/^\s+|\s+$/g, "");
	if(nn && fld.value=='')	return _checkAlert(fld, nam, fMsg(MSG.CMAIL_EMPTY, nam));
	if(!/^\w{2,}@\w{2,}(\.\w{2,})+$/.test(fld.value))	return _checkAlert(fld, nam, fMsg(MSG.CMAIL_INVALID, nam));
	if(fld.value.length>max)	return _checkAlert(fld, nam, fMsg(MSG.CMAIL_UBOUND, nam, max));
	if(fld.onblur)	fld.onblur();
	return true;
}
function checkMails(fld, mn, mx, nam)	{
	if(fld.onfocus)	fld.onfocus();
	
	var ma= fld.value.split(/(\s*[;,])+\s*/g), ma2= [];
	for(var i= 0, max= 150; i<ma.length; i++)	{
		ma[i]= ma[i].replace(/^\s+|\s+$/g, "");
		if(!ma[i])	continue;
		if(!/^\w{2,}@\w{2,}(\.\w{2,})+$/.test(ma[i]))	return _checkAlert(fld, nam, fMsg(MSG.CMAILS_INVALID, nam));
		if(ma[i].length>max)	return _checkAlert(fld, nam, fMsg(MSG.CMAIL_UBOUND, nam, max));
		ma2[ma2.length]= ma[i];
	}
	
	if(ma2.length>0)	{
		var str= ma2[0];
		for(var i= 1; i<ma2.length; i++)
			str+= ";"+ ma2[i];
		fld.value= str;
	}
	
	if(!mn)	mn= 0;
	if(!mx)	mx= 0;
	var len= ma2.length;
	if(len<mn)	return _checkAlert(fld, nam, fMsg(len==0?MSG.CTEXT_EMPTY:MSG.CMAILS_LBOUND, nam, mn, mx));
	if(mx>0 && len>mx)	return _checkAlert(fld, nam, fMsg(MSG.CMAILS_UBOUND, nam, mn, mx));
	
	if(fld.onblur)	fld.onblur();
	return true;
}
function _checkRegex(re, sEmpty, sInvalid, fld, nn, nam)	{
	if(fld.onfocus)	fld.onfocus();
	fld.value= fld.value.replace(/^\s+|\s+$/g, "");
	if(nn || fld.value!='')	{
		if(fld.value=='')	return _checkAlert(fld, nam, fMsg(sEmpty, nam));
		if(!re.test(fld.value))	return _checkAlert(fld, nam, fMsg(sInvalid, nam));
	}
	if(fld.onblur)	fld.onblur();
	return true;
}
function checkPhone(fld, nn, nam)	{	return _checkRegex(/^[0-9]+(\-[0-9]+)+(#[0-9]+)?$/, MSG.CPHONE_EMPTY, MSG.CPHONE_INVALID, fld, nn, nam);	}
function checkAccount(fld, nam)	{	return _checkRegex(/^[0-9a-zA-Z]{6,10}$/, MSG.CACCOUNT_EMPTY, MSG.CACCOUNT_INVALID, fld, true, nam);	}
function checkLoginAcc(fld, nam)	{	return _checkRegex(/^([a-zA-Z][0-9a-zA-Z]{2,11}|[0-9a-zA-Z]{6,12})$/, MSG.CLOGINACC_EMPTY, MSG.CLOGINACC_INVALID, fld, true, nam);	}
function checkPassword(fld, nam)	{	return _checkRegex(/^[0-9a-zA-Z]{6,12}$/, MSG.CPASSWORD_EMPTY, MSG.CPASSWORD_INVALID, fld, true, nam);	}


function isEmptyGroup()	{
	for(var i= 0, fld; i<arguments.length; i++)	{
		fld= arguments[i];
		fld.value= fld.value.replace(/^\s+|\s+$/g, "");
		if(fld.value!="")	return false;
	}
	return true;
}



function sh(obj)	{	if(obj= document.getElementById(obj))	obj.style.display= obj.style.display=="none"?"block":"none";	}
function ca(obj, b)	{	if(obj)	for(var i= 0, obj= isNaN(obj.length)?[obj]:obj; i<obj.length; i++)	obj[i].checked= b;	}
function cc(obj)	{	if(obj)	for(var i= 0, obj= isNaN(obj.length)?[obj]:obj; i<obj.length; i++)	if(obj[i].checked)	return true;	return false;	}


function Thuna(objs, max, num, urls)	{
	if(!objs || (objs= (''+ objs).split('|')).length<3)	return;
	for(var i= 0; i<3; i++)	objs[i]= objs[i]?document.getElementById(objs[i]):null;
	if(isNaN(max= parseInt(max)))	max= 0;
	if(isNaN(num= parseInt(num)))	num= 0;
	
	var x= [-1, -1, -1, -1, -1], xb= null, xf= [];
	if(objs[0])
		for(var i= 0, oc= objs[0].childNodes, oci; i<oc.length && (x[0]<0 || x[1]<0 || x[2]<0); i++)	{
			oci= oc[i];
			if(oci.nodeType!=1)	continue;
			if(x[0]==-1 && oci.tagName=='A' && (x[0]= i)>=0)	continue;
			if(x[1]==-1 && oci.tagName=='INPUT' && oci.type=='button' && (x[1]= i)>=0)	continue;
			if(x[2]==-1 && oci.tagName=='INPUT' && oci.type=='hidden' && (x[2]= i)>=0)	{
				xf[0]= oci.form;
				xf[1]= oci.name;
				continue;
			}
		}
	if(objs[1])
		for(var i= 0, oc= objs[1].childNodes, oci; i<oc.length && (x[3]<0 || x[4]<0); i++)	{
			oci= oc[i];
			if(oci.nodeType!=1)	continue;
			if(x[3]==-1 && oci.tagName=='INPUT' && oci.type=='button' && (x[3]= i)>=0)	continue;
			if(x[4]==-1 && oci.tagName=='INPUT' && oci.type=='file' && (x[4]= i)>=0)	{
				xf[2]= oci.form;
				xf[3]= oci.name;
				continue;
			}
		}
	if(objs[2])
		for(var i= 0, oc= objs[2].childNodes, oci; i<oc.length && !xb; i++)	{
			oci= oc[i];
			if(oci.nodeType!=1)	continue;
			if(oci.tagName=='INPUT' && oci.type=='button')	xb= oci;
		}
		
	var sum= function()	{
		if(max==0)	return 0;
		var o, sum= 0;
		if(xf[0] && xf[1] && (o= xf[0].elements[xf[1]]))
			if(isNaN(o.length))	sum+= o.value!=''?0:1;
			else	for(var i= 0; i<o.length; i++)	sum+= o[i].value!=''?0:1;
		if(xf[2] && xf[3] && (o= xf[2].elements[xf[3]]))
			sum+= isNaN(o.length)?1:o.length;
		return sum;
	};
	var bug= function()	{
		if(document.all || !xf[0])	return;
		for(var i= xf[0].childNodes.length-1; i>=0; i--)
			xf[0].appendChild(xf[0].removeChild(xf[0].childNodes[i]));
	}
	
	if(urls && objs[0] && x[0]>=0 && x[1]>=0 && x[2]>=0)	{
		urls= (''+ urls).split('|');
		var f= function(cnc, x, urls, i)	{
			cnc= cnc.childNodes;
			cnc[x[0]].href= urls[i-2];
			cnc[x[0]].innerHTML= urls[i-1];
			cnc[x[1]].onclick= function(e)	{
				if(!e)	e= window.event;
				if(cnc[x[2]].value=='')	{
					cnc[x[2]].value= urls[i];
					cnc[x[0]].style.textDecoration= 'line-through';
				}
				else	{
					if(max!=0 && sum()>=max)	{
						alert(MSG.thunaMaxReset.replace('%1%', max));
						return;
					}
					cnc[x[2]].value= '';
					cnc[x[0]].style.textDecoration= '';
				}
			}
		}
		for(var i=2, cn, cnc; i<urls.length; i+= 3)	{
			if(urls[i]=='')	continue;
			f(cn= objs[0].cloneNode(true), x, urls, i);
			objs[0].parentNode.insertBefore(cn, objs[0]);
		}
		bug();
	}
	if(objs[0])	objs[0].parentNode.removeChild(objs[0]);
	
	if(objs[1])	(objs[1]= objs[1].parentNode.removeChild(objs[1])).id= '';
	if(xb && objs[1] && objs[2] && x[3]>=0)	{
		xb.onclick= function(e)	{
			if(e!=0 && max!=0 && sum()>=max)	{
				alert(MSG.thunaMax.replace('%1%', max));
				return;
			}
			var of= objs[1].cloneNode(true);
			of.childNodes[x[3]].onclick= function(e)	{
				e= e?e.target:window.event.srcElement;
				e.parentNode.parentNode.removeChild(e.parentNode);
			}
			objs[2].parentNode.insertBefore(of, objs[2]);
			bug();
		}
		for(var i= sum(); i<num && i<max; i++)	xb.onclick(0);
	}
	else
		objs[2].parentNode.removeChild(objs[2]);
}

function Joose(obj, v0s, v1s)	{
	if(obj.charAt && obj.length>0 && obj.charAt(0)==':')	{
		var p= obj.substring(1);
		obj= new Array();
		for(var i= 0; i<8; i++)	obj[i]= document.getElementById(p+i);
	}
	else
		for(var i= 0, obj= (""+ obj).split('|'); i<obj.length; i++)
			obj[i]= document.getElementById(obj[i]);
	if(!obj[0] || !obj[1])	return;
	
	function move(s, d)	{
		var i= s.selectedIndex;
		if(i<0 || i>=s.options.length)	return;
		d.appendChild(s.removeChild(s.options[i]));
		if(i<s.options.length || --i>=0)	s.options[i].selected= true;
	}
	function mova(s, d)	{
		while(s.options.length>0)	d.appendChild(s.removeChild(s.options[0]));
	}
	function movu(o)	{
		var i= o.selectedIndex, len= o.options.length;
		if(i<=0 || i>=len || len<=1)	return;
		o.insertBefore(o.removeChild(o.options[i]), o.options[i-1]);
	}
	function movd(o)	{
		var i= o.selectedIndex, len= o.options.length;
		if(i<0 || i>=len-1 || len<=1)	return;
		o.insertBefore(o.removeChild(o.options[i]), o.options[i+1]);
	}
	if(obj[2])	obj[2].onclick= function()	{	mova(obj[0], obj[1]);	}
	if(obj[3])	obj[3].onclick= function()	{	move(obj[0], obj[1]);	}
	if(obj[4])	obj[4].onclick= function()	{	move(obj[1], obj[0]);	}
	if(obj[5])	obj[5].onclick= function()	{	mova(obj[1], obj[0]);	}
	if(obj[6])	obj[6].onclick= function()	{	movu(obj[1]);	}
	if(obj[7])	obj[7].onclick= function()	{	movd(obj[1]);	}
	
	function init(obj, ary)	{
		for(var i= 0, opt; i+1<ary.length; i+= 2)	{
			obj.options.add(opt= document.createElement("option"));
			opt.value= ary[i];
			opt.text= ary[i+1];
		}
		if(obj.options.length>0)	obj.options[0].selected= true;
	}
	if(v0s)	init(obj[0], (""+ v0s).split('|'));
	if(v1s)	init(obj[1], (""+ v1s).split('|'));
}
