var Magic_validate_number = 0;
var USE_BASE64 = true;
var oTargetElm = "";
var pop_msg_templete = '<div id="#msgboxid#" name="#msgboxname#" class="#msgboxclass# msg_pop"><div>#msgboxContent#</div></div>';
var pop_left_msg_templete = '<div id="#msgboxid#" name="#msgboxname#" class="#msgboxclass# msg_pop_right"><div>#msgboxContent#</div></div>';

function initContainer(){
		var windowHeight = $(window).height();
		var containerHeight = $("#container").height();
		if(windowHeight-containerHeight > 0){
			var iTop = Math.floor((windowHeight-containerHeight)/2);
			$("#container").css("margin-top",iTop +"px");
		}
}

function createXml(str){
　　if(document.all)
	{
	　　var xmlDom=new ActiveXObject("Microsoft.XMLDOM");
	　　xmlDom.loadXML(str);
	　　return xmlDom;
　　}
　　else
	{
	　　return new DOMParser().parseFromString(str, "text/xml");	
	}

}

function getUrlParam()
{
	var url_parameter = window.location.href.match(/\?(.*)$/);
	if(url_parameter)
	{
		url_parameter = url_parameter[1].split("#")[0];
	}
	else
	{
		url_parameter = "";
	}
	return url_parameter;
}

function getParam(){
	var oUrl = new Object();
	var param = "";
	var url_parameter = window.location.href.match(/\?(.*)$/);
	//alert(url_parameter[1]);
	if(url_parameter && url_parameter[1]!="")
	{
		url_parameter = url_parameter[1].split("&");
		for(var i = 0; i<url_parameter.length; i++)
		{
			var aTemp = url_parameter[i].split("=");
			if(aTemp.length == 2)
			{
				oUrl[aTemp[0]] = aTemp[1].split("#")[0];
			}
		}
	}
	for(var i = 0; i < arguments.length; i++)
	{
		if(oUrl[arguments[i]])
		{		
				//alert(base64encode(utf16to8(oUrl[arguments[i]])));
				//alert(encodeURI("保险"));
				//alert(encodeURIComponent("保险"));				
				if(document.all)
				{
					param = param + "&" + arguments[i] + "=" + encodeURI(htmlEncode(oUrl[arguments[i]]));
				}
				else
				{
					param = param + "&" + arguments[i] + "=" + oUrl[arguments[i]];
				}
		}
	}
	//alert(param);
	return param;
}

function addZero(str){
	return str > 9 ? str : "0" + str;
}

/*************turn_page************/
/*
 *msg xml对象
 *param 需要传递的参数
 *返回翻页代码，需要1.将其插入翻页容器，2.对其链接加入访问事件和其他处理（a.拼合成完整的链接,b.处理链接参数生成js事件调用）
*/
function turn_page(msg,param)
{
	//如果内容少于一页，则不显示翻页
	if($("pageinfo pagetotal",msg).text()/1 == 1)
	{
		var html = "";
		return html;
	}
	var html = '<p class="turn_page">';
	param = param ? '&' + param : "";
	if($("pageinfo gotopage",msg).text()/1 > 1 )
	{
		html = html + '<span><a href="#" class="&goto_page='+ ($("pageinfo gotopage",msg).text()/1 - 1) + param +'">上一页</a></span>';
	}
	if($("pageinfo gotopage",msg).text()/1 > 3) 
	{
		html = html + '<span><a href="#" class="&goto_page=1'+ param +'">1</a></span>';
		if($("pageinfo gotopage",msg).text()/1 > 4) 
		{
			html = html + '...';	
		}
	}
	var iBegin=(($("pageinfo gotopage",msg).text()/1 - 2) < 1)? 1: ($("pageinfo gotopage",msg).text()/1 - 2);
	var iEnd = (($("pageinfo gotopage",msg).text()/1 + 2) > ($("pageinfo pagetotal",msg).text()/1)) ? ($("pageinfo pagetotal",msg).text()/1) : ($("pageinfo gotopage",msg).text()/1 + 2);
	for(var i = iBegin; i <= iEnd; i++ )
	{
		if( i == $("pageinfo gotopage",msg).text()/1)
		{
			html = html + '<span class="current">'+ i +'</span>';	
		}
		else
		{
			html = html + '<span><a href="#" class="&goto_page='+ i + param +'">'+ i +'</a></span>';
		}
	}
	if(($("pageinfo gotopage",msg).text()/1 + 2) < $("pageinfo pagetotal",msg).text()/1) 
	{
		if(($("pageinfo gotopage",msg).text()/1 + 3) < $("pageinfo pagetotal",msg).text()/1) 
		{
			html = html + '...';	
		}
		html = html + '<span><a href="#" class="&goto_page='+ $("pageinfo pagetotal",msg).text() + param +'">'+ $("pageinfo pagetotal",msg).text() +'</a></span>';
	}
	if($("pageinfo gotopage",msg).text()/1 < $("pageinfo pagetotal",msg).text()/1 )
	{
		html = html + '<span><a href="#" class="&goto_page='+ ($("pageinfo gotopage",msg).text()/1 + 1) + param +'">下一页</a></span>';
	}
	html = html +'共<b>'+ $("pageinfo rowtotal",msg).text() +'</b>条</p>';
	return html;
}
/*******
  <pageinfo>

    <gotopage><![CDATA[1]]></gotopage>

    <rowsperpage><![CDATA[12]]></rowsperpage>

    <rowbegin><![CDATA[1]]></rowbegin>

    <rowend><![CDATA[12]]></rowend>

    <rowtotal><![CDATA[1121]]></rowtotal>

    <pagetotal><![CDATA[94]]></pagetotal>

    <statusparam />

    <empty><![CDATA[false]]></empty>

    <overflow><![CDATA[false]]></overflow>

  </pageinfo>
*********/

/**********creat_point在地图上根据xml进行标点**************/
function creat_point(msg,style)
{
	if(!style)
	{
		var style = "";
	}
	var aMap = [];
	maps.clearOverLays();
	//$("img.has_point").unbind();
	var points = [];
	$("opublish",msg).each(function(i){
		if($("x",this).text()!="")
		{
			points.push(new LTPoint( $("x",this).text(),$("y",this).text()));
			var marker = new LTMarker( new LTPoint( $("x",this).text(),$("y",this).text()) ); 
			maps.addOverLay( marker ); 
			var title = $("title",this).text();
			var html= '<div class="over_map_box_info clearfix">';
				if($("content_class",this).text()=="movement")
				{
					html= html + '<div class="photo"><img alt="'+$("title",this).text()+'" src="'+($("imgurl",this).text()? $("imgurl",this).text() : "/images/no_photo.gif") +'" border="0" /></div>';
					html= html + '<div class="summary">';
					var xExend = createXml($("extend_info",this).text());
					html= html + '<span class="time clearfix">时间：'+ $("startdate",xExend).text() +' 至 '+ $("enddate",xExend).text() +'</span>';
					html= html + '<span class="area clearfix">区域：'+ $("area",xExend).text() +'</span>';
					html= html + '<span class="address clearfix">地址：'+ $("address",xExend).text() +'</span>';
					html= html + '<span class="phone clearfix">电话：'+ $("phone",xExend).text() +'</span>';
					html= html + '<span class="link"><a href="/move/news_view.shtml?id='+ $("id",this).text() +'" target="_blank">查看详细</a></span>';
					html= html + '</div>';
				}
				else
				{
					if($("imgurl",this).text() != "")
					{
						html= html + '<div class="photo_news"><img alt="'+$("title",this).text()+'" src="'+ $("imgurl",this).text() +'" border="0" /></div>';
					}
					html= html + '<div class="summary_news">';
					html= html + ($("description",this).text() ? $("description",this).text() : getString($("body",this).text(),200)+ "...") ;
					html= html + '<span class="link"><a href="/move/news_view.shtml?id='+ $("id",this).text() +'" target="_blank">查看详细</a></span>';					
					html= html + '</div>';
				}
			var oLine = document.getElementById("point_" + style +$("id",this).text());
			aMap.push(oLine);
			LTEvent.addListener( marker , "click" ,openInfoWin(marker,html,title));
			LTEvent.addListener( oLine , "mouseover" ,openInfoWin(marker,html,title));
		}
	});
	
	$("omark",msg).each(function(i){
		points.push(new LTPoint( $("x",this).text(),$("y",this).text()));
		var marker = new LTMarker( points[i] ); 
		maps.addOverLay( marker ); 
		var title = $("title",this).text();
		var html= '<div class="over_map_box_info clearfix">';
			html= html + '<div class="photo"><img alt="'+$("title",this).text()+'" src="'+($("picture",this).text()? $("picture",this).text() : "/images/no_photo.gif") +'" border="0" /></div>';
			html= html + '<div class="summary">';
			if($("address",this).text())
			{
				html= html + '<span class="address clearfix">地址：'+ $("address",this).text() +'</span>';
			}
			if($("phone",this).text())
			{
				html= html + '<span class="photo clearfix">电话：'+ $("phone",this).text() +'</span>';
			}
			html= html + '<span class="content clearfix">'+ getString($("content",this).text(),55) +'</span>';
			html= html + '<span class="link">';
			html= html + '<a href="/map/map_view.shtml?id='+ $("id",this).text() +'" target="_blank">查看详细</a> ';
			if(getCurrentUsr() != null)
			{
				html = html + '<a href="#" onclick="quote_it(this);return false;" id="map_quote_'+ $("id",this).text() +'" subject_id="'+ $("id",this).text() +'" subject_title="'+ $("title",this).text() +'" category="point" >举报</a> ';
				if($("issystem",this).text()=="true")
				{
					if(/^001(\d)*$/.test($("classify",this).text()))
					{
						html = html + '<a href="/map/map_renew_shop.shtml?id='+ $("id",this).text() +'" target="_blank" >补充修正</a>';
					}
					if(/^002(\d)*$/.test($("classify",this).text()))
					{
						html = html + '<a href="/map/map_renew_build.shtml?id='+ $("id",this).text() +'" target="_blank" >补充修正</a>';
					}
				}
			}
			html= html + '</span>';
			
			html= html + '</div>';
		var oLine = document.getElementById("point_" + style + $("id",this).text());
		LTEvent.addListener( marker , "click" ,openInfoWin(marker,html,title));
		LTEvent.addListener( oLine , "mouseover" ,openInfoWin(marker,html,title));
	});

	$("osubmark",msg).each(function(i){
		points.push(new LTPoint( $("x",this).text(),$("y",this).text()));
		var marker = new LTMarker( points[i] ); 
		maps.addOverLay( marker ); 
		var title = $("title",this).text();
		if($("point_type",this).text()=="map")
		{
			var html= '<div class="over_map_box_info clearfix">';
				html= html + '<div class="photo"><img alt="'+$("title",this).text()+'" src="'+($("picture",this).text()? $("picture",this).text() : "/images/no_photo.gif") +'" border="0" /></div>';
				html= html + '<div class="summary">';
				if($("address",this).text())
				{
					html= html + '<span class="address clearfix">地址：'+ $("address",this).text() +'</span>';
				}
				if($("phone",this).text())
				{
					html= html + '<span class="photo clearfix">电话：'+ $("phone",this).text() +'</span>';
				}
				html= html + '<span class="content clearfix">'+ getString($("content",this).text(),55) +'</span>';
				html= html + '<span class="link">';
				html= html + '<a href="/map/map_view.shtml?id='+ $("markid",this).text() +'" target="_blank">查看详细</a> ';
				if(getCurrentUsr() != null)
				{
					html = html + '<a href="#" onclick="quote_it(this);return false;" id="map_quote_'+ $("markid",this).text() +'" subject_id="'+ $("markid",this).text() +'" subject_title="'+ $("title",this).text() +'" category="point" >举报</a> ';
					if($("issystem",this).text()=="true")
					{
						if(/^001(\d)*$/.test($("classify",this).text()))
						{
							html = html + '<a href="/map/map_renew_shop.shtml?id='+ $("id",this).text() +'" target="_blank" >补充修正</a>';
						}
						if(/^002(\d)*$/.test($("classify",this).text()))
						{
							html = html + '<a href="/map/map_renew_build.shtml?id='+ $("id",this).text() +'" target="_blank" >补充修正</a>';
						}
					}
				}
				html= html + '</span>';
				
				html= html + '</div>';
		}
		if($("point_type",this).text()=="mov")
		{
			var html= '<div class="over_map_box_info clearfix">';
				html= html + '<div class="photo"><img alt="'+$("title",this).text()+'" src="'+($("imgurl",this).text()? $("imgurl",this).text() : "/images/no_photo.gif") +'" border="0" /></div>';
				html= html + '<div class="summary">';
				var xExend = createXml($("extend_info",this).text());
				html= html + '<span class="time clearfix">时间：'+ $("startdate",xExend).text() +' 至 '+ $("enddate",xExend).text() +'</span>';
				html= html + '<span class="area clearfix">区域：'+ $("area",xExend).text() +'</span>';
				html= html + '<span class="address clearfix">地址：'+ $("address",xExend).text() +'</span>';
				html= html + '<span class="phone clearfix">电话：'+ $("phone",xExend).text() +'</span>';
				html= html + '<span class="link"><a href="/move/news_view.shtml?id='+ $("markid",this).text() +'" target="_blank">查看详细</a></span>';
				html= html + '</div>';
				html= html + '</div>';
		}
		
		var oLine = document.getElementById("point_" + style + $("id",this).text());
		LTEvent.addListener( marker , "click" ,openInfoWin(marker,html,title));
		LTEvent.addListener( oLine , "mouseover" ,openInfoWin(marker,html,title));
	});

	$("system_access_users",msg).each(function(i){
		points.push(new LTPoint( $("params13",this).text(),$("params14",this).text()));
		var marker = new LTMarker( points[i] ); 
		maps.addOverLay( marker ); 
		var title = $("usr_name",this).text();
		var html= '<div class="over_map_box_info clearfix">';
			html= html + '<div class="photo"><img alt="'+$("usr_name",this).text()+'" src="'+($("params1",this).text()? $("params1",this).text() : "/images/no_photo.gif") +'" border="0" /></div>';
			html= html + '<div class="summary">';
			html= html + '<span class="address clearfix">称号：'+ $("params6",this).text() +'</span>';
			html= html + '<span class="photo clearfix">标金：'+ $("params7",this).text() +'</span>';
			html= html + '<span class="content clearfix">'+ getString($("params3",this).text(),55) +'</span>';
			html= html + '<span class="link">';
			html= html + '<a href="/person/person.shtml?usr_id='+ $("usr_id",this).text() +'" target="_blank">查看详细</a>';
			html= html + '</span>';
			html= html + '</div>';
		var oLine = document.getElementById("point_" + style + $("usr_id",this).text());
		LTEvent.addListener( marker , "click" ,openInfoWin(marker,html,title));
		LTEvent.addListener( oLine , "mouseover" ,openInfoWin(marker,html,title));
	});
	maps.getBestMap(points);
}
function openInfoWin(marker,html,title)
{
	return function(p){ //这个p是该点的坐标
		var sTitle = '<h3 class="over_map_box_title">'+title+'</h3>';
		maps.moveToCenter( new LTPoint(marker.getPoint().getLongitude() , marker.getPoint().getLatitude() ));
		var win = marker.openInfoWinHtml(html); 
		win.setTitle(sTitle);
		win.moveToShow(); //移动地图以确保信息浮窗在地图范围内
		if($("option.current_point500").size()<1)
		{
			var sArea = '';
			sArea = sArea + '<option class="current_point500" value="">当前位置附近500米</option>';
			sArea = sArea + '<option class="current_point2000" value="">当前位置附近2000米</option>';
			sArea = sArea + '<option class="current_point5000" value="">当前位置附近5000米</option>';
			$("select.select_area").append(sArea);
		}
		$("option.current_point500").val('&x='+ marker.getPoint().getLongitude() +'&y='+ marker.getPoint().getLatitude() +'&length=500');
		$("option.current_point2000").val('&x='+ marker.getPoint().getLongitude() +'&y='+ marker.getPoint().getLatitude() +'&length=200');
		$("option.current_point5000").val('&x='+ marker.getPoint().getLongitude() +'&y='+ marker.getPoint().getLatitude() +'&length=5000');
		$("#current_point").html('你溜达到了：'+ title +' 东经：'+ marker.getPoint().getLongitude()/100000 +'度，北纬：'+ marker.getPoint().getLatitude()/100000 +'度');
	};
}

/**将字符串中的&nbps;替换成" "**/
function replace_blank(sString)
{
	var re=/&nbsp;/g;
	sString = sString.replace(re," ");
	return sString;
}

/*************base64******************/
var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var base64DecodeChars = new Array(
　　-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
　　-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
　　-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
　　52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
　　-1,　0,　1,　2,　3,  4,　5,　6,　7,　8,　9, 10, 11, 12, 13, 14,
　　15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
　　-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
　　41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1);
function base64encode(str) {
　　var out, i, len;
　　var c1, c2, c3;
　　len = str.length;
　　i = 0;
　　out = "";
　　while(i < len) {
 c1 = str.charCodeAt(i++) & 0xff;
 if(i == len)
 {
　　 out += base64EncodeChars.charAt(c1 >> 2);
　　 out += base64EncodeChars.charAt((c1 & 0x3) << 4);
　　 out += "==";
　　 break;
 }
 c2 = str.charCodeAt(i++);
 if(i == len)
 {
　　 out += base64EncodeChars.charAt(c1 >> 2);
　　 out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
　　 out += base64EncodeChars.charAt((c2 & 0xF) << 2);
　　 out += "=";
　　 break;
 }
 c3 = str.charCodeAt(i++);
 out += base64EncodeChars.charAt(c1 >> 2);
 out += base64EncodeChars.charAt(((c1 & 0x3)<< 4) | ((c2 & 0xF0) >> 4));
 out += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >>6));
 out += base64EncodeChars.charAt(c3 & 0x3F);
　　}
　　return out;
}
function base64decode(str) {
　　var c1, c2, c3, c4;
　　var i, len, out;
　　len = str.length;
　　i = 0;
　　out = "";
　　while(i < len) {
 /* c1 */
 do {
　　 c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
 } while(i < len && c1 == -1);
 if(c1 == -1)
　　 break;
 /* c2 */
 do {
　　 c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff];
 } while(i < len && c2 == -1);
 if(c2 == -1)
　　 break;
 out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4));
 /* c3 */
 do {
　　 c3 = str.charCodeAt(i++) & 0xff;
　　 if(c3 == 61)
　return out;
　　 c3 = base64DecodeChars[c3];
 } while(i < len && c3 == -1);
 if(c3 == -1)
　　 break;
 out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2));
 /* c4 */
 do {
　　 c4 = str.charCodeAt(i++) & 0xff;
　　 if(c4 == 61)
　return out;
　　 c4 = base64DecodeChars[c4];
 } while(i < len && c4 == -1);
 if(c4 == -1)
　　 break;
 out += String.fromCharCode(((c3 & 0x03) << 6) | c4);
　　}
　　return out;
}
function utf16to8(str) {
　　var out, i, len, c;
　　out = "";
　　len = str.length;
　　for(i = 0; i < len; i++) {
 c = str.charCodeAt(i);
 if ((c >= 0x0001) && (c <= 0x007F)) {
　　 out += str.charAt(i);
 } else if (c > 0x07FF) {
　　 out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
　　 out += String.fromCharCode(0x80 | ((c >>　6) & 0x3F));
　　 out += String.fromCharCode(0x80 | ((c >>　0) & 0x3F));
 } else {
　　 out += String.fromCharCode(0xC0 | ((c >>　6) & 0x1F));
　　 out += String.fromCharCode(0x80 | ((c >>　0) & 0x3F));
 }
　　}
　　return out;
}
function utf8to16(str) {
　　var out, i, len, c;
　　var char2, char3;
　　out = "";
　　len = str.length;
　　i = 0;
　　while(i < len) {
 c = str.charCodeAt(i++);
 switch(c >> 4)
 {
　 case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
　　 // 0xxxxxxx
　　 out += str.charAt(i-1);
　　 break;
　 case 12: case 13:
　　 // 110x xxxx　 10xx xxxx
　　 char2 = str.charCodeAt(i++);
　　 out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
　　 break;
　 case 14:
　　 // 1110 xxxx　10xx xxxx　10xx xxxx
　　 char2 = str.charCodeAt(i++);
　　 char3 = str.charCodeAt(i++);
　　 out += String.fromCharCode(((c & 0x0F) << 12) |
　　　　((char2 & 0x3F) << 6) |
　　　　((char3 & 0x3F) << 0));
　　 break;
 }
　　}
　　return out;
}
/************base64*************/

/**************设置nav_path************/
/*
 * 1.通过grp_id
 * 2.通过topic_id
 * 3.是否有描述，如果有描述则将描述做为最后一项，如果没有描述，则将grp_id或者topic_id做为最后一项，并将地址去掉
 * 例子：
 * ajax_nav_path.app({param:[grp_id或者topic_id，通过url传递过来的],swords:"[为空或者有字符串，必须设置]"});
 */
var ajax_nav_path = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=groupsort&actiontype=indexdata&rtype=xml",
	beforeAjax: function(options){
		options.data = options.data + options.param;
		return true;
	},
	ajaxBeforeSend: function(xmlHttp,options){
		return true;
	},
	successPass: function(msg,options){
		if(/grp_id/.test(options.param))
		{
			if(options.swords != "")
			{
				var html = '<a href="/">首页</a> &gt; <a href="/group/group_all.shtml">小组</a> &gt; <a href="/group/group_all.shtml?grp_sort='+ $("gsort_id",msg).text() +'">'+ $("gsort_name",msg).text() +'</a> &gt; <a href="/group/group_view.shtml?grp_id='+ $("grp_id",msg).text() +'" id="nav_grp_name" grp_id="'+ $("grp_id",msg).text() +'">'+ $("grp_name",msg).text() +'</a> &gt; ' + options.swords;
			}
			else
			{
				var html = '<a href="/">首页</a> &gt; <a href="/group/group_all.shtml">小组</a> &gt; <a href="/group/group_all.shtml?grp_sort='+ $("gsort_id",msg).text() +'">'+ $("gsort_name",msg).text() +'</a> &gt; <span id="nav_grp_name" grp_id="'+ $("grp_id",msg).text() +'">' + $("grp_name",msg).text() +'</span>';
			}
		}
		if(/topic_id/.test(options.param))
		{
			if(options.swords != "")
			{
				var html = '<a href="/">首页</a> &gt; <a href="/group/group_all.shtml">小组</a> &gt; <a href="/group/group_all.shtml?grp_sort='+ $("gsort_id",msg).text() +'">'+ $("gsort_name",msg).text() +'</a> &gt; <a href="/group/group_view.shtml?grp_id='+ $("grp_id",msg).text() +'" id="nav_grp_name" grp_id="'+ $("grp_id",msg).text() +'">'+ $("grp_name",msg).text() +'</a> &gt; <a href="/group/topic_view.shtml?topic_id='+ $("topic_id",msg).text() +'">'+ $("topic_name",msg).text() +'</a> &gt;' + options.swords;
			}
			else
			{
				var html = '<a href="/">首页</a> &gt; <a href="/group/group_all.shtml">小组</a> &gt; <a href="/group/group_all.shtml?grp_sort='+ $("gsort_id",msg).text() +'">'+ $("gsort_name",msg).text() +'</a> &gt; <a href="/group/group_view.shtml?grp_id='+ $("grp_id",msg).text() +'" id="nav_grp_name" grp_id="'+ $("grp_id",msg).text() +'">'+ $("grp_name",msg).text() +'</a> &gt; '+ $("topic_name",msg).text();
			}
		}
	
		$("#nav_path").html(html);
	},
	successFailed: function(msg,options){
	},
	ajaxError: function(options,xmlHttp){
	}
},"navPath","single");

/**************日期处理**************/
/*
 *将数据库取出的日期最后的.0去掉，如：2008-05-13 19:07:38.0 处理为：2008-05-13 19:07:38
 */
function getMyData(sString)
{
	if(sString !="")
	{
		return sString.split(".")[0];
	}
	return sString;
}
/*
 *将数据库取出的日期的时分秒去掉，如：2008-05-13 19:07:38.0 处理为：2008-05-13
 */
function getMyDay(sString)
{
	if(sString !="")
	{
		return sString.split(" ")[0];
	}
	return sString;
}

function getMonthDay(sString)
{
	if(sString !="")
	{
		sString = sString.split(" ")[0];
		aString = sString.split("-");
		sString = aString[1] + "-" + aString[2];
	}
	return sString;
}

function getMonthDayHour(sString)
{
	if(sString !="")
	{
		sHour = sString.split(" ")[1];
		sHour = sHour.split(".")[0];
		sString = sString.split(" ")[0];
		aString = sString.split("-");
		aHour = sHour.split(":");
		sString = aString[1] + "-" + aString[2] + " " + aHour[0] + ":" + aHour[1];
	}
	return sString;
}

function setCookie(sName,sValue,oExpires,sPath,sDomain,bSecure)
{
	var sCookie = sName + "=" + encodeURIComponent(sValue);
	if(oExpires)
	{
		sCookie = sCookie + "; expires=" + oExpires.toGMTString();
	}
	if(sPath)
	{
		sCookie = sCookie + "; path=" + sPath;
	}
	if(sDomain)
	{
		sCookie = sCookie + "; domain=" + sDomain;
	}
	if(bSecure)
	{
		sCookie = sCookie + "; secure";
	}
	document.cookie = sCookie; 
}
function getCookie(sName)
{
	var sRE = "(?:;)?" +sName + "=([^;]*);?";
	var oRE = new RegExp(sRE);
	if (oRE.test(document.cookie))
	{
		return decodeURIComponent(RegExp["$1"]);
	}
	else
	{
		return null;
	}
}

function getCurrentUsr()
{
	var sCookie = getCookie("LETGOO_TOKEN");
	if(sCookie == null)
	{
		return null;
	}
	sCookie = utf8to16(base64decode(sCookie));
	return sCookie.split("@")[0]; 
}
function getCurrentUsrName()
{
	var sCookie = getCookie("LETGOO_TOKEN");
	if(sCookie == null)
	{
		return null;
	}
	sCookie = utf8to16(base64decode(sCookie));
	var aArray= sCookie.split("|");
	return aArray[aArray.length-1];
}

function getString(sString,sLength)
{
	if($("#exend_deal_content_box").size()<1)
	{
		$(window.document.body).append('<div id="exend_deal_content_box" style="display: none"></div>');
	}
	$("#exend_deal_content_box").html(sString);
	sString = $.trim($("#exend_deal_content_box").text());
	//var reg = new RegExp("<br\/>","ig");
	//sString = sString.replace(reg,"");
	if(sString.length <= sLength)
	{
		return sString;
	}
	else
	{
		sString = '<span title="'+ sString +'">'+ sString.substring(0,sLength-2) +'...</span>';
	}
	return sString;
}

/******************站内短信****************/
function send_mail(elm)
{
	if($("#box_mail").size() == 0)
	{
		var xleft = Math.floor(($(document.body).width() - 500)/2);
		var xtop = Math.floor(($(window).height() - 382)/2);
		var html = '<div id="box_mail" class="pop_box" style="left:'+ xleft +'px; top: '+ xtop +'px;">';
			html = html + '<div id="box_mail_top" class="pop_box_top"><span>发送消息</span><img class="pop_box_close" src="/css/pop_box_close.gif" /></div>';
			html = html + '<div id="box_mail_content" class="pop_box_content">';
			html = html + '<form id="box_mail_add_form" class="pop_box_form" name="box_mail_add_form" method="post" action="" >';
			html = html + '<fieldset >';
			html = html + '<input name="touser" id="box_touser" type="hidden" value="" class="inputText" /><input name="tousername" id="box_tousername" type="hidden" value="" class="inputText" />';
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_mail_title" >标题</label></div>';
			html = html + '<div class="box_input"><input name="title" type="text" id="box_mail_title" class="box_inputText required v_maxlength-50"  title="消息标题" /></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_mail_contents" >内容</label></div>';
			html = html + '<div class="box_input"><textarea name="contents" id="box_mail_contents" class="box_textareaStyle v_maxlength-400" cols="40" rows="5"></textarea></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="box_buttonBox"><input type="submit" class="submitButton" value="提交" id="box_mail_add_bt" /></div>';
			html = html + '<div id="BoxMailAddMsgBox" class="pop_box_msg"></div>';
			html = html + '</fieldset>';
			html = html + '</form>';
			html = html + '</div>';
			html = html + '</div>';
		$(document.body).append(html);
		var validator= new Magic_validation("box_mail_add_form",{ onsubmit: false, requiredPlace: "prevSibling", introPlace: "nextSibling", errPlace: "nextSibling"});
		$('#box_mail').Resizable(
			{
				dragHandle: '#box_mail_top',
				handlers: {
					se: '#windowresize'
				}
			}
		);
		oTargetElm = elm;
	}
	if(document.all)
	{
		var sScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
	}
	else
	{
		var sScrollTop = pageYOffset;
	}
	if(oTargetElm && $(oTargetElm).attr("id") != $(elm).attr("id") && $('#box_mail').css('display') != 'none')
	{
		$("#box_mail_add_form")[0].reset();
		$('#box_mail').TransferTo({
			to:$(oTargetElm).attr("id"),
			className:'transferer2', 
			duration: 400,
			complete:function(){
				if($("#box_mail").offset().top < sScrollTop || $("#box_mail").offset().top > (sScrollTop + $(window).height()) )
				{
					$("#box_mail").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
				}
				$(elm).TransferTo({
					to:'box_mail',
					className:'transferer2', 
					duration: 400,
					complete: function()
					{
						$('#box_mail').show();
					}
				});
			}
		}).hide();
	}
	else
	{
		if($("#box_mail").offset().top < sScrollTop || $("#box_mail").offset().top > (sScrollTop + $(window).height()) )
		{
			$("#box_mail").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
			//alert($("#box_mail").css("top"));
		}
		$(elm).TransferTo(
			{
				to:'box_mail',
				className:'transferer2', 
				duration: 400,
				complete: function()
					{
						$('#box_mail').show();
					}
			}
		);		
	}
	oTargetElm = elm;
	$("#box_mail_top span").html('发送消息给（'+ $(elm).attr("usr_name")+'）');
	$("#box_touser").val($(elm).attr("usr_id"));
	$("#box_tousername").val($(elm).attr("usr_name"));
	$('#box_mail_add_form').unbind();
	$("#box_mail_add_form").submit(function(){
		ajax_box_mail_add.app({param : $('#box_mail_add_form').serialize(),elm: $(elm).attr("id")});
		return false;
	});
	$('#box_mail img.pop_box_close').unbind();
	$('#box_mail img.pop_box_close').bind(
		'click',
		function()
		{
			$('#box_mail').TransferTo(
				{
					to:$(elm).attr("id"),
					className:'transferer2', 
					duration: 400
				}
			).hide();
		}
	);
	return false;
}
var mail_box_add_msg = new Magic_AjaxMsg("","boxMailAddMsg",{timeout: -999,place:"BoxMailAddMsgBox"});

var ajax_box_mail_add = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=message&actiontype=send&rtype=xml",
	beforeAjax: function(options){
		options.data = options.data + "&fromuser=" + getCurrentUsr();
		options.formData = options.param;
		return Magic_validation.checkAll("box_mail_add_form");
	},
	ajaxBeforeSend: function(xmlHttp,options){
		mail_box_add_msg("短信发送中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		mail_box_add_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var elm = options.elm ;
		window.setTimeout('$("#box_mail").TransferTo({to:"'+elm+'",className:"transferer2",duration: 400}).hide()', 1000);
	},
	successFailed: function(msg,options){
		mail_box_add_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		mail_box_add_msg("短信发送时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"boxMailAdd","single");

/******************添加收藏夹****************/
function group_collection(elm)
{
	if($("#box_collection").size() == 0)
	{
		var xleft = Math.floor(($(document.body).width() - 500)/2);
		var xtop = Math.floor(($(window).height() - 382)/2);
		var html = '<div id="box_collection" class="pop_box" style="left:'+ xleft +'px; top: '+ xtop +'px;">';
			html = html + '<div id="box_collection_top" class="pop_box_top"><span>加入小组收藏</span><img class="pop_box_close" src="/css/pop_box_close.gif" /></div>';
			html = html + '<div id="box_collection_content" class="pop_box_content">';
			html = html + '<form id="box_collection_form" class="pop_box_form" name="box_collection_form" method="post" action="" >';
			html = html + '<fieldset >';
			html = html + '<input name="subject_id" id="box_collection_subject_id" type="hidden" value="'+ $(elm).attr("map_id") +'" class="inputText" /><input name="subject_title" id="box_collection_subject_title" type="hidden" value="'+ $(elm).attr("map_name") +'" class="inputText" />';
			html = html + '<div id="box_collection_content_inner"></div>';
			html = html + '<div id="BoxCollectionMsgBox" class="pop_box_msg"></div>';
			html = html + '</fieldset>';
			html = html + '</form>';
			html = html + '</div>';
			html = html + '</div>';
		$(document.body).append(html);
		$('#box_collection').Resizable(
			{
				dragHandle: '#box_collection_top',
				handlers: {
					se: '#windowresize'
				}
			}
		);
		oTargetElm = elm;
	}
	if(document.all)
	{
		var sScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
	}
	else
	{
		var sScrollTop = pageYOffset;
	}
	if(oTargetElm && $(oTargetElm).attr("id") != $(elm).attr("id") && $('#box_collection').css('display') != 'none')
	{
		$("#box_collection_form")[0].reset();
		$('#box_collection').TransferTo({
			to:$(oTargetElm).attr("id"),
			className:'transferer2', 
			duration: 400,
			complete:function(){
				if($("#box_collection").offset().top < sScrollTop || $("#box_collection").offset().top > (sScrollTop + $(window).height()) )
				{
					$("#box_collection").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
				}
				$(elm).TransferTo({
					to:'box_collection',
					className:'transferer2', 
					duration: 400,
					complete: function()
					{
						$('#box_collection').show();
					}
				});
			}
		}).hide();
	}
	else
	{
		if($("#box_collection").offset().top < sScrollTop || $("#box_collection").offset().top > (sScrollTop + $(window).height()) )
		{
			$("#box_collection").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
			//alert($("#box_collection").css("top"));
		}
		$(elm).TransferTo(
			{
				to:'box_collection',
				className:'transferer2', 
				duration: 400,
				complete: function()
					{
						$('#box_collection').show();
					}
			}
		);		
	}
	oTargetElm = elm;
	$('#box_collection img.pop_box_close').unbind();
	$('#box_collection img.pop_box_close').bind(
		'click',
		function()
		{
			$('#box_collection').TransferTo(
				{
					to:$(elm).attr("id"),
					className:'transferer2', 
					duration: 400
				}
			).hide();
		}
	);
	ajax_collection_creat.app({elm: elm});
	return false;
}
var collection_box_add_msg = new Magic_AjaxMsg("","collectionBoxBddMsg",{timeout: -999,place:"BoxCollectionMsgBox"});

var ajax_box_collection_add = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=collectdetail&actiontype=add&rtype=xml",
	beforeAjax: function(options){
		options.data = options.data;
		options.formData = options.param;
		return Magic_validation.checkAll("box_collection_form");
	},
	ajaxBeforeSend: function(xmlHttp,options){
		collection_box_add_msg("收藏添加中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		collection_box_add_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var elm = options.elm ;
		window.setTimeout('$("#box_collection").TransferTo({to:"'+elm+'",className:"transferer2",duration: 400}).hide()', 1000);
	},
	successFailed: function(msg,options){
		collection_box_add_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		collection_box_add_msg("收藏添加时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"boxMailAdd","single");

var collection_creat_msg = new Magic_AjaxMsg("","collectionCreatMsg",{timeout: -999,place:"BoxCollectionMsgBox"});

var ajax_collection_creat = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=collect&actiontype=indexdata&rtype=xml&myjoin=1&orderby=collect_commend&asc=1",
	beforeAjax: function(options){
		if($("#box_collection_content_inner").hasClass("hasLoad"))
		{
			$("#box_collection_form")[0].reset();
			return false;
		}
		else
		{
			options.data = options.data;
			return true;
		}
	},
	ajaxBeforeSend: function(xmlHttp,options){
		collection_creat_msg("收藏夹加载中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		collection_creat_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var html = '';
		if($("ocollect",msg).size() < 1)
		{
			html = html + '也许您没有加入小组，也许您加入的小组没有收藏夹';
			$("#box_collection_content_inner").html(html);
		}
		else
		{
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_collection_collect" >收藏夹</label></div>';
			html = html + '<div class="box_input"><select name="collect" id="box_collection_collect" class="required" ><option value="">请选择您要添加的收藏夹</option>';
			$("ocollect",msg).each(function(){
				html = html + '<option value="select" grp_id="'+ $("grp_id",this).text() +'" collect_id="'+ $("collect_id",this).text() +'" grp_name="'+ $("grp_name",this).text() +'">'+ $("collect_title",this).text() +'（'+ $("grp_name",this).text() +'）</option>';
			});
			html = html + '</select></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<input name="grp_id" id="box_collection_grp_id" type="hidden" value="" class="inputText" />';
			html = html + '<input name="collect_id" id="box_collection_collect_id" type="hidden" value="" class="inputText" />';
			html = html + '<input name="grp_name" id="box_collection_grp_name" type="hidden" value="" class="inputText" />';
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_collection_cdetail_desc" >内容</label></div>';
			html = html + '<div class="box_input"><textarea name="cdetail_desc" id="box_collection_cdetail_desc" class="box_textareaStyle v_maxlength-400" cols="40" rows="5"></textarea></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="box_buttonBox"><input type="submit" class="submitButton" value="提交" id="box_collection_bt" /></div>';
			$("#box_collection_content_inner").html(html);
			$("#box_collection_content_inner").addClass("hasLoad");
			$("#box_collection_collect").change(function(){
				$("#box_collection_grp_id").val($(this.options[this.selectedIndex]).attr("grp_id"));
				$("#box_collection_collect_id").val($(this.options[this.selectedIndex]).attr("collect_id"));
				$("#box_collection_grp_name").val($(this.options[this.selectedIndex]).attr("grp_name"));
			});
			var validator= new Magic_validation("box_collection_form",{ onsubmit: false, requiredPlace: "prevSibling", introPlace: "nextSibling", errPlace: "nextSibling"});
			$("#box_collection_bt").click(function(){
				ajax_box_collection_add.app({param : $('#box_collection_form').serialize(),elm: $(options.elm).attr("id")});
				return false;
			});
		}
	},
	successFailed: function(msg,options){
		collection_creat_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		collection_creat_msg("收藏夹加载时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"collectionCreat","single");

/******************添加专题****************/
function group_special(elm)
{
	if($("#box_special").size() == 0)
	{
		var xleft = Math.floor(($(document.body).width() - 500)/2);
		var xtop = Math.floor(($(window).height() - 382)/2);
		var html = '<div id="box_special" class="pop_box" style="left:'+ xleft +'px; top: '+ xtop +'px;">';
			html = html + '<div id="box_special_top" class="pop_box_top"><span>加入专题</span><img class="pop_box_close" src="/css/pop_box_close.gif" /></div>';
			html = html + '<div id="box_special_content" class="pop_box_content">';
			html = html + '<form id="box_special_form" class="pop_box_form" name="box_special_form" method="post" action="" >';
			html = html + '<fieldset >';
			html = html + '<input name="markid" id="box_special_subject_id" type="hidden" value="" class="inputText" /><input name="point_type" id="box_special_point_type" type="hidden" value="" class="inputText" />';
			html = html + '<div id="box_special_content_inner"></div>';
			html = html + '<div id="BoxspecialMsgBox" class="pop_box_msg"></div>';
			html = html + '</fieldset>';
			html = html + '</form>';
			html = html + '</div>';
			html = html + '</div>';
		$(document.body).append(html);
		$('#box_special').Resizable(
			{
				dragHandle: '#box_special_top',
				handlers: {
					se: '#windowresize'
				}
			}
		);
		oTargetElm = elm;
	}
	if(document.all)
	{
		var sScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
	}
	else
	{
		var sScrollTop = pageYOffset;
	}
	if(oTargetElm && $(oTargetElm).attr("id") != $(elm).attr("id") && $('#box_special').css('display') != 'none')
	{
		$("#box_special_form")[0].reset();
		$('#box_special').TransferTo({
			to:$(oTargetElm).attr("id"),
			className:'transferer2', 
			duration: 400,
			complete:function(){
				if($("#box_special").offset().top < sScrollTop || $("#box_special").offset().top > (sScrollTop + $(window).height()) )
				{
					$("#box_special").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
				}
				$(elm).TransferTo({
					to:'box_special',
					className:'transferer2', 
					duration: 400,
					complete: function()
					{
						$('#box_special').show();
					}
				});
			}
		}).hide();
	}
	else
	{
		if($("#box_special").offset().top < sScrollTop || $("#box_special").offset().top > (sScrollTop + $(window).height()) )
		{
			$("#box_special").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
			//alert($("#box_special").css("top"));
		}
		$(elm).TransferTo(
			{
				to:'box_special',
				className:'transferer2', 
				duration: 400,
				complete: function()
					{
						$('#box_special').show();
					}
			}
		);		
	}
	oTargetElm = elm;
	ajax_special_creat.app({elm: elm});
	$("#box_special_subject_id").val($(elm).attr("map_id"));
	$("#box_special_point_type").val($(elm).attr("point_type"));
	$('#box_special img.pop_box_close').unbind();
	$('#box_special img.pop_box_close').bind(
		'click',
		function()
		{
			$('#box_special').TransferTo(
				{
					to:$(elm).attr("id"),
					className:'transferer2', 
					duration: 400
				}
			).hide();
		}
	);
	return false;
}
var special_box_add_msg = new Magic_AjaxMsg("","specialBoxBddMsg",{timeout: -999,place:"BoxspecialMsgBox"});

var ajax_box_special_add = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=submark&actiontype=add&rtype=xml",
	beforeAjax: function(options){
		options.data = options.data;
		options.formData = options.param;
		return Magic_validation.checkAll("box_special_form");
	},
	ajaxBeforeSend: function(xmlHttp,options){
		special_box_add_msg("专题添加中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		special_box_add_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var elm = options.elm ;
		window.setTimeout('$("#box_special").TransferTo({to:"'+elm+'",className:"transferer2",duration: 400}).hide()', 1000);
	},
	successFailed: function(msg,options){
		special_box_add_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		special_box_add_msg("专题添加时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"boxMailAdd","single");

var special_creat_msg = new Magic_AjaxMsg("","specialCreatMsg",{timeout: -999,place:"BoxspecialMsgBox"});

var ajax_special_creat = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=subject&actiontype=indexdata&rtype=xml",
	beforeAjax: function(options){
		if($("#box_special_content_inner").hasClass("hasLoad"))
		{
			$("#box_special_form")[0].reset();
			return false;
		}
		else
		{
			options.data = options.data;
			return true;
		}
	},
	ajaxBeforeSend: function(xmlHttp,options){
		special_creat_msg("专题加载中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		special_creat_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var html = '';
		if($("osubject",msg).size() < 1)
		{
			html = html + '您尚未建立专题，<a href="/person/special_add.shtml">点击这里建立一个专题</a>';
			$("#box_special_content_inner").html(html);
		}
		else
		{
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_special_collect" >专题名</label></div>';
			html = html + '<div class="box_input"><select name="subjectid" id="box_special_collect" class="required" ><option value="">请选择您要添加的专题</option>';
			$("osubject",msg).each(function(){
				html = html + '<option value="'+ $("id",this).text() +'">'+ $("title",this).text() +'</option>';
			});
			html = html + '</select></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_special_cdetail_desc" >评述</label></div>';
			html = html + '<div class="box_input"><textarea name="description" id="box_special_cdetail_desc" class="box_textareaStyle v_maxlength-400" cols="40" rows="5"></textarea></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="box_buttonBox"><input type="submit" class="submitButton" value="提交" id="box_special_bt" /></div>';
			$("#box_special_content_inner").html(html);
			$("#box_special_content_inner").addClass("hasLoad");
			var validator= new Magic_validation("box_special_form",{ onsubmit: false, requiredPlace: "prevSibling", introPlace: "nextSibling", errPlace: "nextSibling"});
			$("#box_special_bt").click(function(){
				ajax_box_special_add.app({param : $('#box_special_form').serialize(),elm: $(options.elm).attr("id")});
				return false;
			});
		}
	},
	successFailed: function(msg,options){
		special_creat_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		special_creat_msg("收藏夹加载时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"specialCreat","single");

/******************专题标点评述修改****************/
function special_change(elm)
{
	if($("#box_special_point").size() == 0)
	{
		var xleft = Math.floor(($(document.body).width() - 500)/2);
		var xtop = Math.floor(($(window).height() - 382)/2);
		var html = '<div id="box_special_point" class="pop_box" style="left:'+ xleft +'px; top: '+ xtop +'px;">';
			html = html + '<div id="box_special_point_top" class="pop_box_top"><span>修改评述</span><img class="pop_box_close" src="/css/pop_box_close.gif" /></div>';
			html = html + '<div id="box_special_point_content" class="pop_box_content">';
			html = html + '<form id="special_point_change_form" class="pop_box_form" name="special_point_change_form" method="post" action="" >';
			html = html + '<fieldset >';
			html = html + '<input name="markid" id="special_point_change_markid" type="hidden" value="" class="inputText" />';
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_special_point_contents" >评述</label></div>';
			html = html + '<div class="box_input"><textarea name="description" id="box_special_point_contents" class="box_textareaStyle v_maxlength-400" cols="40" rows="5"></textarea></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="box_buttonBox"><input type="submit" class="submitButton" value="提交" id="special_point_change_bt" /></div>';
			html = html + '<div id="special_point_change_msg_box" class="pop_box_msg"></div>';
			html = html + '</fieldset>';
			html = html + '</form>';
			html = html + '</div>';
			html = html + '</div>';
		$(document.body).append(html);
		var validator= new Magic_validation("special_point_change_form",{ onsubmit: false, requiredPlace: "prevSibling", introPlace: "nextSibling", errPlace: "nextSibling"});
		$('#box_special_point').Resizable(
			{
				dragHandle: '#box_special_point_top',
				handlers: {
					se: '#windowresize'
				}
			}
		);
		oTargetElm = elm;
	}
	if(document.all)
	{
		var sScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
	}
	else
	{
		var sScrollTop = pageYOffset;
	}
	if(oTargetElm && $(oTargetElm).attr("id") != $(elm).attr("id") && $('#box_special_point').css('display') != 'none')
	{
		$("#special_point_change_form")[0].reset();
		$('#box_special_point').TransferTo({
			to:$(oTargetElm).attr("id"),
			className:'transferer2', 
			duration: 400,
			complete:function(){
				if($("#box_special_point").offset().top < sScrollTop || $("#box_special_point").offset().top > (sScrollTop + $(window).height()) )
				{
					$("#box_special_point").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
				}
				$(elm).TransferTo({
					to:'box_special_point',
					className:'transferer2', 
					duration: 400,
					complete: function()
					{
						$('#box_special_point').show();
					}
				});
			}
		}).hide();
	}
	else
	{
		if($("#box_special_point").offset().top < sScrollTop || $("#box_special_point").offset().top > (sScrollTop + $(window).height()) )
		{
			$("#box_special_point").css("top",(sScrollTop + Math.floor(($(window).height() - 382)/2))+"px");
			//alert($("#box_special_point").css("top"));
		}
		$(elm).TransferTo(
			{
				to:'box_special_point',
				className:'transferer2', 
				duration: 400,
				complete: function()
					{
						$('#box_special_point').show();
					}
			}
		);		
	}
	oTargetElm = elm;
	$("#box_special_point_top span").html('修改评述（'+ $(elm).attr("map_name")+'）');
	$("#special_point_change_markid").val($(elm).attr("map_id"));
	$("#box_special_point_contents").val($("#comment_"+ $(elm).attr("map_id")).html());
	$('#special_point_change_form').unbind();
	$("#special_point_change_form").submit(function(){
		ajax_special_point_change.app({param : $('#special_point_change_form').serialize(),elm: $(elm).attr("id"),comment:$("#box_special_point_contents").val(),map_id:$(elm).attr("map_id")});
		return false;
	});
	$('#box_special_point img.pop_box_close').unbind();
	$('#box_special_point img.pop_box_close').bind(
		'click',
		function()
		{
			$('#box_special_point').TransferTo(
				{
					to:$(elm).attr("id"),
					className:'transferer2', 
					duration: 400
				}
			).hide();
		}
	);
	return false;
}
var special_point_change_msg = new Magic_AjaxMsg("","specialPointChangeMsg",{timeout: -999,place:"special_point_change_msg_box"});

var ajax_special_point_change = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=submark&actiontype=update&rtype=xml",
	beforeAjax: function(options){
		options.data = options.data ;
		options.formData = options.param;
		return Magic_validation.checkAll("special_point_change_form");
	},
	ajaxBeforeSend: function(xmlHttp,options){
		special_point_change_msg("评述修改中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		special_point_change_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var elm = options.elm ;
		$("#comment_" + options.map_id).html(options.comment);
		window.setTimeout('$("#box_special_point").TransferTo({to:"'+elm+'",className:"transferer2",duration: 400}).hide()', 1000);
	},
	successFailed: function(msg,options){
		special_point_change_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		special_point_change_msg("评述修改时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"specialPointChange","single");

/****************举报不良信息****************/
function quote_it(elm)
{
	if($("#box_quote").size() == 0)
	{
		var xleft = Math.floor(($(document.body).width() - 300)/2);
		var xtop = Math.floor(($(window).height() - 182)/2);
		var html = '<div id="box_quote" class="pop_box" style="left:'+ xleft +'px; top: '+ xtop +'px;">';
			html = html + '<div id="box_quote_top" class="pop_box_top"><span>举报</span><img class="pop_box_close" src="/css/pop_box_close.gif" /></div>';
			html = html + '<div id="box_quote_content" class="pop_box_content">';
			html = html + '<form id="box_quote_form" class="pop_box_form" name="box_quote_form" method="post" action="" >';
			html = html + '<fieldset >';
			html = html + '<input name="category" id="box_quote_category" type="hidden" value="" class="inputText" /><input name="subject_id" id="box_quote_subject_id" type="hidden" value="" class="inputText" />';
			html = html + '<div class="clearfix box_formItem">';
			html = html + '<div class="box_hint"><label for="box_quote_contents" >理由</label></div>';
			html = html + '<div class="box_input"><textarea name="contents" id="box_quote_contents" class="box_textareaStyle required v_maxlength-200" cols="40" rows="5"></textarea></div>';
			html = html + '<div class="box_info"></div>';
			html = html + '</div>';
			html = html + '<div class="box_buttonBox"><input type="submit" class="submitButton" value="提交" id="box_quote__bt" /></div>';
			html = html + '<div id="boxQuoteMsgBox" class="pop_box_msg"></div>';
			html = html + '</fieldset>';
			html = html + '</form>';
			html = html + '</div>';
			html = html + '</div>';
		$(document.body).append(html);
		var validator= new Magic_validation("box_quote_form",{ onsubmit: false, requiredPlace: "prevSibling", introPlace: "nextSibling", errPlace: "nextSibling"});
		$('#box_quote').Resizable(
			{
				dragHandle: '#box_quote_top',
				handlers: {
					se: '#windowresize'
				}
			}
		);
		oTargetElm = elm;
	}
	if(document.all)
	{
		var sScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
	}
	else
	{
		var sScrollTop = pageYOffset;
	}
	if(oTargetElm && $(oTargetElm).attr("id") != $(elm).attr("id") && $('#box_quote').css('display') != 'none')
	{
		$("#box_quote_form")[0].reset();
		$('#box_quote').TransferTo({
			to:$(oTargetElm).attr("id"),
			className:'transferer2', 
			duration: 400,
			complete:function(){
				if($("#box_quote").offset().top < sScrollTop || $("#box_quote").offset().top > (sScrollTop + $(window).height()) )
				{
					$("#box_quote").css("top",(sScrollTop + Math.floor(($(window).height() - 182)/2))+"px");
				}
				$(elm).TransferTo({
					to:'box_quote',
					className:'transferer2', 
					duration: 400,
					complete: function()
					{
						$('#box_mail').show();
					}
				});
			}
		}).hide();
	}
	else
	{
		if($("#box_quote").offset().top < sScrollTop || $("#box_quote").offset().top > (sScrollTop + $(window).height()) )
		{
			$("#box_quote").css("top",(sScrollTop + Math.floor(($(window).height() - 182)/2))+"px");
			//alert($("#box_mail").css("top"));
		}
		$(elm).TransferTo(
			{
				to:'box_quote',
				className:'transferer2', 
				duration: 400,
				complete: function()
					{
						$('#box_quote').show();
					}
			}
		);		
	}
	oTargetElm = elm;
	$("#box_quote_top span").html('举报（'+ $(elm).attr("subject_title")+'）');
	$("#box_quote_subject_id").val($(elm).attr("subject_id"));
	$("#box_quote_category").val($(elm).attr("category"));
	$('#box_quote_form').unbind();
	$("#box_quote_form").submit(function(){
		ajax_box_quote.app({param : $('#box_quote_form').serialize(),elm: $(elm).attr("id")});
		return false;
	});
	$('#box_quote img.pop_box_close').unbind();
	$('#box_quote img.pop_box_close').bind(
		'click',
		function()
		{
			$('#box_quote').TransferTo(
				{
					to:$(elm).attr("id"),
					className:'transferer2', 
					duration: 400
				}
			).hide();
		}
	);
	return false;
}
var box_quote_msg = new Magic_AjaxMsg("","boxQuoteMsg",{timeout: -999,place:"boxQuoteMsgBox"});

var ajax_box_quote = new Magic_AjaxApp(
{
	url: "/hibj/udo.do" ,
	data:"classname=impeach&actiontype=add&rtype=xml",
	beforeAjax: function(options){
		options.data = options.data;
		options.formData = options.param;
		return Magic_validation.checkAll("box_quote_form");
	},
	ajaxBeforeSend: function(xmlHttp,options){
		box_quote_msg("信息举报中...","",{},"msg_loading");
		return true;
	},
	successPass: function(msg,options){
		box_quote_msg($("message",msg).text(),"",{timeout: 5000},"msg_succeed");
		var elm = options.elm ;
		window.setTimeout('$("#box_quote").TransferTo({to:"'+elm+'",className:"transferer2",duration: 400}).hide()', 1000);
	},
	successFailed: function(msg,options){
		box_quote_msg($("message",msg).text(),"",{timeout: 5000},"msg_error");
	},
	ajaxError: function(options){
		box_quote_msg("信息举报时服务器出错，请稍后再试","",{timeout: 5000},"msg_error");
	}
},"boxQuote","single");

function content_init(msg,options)
{
	var html = '<div class="msg_normal">暂无内容</div>';
	$("#" + options.boxs).html(html);
	maps.clearOverLays();
}
//alert(getCurrentUsr());
//alert(navigator.cookieEnabled);

jQuery.fn.extend({
	load: function( url, params, callback ) {
		if ( jQuery.isFunction( url ) )
			return this.bind("load", url);

		var off = url.indexOf(" ");
		if ( off >= 0 ) {
			var selector = url.slice(off, url.length);
			url = url.slice(0, off);
		}

		callback = callback || function(){};

		// Default to a GET request
		var type = "GET";

		// If the second parameter was provided
		if ( params )
			// If it's a function
			if ( jQuery.isFunction( params ) ) {
				// We assume that it's the callback
				callback = params;
				params = null;

			// Otherwise, build a param string
			} else {
				params = jQuery.param( params );
				type = "POST";
			}

		var self = this;

		// Request the remote document
		jQuery.ajax({
			url: url,
			type: type,
			dataType: "html",
			data: params,
			complete: function(res, status){
				// If successful, inject the HTML into all the matched elements
				if ( status == "success" || status == "notmodified" )
					// See if a selector was specified
					self.html( selector ?
						// Create a dummy div to hold the results
						jQuery("<div/>")
							// inject the contents of the document in, removing the scripts
							// to avoid any 'Permission Denied' errors in IE
							.append(res.responseText.replace(/<script(.|\s)*?\/script>/g, ""))

							// Locate the specified elements
							.find(selector) :

						// If not, just inject the full result
						res.responseText );

				self.each( callback, [res.responseText, status, res] );
			}
		});
		return this;
	},

	serialize: function() {
		return jQuery.param(this.serializeArray());
	},
	serializeArray: function() {
		return this.map(function(){
			return jQuery.nodeName(this, "form") ?
				jQuery.makeArray(this.elements) : this;
		})
		.filter(function(){
			return this.name && !this.disabled && 
				(this.checked || /select|textarea/i.test(this.nodeName) || 
					/text|hidden|password/i.test(this.type));
		})
		.map(function(i, elem){
			if(typeof(USE_BASE64) != "undefined")
			{
				if(/^[0-9]+$/.test(jQuery(this).val()))
				{
					var val = jQuery(this).val();
				}
				else
				{
					var val = htmlEncode1(base64encode(utf16to8(htmlEncode(jQuery(this).val()))));				
				}

			}
			else
			{
				var val = jQuery(this).val();
			}
			
			return val == null ? null :
				val.constructor == Array ?
					jQuery.map( val, function(val, i){
						return {name: elem.name, value: val};
					}) :
					{name: elem.name, value: val};
		}).get();
	}


});
