SEP_PADDING = 5;
HANDLE_PADDING = 7;
var EditMode=false;
var SourceMode=true;
 var h;
 var w;
 var l;
 var t;
 var topMar = 4;
 var leftMar = -2;
 var spaces = 1;
 var isvisible;
 var global = window.document
 global.fo_currentMenu = null
 global.fo_shadows = new Array
function HideMenu() {
var mX;
var mY;
var vDiv;
var mDiv;
if (isvisible == true){
vDiv = document.all("menuDiv");
mX = window.event.clientX + document.body.scrollLeft;
mY = window.event.clientY + document.body.scrollTop;
if ((mX < parseInt(vDiv.style.left)) || (mX > parseInt(vDiv.style.left)+vDiv.offsetWidth) || (mY < parseInt(vDiv.style.top)-h) || (mY > parseInt(vDiv.style.top)+vDiv.offsetHeight)){
vDiv.style.visibility = "hidden";
isvisible = false;
}
}
}
function ShowMenu(vMnuCode,tWidth) {
vSrc = window.event.srcElement;
vMnuCode = "<TABLE id='submenu' CELLSPACING=1 cellpadding=3 STYLE='width:"+tWidth+"' onmouseout='HideMenu()'><TR><TD >" + vMnuCode + "</TD></TR></TABLE>";
h = vSrc.offsetHeight;
w = vSrc.offsetWidth;
l = vSrc.offsetLeft + leftMar+4;
t = vSrc.offsetTop + topMar + h + spaces-2;
vParent = vSrc.offsetParent;
while (vParent.tagName.toUpperCase() != "BODY")
{
l += vParent.offsetLeft;
t += vParent.offsetTop;
vParent = vParent.offsetParent;
}
menuDiv.innerHTML = vMnuCode;
menuDiv.style.top = t;
menuDiv.style.left = l;
menuDiv.style.visibility = "visible";
isvisible = true;
    makeRectangularDropShadow(submenu, 4)
}

function makeRectangularDropShadow(el, size)
{
var i;
for (i=size; i>0; i--)
{
var rect = document.createElement('div');
var rs = rect.style
rs.position = 'absolute';
rs.left = (el.style.posLeft + i) + 'px';
rs.top = (el.style.posTop + i) + 'px';
rs.width = el.offsetWidth + 'px';
rs.height = el.offsetHeight + 'px';
rs.zIndex = el.style.zIndex - i;
var opacity = 1 - i / (i + 1);
rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
el.insertAdjacentElement('afterEnd', rect);
global.fo_shadows[global.fo_shadows.length] = rect;
}
}
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
imgmenu = eval("imgmenu" + sid);
if (whichEl.style.display == "none"){
eval("submenu" + sid + ".style.display=\"\";");
imgmenu.background="Images/Admin/Admin20051011.gif";
}else{
eval("submenu" + sid + ".style.display=\"none\";");
imgmenu.background="Images/Admin/Admin20051000.gif";
}
}
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name != 'chkall')       e.checked = form.chkall.checked; 
}
}

function cleanHtml()
{
var fonts = message.document.body.all.tags("FONT");
var curr;
for (var i = fonts.length - 1; i >= 0; i--) {
curr = fonts[i];
if (curr.style.backgroundColor == "#ffffff") curr.outerHTML= curr.innerHTML;
}
}
function switchSysBar(Height)
{
Height = Height;
if (Height==0) {
document.all("frmTitle").style.height="200"
}
else if (Height==1) {
document.all("frmTitle").style.height="800"
}
}
function DoTitle(addTitle) {  
var revisedTitle;  
var currentTitle = document.MessNew.MessToName.value; 
if(currentTitle=="") revisedTitle = addTitle; 
else { 
var arr = currentTitle.split(","); 
for (var i=0; i < arr.length; i++) { 
if( addTitle.indexOf(arr[i]) >=0 && arr[i].length==addTitle.length ) return; 
} 
revisedTitle = currentTitle+","+addTitle; 
} 
document.MessNew.MessToName.value=revisedTitle;  
document.MessNew.MessToName.focus(); 
return; 
} 
function FormMenu(targ,selObj,restore){ 
var selObj = event.srcElement;
window.open(selObj.options[selObj.selectedIndex].value);
if (restore) selObj.selectedIndex=0;
}
function IsDigit(){
return ((event.keyCode >= 48) && (event.keyCode <= 57));
}

function showadv(){
if (document.Save.advshow.checked == true) {
document.getElementById("adv").style.display = "";
//document.getElementById("advance").innerText="";
}else{
document.getElementById("adv").style.display = "none";
//document.getElementById("advance").innerText="";
}

}

function setCookie(name, value)
{
var argv = setCookie.arguments;
var argc = setCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
if(expires!=null)
{
var LargeExpDate = new Date ();
LargeExpDate.setTime(LargeExpDate.getTime() + (expires*1000*3600*24));
}
document.cookie = name + "=" + escape (value)+((expires == null) ? "" : ("; expires=" +LargeExpDate.toGMTString()));
}
function getCookie(Name)
{
var search = Name + "="
if(document.cookie.length > 0) 
{
offset = document.cookie.indexOf(search)
if(offset != -1) 
{
offset += search.length
end = document.cookie.indexOf(";", offset)
if(end == -1) end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
else return ""
}
}
function doZoom(size){
 document.getElementById('zoomz').style.fontSize=size+'px'
}


	var i=1;//全局计数变量
	function Set1()
	{
	var iCount,path;
	var str='';
	iCount=window.Form.upcount.value
//	str='<td></td>';
	if((!iCount)||(iCount==0))
		{iCount=1;
		window.Form.upcount.value=1;
		}
	if (iCount>=100)
		{
		window.Form.upcount.value=i-1;
		alert("每次最大允许上传99个文件");
		}
	else
		{
		window.Form.upcount1.value=0
		for(i=1;i<=iCount;i++)
			{
		str+='<div align="left" style="height:25px;">图片'+i+':<input type=text name="Pic'+i+'" style="width:280">&nbsp;<INPUT TYPE=button NAME=SPic'+i+' CLASS=submit_all VALUE=" 上传 " onClick="window.open(\'Inc/PicLoad.asp?Formname=Form&FileName=Upload/Pic&Editname=Pic'+i+'\','+'\'\''+','+'\'status=no,scrollbars=no,scroll=no,top=300,left=310,width=390,height=80'+'\');"></div>';
			}
			window.upid.innerHTML=str;
		}
		return false;
	}

   function Set2()
   {
	 //  alert(i);
	var iCount,iV,path;
	iV=parseInt(window.Form.upcount1.value)
	iCount=parseInt(window.Form.upcount.value)
	if(iCount!=i-1)
		{iCount=i-1;}		
	if (i>=100)
		{
		window.Form.upcount.value=99;
		alert("每次最大允许上传99个文件");
		}
	else
		{
			if(i==1){i=2}
			if(iV==1){iCount=1;window.Form.upcount1.value=0;}
			{
			window.Form.upcount.value=iCount+1;
		//	if(i==0){i=1}
			window.upid.insertAdjacentHTML('BeforeEnd','<div align="left" style="height:25px;">图片'+i+':<input type="text" name="Pic'+i+'" style="width:280">&nbsp;<INPUT TYPE=button NAME="SPic'+i+'" CLASS=submit_all VALUE=" 上传 " onClick="window.open(\'Inc/PicLoad.asp?Formname=Form&FileName=Upload/Pic&Editname=Pic'+i+'\','+'\'\''+','+'\'status=no,scrollbars=no,scroll=no,top=300,left=310,width=390,height=80'+'\');"></div>');
			}
		}
	i++;
	return false;
	}
	
	function Set3()
		{
			var iCount;
			var str="";
			iCount=window.Form.upcount.value	
	
			str+='<div align="left">&nbsp;<font color=red>不添加组图请不要设定</font><br></div>';
			window.upid.innerHTML=str;
			i=2;
			window.Form.upcount.value=3;
		}


//--------------------------------------------------------
	var ii=1;//全局计数变量
	function Set4()
	{
	var iCount,path;
	var str='';
	iCount=window.Form.upcountpas.value
//	str='<td></td>';
	if((!iCount)||(iCount==0))
		{iCount=1;
		window.Form.upcountpas.value=1;
		}
	if (iCount>=100)
		{
		window.Form.upcountpas.value=ii-1;
		alert("每次最大允许上传99个文件");
		}
	else
		{
		window.Form.upcountpas1.value=0
		for(ii=1;ii<=iCount;ii++)
			{
		str+='<div align="left" style="height:25px;">附件'+ii+':<input type=text name="Pas'+ii+'" style="width:280">&nbsp;<INPUT TYPE=button NAME=SPas'+ii+' CLASS=submit_all VALUE=" 上传 " onClick="window.open(\'Inc/PicLoad.asp?Formname=Form&FileName=Upload/Pic&Editname=Pas'+ii+'\','+'\'\''+','+'\'status=no,scrollbars=no,scroll=no,top=300,left=310,width=390,height=80'+'\');"></div>';
			}
			window.upidpas.innerHTML=str;
		}
		return false;
	}

   function Set5()
   {
	var iCount,iV,path;
	iV=parseInt(window.Form.upcountpas1.value)
	iCount=parseInt(window.Form.upcountpas.value)
	if(iCount!=ii-1)
		{iCount=ii-1;}		
	if (ii>=100)
		{
		window.Form.upcountpas.value=99;
		alert("每次最大允许上传99个文件");
		}
	else
		{
			if(ii==1){ii=2}
			if(iV==1){iCount=1;window.Form.upcountpas1.value=0;}
			{
	//		if(ii==0){ii=1}
			window.Form.upcountpas.value=iCount+1;
			window.upidpas.insertAdjacentHTML('BeforeEnd','<div align="left" style="height:25px;">附件'+ii+':<input type="text" name="Pas'+ii+'" style="width:280">&nbsp;<INPUT TYPE=button NAME="SPas'+ii+'" CLASS=submit_all VALUE=" 上传 " onClick="window.open(\'Inc/PicLoad.asp?Formname=Form&FileName=Upload/Pic&Editname=Pas'+ii+'\','+'\'\''+','+'\'status=no,scrollbars=no,scroll=no,top=300,left=310,width=390,height=80'+'\');"></div>');
			}
		}
	ii++;
	return false;
	}
	
	function Set6()
		{
			var iCount;
			var str="";
			iCount=window.Form.upcountpas.value	
	
			str+='<div align="left">&nbsp;<font color=red>不添加附件请不要设定</font><br></div>';
			window.upidpas.innerHTML=str;
			ii=2;
			window.Form.upcountpas.value=3;
		}

