﻿<!--
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function Dialog(Mode,Url,Name,Width,Height,Resize,Scrool){
	if (Mode==0){
		window.showModelessDialog(Url,Name,'DialogWidth:'+Width+'px;dialogHeight:'+Height+'px;Center:1;Help:0;Resizable:'+Resize+';Status:0;Scroll:'+Scrool);
	}else{
	//1-锁死
		window.showModalDialog(Url,Name,'DialogWidth:'+Width+'px;dialogHeight:'+Height+'px;Center:1;Help:0;Resizable:'+Resize+';Status:0;Scroll:'+Scrool);
	}
}


//多个附件的添加需要的代码
function setFileFileds(num){
	for(var i=0,str="";i<num;i++){
		str+="<input name=\"strFile"+i+"\" type=\"file\" size=50 id=\"strFile"+i+"\"><br>";
	}
	objFiles.innerHTML=str;
}

//图片大小控制
var imageObject;
function ResizeImage(obj, MaxW, MaxH)
{
    if (obj != null) imageObject = obj;
    var state=imageObject.readyState;
	if(state!='complete') {
        setTimeout("ResizeImage(null,"+MaxW+","+MaxH+")",50);
		return;
    }
    var oldImage = new Image();
    oldImage.src = imageObject.src;
    var dW=oldImage.width; var dH=oldImage.height;
    if(dW>MaxW || dH>MaxH) {
        a=dW/MaxW; b=dH/MaxH;
        if(b>a) a=b;
        dW=dW/a; dH=dH/a;
    }
    if(dW > 0 && dH > 0) {
        imageObject.width=dW;
		imageObject.height=dH;
	}
}

//打开地址选择列表,返回值
//selV 值
//selT 显示文本
var partwindow
function OpenSelWindow(str){
    var x=screen.width/2-300;
    var y=screen.height/2-200;
    if (!partwindow || partwindow.closed) {
        partwindow = window.open(str,"partwindow","status=no,resizable=no,dependent = yes,height = 300,width = 500,left="+x+",top="+y);
    } else{
        partwindow.close();
        partwindow = window.open(str,"partwindow","status=no,resizable=no,dependent = yes,height = 300,width = 500,left="+x+",top="+y);
    }	
}

//将png图片弄的透明
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
   var img = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText 
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle  
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
      + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
   img.outerHTML = strNewHTML
   i = i-1
      }
      }
   }
window.attachEvent("onload", correctPNG);
//-->
