var v;
var t;
function logi()
{
login.user.value=trim(login.user.value);
if(login.user.value==""){alert("用户名不能为空!");return false;}

//if(login.pass.value==""){alert("密码不能为空!");return false;}
if(login.newwindow.checked){

//name="win"+Math.round(Math.random()*100);
//alert(login.rooms.value);

for (var i = 0; i < login.rooms.length; i++) {
if (login.rooms[i].checked)
{
name="win"+login.rooms[i].value+login.user.value;
}

}

window.open("","n"+name,"height=610,width=600,left=0,top=0;status=no,scrollbars=yes,resizable=yes,fullscreen=no");
login.target="n"+name;

}
else{login.target="_self"}
}
var icosel=1;
function selectico()
{if(icosel==1){
kj.style.visibility="visible";
icosel=0;
}
else{
kj.style.visibility="hidden";
icosel=1;
}}
function manlog()
{window.open("manlog.asp","manlog","height=410,width=700,left=50,top=60,resizable=no,scrollbars=auto,status=no,toolbar=no,menubar=no,location=no")}
function chatbest(){
window.open("chatbest.asp?del=yes","newwindow3","height=370,width=460,left=150,top=60,resizable=no,scrollbars=auto,status=no,toolbar=no,menubar=no,location=no");
}
function sitelog(lock)
{
	var rightedge=document.body.clientWidth-event.clientX
	var bottomedge=document.body.clientHeight-event.clientY
	if (rightedge<logbox.offsetWidth) {logbox.style.left=document.body.scrollLeft+event.clientX-logbox.offsetWidth}
	else {logbox.style.left=document.body.scrollLeft+event.clientX+50}
	if (bottomedge<logbox.offsetHeight) {logbox.style.top=document.body.scrollTop+event.clientY-logbox.offsetHeight}
	else {logbox.style.top=document.body.scrollTop+event.clientY}
	logbox.style.visibility="visible";
	
	if(lock)
	   rp.innerHTML="房间密码：<input type=\"password\" name=\"roompass\" size=\"12\" style=\"width: 90; height: 20; border-style: inset; border-width: 1\">";
	else
	   rp.innerHTML="";

	return false;
	
}
function fastlogi()
{
logintop.user.value=trim(logintop.user.value);
if(logintop.user.value==""){alert("用户名不能为空!");return false;}
//if(logintop.pass.value==""){alert("密码不能为空!");return false;}
if(logintop.rooms.value==""){alert("请填写房间ID号码");return false;}
name="win"+logintop.rooms.value+logintop.user.value;
window.open("","n"+name,"height=600,width=600,left=0,top=0;status=no,scrollbars=yes,resizable=yes,fullscreen=no");
logintop.target="n"+name;

}

function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function

