/*討論 顯示回覆表單*/
function showForm() {
	$("#reply").show();
}

/*變換滑鼠樣式*/
function delhand() {
	$(".delhand").css("cursor", "pointer"); 
}

/*編輯器 轉換*/
function _(id){
	return document.getElementById(id);
}

// Ctrl+Enter 發佈
function ctrlEnter(event, btnId, onlyEnter) {
	return true;
}

function showimgs(url) {
	if (!_('zoomimglayer_bg')) {
		var div = document.createElement('div');
		div.id = 'zoomimglayer_bg';
		div.style.position = 'absolute';
		div.style.left = div.style.top = '0px';
		div.style.width = '100%';
		result = getViewportInfo();
		div.style.height = document.body.scrollHeight < result.height ? result.height + 'px' : document.body.scrollHeight  + 'px';
		div.style.backgroundColor = '#000';
		div.style.display = 'none';
		div.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=60,finishOpacity=100,style=0)';
		div.style.opacity = 0.6;
		div.style.zIndex = 999;
		document.body.appendChild(div);
	}
	
	$("#zoomimglayer_img").each(function(){this.src = url;});
	
	_('zoomimglayer_bg').style.display = '';
	_('zoomimglayer').style.display = 'block';
	
	var pos = getposdis(_('zoomimglayer'));
	$('#zoomimglayer').css('left',pos.left).css('top',pos.top).addClass('autoheight');
}

function hide() {
	$("#zoomimglayer").css("display", "none");
	$("#zoomimglayer_img").each(function(){this.src = "./images/loading.gif";});
	$("#zoomimglayer_bg").css("display", "none");
}

function getposdis(obj) { 
	var left = document.body.clientWidth / 2 - obj.clientWidth / 2;
	var top = document.documentElement.scrollTop ? document.documentElement.scrollTop + 60 : document.body.scrollTop + 60 ;
	return { 'left' : left, 'top' : top };
}

/*引言*/
function introduction(n) {
	var reply = document.getElementById("reply");
	reply.style.display = "block";
	document.getElementById("uchome-ifrHtmlEditor").focus();
	
	var obj = document.getElementById("post_con_" + n).innerHTML;
	var meb = document.getElementById("post_member_" + n).innerHTML;
	var num = document.getElementById("post_num_" + n).innerHTML;
	insertForward(obj, meb, num);
}

function insertForward(obj, meb, num) {
	var html = "<div class='forward'><p><span class='bold'>引用 " + num + "</span>：" + meb + "</p><div class='forward2'>" + obj + "</div></div><br />";
	edit_insert(html);
}
