﻿var strObj
var flag	//标志当前是否自由编辑状态

flag=0;
function buildDiv(){
	var argArr = buildDiv.arguments;
	var htmlDiv = '';
	//var text = '';

	//for(var i=0;i<argArr.length;i++){
		
	//if(argArr[i]=='popupMenu'){
	//	text = "浮动工具条";
	//}
	//else if(argArr[i]=='popupEditor'){
	//	text = "自由编辑页面内容"
	//}
	if( argArr[0] == 'popupForm')
	{
    	htmlDiv = '<div class="window" id="' + argArr[0] + '">';
		htmlDiv += '	<div class="window_op">';
		htmlDiv += '		<img src="images/button_open.gif" />';
		htmlDiv += '		<a onclick="javascript:hiddenLayer(' + argArr[0] + ')" style="cursor:hand;" title="关闭"><img class="button_close" border="0" src="images/button_close.gif" /></a>';
		htmlDiv += '	</div>';
		htmlDiv += '	<div><img style="margin:100px 20px 0px 0px ;width:260px;" id="imgShow" src="images/che.jpg" /></div>';
		htmlDiv += '</div>'; 
	}
	if( argArr[0] == 'popupNews')
	{
		htmlDiv = '<div class="window1" id="' + argArr[0] + '">';
		htmlDiv += '	<div class="window_op">';
		htmlDiv += '		<img src="images/button_open.gif" />';
		htmlDiv += '		<a onclick="javascript:hiddenLayer(' + argArr[0] + ')" style="cursor:hand;" title="关闭"><img class="button_close" border="0" src="images/button_close.gif" /></a>';
		htmlDiv += '	</div>';
		htmlDiv += '<div class="content3_c_s"><h3 class="h3_3"><div id="dvTitle"></div></h3><div id="dvContent"></div></div>';
		htmlDiv += '</div>'; 
	}   	
    	document.write(htmlDiv);
	//}
}

function displayLayer(imgUrl){
	if(flag==0){
		hiddenLayer('popupForm');
	
		var dv = document.getElementById('popupForm');
	
		//if(iscenter==0){
		//	GetMouseXY_ForLayer(dv);
		//	strObj = obj;
		//}else{
		//	GetCenterXY_ForLayer(dv);
		//	flag=1;
		//}
		//DivSetVisible(dv);
		imgShow = document.getElementById('imgShow');
		imgShow.src = imgUrl;
		dv.style.visibility = "inherit";
	}
}

function displayNewsLayer(title,content){
	
	if(flag==0){
		hiddenLayer('popupNews');
	
		var dv = document.getElementById('popupNews');
		
		//dvTitle = document.getElementById('dvTitle');
		//alert(dvTitle);
		dvTitle.innerHTML = title;
		//dvContent = document.getElementById('dvContent');
		dvContent.innerHTML = content;
		dv.style.visibility = "inherit";
	}
}

function hiddenLayer(){
	var argArr = hiddenLayer.arguments;
	
	//var IfrRef = document.getElementById('DivShim');
	//IfrRef.style.display = "none";
	flag=0;
	for(var i=0;i<argArr.length;i++){
		eval(argArr[i]).style.visibility = "hidden";
		//if(argArr[i]=='popupMenu') flag=0;
	}
}

//将悬浮层的位置定位在屏幕中央
function GetCenterXY_ForLayer(objdiv){
	x = document.body.scrollLeft;
	y = document.body.scrollTop;
	
	//获取屏幕宽度
	availWidth = parseInt(window.screen.availWidth);
	availHeight = parseInt(window.screen.availHeight);
	
	tblWidth = parseInt(objdiv.width);
	
		
	y = y + availHeight/4;
	x = (availWidth - tblWidth)/2;
	
	objdiv.style.top = y;
	objdiv.style.left = x;
}

//将悬浮层的位置跟随鼠标

function GetMouseXY_ForLayer(objdiv){
	objdiv.style.top =   document.body.scrollTop + event.clientY;
	objdiv.style.left =  document.body.scrollLeft + event.clientX;
}

function showdata(show,value){
	//document.all("issuedate").value = value;
	//document.quicksearch.issuedate.value = value;
	//document.all(strObj).value = show;
	//strObj.value = show;
	document.getElementById(strObj).innerHTML=show;
	//document.all("btnSltIssuedate").value = show;
	//hiddenLayer("popupIssuedate");
}

function DivSetVisible(objDiv){
	var IfrRef = document.getElementById('DivShim');
	
	objDiv.style.visibility = "visible";
	IfrRef.style.width = objDiv.offsetWidth;
	IfrRef.style.height = objDiv.offsetHeight;
	IfrRef.style.top = objDiv.style.top;
	IfrRef.style.left = objDiv.style.left;
	IfrRef.style.zIndex = objDiv.style.zIndex - 1;
	IfrRef.style.display = "block";
}

function DivShowDialog(sRUL,nName,sStyle)
{
	sRUL += "?DivId=" + strObj;
	window.open(sRUL,nName,sStyle);
}



