var siteConst = {	
	bodyWidth:1000,
	leftWidth:156,
	rightWidth:200,
	colInter:11,
	topInter:125,
	leftMap:new Map(),
	contentMap:new Map(),
	rightMap:new Map(),
	m_x:0,
	m_y:0,
	offsetLeft:0,
	first:true
};

function pub_layout(){
	$('#swf_ads').css('display','none');
	siteConst.offsetLeft=(document.documentElement.clientWidth-siteConst.bodyWidth)/2;
	if(siteConst.offsetLeft<0)siteConst.offsetLeft=0;
	var maxHeight=0, _top=siteConst.topInter;
	var i, b;
	for(i=0;i<siteConst.leftMap.size();i++){
		b=siteConst.leftMap.get(i);b.order=i;
		if($('#'+b.id).length<1) continue;
		$('#'+b.id).attr('order',i); $('#'+b.id).attr('pos_type',0);
		$('#'+b.id).css({left:siteConst.offsetLeft,width:siteConst.leftWidth,position: "absolute",top: _top,'z-index':100 });
		_top+=eval(document.getElementById(b.id).scrollHeight);		
	}
	maxHeight=_top;_top=siteConst.topInter;
	var tmpLeftWidth = siteConst.leftMap.size()==0?0:(siteConst.leftWidth+siteConst.colInter);
	var contentWidth=siteConst.bodyWidth-tmpLeftWidth-(siteConst.rightMap.size()>0?(siteConst.rightWidth+siteConst.colInter):0);
	//if(siteConst.contentMap.size()>0){
		for(i=0;i<siteConst.contentMap.size();i++){
			b=siteConst.contentMap.get(i);b.order=i;
			if($('#'+b.id).length<1) continue;
			$('#'+b.id).attr('order',i); $('#'+b.id).attr('pos_type',1);
			$('#'+b.id).css({left:siteConst.offsetLeft+tmpLeftWidth,width: contentWidth,position: "absolute",top: _top,'z-index':99 });
			if(b.id=='swf_ads')_top+=205;
			else _top+=eval(document.getElementById(b.id).scrollHeight);
		}
		maxHeight=maxHeight>_top?maxHeight:_top;
		if(siteConst.rightMap.size()>0){
			_top=siteConst.topInter;	
			for(i=0;i<siteConst.rightMap.size();i++){
				b=siteConst.rightMap.get(i);b.order=i;
				if($('#'+b.id).length<1) continue;
				$('#'+b.id).attr('order',i); $('#'+b.id).attr('pos_type',2);
				$('#'+b.id).css({left:siteConst.offsetLeft+contentWidth+siteConst.colInter+tmpLeftWidth,width: siteConst.rightWidth,position: "absolute",top: _top,'z-index':98 });
				_top+=eval(document.getElementById(b.id).scrollHeight);
			}
			maxHeight=maxHeight>_top?maxHeight:_top;
		}
	//}else{
	//	$('#contentBlock').css({left:siteConst.offsetLeft+siteConst.leftWidth+siteConst.colInter,width: contentWidth,position: "absolute",top: _top,'z-index':99,'text-align': 'center' });
	//	_top+=eval(document.getElementById('contentBlock').scrollHeight);
	//	maxHeight=maxHeight>_top?maxHeight:_top;
	//}
	$('#footer').css({left:siteConst.offsetLeft,width:1002, position: "absolute",top: maxHeight});
	$('#swf_ads').css('display','block');
	if(siteConst.first){siteConst.first=false;setTimeout("pub_layout()",200);}
}
var pub_reLayout=function(){setTimeout("pub_layout()",100);}
$(window).ready(function(){
	pub_layout();
	window.onresize=pub_reLayout;
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("itemNav");
		if(navRoot==null||navRoot==undefined) return;
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function(){this.className+=" over";}
				node.onmouseout=function() {this.className=this.className.replace(" over", "");}
			}
		}
	}
});
