function getHTML(url,pars,parwhere)
{

var myAjax = new Ajax.Updater( parwhere, url, {method: 'post',parameters: pars});

}

function getRequest(url,pars,GetComplete)
{
var myAjax = new Ajax.Request(url,{method: 'post',parameters: pars,asynchronous:true,onComplete:GetComplete});
}



//图片按比例缩放 
var flag=false; 
function DrawImage(ImgD,iwidth,iheight){ 
 var image=new Image(); 
 //var iwidth = 770;  //定义允许图片宽度 
 //var iheight = 700;  //定义允许图片高度 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
 flag=true; 
 if(image.width/image.height>= iwidth/iheight){ 
  if(image.width>iwidth){   
  ImgD.width=iwidth; 
  ImgD.height=(image.height*iwidth)/image.width; 
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  //ImgD.alt=image.width+"×"+image.height; 
  } 
 else{ 
  if(image.height>iheight){   
  ImgD.height=iheight; 
  ImgD.width=(image.width*iheight)/image.height;   
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  } 
 } 
}  
function DrawImage2(ImgD,iwidth,iheight,msg) 
{ 
	DrawImage(ImgD,iwidth,iheight);
	if (msg!="")
	{	ImgD.alt=msg;
		}
	}

//表单数据化为字符串
function formToRequestString(form_obj)
{
var query_string='';
var and='';
//alert(form_obj.length);
for (i=0;i<form_obj.length ;i++ )
{
e=form_obj[i];
if (e.name!='')
{
if (e.type=='select-one')
{
element_value=e.options[e.selectedIndex].value;
}
else if (e.type=='checkbox' || e.type=='radio')
{
if (e.checked==false)
{
continue;	
}
element_value=e.value;
}
else
{
element_value=e.value;
}
query_string+=and+e.name+'='+escape(element_value.replace(/\&/g,"%26"));
and="&"
}
}
return query_string;
}

function dbok(ms) 
{alert(ms);
window.close();
window.opener.location.reload();
}

function dboknoclose(ms,url) 
{alert(ms);
window.document.location=url;
}

function showback(ms) 
{	alert(ms);
	history.back();
}

function ShowImage(value,img)
    {
       //alert(value);
	   //检测盘符
	   //alert(value.indexOf(':'));
	   //检测文件是否有扩展名
	   //alert(value.length-value.lastIndexOf('.'));
	   //取文件扩展名
	   //alert(value.substr(value.length-3,3));
	   //检测文件扩展名是否合法
	   //alert(CheckExt(value.substr(value.length-3,3)));
      
        if(value.length>5&&value.indexOf(':')==1&&(value.length-value.lastIndexOf('.'))==4&&CheckExt(value.substr(value.length-3,3)))
        {   img.src=value;
            img.alt="本地图片预览";
            img.style.visibility="visible";
        }
        else
        {
      img.style.visibility="hidden";
     }
    }
    //检查扩展名是否合法,合法返回True
    function CheckExt(ext)
    {
    //这里设置允许的扩展名
    var AllowExt="jpg|gif|jpeg|png|bmp";
    var ExtOK=false;
    var ArrayExt;
    if(AllowExt.indexOf('|')!=-1)
    {
     ArrayExt=AllowExt.split('|');
     for(i=0;i<ArrayExt.length;i++)
     {
      if(ext.toLowerCase()==ArrayExt[i])
      {
       ExtOK=true;
       break;
      }
     }
    }
    else
    {
     ArrayExt=AllowExt;
     if(ext.toLowerCase()==ArrayExt)
     {
      ExtOK=true;
     }
    }
    return ExtOK;
    }

/* senfe("表格ID","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");*/
function senfe(o,a,b,c,d){
 var t=document.getElementById(o).getElementsByTagName("tr");
 for(var i=0;i<t.length;i++){
  t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b;
  t[i].onclick=function(){
   if(this.x!="1"){
    this.x="1";
    this.style.backgroundColor=d;
   }else{
    this.x="0";
    this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
   }
  }
  t[i].onmouseover=function(){
   if(this.x!="1")this.style.backgroundColor=c;
  }
  t[i].onmouseout=function(){
   if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b;
  }
 }
}

function disp(dname) {

if ($(dname).style.display=="block")
{$(dname).style.display="none";

	}
	else
	{$(dname).style.display="block"
		}

}
