//点击弹出窗口
function newwin(url) {
  var wth=window.screen.width; 
  var hth=window.screen.heigth;
  var lefth,topth;
  if(wth==1024)
	{
	  hth=400;
	  lefth =0;
	  wth=550;
	  topth=0;
	}
  else if(wth==800)
	{
	  hth=400;
	  lefth =0;
	  wth=500;
	  topth=0;
	}
  else
	{
	  hth=400;
          lefth =0;
	  wth=500;
          topth=0;
	}
  var oth="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left="+lefth+",top="+topth;
  oth = oth+",width="+wth+",height="+hth ;
  var newwin=window.open(url,"newwin",oth);
   newwin.focus();
  return false;
}

//复选框全选
function cherk()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}

function TL(){
	switchPoint.innerText="打开左栏"
	switchPoint.title="打开左栏"
	switchPoint2.title="左栏最大化"
	document.all("frmLeft").style.width="0"
}
function TR(){
	switchPoint.innerText="关闭左栏"
	switchPoint.title="关闭左栏"
	switchPoint2.title="右栏最大化"
}

function SwitchLeftBar(){
	if (switchPoint.innerText=="关闭左栏"){
		TL()
	}
	else{
		TR()
		document.all("frmLeft").style.width="180"
	}
}
	
function ToLeftRight(){
	if (switchPoint2.innerText==7){
		TL()
	}
	else{
		TR()
		document.all("frmLeft").style.width="100%"
	}

}
	
function ToMiddle(){
	document.all("frmLeft").style.width="50%"
}

//复选控制表单元素的显示
function switchControlEditable(sender)
{
	var elements = document.getElementsByTagName('INPUT');
	for (var i=0; i<elements.length; i++)
	{
		if (elements[i].id == sender.id) continue;
		elements[i].disabled = (!sender.checked);
	}
}

//图片自动调整大小
var flag=false; 
function image(ImgD){ 
var image=new Image(); 
image.src=ImgD.src; 
if(image.width>0 && image.height>0){ 
  flag=true; 
  if(image.width/image.height>= 120/90){ 
   if(image.width>120){
    ImgD.width=120; 
    ImgD.height=(image.height*90)/image.width; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
   /*ImgD.alt="bigpic"  */
  } 
  else{ 
   if(image.height>90){
    ImgD.height=90; 
    ImgD.width=(image.width*90)/image.height; 
   }else{ 
    ImgD.width=image.width;
    ImgD.height=image.height; 
   } 
    /*ImgD.alt="bigpic"  */ 
  } 
}
}
