var bodyScrollWidth=0;
var bodyScrollHeight=0;
var screenAvailWidth=window.screen.availWidth;
var screenAvailHeight=window.screen.availHeight;
reCalBodySize();

function reCalBodySize(){
	bodyScrollWidth=document.documentElement.scrollWidth;
	bodyScrollHeight=document.documentElement.scrollHeight;
}

function vcollist(v,vcount,pid,sonid)
{//vcollist(0,6,'bj_pid_xx_','bj_pid_xx_collist_')
	var frm_heights = new Array('437','430','483','481','438','682','388');
	for(var ii=0;ii <= vcount;ii++)
	{
		var pitem = document.getElementById(pid + ii);
		var sitem = document.getElementById(sonid + ii);
		if(v == ii)
		{
			pitem.className = 'pop_tt2_1bold';
			sitem.style.display = 'block';
		}else{
			pitem.className = 'pop_tt2_1bold2';
			sitem.style.display = 'none';
		}
		
		parent.document.getElementById("frm_search_col").height = frm_heights[v];
		
	}
	
}

function sltColid(v,k,ifcreative,ifeditor)
{
	document.frmsearchadv.btnSltCol.value = k;
	document.frmsearchadv.editor_bj_99.value = v;
	document.frmsearchadv.createck.value = ifcreative;
	document.frmsearchadv.editorck.value = ifeditor;
	if(ifcreative == 1)
	{
		document.frmsearchadv.cy_cktype.value = v;
		//cy_cktype
	}
	hiddenLayer('popupSearchCol');
}
function displayLayer(obj,e)
{
	var o = document.getElementById(obj);
	if(!o)
	{
		return;
	}
	GetCenterXY_ForLayer(o,e);
}

function checkAndResetStyleTop (obj) {
	var clientHeight=obj.firstChild.clientHeight;
	var styleTop=parseInt(obj.style.top.substring(0,obj.style.top.length-2));
	if ( clientHeight+styleTop>bodyScrollHeight ) {
		obj.style.top=(bodyScrollHeight- clientHeight)+'px';
	}
}

//将悬浮层的位置定位在body可见区域中央
function GetCenterXY_ForLayer(objdiv,e){
	objdiv.style.display='block';
	var styleWidth=objdiv.style.width.substring(0,objdiv.style.width.length-2);
	var oEvent = window.event || e;
	var clientHeight= oEvent.clientY;//objdiv.firstChild.clientHeight;
	var objLeft = parseInt(document.documentElement.scrollLeft+(document.documentElement.clientWidth - styleWidth)/2)+'px';
	objLeft = oEvent.clientX;
	var relTop= clientHeight;//(document.documentElement.clientHeight-clientHeight)/2 > 0 ? (document.documentElement.clientHeight-clientHeight)/2:0;
	var objTop = parseInt(document.documentElement.scrollTop+relTop)+'px';
	
	objdiv.style.top = objTop;
	objdiv.style.left = objLeft;
	//alert(objTop + '---' + objLeft);
	//checkAndResetStyleTop(objdiv);
}
	
function hiddenLayer(obj)
{
	document.getElementById(obj).style.display = 'none';
}
function cancel()
{}
function hide()
{}
