<!--
var popWidth;
var popHeight;
var smPath;
var smType;
var bodySize = [];
var fsmInterval;
var fsmAlpha = 100;
var W = screen.width;//取得屏幕分辨率宽度
var H = screen.height;//取得屏幕分辨率高度
var isIEE=window.ActiveXObject;
var isIEE6=isIEE&&!window.XMLHttpRequest;
function getJsConfirm(imbTitle, imbContent, imbBody){
	var jsconfirmText = "<table width=\"100%\" height=\"100%\" bgcolor=\"#eeeeee\" cellpadding=\"5\" cellspacing=\"0\"><tr><td align=center bgcolor=#3A80F3><span id=\"imb_Title\" style=\"padding-left:3px;padding-right:3px;color:white;font-size:18px;line-height:22px;font-family: MenksoftQagan;writing-mode:tb-rl;\">" + imbTitle; 
	jsconfirmText += "</span></td><td width=\"68%\" align=\"left\" nowrap><span id=\"imb_Content\" style=\"text-align: left;font-size: 18px;color: #000000;line-height: 22px;font-family: MenksoftQagan;writing-mode: tb-rl;\">" + imbContent; 
	jsconfirmText += "</span></td><td id=\"imb_Body\" align=center>" + imbBody;
	jsconfirmText += "</td></tr></table>";
	return jsconfirmText;
}

function getLoginText(smmPath){
	var loginText = "<table width=\"247\" height=\"164\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" background=\"" + smmPath + "blog2/images/nevtereh_bg.png\">";
	loginText += "<tr><td width=\"51\">&nbsp;</td><td width=\"221\">";
	loginText += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>";
	loginText += "<table width=\"96%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">";
	loginText += "<tr><td colspan=\"3\" valign=\"top\" nowrap>";
	loginText += "<a href=\"javascript:closeDIV();\" class=\"A.hg\"><img border=\"0\" onContextMenu=\"return false;\" src=\"" + smmPath + "blog2/images/dialogclose.gif\"/></a>";
	loginText += "</td></tr>";
	loginText += "<tr><td width=\"25\" nowrap><span class=\"ulag\"></span></td>";
	loginText += "<td><input name=\"userNameLogin\" id=\"userNameLogin\" type=\"text\" size=\"6\" class=\"mininput\" tabindex=\"101\"></td>";
	loginText += "<td rowspan=\"2\" valign=\"middle\"><input onClick=\"loginSubmit();return false;\" name=\"submit_login\" id=\"submit_login\" type=\"image\" src=\"" + smmPath + "blog2/images/nevtereh.gif\" width=\"56\" height=\"56\" border=\"0\"></td></tr>";
	loginText += "<tr><td width=\"25\" nowrap><span class=\"ulag\"></span></td>";
	loginText += "<td><input name=\"passwordLogin\" id=\"passwordLogin\" type=\"password\" size=\"6\" class=\"mininput\" tabindex=\"102\"></td></tr>";
	loginText += "<tr><td height=\"25\" nowrap><span class=\"ulag\"></span></td>";
	loginText += "<td><input name=\"loginRandLogin\" id=\"loginRandLogin\" type=\"text\" size=\"6\" class=\"mininput\" tabindex=\"103\"></td>";
	loginText += "<td valign=\"middle\"><img onContextMenu=\"return false;\" onClick=\"refreshHebtee();\" id=\"loginHebtee\" src=\"" + smmPath + "servlet/imageRandHebtee.servlet\"/></td>";
	loginText += "</tr></table></td></tr><tr><td>";
	loginText += "<table width=\"40\" height=\"42\"  border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">";
	loginText += "<tr><td lign=\"left\" valign=\"bottom\"><span id=\"smMessage\" class=\"pop\"><br><br><br><br><br><br><br></span></td></tr>";
	loginText += "</table></td></tr></table></td></tr></table>";
	return loginText;
}
function M(id) {
	return document.getElementById(id);//用M()方法代替document.getElementById(id)
}
function MC(t) {
	return document.createElement(t);//用MC()方法代替document.createElement(t)
}
//判断浏览器是否为IE
function isIE() {
	return (document.all && window.ActiveXObject && !window.opera) ? true : false;
} 
//取得页面的高宽
function getBodySize() {
	with (document.documentElement) {
		bodySize[0] = scrollLeft;
		bodySize[1] = scrollTop;
		bodySize[2] = clientWidth;
		bodySize[3] = clientHeight;
		bodySize[4] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;//如果滚动条的宽度大于页面的宽度，取得滚动条的宽度，否则取页面宽度
		bodySize[5] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;//如果滚动条的高度大于页面的高度，取得滚动条的高度，否则取高度
		bodySize[6] = event.clientX;
		bodySize[7] = event.clientY;
	}
	return bodySize;
}
//创建遮盖层
function popCoverDiv() {
	if (M("cover_div")) {
		//如果存在遮盖层，则让其显示 
		M("cover_div").style.display = "block";
	} else {
		//否则创建遮盖层
		var coverDiv = MC("div");
		document.body.appendChild(coverDiv);
		coverDiv.id = "cover_div";
		with (coverDiv.style) {
			position = "absolute";
			background = "#CCCCCC";
			left = "0px";
			top = "0px";
			width = bodySize[4] + "px";
			height = bodySize[5] + "px";
			zIndex = 0;
			if (isIE()) {
				filter = "Alpha(Opacity=60)";//IE逆境
			} else {
				opacity = 0.6;
			}
		}
	}
}

//让登陆层显示为块 
function showLogin(divContent, divButton1, divButton2, toFunction) {
	var login = M("layerDIV");
	login.style.display = "block";
	if(smType == 'login'){
		login.innerHTML = getLoginText(smPath);
	}else{
		login.innerHTML = getJsConfirm("", divContent, "<input type=submit id=imb_Ok name=imb_Ok value=\""+divButton1+"\" onClick=\"this.disabled=true;" + toFunction + ";closeDIV();\" shortKey=\"T\" style=\"margin-top:10px;text-align:center;width:25px;height:60px;border-width:1px;font-size: 18px;border-top-color:#777;border-bottom-color:#ddc;border-left-color:#777;border-right-color:#ddc;color:#133F90;background-color:#EEE;font-family: MenksoftQagan;writing-mode:tb-rl;\">&nbsp;<input type=button id=imb_Cancel name=imb_Cancel value=\""+divButton2+"\" onClick=\"closeDIV();return false;\" shortKey=\"C\" style=\"margin-top:10px;text-align:center;width:25px;height:60px;border-width:1px;font-size: 18px;border-top-color:#777;border-bottom-color:#ddc;border-left-color:#777;border-right-color:#ddc;color:#133F90;background-color:#EEE;font-family: MenksoftQagan;writing-mode:tb-rl;\">");
	}
}

//设置DIV层的样式
function change() {
	//bodySize = getBodySize();
	var login = M("layerDIV");
	login.style.position = "absolute";
	var i = 0;
	if(smType == 'login' || smType == 'notice'){
		login.style.left = bodySize[0] + (bodySize[2] - i * popWidth) / 2 + "px";
		login.style.top = bodySize[1] + (bodySize[3] - i * popHeight) / 2 + "px";
	}else{
		var mLeft = bodySize[0] + bodySize[6] - i * popWidth - 20;
		var mTop = bodySize[1] + bodySize[7] - i * popHeight/2 - 20;
		if(mLeft < 0)
			mLeft = 20;
		if(mTop < 0)
			mTop = 20;
		login.style.left = mLeft + "px";
		login.style.top = mTop + "px";
	}
	login.style.width = i*popWidth + "px";
	login.style.height = i*popHeight + "px";
	popChange(i);
}
//让DIV层大小循环增大
function popChange(i) {
	var login = M("layerDIV");
	if(smType == 'login' || smType == 'notice'){
		login.style.left = bodySize[0] + (bodySize[2] - i * popWidth) / 2 + "px";
		login.style.top = bodySize[1] + (bodySize[3] - i * popHeight) / 2 + "px";
	}else{
		var mLeft = bodySize[0] + bodySize[6] - i * popWidth - 20;
		var mTop = bodySize[1] + bodySize[7] - i * popHeight/2 - 20;
		if(mLeft < 0)
			mLeft = 20;
		if(mTop < 0)
			mTop = 20;
		login.style.left = mLeft + "px";
		login.style.top = mTop + "px";
	}
	login.style.width = i * popWidth + "px";
	login.style.height = i * popHeight + "px";
	if (i < 1) {
		i = i + 0.1;
		setTimeout("popChange(" + i + ")", 10);//设置超时10毫秒
	}else{
		if(smType == 'notice'){
			fsmInterval = window.setInterval(checkAlphaNotice, 5);
		}
	}
}
//打开DIV层
function openDIV(idVal, divWidth, divHeight, divContent, divButton1, divButton2, toFunction) {
	//bodySize = getBodySize();
	popWidth = divWidth;
	popHeight = divHeight;
	smType = idVal;
	change();
	showLogin(divContent, divButton1, divButton2, toFunction);
	popCoverDiv();
	void (0);//不进行任何操作,如：<a href="#">aaa</a>
}
//关闭DIV层
function closeDIV() {
	M("layerDIV").style.display = "none";
	M("cover_div").style.display = "none";
	void (0);
}
function checkAlpha(){
	M("layerDIV").style.filter = "alpha(opacity="+fsmAlpha+");";
	fsmAlpha -= 10;
	if (fsmAlpha<=0){
		clearInterval(fsmInterval);
		fsmAlpha = 100;
		M("layerDIV").style.filter = "alpha(opacity="+fsmAlpha+");";
	}else if (fsmAlpha==50){
		closeDIV();
	}
}
function showLoginNotice(divContent, toFunction) {
	var login = M("layerDIV");
	login.style.display = "block";
	var noticeText = "<table width=\"100%\" height=\"100%\" bgcolor=\"#eeeeee\" cellpadding=\"5\" cellspacing=\"0\"><tr><td width=\"3%\" align=center bgcolor=#3A80F3><span id=\"imb_Title\" style=\"padding-left:3px;padding-right:3px;color:white;font-size:18px;line-height:22px;font-family: MenksoftQagan;writing-mode:tb-rl;\">"; 
	noticeText += "</span></td><td align=\"left\" nowrap><span id=\"imb_Content\" style=\"text-align: left;font-size: 18px;color: #000000;line-height: 22px;font-family: MenksoftQagan;writing-mode: tb-rl;\">" + divContent; 
	noticeText += "</span></td></tr></table>";
	login.innerHTML = noticeText;
}
//打开提示DIV层
function openNoticeDIV(divWidth, divHeight, divContent, toFunction) {
	//bodySize = getBodySize();
	smType = 'notice';
	popWidth = divWidth;
	popHeight = divHeight;
	change();
	showLoginNotice(divContent, toFunction);
	void (0);//不进行任何操作,如：<a href="#">aaa</a>
}
//关闭提示DIV层
function closeNoticeDIV() {
	M("layerDIV").style.display = "none";
	if(M("cover_div")){
		M("cover_div").style.display = "none";
	}
	void (0);
}
function checkAlphaNotice(){
	M("layerDIV").style.filter = "alpha(opacity="+fsmAlpha+");";
	fsmAlpha -= 2;
	if (fsmAlpha<=0){
		clearInterval(fsmInterval);
		fsmAlpha = 100;
		M("layerDIV").style.filter = "alpha(opacity="+fsmAlpha+");";
	}else if (fsmAlpha==10){
		closeNoticeDIV();
	}
}
function popLoginOk(){
	fsmInterval = window.setInterval(checkAlpha, 5);
}


$=function (id){
	return "string" == typeof id ? document.getElementById(id) : id;
}
function refreshCc() {
	var ccImg = $("login");
	if (ccImg) {
		nowTime = new Date();
		ccImg.src = smPath + "servlet/imageRand.servlet?time=" + nowTime.getTime();
	}
}
function refreshHebtee() {
	var ccImg = $("loginHebtee");
	if (ccImg) {
		nowTime = new Date();
		ccImg.src = smPath + "servlet/imageRandHebtee.servlet?time=" + nowTime.getTime();
	}
}
//删除文章
function isDelConfirm(id_, title_, state_){
	bodySize = getBodySize();
	document.forms[0].articleID.value = id_;
	document.forms[0].articleState.value = state_;
	openDIV("delArticle", 130, 320, " " + title_ + "<br/>    <font color='#FF0000'></font>   ", "", "", "delArticle_09()");
	return;
}
function delArticle_09(){
	document.forms[0].action=smPath + "article/delArticleSubmit.do";
	document.forms[0].submit();
}
//屏蔽文章
function isShieldConfirm(id_, title_, state_,blogUrl_){
	bodySize = getBodySize();
	document.forms[0].articleID.value = id_;
	document.forms[0].blogUrl.value = blogUrl_;
	document.forms[0].articleState.value = state_;
	openDIV("shieldArticle", 130, 320, " " + title_ + "<br/>      <font color='#FF0000'>  </font>  ", "", "", "shieldArticle_09()");
	return;
}
function shieldArticle_09(){
	document.forms[0].action=smPath + "manage/shieldArticleSubmit.do";
	document.forms[0].submit();
}
//提交好友申请
function isAnda(){
	bodySize = getBodySize();
	openDIV("isAnda", 130, 320, "<input type=\"text\" class=\"MNormalText\" size=\"38\" onfocus=\"isShowIme('ok');return false;\" name=\"applyText\" id=\"applyText\" maxlength=\"100\" value=\"  \" style=\"font-family: MenksoftQagan;writing-mode:tb-rl\"><br/>    ", "", "", "andaBoleh()");
	return;
}
function andaBoleh(){
	//document.forms[0].action= smPath + "anda/addAndaSubmit.do";
	//document.forms[0].submit();
	var blogUrl = document.forms[0].blogUrl.value;
	var applyText = document.forms[0].applyText.value;
	Blog.addAnda(blogUrl, applyText, andaBolehFruit);
}
function andaBolehFruit(msg){
	if(msg == 'sessionFail'){
		loginW();
	}else if(msg == 'error'){
		openNoticeDIV(180, 140, '  <br/>  <br/>','');
	}else if(msg == 'myself'){
		openNoticeDIV(180, 140, '   <br/>   <br/>   <br/>','');
	}else if(msg == 'sendMsgAnda'){
		openNoticeDIV(180, 140, ' <br/>  <br/>  <br/>  <br/>','');
	}else if(msg == 'alreadyAnda'){
		openNoticeDIV(180, 140, '    <br/>    <br/>   <br/>','');
	}else if(msg == 'andaMax'){
		openNoticeDIV(180, 150, '     <br/>     <br/>   1000  <br/>','');
	}else{
		openNoticeDIV(180, 140, ' <br/>    <br/>  <br/>   <br/>','');
	}
}
function isAgreeAnda(notice_id_,id_,state_){
	bodySize = getBodySize();
	document.forms[0].noticeID.value = notice_id_;
	document.forms[0].andaID.value = id_;
	document.forms[0].andaState.value = state_;
	var str;
	if(state_ == 'yes'){
		str = "     <font color='#006600'></font>   ";
	}else{
		str = "     <font color='#FF0000'> </font>   ";
	}
	openDIV("addAnda", 130, 320, str , "", "", "agreeAnda_09()");
	return;
}
function agreeAnda_09(){
	document.forms[0].action= smPath + "anda/agreeAndaSubmit.do";
	document.forms[0].submit();
}
//提交留言
function add_leaveword_submit(articleID_, type_){
	bodySize = getBodySize();
	if(articleID_ != ''){
		document.forms[0].articleID.value = articleID_;
	}
	if(type_ != ''){
		document.forms[0].leavewordType.value = type_;
	}
	Blog.nameOrBlogNameisNull(add_leaveword_submit1);
}
function add_leaveword_submit1(msg){
	if(msg){
		openNoticeDIV(240, 160, '   <br/>   <br/>  <br/>  <br/>','');
	}else{
		submit_div_09();
	}
}
//文章推荐
function add_home_article(articleID_, name_, title_, blogUrl_){
	bodySize = getBodySize();
	var type_ = dwr.util.getValue("homeArticleType");
	Blog.addRecommendArticle(articleID_, name_, title_, blogUrl_, type_, add_home_article_callback);
}
function add_home_article_callback(msg){
	if(msg == 'true'){
		openNoticeDIV(240, 160, '  <br/>  <br/>','');
	}else{
		openNoticeDIV(240, 160, '   <br/>  <br/>  <br/>','');
	}
}
//照片推荐
function add_home_photo(blogUrl, photo_sign_text, photo_album_id, photo_id, m_url, photo_size){
	bodySize = getBodySize();
	var type_ = dwr.util.getValue("homePhotoType" + photo_id);
	Blog.addRecommendPhoto(blogUrl, photo_sign_text, photo_album_id, photo_id, m_url, type_, photo_size, add_home_photo_callback);
}
function add_home_photo_callback(msg){
	if(msg == 'true'){
		openNoticeDIV(240, 160, '  <br/>  <br/>','');
	}else{
		openNoticeDIV(240, 160, '   <br/>  <br/>  <br/>','');
	}
}
//相册推荐
function add_home_photo_album(blogUrl, name, photo_album_id, photo_album_name, sign_text, cover_photo_id, cover_photo_url, photo_num){
	bodySize = getBodySize();
	var type_ = dwr.util.getValue("homePhotoAlbumType_" + photo_album_id);
	Blog.addRecommendPhotoAlbum(blogUrl, name, photo_album_id, photo_album_name, sign_text, type_, cover_photo_id, cover_photo_url, photo_num, add_home_photo_album_callback);
}
function add_home_photo_album_callback(msg){
	if(msg == 'true'){
		openNoticeDIV(240, 160, '  <br/>  <br/>','');
	}else{
		openNoticeDIV(240, 160, '   <br/>  <br/>  <br/>','');
	}
}
//删除留言1
function isDelLeavewordConfirm(id_, state_, articleID_, type_){
	bodySize = getBodySize();
	document.forms[0].leavewordID.value = id_;
	document.forms[0].leavewordState.value = state_;
	document.forms[0].articleID.value = articleID_;
	document.forms[0].leavewordType.value = type_;
	openDIV("delLeaveword", 130, 320, " <font color='#FF0000'></font>     ", "", "", "delLeaveword_09()");
	return;
}
function delLeaveword_09(){
	document.forms[0].action=smPath + "leaveword/delLeavewordSubmit.do";
	document.forms[0].submit();
}
//删除留言2
function isManageDelLeavewordConfirm(id_, state_, articleID_, type_){
	bodySize = getBodySize();
	document.forms[0].leavewordID.value = id_;
	document.forms[0].leavewordState.value = state_;
	document.forms[0].articleID.value = articleID_;
	document.forms[0].leavewordType.value = type_;
	openDIV("delLeaveword", 130, 320, "   <font color='#FF0000'></font>     ", "", "", "manageDelLeaveword_09()");
	return;
}
function manageDelLeaveword_09(){
	document.forms[0].action=smPath + "manage/manageDelLeavewordSubmit.do";
	document.forms[0].submit();
}
//删除提示消息
function isDelNoticeConfirm(id_){
	bodySize = getBodySize();
	document.forms[0].noticeID.value = id_;
	openDIV("delNotice", 130, 320, " <font color='#FF0000'></font>     ", "", "", "delNotice_09()");
	return;
}
function delNotice_09(){
	document.forms[0].action=smPath + "notice/delNoticeSubmit.do";
	document.forms[0].submit();
}
//删除好友
function isDelAndaConfirm(id_){
	bodySize = getBodySize();
	document.forms[0].andaID.value = id_;
	openDIV("delAnda", 130, 320, " <font color='#FF0000'></font>     ", "", "", "delAnda_09()");
	return;
}
function delAnda_09(){
	document.forms[0].action=smPath + "anda/delAndaSubmit.do";
	document.forms[0].submit();
}
function updLeaveword(id_, leavewordText_, leavewordState_, articleID_, leavewordID_, type_){
	leavewordText_ = leavewordText_.replace(/ \<br\/\>/g,'\r\n');
	document.forms[0].text.value = leavewordText_.replace(/\<br\/\>/g,' ');
	document.forms[0].state.value = leavewordState_;
	if(leavewordState_ == '0'){
		dwr.util.setValue('type1', '');
	}else if(leavewordState_ == '1'){
		dwr.util.setValue('type1', '');
	}
	document.forms[0].articleID.value = articleID_;
	document.forms[0].leavewordID.value = leavewordID_;
	document.forms[0].isUpdate.value = "Y";
	document.forms[0].leavewordType.value = type_;
	if(isIEE6){
		//document.body.scrollLeft=document.body.scrollWidth;
	}else{
		document.documentElement.scrollLeft=document.documentElement.scrollWidth;
	}
	getSelectPos('text');
}
function writeBack(id_, articleID_, toName_, toAndaID_, leavewordState_, type_){
	document.forms[0].text.value = toName_ + "    \r\n";
	document.forms[0].leavewordID.value = id_;
	document.forms[0].state.value = leavewordState_;
	if(leavewordState_ == '0'){
		dwr.util.setValue('type1', '');
	}else if(leavewordState_ == '1'){
		dwr.util.setValue('type1', '');
	}
	document.forms[0].articleID.value = articleID_;
	document.forms[0].toAndaID.value = toAndaID_;
	document.forms[0].leavewordType.value = type_;
	if(isIEE6){
		//document.body.scrollLeft=document.body.scrollWidth;
	}else{
		document.documentElement.scrollLeft=document.documentElement.scrollWidth;
	}
	getSelectPos('text');
}
//焦点放到最后
function getSelectPos(obj){
	var esrc = $(obj);
	if(esrc==null){
	   esrc=event.srcElement;
	}
	var rtextRange =esrc.createTextRange();
	rtextRange.moveStart('character',esrc.value.length);
	rtextRange.collapse(true);
	rtextRange.select();
}
function isUrl(s){
	var pattern =/^http:\/\/.+$/;
	flag = pattern.test(s);
	if (!flag) return false;
	return true;
}
function trim(str){
	return (str.replace(/(\s+)$/g, '')).replace(/^\s+/g, '');
}
function storeCaret(textEl) {
	if(textEl.createTextRange) 
		textEl.caretPos = document.selection.createRange().duplicate(); 
}
function insertAtCaret(textEl, text) {
	if(textEl.createTextRange && textEl.caretPos) {
		var caretPos = textEl.caretPos;
		caretPos.text =caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?text + ' ' : text; 
	}else{
		textEl.value = text;
	}
}
function insertimage(dialogtxt, defaultval){
	try{
		var url = trim(prompt('UP IMAGE', 'http://'));
		if(isUrl(url)){
			if($("text").value == '   '){
				$("text").value = '';
			}
			insertAtCaret($("text"), "\n[img]"+url+"[/img]\n");
			//$("text").innerHTML += "[img]"+url+"[/img]";
			//$("text").focus();
		}
	}catch(err){}
}
function insertswf(dialogtxt, defaultval){
	try{
		var url = trim(prompt('','http://'));
		if(isUrl(url)){
			if($("text").value == '   '){
				$("text").value = '';
			}
			insertAtCaret($("text"), "\n[swf]"+url+"[/swf]\n");
			//$("text").innerHTML += "[swf]"+url+"[/swf]\n";
			//$("text").focus();
		}
	}catch(err){}
}
function loginSubmit(){ 
	Blog.login($("userNameLogin").value, $("passwordLogin").value, $("loginRandLogin").value, isLoginOrError);
}
function isLoginOrError(msg){
	if(msg == 'loginRandError'){
		$("smMessage").innerHTML = "<font color='#FF0000'><br><br><br></font>";
	}else if(msg == 'loginNotPass'){
		$("smMessage").innerHTML = "<font color='#FF0000'><br><br><br><br><br><br></font>";
	}else if(msg == 'loginOk'){
		$("smMessage").innerHTML = "<font color='#006600'><br><br></font>";
		popLoginOk();
	}else{
		$("smMessage").innerHTML = msg;
	}
}
function loginW(){
	openDIV("login", 247, 160, "", "", "");
	return;
}
function submit_div_09(){
	Blog.getSessionState(isLogin);
}
function addArticle(){
	Blog.getSessionState(isLogin);
}
function updArticle(){
	Blog.getSessionState(isLogin);
}
function isLogin(msg){
	if(msg == 'sessionFail'){
		loginW();
	}else{
		document.forms[0].submit();
	}
}
// 控制textarea文字长度
function onModChange(s,max){
	if(s.value.length>max){
		s.value = s.value.substring(0,max);
		return false;
	}
}
function setPath(iPath){
	smPath = iPath;
}
var currentFocusPanel=null;
function showOptions(obj){
	if(currentFocusPanel!=null){
		currentFocusPanel.style.display="none";
		currentFocusPanel = null;
	}else{
		var optPanel=$(obj.id+"_options");
		optPanel.style.display="block";
		chooseCustomer(optPanel, obj);
		currentFocusPanel=optPanel;
	}
}
function chooseOpt(obj, name, id){
	dwr.util.setValue(name, id);
	$(obj.parentElement.targetBox).value=obj.innerText;
	closeOptPanel(obj.parentElement.id);
}
function closeOptPanel(pid){
	$(pid).style.display="none";
	currentFocusPanel=null;
}
var bakObj;		//定义一个空的全局变量；
function chooseCustomer(optPanel, obj){
	bakObj = obj;	//把此方法传进来的参数即当前所点对象使bakObj初始化；
	var CustomerFram = optPanel;		//获取弹出框对象
	var hidivmt = obj.offsetTop;	//获取当前对象居body顶部的高度
	var hidivml = obj.offsetLeft;	//获取当前对象居body左部的宽度
	var objWidth = obj.offsetWidth;		//获取当前对象的实际宽度
	var objHeight = obj.offsetHeight;	//获取当前对象的实际高度
	CustomerFram.style.display ="block";

	var aBox = obj;//需要获得位置的对象
	do {
		aBox = aBox.offsetParent;
		hidivml += aBox.offsetLeft;
		hidivmt += aBox.offsetTop;
	} while( aBox.tagName != "BODY" );

	var cusHeight = CustomerFram.offsetHeight;		//获取弹出框的实际高度
	var cusWidth = CustomerFram.offsetWidth;		//获取弹出框的实宽度
	var bodyHeight = document.body.clientHeight;
	var bodyWidth = document.body.clientWidth;

	CustomerFram.style.left = hidivml+objWidth+1;
	CustomerFram.style.top = hidivmt+1;
	/*
	if(hidivml+cusWidth>=bodyWidth){
		CustomerFram.style.left = hidivml+cusWidth+1;
	}
	if(hidivmt+cusHeight>=bodyHeight-objHeight){
		CustomerFram.style.top = hidivmt-cusHeight+1;
	}*/
}
//-->
