var KEYCODE_ESC = 27 ; //ESC的键值

//客户端主动调用接口
function OnCltKeyPress(KeyCode)
{
    if( KeyCode == KEYCODE_ESC )
    {
        var popobj = $(".pop_close") ;
        if( popobj.length == 0 )
        {
            return "0" ;
        }
        else
        {
            popobj.click() ;
            return "1" ;
        }
    }
    return "0" ;
}

var ad_loading = false;
function load_ad()
{
	try
	{
		var obj = client_core_interface();
		if (typeof(obj) == "undefined") return;
		if (obj == null) return;
	}
	catch(e)
	{
		return;
	}
	
	var webbase = client_core_urlbase("QLFREE");
  var found = (webbase != null && webbase.length > 0) ; //检测基地址是否正确
	if( !found ) {
		setTimeout("load_ad();", 100);
		return;
	}
	var template = webbase + '/ad/#ID#/ad.htm';
	
	$(".ad_block").each(function() {
		var ad = $(this);
		var id = ad.attr('id').substring(3);
		var adurl = template.replace('#ID#', id) + "?_ajax=" + Math.random();
		//ad.load(adurl);
		ajax_load_html(adurl,loadhtml,ad);
	});
}

function loadhtml(elm,html)
{	
	elm.html(html);
}

function ajax_load_html(url, callback,elm)
{
	var req = ql_httprequest_get();
	
	if (req) {
		req.open("GET",url,true);
		
		req.onreadystatechange = function () {
			if(req.readyState==4) {
				callback(elm,req.responseText);
			}
		};
		req.send(null);
	}
}

$(function() {
	$('.footer_container').html(FOOTER);
	$('.loading_mark').html(__html_loading);
	if (ad_loading) return;
	ad_loading = true;
	setTimeout("load_ad();", 100);
});

//-------------------------------------------------------------------------------------------------
// html message, loading etc...
//-------------------------------------------------------------------------------------------------
var __html_loading = 
	"<div class='loading_panel'>"
	+ "<div class='loading_wait'><span>正在加载数据</span></div>"
	+ "</div>";
var __html_msg_loading = 
	"<div class='loading_frame'><table border=0 style='height:100%; width: 100%;'><tr><td style='vertical-align: middle; border:none;text-align:center;'>"
	+ "<table>"
	+ "<tr><td class='loading_frame_info' style='padding-left: 26px; border: none;'>正在加载数据</td></tr></table>"
	+ "</td></tr></table></div>";
var __html_msg_nodata = 
	"<div class='loadingerror_frame'><table border=0>"
	+ "<tr><td style='border: none; padding:0px;'>没有数据</td></tr>"
	+ "</table></div>";

function html_msg_loading(id)
{
	//$("#" + id).html(__html_msg_loading);
}

function html_msg_nodata(id)
{
	$("#" + id).html(__html_msg_nodata);
}

function html_msg_nodata_output()
{
	document.write(__html_msg_nodata);
}
//-------------------------------------------------------------------------------------------------
// ajax
//-------------------------------------------------------------------------------------------------
var __ajax_cache = true;

function ajax_cache_enable()
{
	__ajax_cache = true;
}

function ajax_cache_disable()
{
	__ajax_cache = false;
}

function ajax_url_cache_key(url)
{
	var pos = url.lastIndexOf("/");
	url = url.substr(pos + 1);
	
	pos = url.indexOf(".");
	if (pos > 0) url = url.substr(0, pos);
	return "w_" + url;

	/*
	var pos = url.indexOf("/", 10);
	url = url.substr(pos);
	return "ajax_" + url;

	var pos = url.lastIndexOf("/");
	url = url.substr(pos + 1);
	
	pos = url.indexOf(".");
	if (pos > 0) url = url.substr(0, pos);
	return "w_" + url;
	*/
}

function ajax_url_cache_get(url)
{
	var key = ajax_url_cache_key(url);
	
	var data = client_data_load_json(key, null, 1);
	if (typeof(data) == "undefined") return null;
	return data;
}

function ajax_url_cache_set(url, expire, text)
{
	var key = ajax_url_cache_key(url);
	var data = new Object();
	data["expire"] = expire;
	data["text"] = text;

	client_data_save_json(key, data, 1);
}

function ajax_url_random(url)
{
	if (__ajax_cache) return url;
	
	if (url.indexOf('?') > 0) url += '&_rand=' + Math.random();
	else url += '?_rand=' + Math.random();
	return url;
}

function ajax_load(id, url, callback)
{
	var req = ql_httprequest_get();
	var cachedata = null;
	if (__ajax_cache) cachedata = ajax_url_cache_get(url);

	if (req) {
		html_msg_loading(id);
		req.open("GET",ajax_url_random(url),true);
		
		req.onreadystatechange = function () {
			if(req.readyState==4) {
				if(req.status==200) {
					if (__ajax_cache) ajax_url_cache_set(url, req.getResponseHeader("Last-Modified"), req.responseText);
					$("#" + id).html(req.responseText);
					if (typeof(callback) != "undefined") callback();
				} else if (req.status == 304) {
					$("#" + id).html(cachedata["text"]);
					if (typeof(callback) != "undefined") callback();
				} else {
					html_msg_nodata(id);
				}
			}
		};
		
		if (__ajax_cache) {
			req.setRequestHeader(
				"If-Modified-Since", 
				cachedata == null ? "Thu, 01 Jan 1970 00:00:00 GMT" : cachedata["expire"]
			);
		}
		req.send(null);
	}
}

function write_log(id,text)
{
	try
	{
		var obj = client_core_interface();
		obj.r("S_WriteOPLog", id + "\r\n" + text);
	}
	catch(e)
	{
		return;
	}
}

function ajax_load_xml(url, callback)
{
	var req = ql_httprequest_get();
	var cachedata = null;
	if (__ajax_cache) cachedata = ajax_url_cache_get(url);

	if (req) {
		req.open("GET",ajax_url_random(url),true);
		
		req.onreadystatechange = function () {
			if(req.readyState==4) {
				if(req.status==200) {
					if (__ajax_cache) ajax_url_cache_set(url, req.getResponseHeader("Last-Modified"), req.responseText);
					callback(ql_xml_stringtoxml(req.responseText));
				} else if (req.status == 304) {
					callback(ql_xml_stringtoxml(cachedata["text"]));
				} else {
					callback(null);
				}
			}
		};

		if (__ajax_cache) {
			req.setRequestHeader(
				"If-Modified-Since", 
				cachedata == null ? "Thu, 01 Jan 1970 00:00:00 GMT" : cachedata["expire"]
			);
		}
		req.send(null);
	}
}

//-------------------------------------------------------------------------------------------------
// msgbox
//-------------------------------------------------------------------------------------------------
function html_msgbox_iframe(title, frameurl)
{
    var markObj = $("<div></div>")
		.addClass('pop_markdiv');
	$("<iframe style='width:100%; height: 100%;' src='../pub/popupbg.htm'></iframe>")
		.appendTo(markObj);
    document.body.appendChild(markObj[0]);

    var bgObj = $("<div onmousewheel='return false;'></div>")
		.addClass('pop_bgdiv');
    document.body.appendChild(bgObj[0]);

    var msgObj = $("<div class='pop_msgboxdiv' onmousewheel='return false;'></div>")
    document.body.appendChild(msgObj[0]);

	var table = $("<table></table>")
		.addClass('pop_table')
		.attr("cellSpacing","0")
		.appendTo(msgObj);

	$("<tr class='pop_titlebar'></tr>")
		.append(
			$("<td class='pop_title'></td>")
			.text(title)
		)
		.append(
			$("<td class='pop_close'>×</td>")
			.click(function() {
				markObj.remove();
				bgObj.remove();
				msgObj.remove();
				markObj = null;
				bgObj = null;
				msgObj = null;
			})
		)
		.appendTo(table)

	$("<tr></tr>")
		.append(
			$("<td colspan=2></td>")
			.append(
				$("<iframe frameborder=0 marginwidth=0 " + (ie_version() == 6 ? "scrolling=yes" : "")+ " marginheight=0></iframe>")
					.addClass("pop_iframe")
					.attr("src", frameurl)
			)
		)
		.appendTo(table)

	msgObj.click(function() {
			setTimeout("$('.pop_close:last').click();",100);
		})
	bgObj.click(function() {
			setTimeout("$('.pop_close:last').click();",100);
		})
}

function html_msgbox_text(title, framehtml)
{
    var markObj = $("<div></div>")
		.addClass('pop_markdiv');
	$("<iframe style='width:100%; height: 100%;' src='../pub/popupbg.htm'></iframe>")
		.appendTo(markObj);
    document.body.appendChild(markObj[0]);

    var bgObj = $("<div onmousewheel='return false;'></div>")
		.addClass('pop_bgdiv');
    document.body.appendChild(bgObj[0]);

    var msgObj = $("<div class='pop_msgboxdiv' onmousewheel='return false;'></div>")
    document.body.appendChild(msgObj[0]);

	var table = $("<table></table>")
		.addClass('pop_table')
		.attr("cellSpacing","0")
		.appendTo(msgObj);

	$("<tr class='pop_titlebar'></tr>")
		.append(
			$("<td class='pop_title'></td>")
			.text(title)
		)
		.append(
			$("<td class='pop_close'>×</td>")
			.click(function() {
				markObj.remove();
				bgObj.remove();
				msgObj.remove();
				markObj = null;
				bgObj = null;
				msgObj = null;
			})
		)
		.appendTo(table)

	$("<tr valign=top></tr>")
		.append(
			$("<td id='popup_text' colspan=2></td>")
			.append(
				$("<div class='pop_contentdiv' style='background-color: white;'>" + framehtml + "</div>")
			)
		)
		.appendTo(table)

	msgObj.click(function() {
			markObj.remove();
			bgObj.remove();
			msgObj.remove();
			markObj = null;
			bgObj = null;
			msgObj = null;
		})
	bgObj.click(function() {
			markObj.remove();
			bgObj.remove();
			msgObj.remove();
			markObj = null;
			bgObj = null;
			msgObj = null;
		})
	$('#popup_text').click(function() { return false; });
}

function html_msgbox_textajax(title, framehtml, divid, url)
{
	html_msgbox_text(title, framehtml);
	ajax_load(divid, url);
}

function html_msgbox_dialog(dialoghtml)
{
    var markObj = $("<div></div>")
		.addClass('pop_markdiv');
	$("<iframe style='width:100%; height: 100%;' src='../pub/popupbg.htm'></iframe>")
		.appendTo(markObj);
    document.body.appendChild(markObj[0]);

    var bgObj = $("<div onmousewheel='return false;'></div>")
		.addClass('pop_bgdiv');
    document.body.appendChild(bgObj[0]);

    var msgObj = $(
    	"<div class='pop_dialogdiv' onmousewheel='return false;'>"
    	+ "<table border=0 cellpadding=0 cellspacing=0 style='width:100%; height:100%'>"
    	+ "<tr><td id='div_dialog'></td></tr></table>"
    	+ "</div>"
    );
    document.body.appendChild(msgObj[0]);
    $('#div_dialog')[0].innerHTML = dialoghtml;

	msgObj.click(function() {
			markObj.remove();
			bgObj.remove();
			msgObj.remove();
			markObj = null;
			bgObj = null;
			msgObj = null;
		})
	bgObj.click(function() {
			markObj.remove();
			bgObj.remove();
			msgObj.remove();
			markObj = null;
			bgObj = null;
			msgObj = null;
		})
}


//-------------------------------------------------------------------------------------------------
// calendar
//-------------------------------------------------------------------------------------------------
function html_calendar_register(mode, icondiv, valuediv, callback)
{
	switch(mode)
	{
		case 'd': popupDayCalendar(valuediv, icondiv, callback); break;
		case 'w': popupWeekCalendar(valuediv, icondiv, callback); break;
		case 'm': popupMonthCalendar(valuediv, icondiv, callback); break;
	}
}

function html_lockmouse()
{
	document.body.onmousewheel = function() {
		var Body = document.compatMode != "BackCompat"
			? document.documentElement
			: document.body;

		if (event.wheelDelta > 0 ) 
		{
  			if (Body.scrollTop <= 0) return false;
  			//scrollBy(0, -Body.clientHeight/2) ;
  			scrollBy(0, -event.wheelDelta) ;
		} 
		else if( event.wheelDelta < 0 )
		{
  			if ((Body.scrollTop + Body.clientHeight) >= Body.scrollHeight) return false;
  			//scrollBy(0, Body.clientHeight/2) ;
  			scrollBy(0, -event.wheelDelta) ;
		}
		return false ;
	};
}

//暂时使用Cookie
function html_cookie_set(name, value)
{
	var expdate = new Date();
	var argv = html_cookie_set.arguments;
	var argc = html_cookie_set.arguments.length;
	
	//添加超时时间为一年
	var expires = (argc > 2) ? argv[2] : null ;

	if( expires == null )
	{
		expires = new Date() ;
		expires.setFullYear( expires.getFullYear()+1 ) ;
	}
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
		document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
											+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
											+((secure == true) ? "; secure" : "");
}

function __html_cookie_getval(offsetid)
{
	var endstr = document.cookie.indexOf (";", offsetid);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offsetid, endstr));
}

//获得Cookie的原始值	
function html_cookie_get(name , defVal)
{
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
	{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) return __html_cookie_getval(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)  break;
	}
	return defVal;
}

//-------------------------------------------------------------------------------------------------
// styles
//-------------------------------------------------------------------------------------------------
function html_table_rowhover(tableid, style)
{
	if (typeof(style) == "undefined") style = "row_mouseover";
	
	$("#" + tableid + " > tbody > tr")
		.mouseover(function() { $(this).addClass(style) })
		.mouseout(function() { $(this).removeClass(style) })
}

function html_table_singleselect(tableid, hoverstyle, clickstyle, handler)
{
	$("#" + tableid + " > tbody > tr")
		.mouseover(function() { if (!$(this).hasClass(clickstyle)) $(this).addClass(hoverstyle) })
		.mouseout(function() { if (!$(this).hasClass(clickstyle)) $(this).removeClass(hoverstyle) })
		.click(function() {
			var result = handler.call(this)
			if (result == false) return;
			if ($(this).hasClass(clickstyle))
				$(this).removeClass(clickstyle)
			else {
				$("#" + tableid + " > tbody > tr").removeClass(clickstyle)
				$(this).removeClass(hoverstyle)
				$(this).addClass(clickstyle)
			}
		})
	
	$("#" + tableid + " > tbody > tr:first")
		.addClass(clickstyle)
}

//-------------------------------------------------------------------------------------------------
// tab
//-------------------------------------------------------------------------------------------------
function html_tabex(tabid, frameid, normalstyle, selectedstyle, hoverstyle)
{
	var div = $("#" + tabid);
	
	// if selected is set, get index
	var index = 0;
	var count = 0;
	div.find("li").each(function() {
	    if ($(this).hasClass(selectedstyle))
	    {
	        index = count;
	        return false;
	    }
		count++;
    })
    
    count = 0;
    div.find("li").each(function() {
		$(this).addClass('mark_tab')
		if (count == index)
		{
			$(this).addClass(selectedstyle)
			$('<li></li>')
				.addClass(selectedstyle + 'l')
				.insertBefore($(this));
			$('<li></li>')
				.addClass(selectedstyle + 'r')
				.insertAfter($(this));
		}
		else
		{
			$(this).addClass(normalstyle)
			$('<li></li>')
				.addClass(normalstyle + 'l')
				.insertBefore($(this));
			$('<li></li>')
				.addClass(normalstyle + 'r')
				.insertAfter($(this));
		}
		count++;
    });
	
	count = 0;
	$("#" + frameid + ">div").each(function() {
		$(this).css("display", (count == index ? "" : "none"))
		count++;
	});
	count = 0;
	
	div.find("li.mark_tab").click(function() {
		var tabindex = 1;
		var selecttab = this;
		var i = 1;
		
		if ($(this).hasClass(selectedstyle)) return;
		div.find("li.mark_tab").each(function() {
			if (this == selecttab)
			{
				tabindex = i;
				$(this)
					.removeClass(normalstyle)
					.removeClass(hoverstyle)
					.addClass(selectedstyle)
				$(this)
					.next()
					.removeClass(normalstyle + 'r')
					.addClass(selectedstyle + 'r')
				$(this)
					.prev()
					.removeClass(normalstyle + 'l')
					.addClass(selectedstyle + 'l')
			} else {
				$(this)
					.removeClass(selectedstyle)
					.addClass(normalstyle)
				$(this)
					.next()
					.removeClass(selectedstyle + 'r')
					.addClass(normalstyle + 'r')
				$(this)
					.prev()
					.removeClass(selectedstyle + 'l')
					.addClass(normalstyle + 'l')
			}
			i++;
		});
		
		i = 1;
		$("#" + frameid + ">div").each(function() {
			$(this).css("display", (i == tabindex ? "" : "none"))
			i++;
		});
	});
}

function html_tabex_select(tabid, index)
{
	$("#" + tabid + " li.mark_tab:eq(" + index + ")").trigger('click')
}

function html_tab(tabid, frameid, selectedstyle)
{
	var div = $("#" + tabid);
	
	// if selected is set, get index
	var index = 0;
	var count = 0;
	div.find("div").each(function() {
	    if ($(this).hasClass(selectedstyle))
	    {
	        index = count;
	        return false;
	    }
		count++;
    })
    
    count = 0;
    div.find("div").each(function() {
		if (count == index)
		{
			$(this).addClass(selectedstyle)
		}
		count++;
    });
	
	count = 0;
	$("#" + frameid + ">div").each(function() {
		$(this).css("display", (count == index ? "" : "none"))
		count++;
	});
	count = 0;
	
	div.find("div").click(function() {
		var tabindex = 1;
		var selecttab = this;
		var i = 1;
		
		if ($(this).hasClass(selectedstyle)) return;
		div.find("div").each(function() {
			if (this == selecttab)
			{
				tabindex = i;
				$(this).addClass(selectedstyle);
			} else {
				$(this).removeClass(selectedstyle);
			}
			i++;
		});
		
		i = 1;
		$("#" + frameid + ">div").each(function() {
			$(this).css("display", (i == tabindex ? "" : "none"))
			i++;
		});
	});
}

function html_tab_old(tabid, frameid, selectedstyle)
{
	var div = $("#" + tabid);
	
	// if selected is set, get index
	var index = 0;
	var count = 0;
	div.find("li").each(function() {
	    if ($(this).hasClass(selectedstyle))
	    {
	        index = count;
	        return false;
	    }
		count++;
    })
    
    count = 0;
    div.find("li").each(function() {
		if (count == index)
		{
			$(this).addClass(selectedstyle)
		}
		count++;
    });
	
	count = 0;
	$("#" + frameid + ">div").each(function() {
		$(this).css("display", (count == index ? "" : "none"))
		count++;
	});
	count = 0;
	
	div.find("li").click(function() {
		var tabindex = 1;
		var selecttab = this;
		var i = 1;
		
		if ($(this).hasClass(selectedstyle)) return;
		div.find("li").each(function() {
			if (this == selecttab)
			{
				tabindex = i;
				$(this).addClass(selectedstyle);
			} else {
				$(this).removeClass(selectedstyle);
			}
			i++;
		});
		
		i = 1;
		$("#" + frameid + ">div").each(function() {
			$(this).css("display", (i == tabindex ? "" : "none"))
			i++;
		});
	});
}

function html_tab_select(tabid, index)
{
	$("#" + tabid + " li:eq(" + index + ")").trigger('click')
}

//-------------------------------------------------------------------------------------------------
// load xml to table
//-------------------------------------------------------------------------------------------------
function html_text_url(htmltext)
{
	while(htmltext.substr(0,3) == "../") htmltext = htmltext.substr(3);
	if (htmltext.substr(0,1) == "/") htmltext = htmltext.substr(1);
	if (htmltext.substr(0,5) != "xltxt") htmltext = "xltxt/" + htmltext;
	if (htmltext.indexOf("text") < 0) htmltext = htmltext.substr(0,5) + "/text" + htmltext.substr(5);
	htmltext = (G_BOOL_ASPX_DYN ? "/" : "/h/") + htmltext;
	
	return htmltext;
}

function __datalist_to_xml(data)
{
	var rltxml = '<?xml version="1.0" encoding="utf-8" ?> ' ;
	rltxml += '<xml>' ;
	if(data!=null && typeof(data) != "undefined" && data.length > 0 )
	{
		for(var i=0 ; i<data.length ; i++ )
		{
			rltxml += '<item>' ;
			for( var item in data[i] )
			{
				rltxml += '<' + item + '><![CDATA[' + data[i][item] + ']]></' + item + '>';
			}
			rltxml += '</item>' ;
		}
	}
	rltxml += '</xml>' ;
	return rltxml ;
}

function html_loadtable_array(divid, datalist, setting, handler)
{
	//html_loadtable_xml(divid, ql_xml_stringtoxml(__datalist_to_xml(datalist)), setting, handler);
	var div = $('#' + divid);
	div.text('');
	
	var tableobj = $(
		"<table"
		+ (typeof(setting.tableattrs) == "undefined" ? "" : setting.tableattrs)
		+ ">"
		+ "</table>"
	);
	tableobj.appendTo(div);
	
	var htmltext = "";
	if (typeof(setting.hashead) != "undefined" && setting.hashead) {
		htmltext += "<thead><tr>";
		for (i = 0; i < setting.columns.length; i++)
		{
			htmltext += "<th"
				+ ">" + setting.columns[i]["head"]
				+ (typeof(setting.columns[i].width) == "undefined" ? "" : " width=" + setting.columns[i].width + "")
				+ "</th>"
		}
		htmltext += "</tr></thead>";
		$(htmltext).appendTo(tableobj);
	}
	
	var tablebody = $("<tbody></tbody>");
	tablebody.appendTo(tableobj);
	
	if (datalist.length == 0)
	{
		$(
			"<tr><td colspan=" + setting.columns.length + " style='border: none;'>"
			+ __html_msg_nodata
			+ "</td></tr>"
		).appendTo(tablebody);
		return;
	}
	
	var rows = typeof(setting.rows) == "undefined" ? 0 : setting.rows;
	var count = 0;
	var hasurl = typeof(setting.hasurl) != "undefined" && setting.hasurl;
	var hasclientnav = typeof(setting.hasclientnav) != "undefined" && setting.hasclientnav;
	var htmlall = "";
	
	var columntype = new Array();
	var columnformat = new Array();
	var columnlongtext = new Array();
	var columnattrs = new Array();
	for (i = 0; i < setting.columns.length; i++)
	{
		columntype[i] = typeof(setting.columns[i].type) == "undefined" ? "" : setting.columns[i].type;
		columnformat[i] = typeof(setting.columns[i].format) == "undefined" ? "" : setting.columns[i].format;
		columnlongtext[i] = typeof(setting.columns[i].islongtext) != "undefined" && setting.columns[i].islongtext;
		columnattrs[i] = typeof(setting.columns[i].attrs) != "undefined" && setting.columns[i].attrs;
	}
	
	for (var j = 0; j < datalist.length; j++)
	{
		htmltext = "";
		if (hasurl) {
			htmltext = html_text_url(datalist[j]["link"]);
			htmltext = " onclick='html_msgbox_iframe(\""
				+ setting.title + "\", \"" 
				+ G_STR_WEBROOT + htmltext + "\")'";
		}
		if (hasclientnav) {
			htmltext += " title='"
				+ datalist[j]["market"]
				+ ',' + datalist[j]["code"]
				+ "'";
		}
		htmltext = "<tr" + htmltext + ">";

		for (i = 0; i < setting.columns.length; i++)
		{
			var text = ql_format(
				datalist[j][setting.columns[i].name],
				columntype[i],
				columnformat[i]
			);
			
			if (columnlongtext[i]) text = "<div class='longtext' title='" + text + "'>" + text + "</a></div>";
			htmltext += "<td"
				+ columnattrs[i]
				+ ">"
				+ text
				+ "</td>";
		}
		htmltext + "</tr>";
		htmlall += htmltext;
		
		count++;
		if (count >= rows && rows > 0) break;
	}
	tablebody.html(htmlall);

	var hoverstyle = "news_hover";
	if (typeof(setting["hoverstyle"]) != "undefined") hoverstyle = setting["hoverstyle"];
	if (hoverstyle != "")
		$( "#" + divid + " tbody > tr")
			.mouseover(function(){ $(this).addClass(hoverstyle) })
			.mouseout(function() { $(this).removeClass(hoverstyle) });

	if (typeof(handler) != "undefined") handler(xml);
}

function html_loadtable_xml(divid, xml, setting, handler)
{
	var div = $('#' + divid);	
	div.text('');
	
	var tableobj = $(
		"<table"
		+ (typeof(setting.tableattrs) == "undefined" ? "" : setting.tableattrs)
		+ ">"
		+ "</table>"
	);
	tableobj.appendTo(div);
	
	var htmltext = "";
	if (typeof(setting.hashead) != "undefined" && setting.hashead) {
		htmltext += "<thead><tr>";
		for (i = 0; i < setting.columns.length; i++)
		{
			htmltext += "<th"
				+ ">" + setting.columns[i]["head"]
				+ (typeof(setting.columns[i].width) == "undefined" ? "" : " width=" + setting.columns[i].width + "")
				+ "</th>"
		}
		htmltext += "</tr></thead>";
		$(htmltext).appendTo(tableobj);
	}
	
	var tablebody = $("<tbody></tbody>");
	tablebody.appendTo(tableobj);
	
	if (typeof(xml) == "undefined" || xml == null || $(xml).find("item").length == 0)
	{
		$(
			"<tr><td colspan=" + setting.columns.length + " style='border: none;'>"
			+ __html_msg_nodata
			+ "</td></tr>"
		).appendTo(tablebody);
		return;
	}
	
	var rows = typeof(setting.rows) == "undefined" ? 0 : setting.rows;
	var count = 0;
	var hasurl = typeof(setting.hasurl) != "undefined" && setting.hasurl;
	var hasclientnav = typeof(setting.hasclientnav) != "undefined" && setting.hasclientnav;
	var htmlall = "";
	var logid = div.attr("logid");
	var logtext = div.attr("logtext");
	
	var columntype = new Array();
	var columnformat = new Array();
	var columnlongtext = new Array();
	var columnattrs = new Array();
	for (i = 0; i < setting.columns.length; i++)
	{
		columntype[i] = typeof(setting.columns[i].type) == "undefined" ? "" : setting.columns[i].type;
		columnformat[i] = typeof(setting.columns[i].format) == "undefined" ? "" : setting.columns[i].format;
		columnlongtext[i] = typeof(setting.columns[i].islongtext) != "undefined" && setting.columns[i].islongtext;
		columnattrs[i] = typeof(setting.columns[i].attrs) != "undefined" && setting.columns[i].attrs;
	}
	
	
	$(xml).find("item").each(function() {
		var thisobj = $(this);
		htmltext = "";
		if (hasurl) {
			var link = html_text_url(thisobj.find("link").text());
			if (logid != undefined)
			{	
				htmltext = " onclick='write_log(\""+ logid + "\",\""+ logtext +"\");html_msgbox_iframe(\"";
			}
			else
			{
				htmltext = " onclick='html_msgbox_iframe(\"";
			}
			htmltext += setting.title + "\", \"" 
				+ G_STR_WEBROOT + link + "\")'";
		}
		if (hasclientnav) {
			htmltext += " title='"
				+ thisobj.find("market").text() 
				+ ',' + thisobj.find("code").text() 
				+ "'";
		}
		htmltext = "<tr" + htmltext + ">";

		for (i = 0; i < setting.columns.length; i++)
		{
			var text = ql_format(
				thisobj.find(setting.columns[i].name).text(),
				columntype[i],
				columnformat[i]
			);
			
			if (columnlongtext[i]) text = "<div class='longtext' title='" + text + "'>" + text + "</a></div>";

			htmltext += "<td"
				+ columnattrs[i]
				+ ">"
				+ text
				+ "</td>";
		}
		htmltext += "</tr>";
		htmlall += htmltext;
		
		count++;
		if (count >= rows && rows > 0) return false;
	});
	tablebody.html(htmlall);

	var hoverstyle = "news_hover";
	if (typeof(setting["hoverstyle"]) != "undefined") hoverstyle = setting["hoverstyle"];
	if (hoverstyle != "")
		$( "#" + divid + " tbody > tr")
			.mouseover(function(){ $(this).addClass(hoverstyle) })
			.mouseout(function() { $(this).removeClass(hoverstyle) });

	if (typeof(handler) != "undefined") handler(xml);
}

function html_loadtable_ajaxxml(divid, url, setting, handler)
{
	var div = $('#' + divid);	
	div.text('');
	
	var htmltext = "<table"
		+ (typeof(setting.tableattrs) == "undefined" ? "" : setting.tableattrs)
		+ ">";

	if (typeof(setting.hashead) != "undefined" && setting.hashead) {
		htmltext += "<thead><tr>";
		for (i = 0; i < setting.columns.length; i++)
		{
			htmltext += "<th"
				+ ">" + setting.columns[i]["head"]
				+ (typeof(setting.columns[i].width) == "undefined" ? "" : " width=" + setting.columns[i].width + "")
				+ "</th>"
		}
		htmltext += "</tr></thead>";
	}

	htmltext += "<tr><td colspan=" + setting.columns.length + " style='border: none;'>"
		+ __html_msg_loading
		+ "</td></tr>"
		+ "</table>";
	$(htmltext).appendTo(div);

	ajax_load_xml(url, function(xml) {
		html_loadtable_xml(divid, xml, setting, handler);
	});
}

//-------------------------------------------------------------------------------------------------
// news content & list url processing
//-------------------------------------------------------------------------------------------------
var news_datetitle = {
	tableattrs : " class='table_news' width=99% cellpadding=2",
	hashead : false,
	hasurl : true,
	title : "正文",
	columns : [
		{ name:"date", attrs:" width=20% class='ac fb'" },
		{ name:"title", attrs:" width=80% class='al'", islongtext: true }
	]
}

var news_datetypetitle = {
	tableattrs : " class='table_news' width=99% cellpadding=2",
	hashead : false,
	hasurl : true,
	title : "正文",
	columns : [
		{ name:"date", attrs:" width=15% class='ac fb'" },
		{ name:"type", attrs:" width=20% class='al'", islongtext:true },
		{ name:"title", attrs:" width=65% class='al'", islongtext: true }
	]
}

var news_index_titledate = {
	tableattrs : " class='index_news' width=99% cellpadding=2",
	hashead : false,
	hasurl : true,
	title : "正文",
	rows : 5,
	columns : [
		{ name:"title", attrs:" width=73% class='al'", islongtext: true },
		{ name:"date", attrs:" width=27% class='ac fb'" }
	]
}

var news_rss_index_titledate = {
	tableattrs : " class='index_news' width=99% cellpadding=2",
	hashead : false,
	hasurl : true,
	title : "正文",
	rows : 5,
	columns : [
		{ name:"title", attrs:" width=83% class='al'", islongtext: true },
		{ name:"pubDate", attrs:" width=17% class='ac'", type:"date", format:"MM-dd" }
	]
}

var news_rss = {
	tableattrs : " border=0 cellspacing=0 cellpadding=0 class=table_news style='width:99%'",
	hashead : false,
	hasurl : true,
	title : "正文",
	columns : [
		{ name:"typeName", attrs:" width=20% class='al'", islongtext:true },
		{ name:"title", attrs:" width=70% class='al'", islongtext: true },
		{ name:"pubDate", attrs:" width=10% class='ac' style='font-size:12px; color:gray;'", type:"date", format:"hh:mm" }
	]
}

function news_datetag(date, mode)
{
	if (mode == 'm') date = date + '-01';
	var tag = ql_date_yyyymmdd(date);
	return tag;
}

function news_headline(key, tag, category)
{
	if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/xltxt/page/list.aspx?key=" + key + "," + tag + "," + category;
	else return G_STR_WEBROOT + "/h/xltxt/latest/" + category + "/" + tag + "/" + key + "_headline.xml";
}

function zxzx_list_headline(tag)
{
    if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/xltxt/page/" + tag + ".aspx";
	else return G_STR_WEBROOT + "/h/xltxt/latest/zxzx/" + tag + "_headline.xml";
}

function news_headline2(key, category)
{
	if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/xltxt/page/list.aspx?key=" + key + "," + tag + "," + category;
	else return G_STR_WEBROOT + "/h/xltxt/latest/" + category + "/" + key + "_headline.xml";
}


function news_paging(key, date, mode, tag, category)
{
	date = news_datetag(date, mode);
	if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/xltxt/page/list.aspx?key=" + key + "," + tag + "," + category + "," + date + "," + mode;
	else
	{
		if (date == news_datetag(new Date(), mode)) return G_STR_WEBROOT + "/h/xltxt/latest/" + category + "/" + tag + "/" + key + "_lastdate.xml";
		return G_STR_WEBROOT + "/h/xltxt/history/" + category + "/" + tag + "/" + key + "/" + date.substr(0,4) + "/" + date + ".xml";
	}
}

function news_headline_rss(key)
{
	if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/xltxt/page/rsslist.aspx?key=" + key;
	else return G_STR_WEBROOT + "/h/xltxt/latest/rss/" + key + "_headline.xml";
}

function news_paging_rss(key, date, mode)
{
	date = news_datetag(date, mode);
	if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/xltxt/page/rsslist.aspx?key=" + key + "," + date + "," + mode;
	else
	{
		if (date == news_datetag(new Date(), mode)) return G_STR_WEBROOT + "/h/xltxt/latest/rss/" + key + "_lastdate.xml";
		return G_STR_WEBROOT + "/h/xltxt/history/rss/" + key + "/" + date.substr(0,4) + "/" + date + ".xml";
	}
}

function url_misc_content(key, tag)
{
	if (! G_BOOL_ASPX_DYN) key = key.replace(/\\/g, '_').replace(/\//g, '_').replace(/\:/g, '_');
	var pos = key.indexOf(",");
	
	if (pos > 0) key = encodeURIComponent(key.substr(0, pos)) + key.substr(pos);
	else key = encodeURIComponent(key);
	if (G_BOOL_ASPX_DYN) return G_STR_WEBROOT + "/misc/content/" + tag + ".aspx?key=" + key;
	else return G_STR_WEBROOT + "/h/misc/" + tag + "/" + key.replace(/,/g, '-') + ".htm";
}

//-------------------------------------------------------------------------------------------------
// chart drawing functions
//-------------------------------------------------------------------------------------------------
var __chart_default = {
	linecolor: "0x000000",
	font: {
		font: "Arial, Verdana, Helvetica, sans-serif, 宋体",
		fontsize: 12,
		fontcolor: "0x000000"
	}
};
var __chart_default_c1 = {
	linecolor: "0x000000",
	font: {
		font: "Arial, Verdana, Helvetica, sans-serif, 宋体",
		fontsize: "10.5",
		fontcolor: "0x000000"
	}
};

function __chart_param(value)
{
	return '<?xml version=\'1.0\' encoding=\'utf-8\' ?>'
		+ ql_xml_objecttoxml("xml", value)
			.replace(/"/g, "'")
			.replace(/%/g, "%25")
			.replace(/&/g, "%27");
}

function __chart_draw(id, width, height, style, data)
{
	var displaylevel = global_displaylevel();
	var defaultstyle = __chart_default;
	var ratio = 1;
	switch(displaylevel)
	{
		case "c1":
			ratio = 0.875;
			defaultstyle = __chart_default_c1;
			break;
	}

	var flashvars = {};
	var params = {
		quality : "high",
		wmode : "transparent"
	};
	
	if (typeof(style["default"]) == "undefined")
		style["default"] = defaultstyle;
	else
	{
		if (typeof(style["default"]["linecolor"]) == "undefined")
			style["default"]["linecolor"] = defaultstyle["linecolor"]; 
		if (typeof(style["default"]["font"]) == "undefined")
			style["default"]["font"] = defaultstyle["font"]; 
	}

	flashvars["style"] = __chart_param(style);
	flashvars["data"] = __chart_param(data);
	
	if (typeof(width) == "number") width *= ratio;
	if (typeof(height) == "number") height *= ratio;

	swfobject.embedSWF(
		"../flash/QlChart.swf", id, width, height,
		"9.0.0", "expressInstall.swf",
		flashvars, params
	);
}

function chart_pie(id, width, height, style, data)
{
	style["charttype"] = "pie";
	__chart_draw(id, width, height, style, data)
}

function chart_standard(id, width, height, style, data)
{
	style["charttype"] = "chart";
	__chart_draw(id, width, height, style, data)
}

function chart_bar(id, width, height, style, data)
{
	style["charttype"] = "bar";
	style["chart"]["type"] = "bar";
	__chart_draw(id, width, height, style, data)
}

function chart_stackbar(id, width, height, style, data)
{
	style["charttype"] = "bar";
	style["chart"]["type"] = "stackbar";
	__chart_draw(id, width, height, style, data)
}

function chart_stackcolumn(id, width, height, style, data)
{
	style["charttype"] = "stack";
	style["chart"]["type"] = "stackcolumn";
	__chart_draw(id, width, height, style, data)
}

function chart_stackarea(id, width, height, style, data)
{
	style["charttype"] = "stack";
	style["chart"]["type"] = "stackarea";
	__chart_draw(id, width, height, style, data)
}

function chart_percentage(id, width, height, style, data)
{
	style["charttype"] = "stack";
	style["chart"]["type"] = "percentage";
	__chart_draw(id, width, height, style, data)
}

//-------------------------------------------------------------------------------------------------
// chart drawing functions
//-------------------------------------------------------------------------------------------------
var jquery_tablesorter_pagingwidget = {
 id : 'paging',
 format : function(table) {
   __html_table_setpage(table.id, 1);

   if ($(table).attr("no") == "yes") {
    var count = 1;
    $(table).find("tbody tr").each(function() {
	 $(this).find("td").each(function() {
	  $(this).text(count);
	  count++;
	  return false;
	 })
    })
   }
 }
}

var jquery_tablesorter_bignumberparser = {
	id : 'bignumber',
	is : function(s) {
		return false;
	},
	format : function(s) {
		if (s == "" || s == "&nbsp;" || s.substr(0,2) == "--") return -Number.MAX_VALUE;
		return parseFloat(s.replace(/,/g,""));
	},
	type: 'numeric'
}

function html_paging(divid, setting, pageindex, callback)
{
	var pagesize = setting["pagesize"];
	var rowcount = setting["rowcount"];
	var pagecount = Math.floor((rowcount - 1) / pagesize) + 1
	if (pagecount < 1) pagecount = 1;
	if (pagecount == 1) return;
	if (pageindex <= 0 || pageindex > pagecount) pageindex = pagecount;
	
  var pageobj = $('#' + divid);
  pageobj.empty();
  var list = $("<ul>");
  list.appendTo(pageobj);
  if (rowcount == 0)
  {
    $("<li/>")
      .text("没有数据记录")
      .appendTo(list)
    return;
  }
  
  var startpage = Math.floor((pageindex - 1)/ 10) * 10 + 1;
  if (startpage <= 0) startpage = 1;
  if (startpage > 1)
  {
    $("<li/>")
      .text("<<")
      .appendTo(list)
    $("<li/>")
      .text(" < ")
      .appendTo(list)
  }
  
  for (var i = 0; i < 10; i++)
  {
    var index = startpage + i;
    if (index > pagecount) break;
    $("<li/>")
      .text(index)
      .appendTo(list)
  }

  if ((startpage + 9) < pagecount)
  {
    $("<li/>")
      .text(" > ")
      .appendTo(list)
    $("<li/>")
      .text(">>")
      .appendTo(list)
  }
  
  list.find("li").each(function() {
    var text = $(this).text();
    if (parseInt(text) == pageindex)
    {
      $(this).addClass("pager_selected");
    }
    else
    {
      $(this)
        .mouseover(function() { $(this).addClass("pager_over"); })
        .mouseout(function() { $(this).removeClass("pager_over"); })
        .click(function() {
          if (text == "<<") callback(1);
          else if (text == " < ") callback(pageindex - 10);
          else if (text == " > ") {
            callback(pageindex + 10);
          } else if (text == ">>") callback(-1);
          else callback(parseInt(text));
        })
    }
  });
  
  $("<li/>")
    .text("  (共" + rowcount + "条," + pagecount + "页)")
    .appendTo(list)
}

function html_table_paging(tablediv, pagesize)
{
	$('#' + tablediv).attr('_pagesize', pagesize);
	__html_table_setpage(tablediv, 1);
}

function __html_table_setpage(tablediv, pageindex)
{
	var tableobj = $('#' + tablediv);
	var pagesize = parseInt(tableobj.attr("_pagesize"));
	var rowcount = tableobj.find("tbody tr").length;
	var pagecount = Math.floor((rowcount - 1) / pagesize) + 1
	if (pagecount < 1) pagecount = 1;
	if (pageindex <= 0 || pageindex > pagecount) pageindex = pagecount;
	var startindex = (pageindex - 1) * pagesize;
	var endindex = startindex + pagesize - 1;

	var count = 0;
	tableobj.find("tbody tr").each(function() {
		if (count >= startindex && count <= endindex)
		{
			$(this).css("display","");
		}
		else
		{
			$(this).css("display","none");
		}
		count++;
	})

  var foottd = tableobj.find("tfoot td:first");
  
  foottd.find("ul").remove();
  var list = $("<ul>");
  list.appendTo(foottd);
  if (rowcount == 0)
  {
    $("<li/>")
      .text("没有数据记录")
      .appendTo(list)
    return;
  }
  var startpage = Math.floor((pageindex - 1)/ 10) * 10 + 1;
  if (startpage <= 0) startpage = 1;
  if (startpage > 1)
  {
    $("<li/>")
      .text("<<")
      .appendTo(list)
    $("<li/>")
      .text(" < ")
      .appendTo(list)
  }
  
  for (var i = 0; i < 10; i++)
  {
    var index = startpage + i;
    if (index > pagecount) break;
    $("<li/>")
      .text(index)
      .appendTo(list)
  }

  if ((startpage + 9) < pagecount)
  {
    $("<li/>")
      .text(" > ")
      .appendTo(list)
    $("<li/>")
      .text(">>")
      .appendTo(list)
  }
  
  list.find("li").each(function() {
    var text = $(this).text();
    if (parseInt(text) == pageindex)
    {
      $(this).addClass("pager_selected");
    }
    else
    {
      $(this)
        .mouseover(function() { $(this).addClass("pager_over"); })
        .mouseout(function() { $(this).removeClass("pager_over"); })
        .click(function() {
          if (text == "<<") __html_table_setpage(tablediv, 1);
          else if (text == " < ") __html_table_setpage(tablediv, pageindex - 10);
          else if (text == " > ") {
            __html_table_setpage(tablediv, pageindex + 10);
          } else if (text == ">>") __html_table_setpage(tablediv, -1);
          else __html_table_setpage(tablediv, parseInt(text));
        })
    }
  });
  
  $("<li/>")
    .text("  (共" + rowcount + "条数据," + pagecount + "页)")
    .appendTo(list)

}

function html_table_paging2(tablediv, pagerdiv, pagesize)
{
	$('#' + tablediv)
		.attr('_pagesize', pagesize)
		.attr('_pagerdiv', pagerdiv);
	__html_table_setpage2(tablediv, 1);
}

function __html_table_setpage2(tablediv, pageindex)
{
	var tableobj = $('#' + tablediv);
	var pagesize = parseInt(tableobj.attr("_pagesize"));
	var rowcount = tableobj.find("tbody tr").length;
	var pagecount = Math.floor((rowcount - 1) / pagesize) + 1
	if (pagecount < 1) pagecount = 1;
	if (pageindex <= 0 || pageindex > pagecount) pageindex = pagecount;
	var startindex = (pageindex - 1) * pagesize;
	var endindex = startindex + pagesize - 1;
	
	var count = 0;
	tableobj.find("tbody tr").each(function() {
		if (count >= startindex && count <= endindex)
		{
			$(this).css("display","");
		}
		else
		{
			$(this).css("display","none");
		}
		count++;
	})

  var pagerdiv = $('#' + tableobj.attr("_pagerdiv"));
  pagerdiv.empty();
  var list = $("<ul>");
  list.appendTo(pagerdiv);
  if (rowcount == 0)
  {
    $("<li/>")
      .text("没有数据记录")
      .appendTo(list)
    return;
  }
  
  var startpage = Math.floor((pageindex - 1)/ 10) * 10 + 1;
  if (startpage <= 0) startpage = 1;
  if (startpage > 1)
  {
    $("<li/>")
      .text("<<")
      .appendTo(list)
    $("<li/>")
      .text(" < ")
      .appendTo(list)
  }
  
  for (var i = 0; i < 10; i++)
  {
    var index = startpage + i;
    if (index > pagecount) break;
    $("<li/>")
      .text(index)
      .appendTo(list)
  }

  if ((startpage + 9) < pagecount)
  {
    $("<li/>")
      .text(" > ")
      .appendTo(list)
    $("<li/>")
      .text(">>")
      .appendTo(list)
  }
  
  list.find("li").each(function() {
    var text = $(this).text();
    if (parseInt(text) == pageindex)
    {
      $(this).addClass("pager_selected");
    }
    else
    {
      $(this)
        .mouseover(function() { $(this).addClass("pager_over"); })
        .mouseout(function() { $(this).removeClass("pager_over"); })
        .click(function() {
          if (text == "<<") __html_table_setpage2(tablediv, 1);
          else if (text == " < ") __html_table_setpage2(tablediv, pageindex - 10);
          else if (text == " > ") {
            __html_table_setpage2(tablediv, pageindex + 10);
          } else if (text == ">>") __html_table_setpage2(tablediv, -1);
          else __html_table_setpage2(tablediv, parseInt(text));
        })
    }
  });
  
  $("<li/>")
    .text("  (共" + rowcount + "条数据," + pagecount + "页)")
    .appendTo(list)

}

function html_table_paging3(tablediv, pagesize)
{
	$('#' + tablediv).attr('_pagesize', pagesize);
	__html_table_setpage3(tablediv, 1);
}

function __html_table_setpage3(tablediv, pageindex)
{
	var tableobj = $('#' + tablediv);
	var pagesize = parseInt(tableobj.attr("_pagesize"));
	var rowcount = tableobj.find("tbody tr").length;
	var pagecount = Math.floor((rowcount - 1) / pagesize) + 1
	if (pagecount < 1) pagecount = 1;
	if (pageindex <= 0 || pageindex > pagecount) pageindex = pagecount;
	var startindex = (pageindex - 1) * pagesize;
	var endindex = startindex + pagesize - 1;

	var count = 0;
	tableobj.find("tbody tr").each(function() {
		if (count >= startindex && count <= endindex)
		{
			$(this).css("display","");
		}
		else
		{
			$(this).css("display","none");
		}
		count++;
	})

  var foottd = tableobj.find("tfoot td:first");
  
  foottd.find("ul").remove();
  var list = $("<ul>");
  list.appendTo(foottd);
  if (rowcount == 0)
  {
    $("<li/>")
      .text("没有数据记录")
      .appendTo(list)
    return;
  }

  var startpage = Math.floor((pageindex - 1)/ 5) * 5 + 1;
  if (startpage <= 0) startpage = 1;
  if (startpage > 1)
  {
    $("<li/>")
      .text("<<")
      .appendTo(list)
    $("<li/>")
      .text(" < ")
      .appendTo(list)
  }

  for (var i = 0; i < 5; i++)
  {
    var index = startpage + i;
    if (index > pagecount) break;
    $("<li/>")
      .text(index)
      .appendTo(list)
  }
  if ((startpage + 4) < pagecount)
  {
    $("<li/>")
      .text(" > ")
      .appendTo(list)
    $("<li/>")
      .text(">>")
      .appendTo(list)
  }
  
  list.find("li").each(function() {
    var text = $(this).text();
    if (parseInt(text) == pageindex)
    {
      $(this).addClass("pager_selected");
    }
    else
    {
      $(this)
        .mouseover(function() { $(this).addClass("pager_over"); })
        .mouseout(function() { $(this).removeClass("pager_over"); })
        .click(function() {
          if (text == "<<") __html_table_setpage(tablediv, 1);
          else if (text == " < ") __html_table_setpage(tablediv, pageindex - 5);
          else if (text == " > ") {
            __html_table_setpage(tablediv, pageindex + 5);
          } else if (text == ">>") __html_table_setpage(tablediv, -1);
          else __html_table_setpage(tablediv, parseInt(text));
        })
    }
  });
  
  $("<li/>")
    .text("  (共" + rowcount + "条数据," + pagecount + "页)")
    .appendTo(list)

}

function var_dumpstr(obj)
{
	var text = JSON.stringify(obj);
}

var ieversion = 0;
function ie_version()
{
	if (ieversion > 0) return ieversion;
	var ua = navigator.userAgent;
	var pos = ua.indexOf("MSIE");
	ieversion = parseInt(ua.substr(pos + 5, 1));
	return ieversion;
}
