var lWin;
var noteTitleLimit = 25;
var noteBodyLimit = 300;

function sendNote(lnBtn) {
	lWin = new Window('lWin', 
								{
								className:"alphacube",
								width:350, height:250,
								resizable: true, 
								hideEffect:Element.hide, 
								showEffect:Element.show, 
								minWidth: 10,
								draggable:true,
								wiredDrag: true
								});
	lWin.setAjaxContent('/lvtou_member/my_style/common/littleNote/noteForm.vm?recieverId='+lnBtn.recieverId+'&adminLN='+lnBtn.adminLN);
	lWin.toFront(); 
	lWin.setTitle(lnBtn.title);
	lWin.setDestroyOnClose(); 
	lWin.showCenter();
}

function sumbitLNForm() {
	if($F('noteTitle').Trim()!="" && $F('noteBody').Trim()!="") {
		var form = $('LNForm');
		new Ajax.Updater('', form.action, {parameters:Form.serialize(form),onComplete: submitLNFormCallBack,asynchronous:true, evalScripts:true});
	} else {
		showMessage("请填写标题和内容!",null);
	}
}

function closeLNWin() {
	lWin.destroy();
}
function resetNoteWin() {
	$('noteTitle').value = '';
	$('noteBody').value = '';
}
/**
	小纸条表单提交成功后的回调函数
*/                  		
function submitLNFormCallBack(originalRequest) {
	callBack(originalRequest);
	lWin.destroy();
}


/**
 检查标题长度
*/
function checkTitleLimit() {
	if(!checkLength($F('noteTitle'),20)) {
		$('noteTitle').value = $F('noteTitle').substr(0,noteTitleLimit);
	}
}
/**
 检查内容长度
*/
function checkBodyLimit() {
	if(!checkLength($F('noteBody'),noteBodyLimit)) {
		$('noteBody').value = $F('noteBody').substr(0,noteBodyLimit);
	}
}

function showLN(noteid) {
	showContent("/showLittleNote.do?noteid="+noteid,540);
	//Dialog.alert({url:"/showLittleNote.do?noteid="+noteid, options: {method: 'get'}}, {windowParameters: {className: "alphacube", width:540,hideEffect:Element.hide,showEffect:Element.show},okLabel: "关闭"});
}
/*function showContent(url,width) {
alert(url);
   	Dialog.alert({url: url, options: {method: 'get'}}, 
           {className: "alphacube", width:width, okLabel: " 关闭 "});
}*/