// 关闭当前窗口
function closeWindow(){
	window.close();return false;
}

//add by willsu on 2004-10-14
/*使表格中的各个元素为readonly
*flag==1-->readonly
*flag==0-->donothing
*tablename-->表格ID
*/
function setTableReadOnly(tableName,flag)
{

		 if (flag==1)
		 {
			var table1=document.getElementById(tableName);
			table1.style.background = "#cccccc";
			var inputs = table1.all.tags("INPUT");  //针对text,checkbox,radio
			var textareas=table1.all.tags("TEXTAREA");//针对textarea
			var selects=table1.all.tags("SELECT");//针对select
			var spans=table1.all.tags("SPAN"); //针对listbox,dropdownlist,radiogroup
			var divs=table1.all.tags("DIV"); //针对listbox,dropdownlist,radiogroup
			var i;
			for (i=0;i<inputs.length;i++)
			{
				if (inputs[i].type=="text")
					inputs[i].readOnly=true;
				else
					if(inputs[i].type=="checkbox"||inputs[i].type=="radio")
						inputs[i].onclick=function(){event.returnValue=false};
			}
			for (i=0;i<selects.length;i++){
			  selects[i].readOnly=true
		    }
			for (i=0;i<textareas.length;i++)
			{
				textareas[i].readOnly=true;
			}

			for (i=0;i<spans.length;i++)
			{
				  spans[i].onmouseover=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=true;}else{this.children[j].readOnly==true}}};
				  spans[i].onmouseout=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=false;}else{this.children[j].readOnly==false}}};
			}

			for (i=0;i<divs.length;i++)
			{
				  divs[i].onmouseover=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=true;}else{this.children[j].readOnly==true}}};
				  divs[i].onmouseout=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=false;}else{this.children[j].readOnly==false}}};
			}

		}
		else //使可用
		{
			var table1=document.getElementById(tableName);
			table1.style.background = "#ffffff";
			var inputs = table1.all.tags("INPUT");  //针对text,checkbox,radio
			var textareas=table1.all.tags("TEXTAREA");//针对textarea
			var selects=table1.all.tags("SELECT");//针对select
			var spans=table1.all.tags("SPAN"); //针对listbox,dropdownlist,radiogroup
			var divs=table1.all.tags("DIV"); //针对listbox,dropdownlist,radiogroup
			var i;
			for (i=0;i<inputs.length;i++)
			{
				if (inputs[i].type=="text")
					inputs[i].readOnly=false;
				else
					if(inputs[i].type=="checkbox"||inputs[i].type=="radio")
						inputs[i].onclick=function(){event.returnValue=true};
			}
			for (i=0;i<selects.length;i++){
			  selects[i].readOnly=false
		    }
			for (i=0;i<textareas.length;i++)
			{
				textareas[i].readOnly=false;
			}

			for (i=0;i<spans.length;i++)
			{
				  spans[i].onmouseover=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=false;}else{this.children[j].readOnly==false}}};
				  spans[i].onmouseout=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=false;}else{this.children[j].readOnly==false}}};
			}

			for (i=0;i<divs.length;i++)
			{
				  divs[i].onmouseover=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=false;}else{this.children[j].readOnly==false}}};
				  divs[i].onmouseout=function(){for(var j=0;j<this.children.length;j++){if ((this.children[j].type!=null)&&((this.children[j].type.indexOf("radio")!=-1)||(this.children[j].type.indexOf("select")!=-1))){this.children[j].disabled=false;}else{this.children[j].readOnly==false}}};
			}
		}
		
}

