//设置DIV全屏效果
document.write('<div id="DIV_overlay" style="display:none;position:absolute; top:-30px;left:0px;width:100%; height:expression(body.clientHeight+30);z-index:1000;background-color:#000;filter:alpha(opacity=70);"><iframe src="javascript:false" scrolling="no" frameborder="0" style="z-index:-1;position:absolute; width:100%;height:100%" ></iframe></div>');
document.write('<div id="DIV_window" style="display:none;position:absolute; top:0px;left:0px; width:100%; height:100%;z-index:1001;"></div>');

//关闭全屏DIV
function close_DIV()
{
	document.getElementById("DIV_overlay").style.display= "none";
	document.getElementById("DIV_window").style.display= "none";
}

//关闭全屏DIV 并页面刷新
function reload_DIV()
{
	document.getElementById("DIV_overlay").style.display= "none";
	document.getElementById("DIV_window").style.display= "none";
	parent.location.reload();
}
//全屏DIV滚动条控制
function f_DIV() {
document.getElementById("DIV_overlay").style.top = document.body.scrollTop;
document.getElementById("DIV_window").style.top = document.body.scrollTop;
}
window.onscroll=f_DIV; 


//带表单返回值调用全屏DIV
	var frmObjId;
	var frmObjShow;
function showdiv(width,height,src,divtitle,frmId,frmShow)
{
	frmObjId = frmId;
	frmObjShow = frmShow;
	if_height=height-31;
	document.getElementById("DIV_overlay").style.display= "";
	document.getElementById("DIV_window").style.display= "";
	show_text='<div id="DIV_window_show" style="position:absolute;top: 50%;left: 50%;border: 4px solid #666;width:'+width+'px;height:'+height+'px;margin:-'+height/2+'px auto auto -'+width/2+'px;">';
	show_text+='<table width="100%" cellspacing="8"  background="/images/ptitle.png"><tr><td style="color:#fff">'+divtitle+'</td><td align="right"><b onclick="CateValue();"style="color:#fff;cursor: hand;">确定</b> | <b onclick="close_DIV();"style="color:#fff;cursor: hand;">取消</b></td> </tr></table>';
	show_text+='<iframe frameborder=0 style="overflow: hidden;width: 100%;height:'+if_height+'" src="'+src+'" id="divWindows" name="divWindows"></iframe>';
	show_text+='</div>';
	document.getElementById("DIV_window").innerHTML=show_text;
}
function CateValue(obj)
{
	var reValue=",";
	var reTitle = "";
	var intCount = 0;
	for(i=0;i<divWindows.CateID.length;i++)
	{
		if(divWindows.CateID[i].checked == true)
		{
			reValue = reValue + divWindows.CateID[i].value + ",";
			reTitle = reTitle + divWindows.CateID[i].title + ",";
			intCount  = intCount + 1
		}
	}
		frmObjId.value =reTitle.substr(0,reTitle.length-1);
		frmObjShow.value = reValue.substr(0,reValue.length-1)+",";
		close_DIV();

}
//普通页面调用全屏DIV
function show_DIV(width,height,src,divtitle)
{
if_height=height-31;
//document.getElementById("DIV_overlay").style.display= "";
document.getElementById("DIV_window").style.display= "";
show_text='<div id="DIV_window_show" style="position:absolute;top: 50%;left: 50%;background: #fff;border: 1px solid #999;width:'+width+'px;height:'+height+'px;margin:-'+height/2+'px auto auto -'+width/2+'px;">';

show_text+='<table width="100%" cellspacing="8"  background="/images/ptitle.png"><tr><td style="color:#fff" align="left">'+divtitle+'</td><td align="right"><b onclick="close_DIV();" style="color:#fff;cursor: hand;">关闭</b></td> </tr></table>';

show_text+='<iframe frameborder=0 style="overflow: hidden;width: 100%;height:'+if_height+'" src="'+src+'" id="divWindows" name="divWindows"></iframe>';
show_text+='</div>';
document.getElementById("DIV_window").innerHTML=show_text;
}
//普通页面调用全屏DIV     --结束




//不带全屏窗口
function div_show(width,height,src,divtitle)
{
	if_height=height-31;
	document.getElementById("DIV_window").style.display= "";
	show_text='<div id="DIV_window_show" style="position:absolute;top: 50%;left: 50%;background: #fff;border: 2px solid #5481D1;width:'+width+'px;height:'+height+'px;margin:-'+height/2+'px auto auto -'+width/2+'px;">';
	show_text+='<iframe src="javascript:false" scrolling="no" frameborder="0" style="z-index:-1;position:absolute; width:'+(width-4)+'px;height:40px"></iframe>';
	show_text+='<table width="100%" cellspacing="8"  background="/images/ptitle.png" onmousedown=\'m("DIV_window_show")\'><tr><td >'+divtitle+'</td><td align="right"><b onclick="close_DIV();"style="cursor: hand;">关闭</b></td> </tr></table>';
	show_text+='<iframe frameborder=0 style="overflow: hidden;width: 100%;height:'+if_height+'" src="'+src+'" id="divWindows" name="divWindows"></iframe>';
	show_text+='</div>';
	document.getElementById("DIV_window").innerHTML=show_text;
}

//图片上传
function uploadImg(width,height,src,divtitle,frmId,frmShow)
{
	frmObjId = frmId;
	frmObjShow = frmShow;
	
	if_height=height-31;
	document.getElementById("DIV_window").style.display= "";
	show_text='<div id="DIV_window_show" style="position:absolute;top: 50%;left: 50%;background: #fff;border: 2px solid #5481D1;width:'+width+'px;height:'+height+'px;margin:-'+height/2+'px auto auto -'+width/2+'px;">';
	show_text+='<iframe src="javascript:false" scrolling="no" frameborder="0" style="z-index:-1;position:absolute; width:'+(width-4)+'px;height:40px"></iframe>';
	//select挡住div的解决方法
	show_text+='<table width="100%" cellspacing="8"  background="/images/ptitle.png" onmousedown=\'m("DIV_window_show")\' style="cursor: hand;"><tr><td >'+divtitle+'</td><td align="right"><b onclick="upImg();" style="cursor: hand;">确定</b> | <b onclick="close_DIV();"style="cursor: hand;">取消</b></td> </tr></table>';
	show_text+='<iframe frameborder=0 style="overflow: hidden;width: 100%;height:'+if_height+'" src="'+src+'" id="divWindows" name="divWindows"></iframe>';
	show_text+='</div>';
	document.getElementById("DIV_window").innerHTML=show_text;
}
function upImg()
{
	if(divWindows.document.all('upImg'))
	{
		frmObjId.value =divWindows.document.all('upImg').value;
		frmObjShow.src ="/upload/"+divWindows.document.all('upImg').value;
		}
		close_DIV();
}
//END 图片上传
//区别于文件上传只返加一个值操作，图片是值跟图片显示
//文件上传
function uploadFile(width,height,src,divtitle,frmId)
{
	frmObjId = frmId;
	if_height=height-31;
	document.getElementById("DIV_window").style.display= "";
	show_text='<div id="DIV_window_show" style="position:absolute;top: 50%;left: 50%;background: #fff;border: 2px solid #5481D1;width:'+width+'px;height:'+height+'px;margin:-'+height/2+'px auto auto -'+width/2+'px;">';
	show_text+='<iframe src="javascript:false" scrolling="no" frameborder="0" style="z-index:-1;position:absolute; width:'+(width-4)+'px;height:40px"></iframe>';
	//select挡住div的解决方法
	show_text+='<table width="100%" cellspacing="8"  background="/images/ptitle.png" onmousedown=\'m("DIV_window_show")\' style="cursor: hand;"><tr><td >'+divtitle+'</td><td align="right"><b onclick="upFile();" style="cursor: hand;">确定</b> | <b onclick="close_DIV();"style="cursor: hand;">取消</b></td> </tr></table>';
	show_text+='<iframe frameborder=0 style="overflow: hidden;width: 100%;height:'+if_height+'" src="'+src+'" id="divWindows" name="divWindows"></iframe>';
	show_text+='</div>';
	document.getElementById("DIV_window").innerHTML=show_text;
}
function upFile()
{
	if(divWindows.document.all('upImg'))
	{
		frmObjId.value =divWindows.document.all('upImg').value;
	}
		close_DIV();
}
//END 文件上传


var mouseObj=null;
var pX
var pY
document.onmousemove=divMove;
document.onmouseup=divUp;
function m(c_Obj)
{ mouseObj=document.all(c_Obj);
  pX=mouseObj.style.pixelLeft-event.x;
  pY=mouseObj.style.pixelTop-event.y;}
function divMove()
{if(mouseObj)
  {mouseObj.style.left=pX+event.x;
   mouseObj.style.top=pY+event.y;
   event.returnValue=false;}}
function divUp()
{if(mouseObj)
  {mouseObj=null;} }
  
//选项卡
function showsub(name,id,n)
{
	for (i = 0;i<n;i++)
	{	
		document.getElementById(name+i).className =  name+"Out";
		document.getElementById(name+"0"+i).style.display= "none";
	}
//	alert(name+id);
	document.getElementById(name+id).className = name+"Over";
	document.getElementById(name+"0"+id).style.display = "";
}
  
function copyToClipBoard(copytext){
window.clipboardData.setData("Text",copytext);
alert("你已复制链接及标题，请粘贴到POPO/MSN等发给好友!");
}