<!--
function auth(){
	if(0 == ot_uid){
		str = '';
		str += '<a href="http://account.opentags.org/login.php?url_to='+  ___encodeURIComponent(this_url) +'">'+ login +'</a>';
		document.getElementById('user').innerHTML = str;
		try{
			document.getElementById('Edit').innerHTML = '<b class="title"><a href="http://account.opentags.org/login.php?url_to='+ ___encodeURIComponent(this_url) +'">'+ lognull +'</a></b>';
			document.getElementById('Edit').style.display = 'block';
		}catch(err){}
	}else{
		if('' == ot_uname){
			Location('http://account.opentags.org/setting.php');
		}else{
			str = '<b>'+ ot_uname +'</b>';
			str += nav_space;
			str += '<a href="http://account.opentags.org/setting.php">'+ setting +'</a>';
			str += nav_space;
			str += '<a href="http://www.opentags.org/?user='+ ot_uid +'&tag='+ ___encodeURIComponent(ot_uname +'\'s '+ tag) +'">'+ my_tags +'</a>';
			str += nav_space;
			str += '<a href="http://account.opentags.org/logout.php">'+ logout +'</a>';
			document.getElementById('user').innerHTML = str;
			try{
				document.getElementById('Edit').style.display = 'block';
				if(uid == ot_uid){
					var ar = document.getElementById('tag_tree').getElementsByTagName('a');
					for(var i=0,len=ar.length; i<len; i++){
						if(ar[i].href.toString().indexOf('id=0') == -1){
							tags_array[tags_array.length] = ar[i].innerHTML;
						}
					}
					str = nav_space +'<a href="JavaScript:edit_tags();void(0)">'+ edit +'</a>';
					document.getElementById('tag_tree').innerHTML += str;
					document.getElementById('tag_tree2').innerHTML += str;
				}
			}catch(err){}
		}
	}
}

function edit_tags(){
	if(typeof(tags_array) != 'undefined')
		var old_tags = tags_array.join(' ');
	else
		var old_tags = '';

	var w = (window.screen.width)/2;
	var h = (window.screen.height)/2;
	var winwidth = window.screen.width;
	var winheight = window.screen.height;
	var win= (winheight - h)/2;
	var winleft = (winwidth - w)/2;
	window.open('http://account.opentags.org/edit_tags.php?id='+ id +'&tags='+ ___encodeURIComponent(old_tags), 'edit_tags', "top="+win+",left="+winleft+",width="+w+",height="+h+",modal=yes,scrollbars=yes");
}

function bookmarks(){
	document.write('<a href="http://url.freebapp.org/bookmark/" onmouseover="return _b_open(this)" onmouseout="_b_close()" onclick="return _b_more()" style="text-decoration:none">');
	document.write('<img src="http://url.freebapp.org/static/img/lg-bookmark.gif" width="125" height="16" border="0" alt="">');
	document.write('</a>');
}

function replyUserList(){
	if(typeof(rsu) != 'undefined'){
		str  = '';
		str += '<select size="1" onchange="replyUserSubmit(this)">';
		str += '<option value="0">'+ read_all +'</option>';
		for(i in rsu){
			str += '<option value="'+ i +'">'+ rsu[i].toString() +'</option>';
		}
		str += '</select>';
		document.getElementById('view_reply').innerHTML = str;
	}
}

function replyUserSubmit(e){
	if(0 == e.value)
		replyAll();
	else
		replyUser(e.value);
	e.blur();

}

function replyUser(u){
	u = parseInt(u);
	var replyDivs = document.getElementById('reply').getElementsByTagName('div');
	for(var i=0,len=replyDivs.length; i<len; i++){
		var reuser = parseInt(replyDivs[i].id);
		if(false == isNaN(reuser)){
			if(reuser == u){
				replyDivs[i].style.display = 'block';
			}else{
				replyDivs[i].style.display = 'none';
			}
		}
	}
}

function replyAll(){
	var replyDivs = document.getElementById('reply').getElementsByTagName('div');
	for(var i=0,len=replyDivs.length; i<len; i++){
		var reuser = parseInt(replyDivs[i].id);
		if(false == isNaN(reuser)){
			replyDivs[i].style.display = 'block';
		}
	}
}

function UserSetSubmit(){
	if('' == trim(document.getElementsByName('name')[0].value)){
		alert(user_error_name_null);
		return false;
	}
	if('' == trim(document.getElementsByName('email')[0].value)){
		//alert(user_error_email_null);
		//return false;
	}
	return true;
}

function LoginSubmit(){
	var url = trim(document.getElementsByName('url')[0].value);
	if('' == url){
		return false;
	}
	return true;
}

function AddSubmit(){
	document.getElementById('submit_button').disabled = true;
	str = FCKeditorAPI.GetInstance("body").GetXHTML();
	str = str.replace(/<br \/>/g, "\n");
	if('' == trim(str)){
		alert(add_null_error);
		document.getElementById('submit_button').disabled = false;
		return false;
	}
	if(0 != document.getElementsByName('subject').length){
		if('' == trim(document.getElementsByName('subject')[0].value)){
			alert(add_subject_error);
			document.getElementById('submit_button').disabled = false;
			return false;
		}
	}
	return true;
}

function Editor(id, tag){
	var tg = '_self';
	document.write('<form target="'+ tg +'" action="http://account.opentags.org/submit.php?url_to='+  ___encodeURIComponent(this_url) +'" method="POST" onsubmit="return AddSubmit()" id="Edit">');
	document.write('<b class="title">'+ add_tags +'</b>');
	if(0 != id)
		document.write('<input type="hidden" name="id" value="'+ id +'">');
	document.write('<table border="0" cellpadding="0" cellspacing="0"" width="100%">');
	if(0 == id){
		document.write('<tr>');
		document.write('<td nowrap>'+ subject +'</td>');
		document.write('<td class="ll"><input type="text" name="subject" class="input"></td>');
		document.write('</tr>');
		document.write('<tr>');
		document.write('<td nowrap>'+ tags +'</td>');
		document.write('<td class="ll"><input type="text" name="tags" value="'+ tag +'" class="input"><br><small>'+ tags_provisions +'</small></td>');
		document.write('</tr>');
	}
	document.write('<tr>');
	document.write('<td colspan="2">');
	var oFCKeditor = new FCKeditor('body');
	oFCKeditor.BasePath = 'http://static.opentags.org/fckeditor/';
	oFCKeditor.ToolbarSet = 'Basic';
	oFCKeditor.Width = '100%';
	oFCKeditor.Height = '300';
	oFCKeditor.Value = '';

	oFCKeditor.Config['LinkBrowser'] = false;
	oFCKeditor.Config['ImageBrowser'] = true;
	oFCKeditor.Config['FlashBrowser'] = false;
	oFCKeditor.Config['LinkUpload'] = false;
	oFCKeditor.Config['ImageUpload'] = true;
	oFCKeditor.Config['FlashUpload'] = false;
	oFCKeditor.Config['LinkDlgHideAdvanced'] = true;
	oFCKeditor.Config['ImageDlgHideAdvanced'] = true;
	oFCKeditor.Config['FlashDlgHideAdvanced'] = true;
	oFCKeditor.Config['LinkDlgHideTarget'] = true;
	oFCKeditor.Config['DefaultLinkTarget'] = '_blank';
	oFCKeditor.Config['ImageBrowserURL'] = 'http://account.opentags.org/img.php';
	oFCKeditor.Config['ImageUploadURL'] = 'http://account.opentags.org/upload_img.php';

	oFCKeditor.Config['AutoDetectLanguage'] = false;
	oFCKeditor.Config['DefaultLanguage'] = "zh-cn";
	oFCKeditor.Config['FormatSource'] = false;
	oFCKeditor.Config['FormatOutput'] = false;
	oFCKeditor.Config['GeckoUseSPAN'] = false;
	oFCKeditor.Config['StartupFocus'] = false;
	oFCKeditor.Config['ForcePasteAsPlainText'] = true;
	oFCKeditor.Config['AutoDetectPasteFromWord'] = false;
	oFCKeditor.Config['ForceSimpleAmpersand'] = true;
	oFCKeditor.Config['EnterMode'] = 'br';
	oFCKeditor.Config['ShiftEnterMode'] = 'br';
	oFCKeditor.Config['TabSpaces'] = 0;

	oFCKeditor.Config['EditorAreaCSS'] = 'http://static.opentags.org/css/fck_editorarea.css';
	oFCKeditor.Config['RemoveFormatTags'] = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var,table,tr,td,th,tbody,div,script,h1';
	oFCKeditor.Config['RemoveAttributes'] = 'id,class,style,lang,width,height,align,hspace,valign,onclick,onmouseout,onmouseover,onload,onerror';

	//oFCKeditor.Config['ToolbarStartExpanded'] = false;

	oFCKeditor.Create();

	document.write('</td>');
	document.write('</tr>');
	document.write('<tr>');
	document.write('<td colspan="2"><input type="submit" id="submit_button" value="'+ submit +'"></td>');
	document.write('</tr>');
	document.write('</table>');
	document.write('</form>');
}

function FCKeditor_OnComplete(editorInstance){
	//editorInstance.Events.AttachEvent('OnPaste', FCKeditor_OnPaste);
}

function FCKeditor_OnPaste(editorInstance){
	var oEditor = FCKeditorAPI.GetInstance('body');
	if(oEditor.Config['ForcePasteAsPlainText']){
		oEditor.PasteAsPlainText();
		return false;
	}else{
		var sHtml = oEditor.GetClipboardHTML();
		alert( oEditor.EditorDocument.body.innerHTML);
		oEditor.InsertHtml(sHtml);
		return false;
	}
}

function CopyTagTree(){
	document.write(document.getElementById('tag_tree').innerHTML);
}

function TheEnd(){
	try{
		var pageTracker = _gat._getTracker("UA-1558484-14");
		pageTracker._trackPageview();
	}catch(err){}
}
//-->