
/*---- md5.js ----*/
 //清除。调用处已不存在
/*---- md5.js end----*/




/*---- function.js ----*/
var attr_box_array	= new Array();
var isIE	= (document.all && window.ActiveXObject && !window.opera) ? true : false;

function trim(vStr)
{
	return vStr.replace(/(^[\s ]*)|([\s ]*$)/g, "");
}


/*---- COOKIE function----*/
function getExpTime(time, type)
{
	var expTime	= new Date();
	switch(type)
	{
		case 'year' :
			expTime.setFullYear(expTime.getFullYear() + time);
			break ;
		case 'month' :
			expTime.setMonth(expTime.getMonth() + time);
			break;
		case 'day' :
			expTime.setDate(expTime.getDate() + time);
			break;
		case 'hour' :
			expTime.setHours(expTime.getHours() + time);
			break;
	}
	return expTime.toGMTString();
}
function getCookieVal(offset)
{
	var endstr	= document.cookie.indexOf(";", offset);
	if(endstr == -1)
		endstr	= document.cookie.length;
	return decodeURIComponent(document.cookie.substring(offset, endstr));
}
function getCookie(name)
{
	var arg		= name + "=";
	var alen	= arg.length;
	var clen	= document.cookie.length;
	var i		= 0;
	while (i < clen)
	{
		var j	= i + alen;
		if (document.cookie.substring(i, j) == arg)
		{
			return getCookieVal(j);
		}
		i	= document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
		{
			break;
		}
	}
	return "";
}
function setCookie(name, value, expires, path, domain, secure)
{
	document.cookie		= name + "=" + encodeURIComponent(value) +
	((expires) ? "; expires=" + expires : "") +
	((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	((secure) ? "; secure" : "");
}
function delCookie(name)
{
	var last_date	= new Date();
	expiresTime		= last_date.setTime(last_date.getTime() - 100);
	setCookie(name, '', expiresTime, '', '') ;
}
/*---- COOKIE function end----*/

/*---- softwarecompare by COOKIE ----*/
function add_compare(id, title)
{
	var expiresTime	= getExpTime(1, 'month');
	var oldValue	= getCookie('compare_list');
	var newValue	= '';
	if(oldValue)
	{
		var matchStr	= 'v' + oldValue + 'v';
		if(new RegExp('v' + id + 'v').test(matchStr))
		{
			return 'F';
		}
		if(oldValue.split('v').length >= 100)
		{
			newValue	= oldValue.replace(/\d*v/,'') + 'v' + id;
		}
		else
		{
			newValue	= oldValue + 'v' + id;
		}
	}
	else
	{
		newValue	= id;
	}
	//setCookie('compare_list', newValue, expiresTime, '/', '');
	setCookie('compare_list', newValue, expiresTime, '/', cookie_domain);
	compare_length	= compare_article.length;
	if(compare_length == 0)
	{
		compare_article[0]	= {id: id, title: title};
	}
	else
	{
		for (i=0; i<compare_length; i++)
		{
			if(compare_article[i]["id"] == id)break;
		}
		if (i == compare_length)
		{
			compare_article[compare_length]	= {id: id, title: title};
		}
	}
	getObject('ck_' + id).style.backgroundColor	= '#FEFEF2';
	display_compare();
}
function del_compare(id)
{
	var expiresTime	= getExpTime(1, 'month');
	var oldValue	= getCookie('compare_list');
	var newValue	= '';
	var matchStr	= 'v' + oldValue + 'v';
	replaceStr		= 'v' + id + 'v';
	newValue		= matchStr.replace(replaceStr , 'v').slice(1,-1);
	//setCookie('compare_list', newValue, expiresTime, '/', '');
	setCookie('compare_list', newValue, expiresTime, '/', cookie_domain);
	compare_length	= compare_article.length;
	if(compare_length == 0)
	{
		return;
	}
	else
	{
		old_compare_article	= compare_article;
		compare_article		= Array();
		for(i=0; i<compare_length; i++)
		{
			if(old_compare_article[i]["id"] == id)
			{
				compare_length--;
				try
				{
					getObject('article_' + id).checked	= false;
				}
				catch (e)
				{}
				break;
			}
			compare_article[i]	= old_compare_article[i];
		}
		for (; i<compare_length; i++)
		{
			compare_article[i] = old_compare_article[i+1];
		}
	}
	getObject('ck_' + id).style.backgroundColor	= '#FFFFFF';
	display_compare();
}
function display_compare()
{
	getObject('filter_list').innerHTML	= "";
	var txt	= "";
	/*
	var cl	= getCookie('compare_list');
	if(cl)
	{
		list	= cl.split('v');
		for(i=0; i<list.length; i++)
		{
			txt		= txt + "<li><a href=/>" + list[i] + "</a></li>";
		}
		getObject('filter_list').innerHTML	= "<ul>" + txt + "</ul>";
	}
	*/
	compare_length	= compare_article.length;
	if(compare_length == 0)
	{
		getObject('filter_list').innerHTML	= "<ul class='cborder' style='padding:5px; color:#666666'>There is no software checked</ul>";
		try
		{
			//getObject('btn_compare_1').src		= "/images/btn_compare_disable.gif";
			getObject('btn_compare_2').src		= "/images/btn_compare_disable.gif";
			getObject('btn_compare_2').style.cursor	= "";
			getObject('btn_compare_2').onclick		= function()
			{
				return false;
			}
		}
		catch (e)
		{
		}
		return;
	}
	else
	{
		for(i=0; i<compare_length; i++)
		{
			txt	= txt + "<li><a href=\"javascript:del_compare('" + compare_article[i]['id'] + "')\"><img class='none' width=9 height=9 src='/images/x.gif'></a> " + compare_article[i]['title'] + "</li>";
		}
	}
	getObject('filter_list').innerHTML	= "<ul class='cborder' style='padding:5px'>" + txt + "</ul>";
	if(compare_length > 1)
	{
		try
		{
			//getObject('btn_compare_1').src	= "/images/btn_compare.gif";
			getObject('btn_compare_2').src	= "/images/btn_compare.gif";
			getObject('btn_compare_2').style.cursor	= "pointer";
			getObject('btn_compare_2').onclick		= function()
			{
				top.location.href	= 'http://' + wiki_domain + "/Special:SoftwareCompare";
			}
		}
		catch (e)
		{
		}
	}
	else
	{
		try
		{
			//getObject('btn_compare_1').src	= "/images/btn_compare_disable.gif";
			getObject('btn_compare_2').src	= "/images/btn_compare_disable.gif";
			getObject('btn_compare_2').style.cursor	= "";
			getObject('btn_compare_2').onclick		= function()
			{
				return false;
			}
		}
		catch (e)
		{
		}
	}
}
/*---- softwarecompare by COOKIE end----*/

/*---- see_also_app 插件 ----*/
function see_also_app(app_name)
{
	this.app_name		= app_name;
	this.article_type	= "software";
	this.div_obj		= null;
	this.tBody			= null;
	this.list_array		= new Array();
	this.selected		= -1;
	var _root			= this;
	this.get_tr_id		= function(curr_id)
	{
		return "s_tr_" + _root.app_name + "_" + curr_id;
	}
	this.get_input_id	= function(curr_id)
	{
		return "s_input_" + _root.app_name + "_" + curr_id;
	}
	this.init		= function(div_obj, value_obj)
	{
		//---- 初始化 Title ----
		var this_url	= location.href;
		if(this_url.indexOf('/Create_A_Software/') > 0)
		{
			var sname	= getObject('subject_title').innerHTML;
			var all		= document.getElementsByName('This_is_A_Software[all_see_also]');
			_root.article_type	= "software";
		}
		if(this_url.indexOf('/Create_A_Solution/') > 0)
		{
			var sname	= document.getElementsByName('This_is_A_Solution[solution_name]')[0].value;
			var all		= document.getElementsByName('This_is_A_Solution[all_see_also]');
			
			//xcl
			if(getObject('sf_preview'))
			{
				if(getObject('span_approve') && getObject('solution_name'))
				{

					getObject('solution_name').innerHTML	= getObject('solution_name').innerHTML + ' <img  src="/images/approved.gif" alt="By ' + getObject('span_approve').innerHTML + '" title="By ' + getObject('span_approve').innerHTML + '" style="float:none;" />';
				}
				else if(getObject('span_invalid') && getObject('solution_name'))
				{
					getObject('solution_name').innerHTML	= getObject('solution_name').innerHTML + ' <img  src="/images/Invalid.gif" alt="By ' + getObject('span_invalid').innerHTML + '" title="By ' + getObject('span_invalid').innerHTML + '" style="float:none;" />';
				}
				else if (getObject('solution_name')) //if(getObject('span_unapprove'))
				{
					//span_unapproved_img	//getObject('span_unapproved_img').innerHTML
					getObject('solution_name').innerHTML	= getObject('solution_name').innerHTML + ' <img  src="/images/toapprove.gif" style="float:none;" />' ;
				}
			}
			_root.article_type	= "solution";
		}
		//-------------------
		_root.div_obj		= div_obj;
		_root.value_obj		= value_obj;
		var input_area_div	= document.createElement("DIV");
		input_area_div.style.width		= "700px";
		input_area_div.style.background	= "#f6f6f6";
		input_area_div.style.border		= "1px solid #f1f1f1";
		input_area_div.style.padding	= "10px";
		_root.div_obj.appendChild(input_area_div);
		//---- Related Article 的 Tab ----
		var tmp_obj			= document.createElement("A");
		tmp_obj.id			= "ra_" + _root.app_name + "_link";
		tmp_obj.innerHTML	= "Related Article";
		tmp_obj.href		= "#";
		tmp_obj.style.textAlign		= "center";
		tmp_obj.style.width			= "120px";
		tmp_obj.style.height		= "25px";
		tmp_obj.style.lineHeight	= "25px";
		tmp_obj.style.display		= "block";
		tmp_obj.style.background	= "#ffffff";
		tmp_obj.style.cssFloat		= "left";
		tmp_obj.style.styleFloat	= "left";
		tmp_obj.style.borderLeft	= "1px solid #f0f0f0";
		tmp_obj.style.borderTop		= "1px solid #f0f0f0";
		tmp_obj.style.borderRight	= "1px solid #f0f0f0";
		tmp_obj.style.borderBottom	= "1px solid #ffffff";
		tmp_obj.style.marginBottom	= "-1px";
		tmp_obj.style.position		= "relative";
		tmp_obj.onclick				= function()
		{
			var obj_ra		= getObject("ra_" + _root.app_name + "_link");
			var obj_el		= getObject("el_" + _root.app_name + "_link");
			obj_ra.style.background		= "#ffffff";
			obj_ra.style.borderLeft		= "1px solid #f0f0f0";
			obj_ra.style.borderTop		= "1px solid #f0f0f0";
			obj_ra.style.borderRight	= "1px solid #f0f0f0";
			obj_ra.style.borderBottom	= "1px solid #ffffff";

			obj_el.style.background		= "#f6f6f6";
			obj_el.style.borderLeft		= "1px solid #f6f6f6";
			obj_el.style.borderTop		= "1px solid #f6f6f6";
			obj_el.style.borderRight	= "1px solid #f6f6f6";
			obj_el.style.borderBottom	= "1px solid #f0f0f0";
			getObject("ra_" + _root.app_name + "_area").style.display	= '';
			getObject("el_" + _root.app_name + "_area").style.display	= 'none';
			getObject("ra_title_" + _root.app_name).focus();
			return false;
		}
		input_area_div.appendChild(tmp_obj);
		//---- External Link 的 Tab ----
		var tmp_obj			= document.createElement("A");
		tmp_obj.id			= "el_" + _root.app_name + "_link";
		tmp_obj.innerHTML	= "External Link";
		tmp_obj.href		= "#";
		tmp_obj.style.textAlign		= "center";
		tmp_obj.style.width			= "120px";
		tmp_obj.style.height		= "25px";
		tmp_obj.style.lineHeight	= "25px";
		tmp_obj.style.display		= "block";
		tmp_obj.style.background	= "#f6f6f6";
		tmp_obj.style.cssFloat		= "left";
		tmp_obj.style.styleFloat	= "left";
		tmp_obj.style.borderLeft	= "1px solid #f6f6f6";
		tmp_obj.style.borderTop		= "1px solid #f6f6f6";
		tmp_obj.style.borderRight	= "1px solid #f6f6f6";
		tmp_obj.style.borderBottom	= "1px solid #f0f0f0";
		tmp_obj.style.marginBottom	= "-1px";
		tmp_obj.style.position		= "relative";
		tmp_obj.onclick				= function()
		{
			var obj_ra		= getObject("ra_" + _root.app_name + "_link");
			var obj_el		= getObject("el_" + _root.app_name + "_link");
			obj_el.style.background		= "#ffffff";
			obj_el.style.borderLeft		= "1px solid #f0f0f0";
			obj_el.style.borderTop		= "1px solid #f0f0f0";
			obj_el.style.borderRight	= "1px solid #f0f0f0";
			obj_el.style.borderBottom	= "1px solid #ffffff";

			obj_ra.style.background		= "#f6f6f6";
			obj_ra.style.borderLeft		= "1px solid #f6f6f6";
			obj_ra.style.borderTop		= "1px solid #f6f6f6";
			obj_ra.style.borderRight	= "1px solid #f6f6f6";
			obj_ra.style.borderBottom	= "1px solid #f0f0f0";
			getObject("ra_" + _root.app_name + "_area").style.display	= 'none';
			getObject("el_" + _root.app_name + "_area").style.display	= '';
			getObject("el_title_" + _root.app_name).focus();
			return false;
		}
		input_area_div.appendChild(tmp_obj);
		//---- 换行 ----
		var tmp_obj					= document.createElement("SPAN");
		tmp_obj.style.height		= "0px";
		tmp_obj.style.lineHeight	= "0px";
		tmp_obj.style.fontSize		= "0px";
		tmp_obj.style.clear			= "both";
		tmp_obj.style.display		= "block";
		input_area_div.appendChild(tmp_obj);
		//---- 添加 Related Article 的输入区域 ----
		var ra_area_obj					= document.createElement("DIV");
		ra_area_obj.id					= "ra_" + _root.app_name + "_area";
		ra_area_obj.style.width			= "650px";
		ra_area_obj.style.height		= "60px";
		ra_area_obj.style.border		= "1px solid #f0f0f0";
		ra_area_obj.style.background	= "#ffffff";
		ra_area_obj.style.padding		= "20px";
		input_area_div.appendChild(ra_area_obj);
		//---- 添加 External Link 的输入区域 ----
		var el_area_obj					= document.createElement("DIV");
		el_area_obj.id					= "el_" + _root.app_name + "_area";
		el_area_obj.style.width			= "650px";
		el_area_obj.style.height		= "60px";
		el_area_obj.style.border		= "1px solid #f0f0f0";
		el_area_obj.style.background	= "#ffffff";
		el_area_obj.style.display		= "none";
		el_area_obj.style.padding		= "20px";
		input_area_div.appendChild(el_area_obj);
		//---- Related Article 的输入框 ----
		var tmp_obj					= document.createElement("LABEL");
		tmp_obj.style.width			= "80px";
		tmp_obj.style.height		= "20px";
		tmp_obj.style.display		= "block";
		tmp_obj.style.cssFloat		= "left";
		tmp_obj.style.styleFloat	= "left";
		tmp_obj.innerHTML			= "Title:";
		tmp_obj.style.lineHeight	= "20px";
		ra_area_obj.appendChild(tmp_obj);

		var ra_input_title_obj		= document.createElement("INPUT");
		ra_input_title_obj.id				= "ra_title_" + _root.app_name;
		ra_input_title_obj.style.width		= "360px";
		ra_input_title_obj.className		= "user_links";
		ra_area_obj.appendChild(ra_input_title_obj);

		var ra_input_url_obj			= document.createElement("INPUT");
		ra_input_url_obj.id				= "ra_url_" + _root.app_name;
		ra_input_url_obj.setAttribute("type", "hidden");
		ra_area_obj.appendChild(ra_input_url_obj);
		//---- 初始化该输入框，使其可以支持 Suggestion ----
		if(_root.article_type == "software")
		{
			var mode	= 'related';
		}
		if(_root.article_type == "solution")
		{
			var mode	= 'related_solution';
		}
		init_see_also_suggest(ra_input_title_obj, ra_input_url_obj, mode);
		//-------------------------------------------------
		tmp_obj				= document.createElement("A");
		tmp_obj.innerHTML	= "<img src='/images/softwiki_images/btn_add.gif' align='text'>";
		tmp_obj.href		= "javascript:void(0)";
		tmp_obj.style.paddingLeft		= "15px";
		tmp_obj.onclick		= function ()
		{
			eval(_root.app_name + ".add('ra')");
		}
		ra_area_obj.appendChild(tmp_obj);
		//---- External Link 的 Title 输入框 ----
		var tmp_obj					= document.createElement("LABEL");
		tmp_obj.style.width			= "80px";
		tmp_obj.style.height		= "25px";
		tmp_obj.style.display		= "block";
		tmp_obj.style.cssFloat		= "left";
		tmp_obj.style.styleFloat	= "left";
		tmp_obj.style.lineHeight	= "20px";
		tmp_obj.innerHTML			= "Link Title:";
		el_area_obj.appendChild(tmp_obj);

		var tmp_obj					= document.createElement("INPUT");
		tmp_obj.id					= "el_title_" + _root.app_name;
		tmp_obj.style.width			= "360px";
		tmp_obj.style.border		= "1px solid #C1C1C1";
		tmp_obj.className			= 'user_links';
		tmp_obj.style.padding		= "0px";
		tmp_obj.onfocus		= function()
		{
			this.style.background	= '#fff5ec';
		}
		tmp_obj.onblur		= function()
		{
			this.style.background	= '#f9f9f9';
		}
		el_area_obj.appendChild(tmp_obj);
		//---- 换行 ----
		var tmp_obj					= document.createElement("SPAN");
		tmp_obj.style.height		= "6px";
		tmp_obj.style.lineHeight	= "0px";
		tmp_obj.style.fontSize		= "0px";
		tmp_obj.style.clear			= "both";
		tmp_obj.style.display		= "block";
		el_area_obj.appendChild(tmp_obj);
		//---- External Link 的 URL 输入框 ----
		var tmp_obj					= document.createElement("LABEL");
		tmp_obj.style.width			= "80px";
		tmp_obj.style.height		= "25px";
		tmp_obj.style.display		= "block";
		tmp_obj.style.cssFloat		= "left";
		tmp_obj.style.styleFloat	= "left";
		tmp_obj.innerHTML			= "Url:";
		el_area_obj.appendChild(tmp_obj);

		var tmp_obj					= document.createElement("INPUT");
		tmp_obj.id					= "el_url_" + _root.app_name;
		tmp_obj.style.width			= "360px";
		tmp_obj.style.border		= "1px solid #C1C1C1";
		tmp_obj.className			= 'user_links';
		tmp_obj.style.padding		= "0px";
		tmp_obj.setAttribute("value", "http://");
		tmp_obj.onfocus		= function()
		{
			this.style.background	= '#fff5ec';
		}
		tmp_obj.onblur		= function()
		{
			this.style.background	= '#f9f9f9';
		}
		el_area_obj.appendChild(tmp_obj);

		tmp_obj				= document.createElement("A");
		tmp_obj.innerHTML	= "<img src='/images/softwiki_images/btn_add.gif' align='absmiddle'>";
		tmp_obj.href		= "javascript:void(0)";
		tmp_obj.style.paddingLeft		= "15px";
		tmp_obj.onclick		= function ()
		{
			eval(_root.app_name + ".add('el')");
		}
		el_area_obj.appendChild(tmp_obj);
		//---- 换行 ----
		var tmp_obj					= document.createElement("SPAN");
		tmp_obj.style.height		= "30px";
		tmp_obj.style.lineHeight	= "10px";
		tmp_obj.style.fontSize		= "0px";
		tmp_obj.style.clear			= "both";
		tmp_obj.style.display		= "block";
		_root.div_obj.appendChild(tmp_obj);
		//---- 输入框表格外的表格 ----
		var big_table_obj	= document.createElement("TABLE");
		big_table_obj.setAttribute("width", "700");
		big_table_obj.setAttribute("style", "margin-left:2px");
		
		_root.div_obj.appendChild(big_table_obj);
		var big_tbody		= document.createElement("TBODY");
		big_table_obj.appendChild(big_tbody);
		var big_tr			= document.createElement("TR");
		big_tbody.appendChild(big_tr);
		var big_td_left		= document.createElement("TD");
		big_td_left.setAttribute("width", "550");
		big_tr.appendChild(big_td_left);
		var big_td_right	= document.createElement("TD");
		big_td_right.setAttribute("width", "150");
		big_tr.appendChild(big_td_right);
		//---- 上移按钮 ----
		var tmp_obj				= document.createElement("IMG");
		tmp_obj.style.width		= "20px";
		tmp_obj.style.height	= "11px";
		tmp_obj.style.cursor	= "pointer";
		tmp_obj.onclick			= function ()
		{
			eval(_root.app_name + ".up()");
		}
		tmp_obj.src				= "/images/softwiki_images/btn_up.gif";
		big_td_right.appendChild(tmp_obj);
		//---- 换行 ----
		var tmp_obj					= document.createElement("SPAN");
		tmp_obj.style.height		= "5px";
		tmp_obj.style.lineHeight	= "5px";
		tmp_obj.style.fontSize		= "0px";
		tmp_obj.style.clear			= "both";
		tmp_obj.style.display		= "block";
		big_td_right.appendChild(tmp_obj);
		//---- 下移按钮 ----
		var tmp_obj				= document.createElement("IMG");
		tmp_obj.style.width		= "20px";
		tmp_obj.style.height	= "11px";
		tmp_obj.style.cursor	= "pointer";
		tmp_obj.onclick		= function ()
		{
			eval(_root.app_name + ".down()");
		}
		tmp_obj.src				= "/images/softwiki_images/btn_down.gif";
		big_td_right.appendChild(tmp_obj);

		//---- 输入框表格 ----
		var table_obj		= document.createElement("TABLE");
		table_obj.setAttribute("width", "540");
		table_obj.setAttribute("cellSpacing", "1");
		table_obj.setAttribute("cellPadding", "5");
		table_obj.style.border	= "1px solid #c1c1c1";
		big_td_left.appendChild(table_obj);
		_root.tBody			= document.createElement("TBODY");
		table_obj.appendChild(_root.tBody);
		var tRow			= document.createElement("TR");
		tRow.setAttribute("height", "1");
		_root.tBody.appendChild(tRow);
		var tCell			= document.createElement("TD");
		tCell.id			= "first_td_" + _root.app_name;
		tCell.setAttribute("width", "430");
		tRow.appendChild(tCell);
		var tCell			= document.createElement("TD");
		tCell.setAttribute("width", "60");
		tRow.appendChild(tCell);
		var tCell			= document.createElement("TD");
		tCell.setAttribute("width", "50");
		tRow.appendChild(tCell);
		if(value_obj.value == "")
		{
			getObject("first_td_" + _root.app_name).setAttribute("height", "30");
			getObject("first_td_" + _root.app_name).innerHTML	= "&nbsp;&nbsp;&nbsp;Neither related article nor external Link has been added to this article.";
			return false;
		}
		var el				= value_obj.value.split('###');
		for(var i=0; i<el.length; i++)
		{
			data	= el[i].split('@@@');
			if(data[0] == 'x=el' || data[0] == 'el')
			{
				_root.list_array[i]	= {id:i, type:'el', title:data[1], url:data[2], status:'td'};
			}
			else if(data[0] == 'x=ra' || data[0] == 'ra')
			{
				_root.list_array[i]	= {id:i, type:'ra', title:data[1], url:data[2], status:'td'};
			}
			_root.display(i);
		}
	}
	this.display	= function(curr_id)
	{
		if(!_root.list_array[curr_id])
		{
			return false;
		}
		if(_root.list_array[curr_id]['status'] != 'td')
		{
			return false;
		}
		var tr_id			= _root.get_tr_id(curr_id);
		if(getObject(tr_id))
		{
			//---- 该行已经创建过了 ----
			var tRow		= getObject(tr_id);
			var row_len		= tRow.cells.length;
			for(var i=0; i<row_len; i++)
			{
				tRow.deleteCell(0);
			}
		}
		else
		{
			//---- 添加新行 ----
			var tRow		= _root.tBody.insertRow(-1);
			_root.tBody.appendChild(tRow);
		}
		tRow.style.backgroundColor	= '';
		tRow.id				= tr_id;
		tRow.onclick		= function()
		{
			var last_id		= _root.get_tr_id(_root.selected);
			if(getObject(last_id))
			{
				//---- 清除上一次选中 ----
				getObject(last_id).style.backgroundColor	= '';
			}
			//---- 选中当前条目 ----
			_root.selected	= curr_id;
			this.style.backgroundColor	= '#fff5ec';
		}
		tRow.onmouseover	= function()
		{
			if(_root.selected == curr_id)
			{
				return false;
			}
			this.style.backgroundColor	= '#fafafa';
		}
		tRow.onmouseout		= function()
		{
			if(_root.selected == curr_id)
			{
				return false;
			}
			this.style.backgroundColor	= '';
		}
		if(_root.selected == curr_id)
		{
			tRow.style.backgroundColor	= '#fff5ec';
		}
		var tCell				= document.createElement("TD");
		tCell.style.padding		= "5px";
		if(_root.list_array[curr_id]['type'] == 'el')
		{
			//---- 外链加个小 icon ----
			tCell.innerHTML			= _root.list_array[curr_id]['title'] + "&nbsp;<img align='text' width='8' height='8' src='/images/softwiki_images/external_sm.png'>";
		}
		else
		{
			tCell.innerHTML			= _root.list_array[curr_id]['title'];
		}
		tRow.appendChild(tCell);
		var tCell				= document.createElement("TD");
		tCell.style.textAlign	= "center";
		//---- 删除 ----
		var tmp_obj				= document.createElement("A");
		tmp_obj.style.fontSize	= "9px";
		tmp_obj.innerHTML		= "Remove";
		tmp_obj.href			= "javascript:void(0)";
		tmp_obj.onclick			= function()
		{
			eval(_root.app_name + ".del(" + curr_id + ")");
		}
		tCell.appendChild(tmp_obj);
		tRow.appendChild(tCell);
		var tCell				= document.createElement("TD");
		tCell.style.textAlign	= "center";
		//---- 编辑 ----
		var tmp_obj				= document.createElement("A");
		tmp_obj.style.fontSize	= "9px";
		tmp_obj.innerHTML		= "Edit";
		tmp_obj.href			= "javascript:void(0)";
		tmp_obj.onclick			= function()
		{
			eval(_root.app_name + ".edit(" + curr_id + ")");
		}
		tCell.appendChild(tmp_obj);
		tRow.appendChild(tCell);
	}
	this.del		= function(curr_id)
	{
		var tr_id	= _root.get_tr_id(curr_id);
		if(!getObject(tr_id))
		{
			return false;
		}
		_root.selected		= -1;
		_root.tBody.removeChild(getObject(tr_id));
		_root.list_array[curr_id]['title']		= "";
		_root.list_array[curr_id]['url']		= "";
		_root.list_array[curr_id]['status']		= "deleted";
		_root.flush();
	}
	this.edit		= function(curr_id)
	{
		var tr_id	= _root.get_tr_id(curr_id);
		if(!getObject(tr_id))
		{
			return false;
		}
		var last_id		= _root.get_tr_id(_root.selected);
		if(getObject(last_id))
		{
			//---- 清除上一次选中 ----
			getObject(last_id).style.backgroundColor	= '';
		}
		//---- 清除当前选中状态 ----
		_root.selected	= -1;
		var tRow		= getObject(tr_id);
		tRow.onclick	= function()
		{
			//---- 清楚点击效果 ----
			return false;
		}
		var row_len		= tRow.cells.length;
		tRow.style.backgroundColor	= '';
		for(var i=0; i<row_len; i++)
		{
			tRow.deleteCell(0);
		}
		//---- 变成一列 ----
		var tCell			= document.createElement("TD");
		tCell.setAttribute("colSpan", "3");
		tCell.style.padding		= "5px";
		//---- 添加这一行到 TR ----
		tRow.appendChild(tCell);
		//---- 输入框 ----
		var input_id			= _root.get_input_id(curr_id);
		var input_title_obj		= document.createElement("INPUT");
		input_title_obj.setAttribute("value", _root.list_array[curr_id]['title']);
		input_title_obj.id				= input_id;
		input_title_obj.style.width		= "350px";
		input_title_obj.style.height	= "20px";
		input_title_obj.style.border	= "1px solid #cccccc";
		input_title_obj.className		= 'user_links_suggest';
		tCell.appendChild(input_title_obj);
		if(_root.list_array[curr_id]['type'] == 'ra')
		{
			//---- 是内部文章 ----
			var input_id			= _root.get_input_id(curr_id) + "_url";
			var input_url_obj		= document.createElement("INPUT");
			input_url_obj.setAttribute("type", "hidden");
			input_url_obj.setAttribute("value", _root.list_array[curr_id]['url']);
			input_url_obj.id		= input_id;
			tCell.appendChild(input_url_obj);
			//---- 初始化该输入框，使其可以支持 Suggestion ----
			if(_root.article_type == "software")
			{
				var mode	= 'related';
			}
			if(_root.article_type == "solution")
			{
				var mode	= 'related_solution';
			}
			init_see_also_suggest(input_title_obj, input_url_obj, mode);
			//-------------------------------------------------
		}
		else
		{
			//---- 是外部链接 ----
			//---- 换行 ----
			var tmp_obj					= document.createElement("SPAN");
			tmp_obj.style.height		= "5px";
			tmp_obj.style.lineHeight	= "5px";
			tmp_obj.style.fontSize		= "0px";
			tmp_obj.style.clear			= "both";
			tmp_obj.style.display		= "block";
			tCell.appendChild(tmp_obj);

			var input_id			= _root.get_input_id(curr_id) + "_url";
			var tmp_obj				= document.createElement("INPUT");
			tmp_obj.setAttribute("value", _root.list_array[curr_id]['url']);
			tmp_obj.id				= input_id;
			tmp_obj.style.width		= "350px";
			tmp_obj.style.height	= "20px";
			tmp_obj.style.border	= "1px solid #cccccc";
			tmp_obj.className		= 'user_links_suggest';
			tCell.appendChild(tmp_obj);
		}
		//---- 保存按钮 ----
		var tmp_obj				= document.createElement("IMG");
		tmp_obj.src				= "/images/softwiki_images/btn_save.gif";
		tmp_obj.style.cursor	= "pointer";
		tmp_obj.style.width		= "34px";
		tmp_obj.style.height	= "15px";
		tmp_obj.style.paddingLeft		= "10px";
		tmp_obj.style.verticalAlign		= "middle";
		if(isIE)
		{
			tmp_obj.attachEvent("onclick", function(){eval(_root.app_name + ".save(" + curr_id + ")")});
		}
		else
		{
			tmp_obj.addEventListener("click", function(){eval(_root.app_name + ".save(" + curr_id + ")")}, false);
		}
		tCell.appendChild(tmp_obj);
		//---- 取消按钮 ----
		var tmp_obj				= document.createElement("IMG");
		tmp_obj.src				= "/images/softwiki_images/btn_cancel.gif";
		tmp_obj.style.cursor	= "pointer";
		tmp_obj.style.width		= "42px";
		tmp_obj.style.height	= "15px";
		tmp_obj.style.paddingLeft		= "10px";
		tmp_obj.style.verticalAlign		= "middle";
		if(isIE)
		{
			tmp_obj.attachEvent("onclick", function(){eval(_root.app_name + ".display(" + curr_id + ")")});
		}
		else
		{
			tmp_obj.addEventListener("click", function(){eval(_root.app_name + ".display(" + curr_id + ")")}, false);
		}
		tCell.appendChild(tmp_obj);
	}
	this.save		= function(curr_id)
	{
		var input_id	= _root.get_input_id(curr_id);
		var title_obj	= getObject(input_id);
		var url_obj		= getObject(input_id + "_url");
		var v	= _root.validate(_root.list_array[curr_id]['type'], title_obj, url_obj, curr_id);
		if(v == false)
		{
			return false;
		}
		_root.list_array[curr_id]['title']	= title_obj.value;
		_root.list_array[curr_id]['url']	= url_obj.value;
		_root.display(curr_id);
		_root.flush();
	}
	this.up			= function()
	{
		if(_root.selected < 1)
		{
			//---- 已经是最顶端了 ----
			return false;
		}
		var old_id	= _root.selected;
		var done	= -1;
		var tmp_arr	= _root.list_array[old_id];
		if(tmp_arr['status'] != 'td')
		{
			return false;
		}
		for(var i=old_id-1; i>-1; i--)
		{
			//---- 前一个是什么 ----
			if(_root.list_array[i]['status'] == 'td')
			{
				done	= i;
				break;
			}
		}
		if(done > -1)
		{
			_root.list_array[old_id]	= _root.list_array[done];
			_root.list_array[done]		= tmp_arr;
			_root.selected				= done;
			_root.display(old_id);
			_root.display(done);
		}
		_root.flush();
	}
	this.down		= function()
	{
		var len		= _root.list_array.length;
		if(_root.selected >= len || _root.selected < 0)
		{
			//---- 已经是最低端了 ----
			return false;
		}
		var old_id	= _root.selected;
		var done	= -1;
		var tmp_arr	= _root.list_array[old_id];
		if(tmp_arr['status'] != 'td')
		{
			return false;
		}
		for(var i=old_id+1; i<len; i++)
		{
			//---- 前一个是什么 ----
			if(_root.list_array[i]['status'] == 'td')
			{
				done	= i;
				break;
			}
		}
		if(done > -1)
		{
			_root.list_array[old_id]	= _root.list_array[done];
			_root.list_array[done]		= tmp_arr;
			_root.selected				= done;
			_root.display(old_id);
			_root.display(done);
		}
		_root.flush();
	}
	this.add		= function(type)
	{
		var len		= _root.list_array.length;
		if(type == 'el')
		{
			var title_obj	= getObject("el_title_" + _root.app_name);
			var url_obj		= getObject('el_url_' + _root.app_name);
		}
		else if(type == 'ra')
		{
			var title_obj	= getObject("ra_title_" + _root.app_name);
			var url_obj		= getObject('ra_url_' + _root.app_name);
		}
		var v	= _root.validate(type, title_obj, url_obj, -1);
		if(v == false)
		{
			return false;
		}
		_root.list_array[len]	= {id:len, type:type, title:title_obj.value, url:url_obj.value, status:'td'};
		getObject("first_td_" + _root.app_name).setAttribute("height", "1");
		getObject("first_td_" + _root.app_name).innerHTML	= "";
		title_obj.value		= "";
		url_obj.value		= "";
		if(type == 'el')
		{
			url_obj.value	= "http://";
		}
		_root.display(len);
		_root.flush();
	}
	this.validate	= function(type, title_obj, url_obj, curr_id)
	{
		var len		= _root.list_array.length;
		var title	= title_obj.value;
		var url		= url_obj.value;
		if(type == 'el')
		{
			if(title.length < 3)
			{
				alert("Please enter at least 3 characters!");
				title_obj.focus();
				return false;
			}
			if(url.length < 10)
			{
				alert("Please Input Full URL!");
				url_obj.focus();
				return false;
			}
			if(url.indexOf('http://') == -1 && url.indexOf('https://') == -1 && url.indexOf('ftp://') == -1)
			{
				alert("Please Input Full URL!");
				url_obj.focus();
				return false;
			}
			for(var i=0; i<len; i++)
			{
				if(_root.list_array[i]['type'] == 'ra' || curr_id == i)
				{
					continue;
				}
				if(title == _root.list_array[i]['title'])
				{
					alert(title + "\nHas been exists !");
					return false;
				}
			}
			return true;
		}
		else if(type == 'ra')
		{
			if(title.length < 3)
			{
				alert("Please enter at least 3 characters!");
				title_obj.focus();
				return false;
			}
			for(var i=0; i<len; i++)
			{
				if(_root.list_array[i]['type'] == 'el' || curr_id == i)
				{
					continue;
				}
				if(title == _root.list_array[i]['title'])
				{
					alert(title + "\nHas been exists !");
					return false;
				}
			}
			if(url_obj.value == "" || url_obj.value == "undefined")
			{
				var title_head	= title.substr(0,6);
				if(title_head.toLowerCase() == "how to")
				{
					url_obj.value	= "Special:CreateRecipe";
				}
				else
				{
					url_obj.value	= "Special:AddData/Create_A_Software/Software:" + encodeURIComponent(title);
				}
			}
			return true;
		}
	}
	this.flush		= function()
	{
		//---- 刷新列表 ----
		var total	= 0;
		_root.value_obj.value	= '';
		for(var i=0; i<_root.list_array.length; i++)
		{
			var content	= _root.list_array[i];
			if(content['status'] != 'td')
			{
				continue;
			}
			if(typeof _root.list_array[i]['title'] == 'undefined' || _root.list_array[i]['title'] == null)
			{
				continue;
			}
			if(_root.list_array[i]['url'] == 'undefined')
			{
				_root.list_array[i]['url']	= '';
			}
			total++;
			var tmp	= "x=" + _root.list_array[i]['type'] + "@@@" + _root.list_array[i]['title'] + "@@@" + _root.list_array[i]['url'];
			if(_root.value_obj.value == "")
			{
				_root.value_obj.value	= tmp;
			}
			else
			{
				_root.value_obj.value	= _root.value_obj.value + "###" + tmp;
			}
		}
		if(total > 0)
		{
			getObject("first_td_" + _root.app_name).setAttribute("height", "1");
			getObject("first_td_" + _root.app_name).innerHTML	= "";
		}
		else
		{
			getObject("first_td_" + _root.app_name).setAttribute("height", "30");
			getObject("first_td_" + _root.app_name).innerHTML	= "&nbsp;&nbsp;&nbsp;Neither related article nor external Link has been added to this article.";
		}
	}
}
/*---- see_also_app 插件 end ----*/


//------------------------------------
function software_tags_init()
{
	tmp_obj				= document.createElement("INPUT");
	tmp_obj.id			= "user_input_tags";
	tmp_obj.type		= "text";
	tmp_obj.name		= "user_input_tags";
	tmp_obj.className	= "user_links";
	getObject('tag_input').appendChild(tmp_obj);
 	getObject('user_input_tags').value	= top.user_tags;
}
//---- 创建软件的多个属性 ----

/*---- software_attribute_app software词条编辑，已不允许用户自由创建软件属性，此插件 废弃，已清理 ----*/
//原件参见function.js文件
/*---- software_attribute_app end----*/

//---- 从右边推荐软件属性 ----
var	softwiki_attribute_item_status	= null;

/*---- attribute_suggest_app 插件 （已废弃，尚未剥离） ----*/
function attribute_suggest_app(app_name)
{
	this.keyword		= Array();
	this.app_name		= app_name;
	this.soft_attr_app	= null;
	_root				= this;
	this.init			= function(attrib_obj, soft_attr_app)
	{
		_root.soft_attr_app	= soft_attr_app;
		//---- 用户输入 this is a 属性时 更新软件的属性 suggestion ----
		var this_is_a	= attrib_obj.value;
		if(softwiki_attribute_item_status && softwiki_attribute_item_status.readyState!=0)
		{
			softwiki_attribute_item_status.abort()
		}
		softwiki_attribute_item_status	= ajax();
		if(softwiki_attribute_item_status)
		{
			softwiki_attribute_item_status.open("GET", "/software_attribute_suggest.php?title=" + encodeURIComponent(getObject('subject_title').innerHTML) + "&c=" + encodeURIComponent(this_is_a) + "&nocache=" + Math.random(), true);
			softwiki_attribute_item_status.onreadystatechange	= function()
			{
				if(softwiki_attribute_item_status.readyState == 4 && softwiki_attribute_item_status.responseText)
				{
					//---- 得到了新的推荐属性 ----
					var text	= softwiki_attribute_item_status.responseText;
					_root.keyword	= Array();
					var rs		= text.split('###');
					for(var i=0; i<rs.length; i++)
					{
						_root.keyword[i]	= {id:i, value:rs[i], ststus:1};
					}
					_root.flush();
					//---- 把页面上已经有的属性清空推荐属性的id ----
					var len		= _root.soft_attr_app.attribute_list.length;
					for(i=0; i<len; i++)
					{
						_root.soft_attr_app.attribute_list[i]['suggest']	= -1;
					}
				}
			};
			softwiki_attribute_item_status.send(null);
		}
	}
	this.flush		= function()
	{
		//---- 刷新推荐属性 ----
		var html	= "";
		len			= _root.keyword.length;
		for(var i=0; i<len; i++)
		{
			if(_root.keyword[i]['ststus'] == 0)
			{
				continue;
			}
			html	= html + "<li><a href='javascript:" + _root.app_name + ".add(" + i + ")'>" + _root.keyword[i]['value'] + "</a></li>";
		}
		getObject('software_attribute_suggest').innerHTML	= html;
	}
	this.add		= function(id)
	{
		//---- 推荐属性被点击 ----
		_root.soft_attr_app.add(_root.keyword[id]['value'], id);
		_root.keyword[id]['ststus']	= 0;
		_root.flush();
	}
}
/*---- attribute_suggest_app 插件 end ----*/

solution_submit	= function()
{
	//---- 输入的Tags录入到隐藏输入框 ----
	var tags_obj		= document.getElementsByName('tags[tags]');
	tags_obj[0].value	= getObject('user_input_tags').value;
}

/*---- input_box_app 输入框区块化效果, ----*/

//software_attribute_app 的附属插件,废弃；清理
//原件参见function.js文件

/*---- input_box_app 输入框区块化效果 end----*/

//---- 推荐Recipe文章 ----
var	softwiki_solution_title_status	= null;
function solution_title_suggest_app(s)
{
	if(typeof s == 'undefined')
	{
		s	= '';
	}
	//---- 用户输入 title 属性时 更新 suggestion ----
	var s_name	= getObject('solution_name').value;
	if(softwiki_solution_title_status && softwiki_solution_title_status.readyState!=0)
	{
		softwiki_solution_title_status.abort();
	}
	softwiki_solution_title_status	= ajax();
	if(softwiki_solution_title_status)
	{
		softwiki_solution_title_status.open("GET", "/recipe_suggest.php?keyword=" + encodeURIComponent(s_name) + "&s=" + s + "&nocache=" + Math.random(), true);
		softwiki_solution_title_status.onreadystatechange	= function()
		{
			if(softwiki_solution_title_status.readyState == 4 && softwiki_solution_title_status.responseText)
			{
				var text	= trim(softwiki_solution_title_status.responseText);
				if(text == "<!-- Total: 0 -->")
				{
					getObject('hidden_box').style.display	= 'none';
				}
				else
				{
					getObject('suggest_solution_title').innerHTML	= text;
					getObject('hidden_box').style.display	= 'block';
				}
			}
		};
		softwiki_solution_title_status.send(null);
	}
}
//function disable_nologin_input(soft_attr_app)
function disable_nologin_input()
{
	try
	{
		var obj	= getObject('Create_lo_id');
		var str	= obj.innerHTML;
		if(str.indexOf('Create an account') == -1)
		{
			return false;
		}
		getObject('user_input_tags').setAttribute('readOnly', true);
		getObject('related_article_name').setAttribute('readOnly', true);
		getObject('external_link_name').setAttribute('readOnly', true);
		getObject('external_link_url').setAttribute('readOnly', true);
		getObject('add_input').setAttribute('readOnly', true);
		//getObject('add_software_attribute_btn').innerHTML	= '';
		/*
		var len	= soft_attr_app.attribute_list.length;
		if(len == 0)
		{
			return false;
		}
		for(var i=0; i<len; i++)
		{
			getObject("soft_attr_value_" + software_attribute_app.attribute_list[i]['id']).setAttribute('readOnly', true);
		}
		*/
	}
	catch(e)
	{
	}
}
var TINY={};
function $T(e,p){return p.getElementsByTagName(e)}

TINY.table	= function()
{
	function sorter(n)
	{
		this.n	= n;
		this.pagesize	= 20;
		this.paginate	= 0;
	}
	sorter.prototype.init	= function(e, f)
	{
		var t	= ge(e);
		var i	= 0;
		this.e	= e;
		this.l	= t.r.length;
		this.filter_rows	= new Array();	//---- 要过滤哪个列 ----
		this.filter_name	= new Array();	//---- 要过滤哪个列的名称 ----
		this.selected		= new Array();	//---- 选择了哪个值 ----
		this.uniq_value		= new Array();	//---- 过滤列都有哪些值 ----
		this.all_value		= new Array();	//---- 过滤列所有的值 ----
		var caption	= $T('caption', getObject(e));
		if(caption.length)
		{
			this.filter_rows	= caption[0].innerHTML.split(",");
			caption[0].innerHTML	= '';
		}
		t.a		= [];
		t.h		= $T('thead', getObject(e))[0].rows[0];
		t.w		= t.h.cells.length;
		for(i; i<t.w; i++)
		{
			var c	= t.h.cells[i];
			if(c.className != 'nosort')
			{
				c.className	= this.head;
				c.onclick	= new Function(this.n + '.wk(this.cellIndex)');
			}
			for(var j=0; j<this.filter_rows.length; j++)
			{
				//---- 过滤条件的名称 ----
				if(this.filter_rows[j] == i)
				{
					this.filter_name[j]	= strip_tags(c.innerHTML);
				}
			}
		}
		for(i=0; i<this.l; i++)
		{
			t.a[i]	= {};
			var cells	= t.r[i].cells;
			for(var j=0; j<this.filter_rows.length; j++)
			{
				var fr	= this.filter_rows[j];
				if(!this.all_value[j])
				{
					this.all_value[j]	= new Array();
				}
				if(!this.uniq_value[j])
				{
					this.uniq_value[j]	= new Array();
				}
				if(cells[fr])
				{
					this.all_value[j].push(trim(cells[fr].innerHTML));
					var len	= this.uniq_value[j].length;
					for(var tmp=0; tmp<len; tmp++)
					{
						var str_1	= trim(cells[fr].innerHTML);
						str_1		= str_1.toLowerCase();
						var str_2	= this.uniq_value[j][tmp];
						str_2		= str_2.toLowerCase();
						if(str_1 == str_2)
						{
							break;
						}
					}
					this.uniq_value[j][tmp]	= trim(cells[fr].innerHTML);
				}
			}
		}
		for(var j=0; j<this.uniq_value.length; j++)
		{
			this.uniq_value[j]	= this.uniq_value[j].sort();
			var tmp_obj			= document.createElement('SPAN');
			tmp_obj.innerHTML	= "Filter by " + this.filter_name[j] + ": ";
			caption[0].appendChild(tmp_obj);
			var objSelect			= document.createElement('SELECT');
			objSelect.style.width	= "160px";
			objSelect.onchange		= new Function(this.n + ".display_filter(" + j + ", this.value)");
			objSelect.length		= 0;
			objSelect.options[0] = new Option('All', '');
			caption[0].appendChild(objSelect);
			for(var tmp=0; tmp<this.uniq_value[j].length; tmp++)
			{
				objSelect.options[objSelect.length] = new Option(this.uniq_value[j][tmp], this.uniq_value[j][tmp]);
				if(this.selected[j] == this.uniq_value[j][tmp])
				{
					objSelect.selectedIndex	= tmp + 1;
				}
			}
			var tmp_obj			= document.createElement('SPAN');
			tmp_obj.innerHTML	= "&#160;&#160;&#160;";
			caption[0].appendChild(tmp_obj);
		}
		if(f != null)
		{
			if(f < 0)
			{
				f	= 0 - f;
				var a	= new Function(this.n + '.wk(' + f + ')');
				a();
			}
			var a	= new Function(this.n + '.wk(' + f + ')');
			a();
		}
		if(this.paginate)
		{
			this.g	= 1;
			this.pages()
		}
	};
	sorter.prototype.wk	= function(y)
	{
		var t	= ge(this.e);
		var x	= t.h.cells[y]
		var i	= 0;
		for(i; i<this.l; i++)
		{
			t.a[i].o	= i;
			var v	= t.r[i].cells[y];
			t.r[i].style.display	= '';
			while(v.hasChildNodes())
			{
				v	= v.firstChild;
			}
			t.a[i].v	= v.nodeValue ? v.nodeValue : '';
		}
		for(i=0; i<t.w; i++)
		{
			var c	= t.h.cells[i];
			if(c.className != 'nosort')
			{
				c.className	= this.head
			}
		}
		if(t.p == y)
		{
			t.a.reverse();
			x.className	= t.d ? this.asc : this.desc;
			t.d	= t.d ? 0 : 1;
		}
		else
		{
			t.p			= y;
			t.a.sort(cp);
			t.d			= 0;
			x.className	= this.asc
		}
		var n	= document.createElement('tbody');
		for(i=0; i<this.l; i++)
		{
			var r		= t.r[t.a[i].o].cloneNode(true);
			n.appendChild(r);
			r.className	= (i % 2 == 0) ? this.even : this.odd;
			var cells	= $T('td',r);
			for(var z=0; z<t.w; z++)
			{
				cells[z].className	= (y == z) ? (i % 2 == 0) ? this.evensel : this.oddsel : '';
				for(var j=0; j<this.filter_rows.length; j++)
				{
					if(z == this.filter_rows[j])
					{
						if(this.selected[j])
						{
							var str_1	= trim(cells[z].innerHTML);
							str_1		= str_1.toLowerCase();
							var str_2	= trim(this.selected[j]);
							str_2		= str_2.toLowerCase();
							if(str_1 != str_2)
							{
								r.style.display		= 'none';
							}
						}
					}
				}
			}
		}
		t.replaceChild(n, t.b);
		if(this.paginate)
		{
			this.size(this.pagesize)
		}
	};
	sorter.prototype.page	= function(s)
	{
		var t	= ge(this.e);
		var i	= 0;
		var l	= s + parseInt(this.pagesize);
		if(this.currentid && this.limitid)
		{
			getObject(this.currentid).innerHTML	= this.g
		}
		for(i; i<this.l; i++)
		{
			t.r[i].style.display	= (i >= s && i < l) ? '' : 'none'
		}
	};
	sorter.prototype.display_filter	= function(index, val)
	{
		var t	= ge(this.e);
		var i	= 0;
		for(i; i<this.l; i++)
		{
			if(this.all_value[index][i] == val)
			{
				t.r[i].style.display	= 'none';
			}
			else
			{
				t.r[i].style.display	= '';
			}
		}
		this.selected[index]	= val;
		this.wk(this.filter_rows[index]);
	};
	sorter.prototype.move	= function(d, m)
	{
		var s	= (d == 1) ? (m ? this.d : this.g + 1) : (m ? 1 : this.g - 1);
		if(s <= this.d && s > 0)
		{
			this.g	= s;
			this.page((s - 1) * this.pagesize);
		}
	};
	sorter.prototype.size	= function(s)
	{
		this.pagesize	= s;
		this.g			= 1;
		this.pages();
		this.page(0);
		if(this.currentid && this.limitid)
		{
			getObject(this.limitid).innerHTML	= this.d
		}
	};
	sorter.prototype.pages	= function()
	{
		this.d	= Math.ceil(this.l / this.pagesize)
	};
	function ge(e)
	{
		var t	= getObject(e);
		t.b		= $T('tbody',t)[0];
		t.r		= t.b.rows;
		return t
	};
	function cp(f, c)
	{
		var g, h;
		f	= g = f.v.toLowerCase();
		c	= h = c.v.toLowerCase();
		var i	= parseFloat(f.replace(/(\$|\,)/g,''));
		var n	= parseFloat(c.replace(/(\$|\,)/g,''));
		if(!isNaN(i) && !isNaN(n))
		{
			g	= i;
			h	= n
		}
		i	= Date.parse(f);
		n	= Date.parse(c);
		if(!isNaN(i) && !isNaN(n))
		{
			g	= i;
			h	= n;
		}
		return g > h ? 1 : (g < h ? -1 : 0);
	};
	function strip_tags(str)
	{
		return str.replace(/<\/?[^>]+>/gi, "");
	};
	return{sorter:sorter}
}();

/*---- Edit Guide Note ----*/
var software_guide	= '<br/>';
software_guide	+= '<b>To Link to Other Articles</b><br/>\n';
software_guide	+= '<ol><li>In Advanced Editing. Enter [[Software:article title]]</li>\n';
software_guide	+= '<li>To customize the link text enter [[Software:Article title | custom link text]]</li></ol><br/>\n\n';
software_guide	+= '<b>To Upload or Insert Images</b><br/>\n';
software_guide	+= '<ul><li>In Advanced Editing, Type [[Image:Imagename.jpg]]</li>\n';
software_guide	+= '<li>In FCKeditor. Click the <img width="16" height="16" src="/extensions/FCKeditor/plugins/mediawiki/images/img.gif" /> icon to start uploading images.</li></ul><br/>\n\n';
software_guide	+= '<b>To Add a Citation</b><br/>\n';
software_guide	+= '<ul><li>In Advanced Editing. Enter &lt;ref&gt; Source Name: [http://source-url.com Link Title] (Month Day, Year) immediately after the quote, data, or opinion you need to cite.</li>\n';
software_guide	+= '<li>In FCKeditor. Click the <img width="16" height="16" src="/extensions/FCKeditor/plugins/mediawiki/images/r.gif"/> icon, and enter quote, data, or opinion you need to cite in the popped up dialog box.</li></ul><br/>\n\n';
software_guide	+= '<b>Add Source Code</b><br/>\n';
software_guide	+= '<ul><li>In Advanced Editing. <br />Fill in source codes in the middle of &lt;source lang=" "&gt; &lt;/source&gt;</li>\n\n';
software_guide	+= 'Note: Enter the language name you are to use.<br/>\n';
software_guide	+= '<li>In FCKeditor. Click the <img width="16" height="16" src="/extensions/FCKeditor/plugins/mediawiki/images/code.gif"/> icon. Select one language from the dropdown menu and enter the source codes into the code field.</li></ul><br/>\n';
software_guide	+= 'Note: Some advanced page editing are limited to Advanced Editing.\n';

var solution_guide	= '<br/>';
solution_guide	+= '<b>To Link to Other Articles</b><br/>\n';
solution_guide	+= '<ol><li>Enter [[Recipe:article title]] </li>\n';
solution_guide	+= '<li>To customize the link text enter [[Recipe:Article title | custom link text]]</li></ol><br/>\n\n';
solution_guide	+= '<b>To Upload or Insert Images</b><br/>\n';
solution_guide	+= '<ul><li>Type [[Image:Imagename.jpg]]</li>\n';
solution_guide	+= '<li>In FCKeditor. Click the <img width="16" height="16" src="/extensions/FCKeditor/plugins/mediawiki/images/img.gif"/> icon to start uploading images.</li></ul><br/>\n\n';
solution_guide	+= '<b>To Add a Citation</b><br/>\n';
solution_guide	+= '<ul><li>Enter &lt;ref&gt; Source Name:[http://source-url.com Link Title] (Month Day, Year) immediately after the quote, data, or opinion you need to cite.</li>\n';
solution_guide	+= '<li>In FCKeditor. Click the <img src="/extensions/FCKeditor/plugins/mediawiki/images/r.gif"/> icon, and enter quote, data, or opinion you need to cite in the popped up dialog box.</li></ul><br/>\n\n';
solution_guide	+= '<b>Add Source Code</b><br/>\n';
solution_guide	+= '<ul><li>Fill in source codes in the middle of &lt;source lang=" "&gt; &lt;/source&gt;</li>\n\n';
solution_guide	+= 'Note: Enter the language name you are to use.<br/>\n';
solution_guide	+= '<li>In FCKeditor. Click the <img src="/extensions/FCKeditor/plugins/mediawiki/images/code.gif"/> icon. <br />Select one language from the dropdown menu and enter the source codes into the code field.</li></ul><br/>\n';
solution_guide	+= 'Note: Some advanced page editing are limited to Advanced Editing.\n';

function display_software_guide_note()
{
	if(getObject('edit_guide_content').innerHTML == '')
	{
		getObject('edit_guide_content').innerHTML	= software_guide;
	}
	getObject('guide_btn').style.backgroundImage	= 'url(/images/softwiki_images/btn_hidden.gif)';
	getObject('guide_btn').onclick	= hidden_software_guide_note;
	getObject('edit_guide_content').style.display	= '';
}
function hidden_software_guide_note()
{
	getObject('guide_btn').onclick	= display_software_guide_note;
	getObject('guide_btn').style.backgroundImage	= 'url(/images/softwiki_images/btn_display.gif)';
	getObject('edit_guide_content').style.display	= 'none';
}

function display_solution_guide_note()
{
	if(getObject('edit_guide_content').innerHTML == '')
	{
		getObject('edit_guide_content').innerHTML	= solution_guide;
	}
	getObject('guide_btn').style.backgroundImage	= 'url(/images/softwiki_images/btn_hidden.gif)';
	getObject('guide_btn').onclick	= hidden_solution_guide_note;
	getObject('edit_guide_content').style.display	= '';
}
function hidden_solution_guide_note()
{
	getObject('guide_btn').onclick	= display_solution_guide_note;
	getObject('guide_btn').style.backgroundImage	= 'url(/images/softwiki_images/btn_display.gif)';
	getObject('edit_guide_content').style.display	= 'none';
}
/*---- Edit Guide Note  end ----*/


function openEmailResultDiv(str)
{
	openNewDiv_email('email_div');
	getObject('email_div').style.width	= "520px";
	getObject('email_div').style.height	= "190px";
	getObject('email_div').className		= 'suggest_tag';
	var sug_tith			= document.createElement("h2");
	sug_tith.className		= 'sug_tith sug_tith2';
	var sut_con				= document.createElement("div");
	sut_con.className		= 'sut_con sut_con2';
	sut_con.style.height	= "125px";

	if(str=="1")
	{
		sug_tith.innerHTML	= '<span><img src="' + cancel_image.src + '" style="cursor:pointer;" onclick="getObject(\'email_div\').style.display=\'none\'; getObject(\'mask\').style.display=\'none\';" /></span>Application has been successfully sent.';
		sut_con.innerHTML	= "<p>Your request has been successfully submitted. Please wait for our feedback.</p>";
	}
	else
	{
		sug_tith.innerHTML	= '<span><img src="' + cancel_image.src + '" style="cursor:pointer;" onclick="getObject(\'email_div\').style.display=\'none\'; getObject(\'mask\').style.display=\'none\';" /></span>Application has not been sent.';
		sut_con.innerHTML	= "<p>You can\'t apply to join workgroup, for you are not our Recipester users yet.</p>";
	}
	getObject('email_div').appendChild(sug_tith);
	getObject("email_div").appendChild(sut_con);
}
function openNewDiv_email(_id)
{
	var m	= "mask";
	if(getObject(_id))
	{
		document.body.removeChild(getObject(_id));
	}
	if(getObject(m))
	{
		document.body.removeChild(getObject(m));
	}
	var email_div	= document.createElement("div");
	email_div.id	= _id;
	email_div.style.position	= "absolute";
	//email_div.style.position	= "fixed";
	email_div.style.zIndex		= "9999";
	email_div.style.width		= "445px";
	email_div.style.height		= "120px";
	email_div.style.left		= (parseInt(document.documentElement.clientWidth) - 445) / 2 + document.documentElement.scrollLeft + "px";
	email_div.style.top		= (parseInt(document.documentElement.clientHeight) - 100) / 2 + document.documentElement.scrollTop + "px";
	email_div.style.background	= "#ebebeb";
	email_div.style.border		= "3px solid #888";
	email_div.style.padding	= "0px";
	document.body.appendChild(email_div);
	var newMask		= document.createElement("div");
	newMask.id		= m;
	if(navigator.appName == "Microsoft Internet Explorer")
	{
		if(parseInt(navigator.appVersion.match(/MSIE(.*?)\./i)[1])<7)
		{
			newMask.style.position	= "absolute";
			newMask.style.height	= document.documentElement.scrollHeight+ "px";
		}
		else
		{
			newMask.style.position	= "fixed";
			newMask.style.height	= "100%";
		}
	}
	else
	{
		newMask.style.position		= "absolute";
		newMask.style.height		= document.documentElement.scrollHeight + "px";
	}
	newMask.style.zIndex		= "888";
	newMask.style.width			= "100%";
	newMask.style.top			= "0px";
	newMask.style.left			= "0px";
	newMask.style.filter		= "alpha(opacity=40)";
	newMask.style.opacity		= "0.40";
	document.body.appendChild(newMask);
	newMask.style.background	= "#000";
}

/*---- function.js end ----*/


