function KillSpace(x)
{
	while((x.length>0) && (x.charAt(0)==' '))
	x = x.substring(1,x.length)
	while((x.length>0) && (x.charAt(x.length-1)==' '))
	x = x.substring(0,x.length-1)
	return x
}
function checkLogin()
{
	if(KillSpace(document.loginForm.username.value)=='')
	{
		alert('????????');
		document.loginForm.username.focus();
		return false;
	}
	else if(KillSpace(document.loginForm.userPasswd.value)=='')
	{
		alert('???????');
		document.loginForm.userPasswd.focus();
		return false;
	}
	else 
	{
		document.loginForm.action = "login.jsp";
		document.loginForm.submit();
		return true;
	}
}
function ShowWrtieDialog(filename,tid,obid,bid) {
	//alert(tid+"@@"+obid);
	window.open(filename+"?tid="+tid+"&obid="+obid+"&bid="+bid,"","height=180, width=600, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, status=no");
}
function fPopUpWin(filename,prop_w,prop_h,prop_l,prop_t) 
{
	var features = 
		'height=' + prop_h + ', ' +
		'width=' + prop_w + ', ' +
		'top=' + prop_t + ', ' +
		'left=' + prop_l + ', '+
		'toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no';
	window.open(filename,"",features);
}

function fPopUpWinDialog(prop_url,prop_w,prop_h,prop_l,prop_t) 
{
	var features =
		'dialogWidth:'  + prop_w + 'px;' +
		'dialogHeight:' + prop_h + 'px;' +
		'dialogLeft:'   + prop_l + 'px;' +
		'dialogTop:'    + prop_t + 'px;' +
		'directories:yes; localtion:yes; menubar:no; status=no; toolbar=no;scrollbars:no;Resizeable=no';    
	
	var	handle = window.showModalDialog(prop_url,'',features );
	if(handle != null) {	
		window.location.reload();
	} else {
		return false;
	}
}

/**
* ??
*/
function checkornot() 
{
	if (document.loginForm.elements.length >1) 
	{
		for (var i=0;i<document.loginForm.elements.length;i++) 
		{
			var e = document.loginForm.elements[i];
			if(e.type=='checkbox') 
			{
				if (e.checked)
				{
					e.checked = false;
				} else {
					e.checked = true;
				}
			}
		}
	}
}
/**
*??
*/
function del()
{   
	var objectID = loginForm.objectID.value;
	var a = document.getElementsByName("chk");
	var blnDel = true
	var totle = "";
	var j = 0;
	for (var i = 0;i<a.length;i++)
	{
		if (a[i].name == 'chk' && a[i].checked == true)
        {
	    blnDel = false;
		break;
	    }
	}
	   if(blnDel)
	   {
	   alert("???????????????");
	   }
	   else
	   {
		  if (window.confirm("???????????????????????????"))
		  {
			for (var i = 0;i<a.length;i++)
			{
				if(a[i].checked)
				{
				   if(j == 0)
				   {
					   totle = a[i].value; 
				   }
				   else
				   {
					   totle = totle + "," + a[i].value;
				   }
				   j++;
				}
			}
			loginForm.perm.value = totle;
			loginForm.action = "opr_delindex.jsp?objectID="+objectID;
			loginForm.submit();
		}
	}
 
}

