// JavaScript Document
function addOption(objSelectNow,txt,val)
 {
  /// 使用W3C标准语法为SELECT添加Option
  var objOption = document.createElement("OPTION");
  objOption.text= txt;
  objOption.value=val;
  objSelectNow.options.add(objOption);
 }
 
 //使用jQuery中的ajax添加选项到下拉控件
 function addOptions(selectId,data,val,key,i)
 {
	    $(selectId).empty();//首先清空原有的,不然连续操作会越积越多
		for (i in data)
		{
			if(val!='' && key!=''){
			$(selectId).append("<option value='" + data[i][val] + "'>" + data[i][key] + "</option>"); 
			}else{
			$(selectId).append("<option value='" + data[i] + "'>" + data[i] + "</option>"); 
			}
		}
 }
 
 function cleanitem(a,b,c,d,e,f,g,h)
 {
	if(a!=''){$(a).val('');}
	if(b!=''){$(b).val('');}
	if(c!=''){$(c).val('');}
	if(d!=''){$(d).val('');}
	if(e!=''){$(e).val('');}
	if(f!=''){$(f).val('');}
	if(g!=''){$(g).val('');}
	if(h!=''){$(h).val('');}
 }
 
 function disable(a,b,c,d,e,f,g,h)
 {
    if(a!=''){$(a).attr("disabled",true);}
	if(b!=''){$(b).attr("disabled",true);}
	if(c!=''){$(c).attr("disabled",true);}
	if(d!=''){$(d).attr("disabled",true);}
	if(e!=''){$(e).attr("disabled",true);}
	if(f!=''){$(f).attr("disabled",true);}
	if(g!=''){$(g).attr("disabled",true);}
	if(h!=''){$(h).attr("disabled",true);}
 }
 
 function enable(a,b,c,d,e,f,g,h)
 {
    if(a!=''){$(a).attr("disabled",false);} 
	if(b!=''){$(b).attr("disabled",false);}
	if(c!=''){$(c).attr("disabled",false);}
	if(d!=''){$(d).attr("disabled",false);} 
	if(e!=''){$(e).attr("disabled",false);} 
	if(f!=''){$(f).attr("disabled",false);} 
	if(g!=''){$(g).attr("disabled",false);}
	if(h!=''){$(h).attr("disabled",false);}
 }
 
 function fnLaunch(tbID,type,client)
{
	//var aForm;
	//aForm = oForm.elements;
	var myObject = new Object();
	//myObject.firstName = aForm.oFirstName.value;
	//myObject.lastName = aForm.oLastName.value;
	// The object "myObject" is sent to the modal window.
	var returnv=window.showModalDialog("../upload/ajaxfileupload.php?tbID="+tbID+"&type="+type+"&client="+client,myObject, "dialogWidth:800px; dialogHeight:600px; dialogLeft:100px;");
	alert(returnv);
}