
var SelectType=false ;

function checkselectall() {
	SelectType = !SelectType
	var ii = document.delform.Del_ID.length ;
    var i ;
	if (SelectType)
	{  document.delform.selectall.value="取消全选";
	   document.delform.selecttype.checked = true;
	   for (i=0;i<ii;i++)
	   {
	        document.delform.Del_ID[i].checked=true;
	   }
	}
	else
	{  document.delform.selectall.value="所定所有";
	   document.delform.selecttype.checked = false;
	   for (i=0;i<ii;i++)
	   {
	        document.delform.Del_ID[i].checked=false;
	   }
	}

}


function WinOpen(theURL,winName,features)
{
   window.open(theURL,winName,features);
}

function WinOpenPar(URL)
{
   window.open(URL,'Table','width=778,height=380,top=70,left='+(((window.screen.width)-710)/2)+',scrollbars=1');
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


function showmenu(N)
{
  var menuname;
  var menuno = N;
  var i;
  if (menuno>0)
  {
  //menu.style.display="";
  //menu5.style.display="none";
  for(i=1;i<=5;i++)
	{
	  menuname = eval("menu" + i) ;
	  if(i!=N){
		  menuname.style.display="none";
	  }
	  else{
		  menuname.style.display="";
	  }
	}
  }
  else 
  {
  //menu.style.display="none";
  //menu5.style.display="";
  for(i=1;i<=5;i++)
	{
	  menuname = eval("menu" + i) ;
	  menuname.style.display="none";
	}
  }
}

function show_image(name)
{
	var imagename=name;
	if (imagename=="")
	{
		document.showpro.src="Images/products.jpg";
	}
	else
	{
		imagepath = "../Upload/Sort/" + imagename;
		document.showpro.src=imagepath;
	}
}

function addToFavorite(favTitle){
  if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
    window.external.AddFavorite(location.href, unescape(favTitle));
  }
}

function fiximgwin(url)
{
 var imgwin=window.open('','img','width=50,height=50')//打开一个空白窗口，并初始化大小
 imgwin.focus()//使窗口聚焦，成为当前窗口
 var HTML="<html>\r\n<head>\r\n<title>图片浏览</title>\r\n</head>\r\n<body leftmargin=\"0\" topmargin=\"0\">\r\n<img src=\""+url+"\" onload=\"window.resizeTo(this.width,this.height);window.moveTo((screen.width-this.width)/2,(screen.height-this.height)/2)\">\r\n</body>\r\n</html>"//这里是关键代码，在图片加载完后调用resizeTo()和moveTo()方法调整窗口大小和位置
 var doc=imgwin.document
 doc.open("text/html","replace") //指定文档的多用途网际邮件扩充协议
 doc.write(HTML)//向空白窗口写入代码
 doc.close()//关闭输入流，并强制发送数据显示。
}


var iCheck = 0 ;
function SelectAll(theForm)
{
	if (iCheck==0)
	{
		for (var i=0;i<theForm.elements.length;i++)
		{
			theForm.elements[i].checked = true ;
			iCheck = 1 ;
			var the_obj = event.srcElement ;
			the_obj.alt = "全部取消" ;
			the_obj.src="Images/icon_selectall.gif" ;

		}
	}
	else
	{
		for (var i=0;i<theForm.elements.length;i++)
		{
			theForm.elements[i].checked = false ;
			iCheck = 0 ;
			var the_obj = event.srcElement ;
			the_obj.alt = "全部选定" ;
			the_obj.src="Images/icon_select.gif" ;
		}
	}
}

function FormActive(theForm,sActive)
{
	var bFlag = false; 
	theForm.Active.value = sActive;
	if (theForm.elements.length>0)
	{
		for (var i=0;i<theForm.elements.length;i++)
		{
			if (theForm.elements[i].checked == true)
			{
				bFlag = true;
				break;
			}
		}
	}

	if (bFlag)
	{
		if (sActive=="Del")
		{
			if (confirm("您真的要删除所选定的内容吗？")==true)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		if (sActive=="Pass")
		{
			return true;
		}
	}
	else
	{
		alert(" 您还没有选定内容！ ");
		return false;
	}
}
