var mb1 = 273;//列表呈现时maibody距右边的距离
var mb2 = 7;//列表关闭时maibody距右边的距离
var mbright = mb1;
init();
onresize = function()
{
	init();
}

function init()
{
	resize_x('header',0,0);
	resize('mapbody1',98,mbright,5,5);
	resize('mapbody2',98,mbright,5,5);
	resize_y('list',165,5);
	resize_y('resize',98,3);
}
function resize_x(id,left,right)
{
	var obj = $(id);
	obj.style.width = (document.body.offsetWidth-left-right)+'px';
	obj.style.left = left+'px';
}
function resize_y(id,top,bottom)
{
	var obj = $(id);
	obj.style.height = (document.body.offsetHeight-top-bottom)+'px';
	obj.style.top = top+'px';
}
function resize(id,top,right,bottom,left)
{
	var obj = $(id);
	obj.style.width = (document.body.offsetWidth-left-right)+'px';
	obj.style.height = (document.body.offsetHeight-top-bottom)+'px';
	obj.style.top = top+'px';
	obj.style.left = left+'px';
}
function $(id)
{
	return document.getElementById(id);
}
/*
var fname = $('fields_name');
var ftype = $('fields_type');
var fads = $('fields_ads');
var vname = $('values_name');
var vtype = $('values_type');
var vads = $('values_ads');
function setName(long)
{
	fname.style.width = long+'px';
	vname.style.width = long+1+'px';
}
function setAds(long)
{
	fads.style.width = long+'px';
	vads.style.width = long+1+'px';
}
function setType(long)
{
	ftype.style.width = long+'px';
	vtype.style.width = long+2+'px';
}
*/
var resize1 = $('fields_resize_1');
var oldX;
resize1.onmousedown = function(e){
	e = (e ? e : event);
	//echo(e.clientX+' '+e.offsetX+' '+e.screenX);
}
resize1.ondrag = function(e){
	e = (e ? e : event);
	echo(e.clientX+' '+e.offsetX+' '+e.screenX);
}
document.onmouseup = function(e){
	echo('鼠标松开');
	e = (e ? e : event);
}
document.onmousemove = function(e){
	e = (e ? e : event);
	//echo(e.clientX+' '+e.offsetX+' '+e.screenX);
}


var re = $('resize');
var reisopen = true;
re.onclick = function(){
	if(reisopen){
		$('filter').style.display = 'none';
		$('listtitle').style.display = 'none';
		$('list').style.display = 'none';
		this.className = 'resize_c_2';
		mbright = mb2;
		init();
		reisopen = false;
	}else{
		$('filter').style.display = 'block';
		$('listtitle').style.display = 'block';
		$('list').style.display = 'block';
		this.className = 'resize_c_1';
		mbright = mb1;
		init();
		reisopen = true;
	}	
}
re.onmouseover = function()
{
	this.style.backgroundColor = '#ffeeaa';
}
re.onmouseout = function()
{
	this.style.backgroundColor = '#ffffff';
}

var testo = $('testout');
function echo(str)
{
	testo.innerHTML = 'output:'+str;
}

function show(id)
{
	$(id).style.display = 'block';	
}
function hide(id)
{
	$(id).style.display = 'none';
}
function changetitle(titleid, value)
{
	$(titleid).getElementsByTagName('a')[0].innerHTML = value;
	if(titleid == 'state_title')
	{
		state_change(value);
	}
}
