function doNickServ () {
	cmd=document.myNickserv.NICKSERV.options[document.myNickserv.NICKSERV.selectedIndex].value;
	if (cmd == "help") { //request help.
		sendToChan("/msg nickserv help");
	}	
	if (cmd == "ns1") { //regiser a nickname.
		var info1 = prompt("Type a password here to use with NickServ.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type your email address here.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg nickserv register "+info1+" "+info2+"");
			}			
		}
	}		
	if (cmd == "ns2") { //group a nickname.
		var info1 = prompt("Type the Target nickname here.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type the Target password here.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg nickserv group "+info1+" "+info2+"");
			}			
		}
	}			
	if (cmd == "ns3") { //identify a nickname.
		var info1 = prompt("Type your nickname password here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv identify "+info1+"");
		}
	}			
	if (cmd == "ns4") { //access add mask.
		var info1 = prompt("Type the mask to add here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv access add "+info1+"");
		}
	}		
	if (cmd == "ns5") { //access del mask.
		var info1 = prompt("Type the mask to delete here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv access del "+info1+"");
		}
	}		
	if (cmd == "ns6") { //access list.
		sendToChan("/msg nickserv access list");
	}		
	if (cmd == "ns7") { //set display.
		var info1 = prompt("Type the nickname to be displayed with your group.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set display "+info1+"");
		}
	}		
	if (cmd == "ns8") { //set password.
		var info1 = prompt("Type a new password to identify with.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set password "+info1+"");
		}
	}		
	if (cmd == "ns9") { //set language.
		var info1 = prompt("Type the number of the language services responds to you with.\n 1 = English, 2 = French, 3 = Portuguese, 4 = Turkish","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set language "+info1+"");
		}
	}		
	if (cmd == "ns10") { //set url.
		var info1 = prompt("Type your home page URL here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set url "+info1+"");
		}
	}		
	if (cmd == "ns11") { //set email.
		var info1 = prompt("Type your e-mail address here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set email "+info1+"");
		}
	}		
	if (cmd == "ns12") { //set icq.
		var info1 = prompt("Type your ICQ number here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set icq "+info1+"");
		}
	}		
	if (cmd == "ns13") { //set greet.
		var info1 = prompt("Type your services greeting here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv set greet "+info1+"");
		}
	}		
	if (cmd == "ns14") { //set kill on.
		sendToChan("/msg nickserv set kill on");
	}
	if (cmd == "ns15") { //set kill quick.
		sendToChan("/msg nickserv set kill quick");
	}
	if (cmd == "ns16") { //set kill immed.
		sendToChan("/msg nickserv set kill immed");
	}
	if (cmd == "ns17") { //set kill off.
		sendToChan("/msg nickserv set kill off");
	}
	if (cmd == "ns18") { //set secure on.
		sendToChan("/msg nickserv set secure on");
	}
	if (cmd == "ns19") { //set secure off.
		sendToChan("/msg nickserv set secure off");
	}
	if (cmd == "ns20") { //set private on.
		sendToChan("/msg nickserv set private on");
	}
	if (cmd == "ns21") { //set private off.
		sendToChan("/msg nickserv set private off");
	}
	if (cmd == "ns22") { //set hide email on.
		sendToChan("/msg nickserv set hide email on");
	}	
	if (cmd == "ns23") { //set hide email off.
		sendToChan("/msg nickserv set hide email off");
	}	
	if (cmd == "ns24") { //set hide usermask on.
		sendToChan("/msg nickserv set hide usermask on");
	}	
	if (cmd == "ns25") { //set hide usermask off.
		sendToChan("/msg nickserv set hide usermask off");
	}	
	if (cmd == "ns26") { //set hide quit on.
		sendToChan("/msg nickserv set hide quit on");
	}	
	if (cmd == "ns27") { //set hide quit off.
		sendToChan("/msg nickserv set hide quit off");
	}
	if (cmd == "ns28") { //set msg on.
		sendToChan("/msg nickserv set msg on");
	}
	if (cmd == "ns29") { //set msg off.
		sendToChan("/msg nickserv set msg off");
	}
	if (cmd == "ns30") { //drop nickname.
		var info1 = prompt("Type the nickname to drop here.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv drop "+info1+"");
		}
	}
	if (cmd == "ns31") { //recover nickname.
		var info1 = prompt("Type the nickname to recover.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type the nickname password.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg nickserv recover "+info1+" "+info2+"");
			}			
		}
	}
	if (cmd == "ns32") { //release nickname.
		var info1 = prompt("Type the nickname to release.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type the nickname password.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg nickserv release "+info1+" "+info2+"");
			}			
		}
	}
	if (cmd == "ns33") { //sendpass to nickname.
		var info1 = prompt("Type the nickname to send the password to.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg nickserv sendpass "+info1+"");
		}
	}		
	doReset();	
}
function doChanServ () {
	cmd=document.myChanserv.CHANSERV.options[document.myChanserv.CHANSERV.selectedIndex].value;
	if (cmd == "help") { //request help.
		sendToChan("/msg chanserv help");
	}
	if (cmd == "cs1") { //register channel/room.
		var info1 = prompt("Type the password you want to use to register this channel/room.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type a brief description of your channel/room.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg chanserv register #"+chan+" "+info1+" "+info2+"");
			}
		}
	}
	if (cmd == "cs2") { //identify with chanserv.
		var info1 = prompt("Type your ChanServ password.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv identify #"+chan+" "+info1+"");
		}
	}
	if (cmd == "cs3") { //set founder.
		var info1 = prompt("Type the registered nickname of the new founder.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" founder "+info1+"");
		}
	}
	if (cmd == "cs4") { //set successor.
		var info1 = prompt("Type the registered nickname of the successor.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" successor "+info1+"");
		}
	}	
	if (cmd == "cs5") { //set password.
		var info1 = prompt("Type your new password to use with ChanServ.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" password "+info1+"");
		}
	}	
	if (cmd == "cs6") { //set channel/room description.
		var info1 = prompt("Type the new description for the channel/room.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" desc "+info1+"");
		}
	}
	if (cmd == "cs7") { //set url.
		var info1 = prompt("Type the URL (web page address) to be associated with this channel/room.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" url "+info1+"");
		}
	}
	if (cmd == "cs8") { //set email.
		var info1 = prompt("Type the e-mail address to be associated with this channel/room.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" email "+info1+"");
		}
	}
	if (cmd == "cs9") { //set entrymsg.
		var info1 = prompt("Type the entry message to send to chatters that join your channel/room.\nNote: leave blank to clear entry messages from being sent to chatters.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" entrymsg "+info1+"");
		}
	}	
	if (cmd == "cs10") { //set topic.
		var info1 = prompt("Type the channel/room's new topic.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" topic "+info1+"");
		}
	}	
	if (cmd == "cs11") { //set bantype.
		var info1 = prompt("Type number of bantype to use. (3 is recommended)\n0 = *!user@host, 1 = *!*user@host, 2 = *!*@host, 3 = *!*user@*.domain","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" bantype "+info1+"");
		}
	}	
	if (cmd == "cs12") { //set keeptopic on.
		sendToChan("/msg chanserv set #"+chan+" keeptopic on");
	}	
	if (cmd == "cs13") { //set keeptopic off.
		sendToChan("/msg chanserv set #"+chan+" keeptopic off");
	}
	if (cmd == "cs14") { //set topiclock on.
		sendToChan("/msg chanserv set #"+chan+" topiclock on");
	}
	if (cmd == "cs15") { //set topiclock off.
		sendToChan("/msg chanserv set #"+chan+" topiclock off");
	}
	if (cmd == "cs16") { //set mlock.
		var info1 = prompt("Type the channel/room modes (i k l m n p s t) to keep locked. Example: +s-k\nwill keep the channel/room mode +s (secret) and remove -k (keyed)","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" mlock "+info1+"");
		}
	}
	if (cmd == "cs17") { //set mlock clear.
		sendToChan("/msg chanserv set #"+chan+" mlock +");
	}
	if (cmd == "cs18") { //set private on.
		sendToChan("/msg chanserv set #"+chan+" private on");
	}	
	if (cmd == "cs19") { //set private off.
		sendToChan("/msg chanserv set #"+chan+" private off");
	}
	if (cmd == "cs20") { //set restricted on.
		sendToChan("/msg chanserv set #"+chan+" restricted on");
	}
	if (cmd == "cs21") { //set restricted off.
		sendToChan("/msg chanserv set #"+chan+" restricted off");
	}	
	if (cmd == "cs22") { //set secure on.
		sendToChan("/msg chanserv set #"+chan+" secure on");
	}	
	if (cmd == "cs23") { //set secure off.
		sendToChan("/msg chanserv set #"+chan+" secure off");
	}
	if (cmd == "cs24") { //set secureops on.
		sendToChan("/msg chanserv set #"+chan+" secureops on");
	}
	if (cmd == "cs25") { //set secureops off.
		sendToChan("/msg chanserv set #"+chan+" secureops off");
	}
	if (cmd == "cs26") { //set securefounder on.
		sendToChan("/msg chanserv set #"+chan+" securefounder on");
	}
	if (cmd == "cs27") { //set securefounder off.
		sendToChan("/msg chanserv set #"+chan+" securefounder off");
	}
	if (cmd == "cs28") { //set signkick on.
		sendToChan("/msg chanserv set #"+chan+" signkick on");
	}
	if (cmd == "cs29") { //set signkick off.
		sendToChan("/msg chanserv set #"+chan+" signkick off");
	}
	if (cmd == "cs30") { //set signkick level.
		var info1 = prompt("Type the level limit for signkick. Users under this level will have their kicks signed.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv set #"+chan+" signkick "+info1+"");
		}
	}
	if (cmd == "cs31") { //set opnotice on.
		sendToChan("/msg chanserv set #"+chan+" opnotice on");
	}
	if (cmd == "cs32") { //set opnotice off.
		sendToChan("/msg chanserv set #"+chan+" opnotice off");
	}
	if (cmd == "cs33") { //access add.
		var info1 = prompt("Type the NickName you want to add to the channel/room's access list. If you have already highlighted a nickname to use leave this blank.","");
		var info2 = prompt("Type the level to be given to this user.","");
		if (info2 != null && info2 != "") {
			if (info1 != null && info1 != "") {
				sendToChan("/msg chanserv access #"+chan+" add "+info1+" "+info2+"");
			}
		}
	}
	if (cmd == "cs34") { //access del.
		var info1 = prompt("Type the NickName or entry number to delete. Leave this blank to use a highlighted nickname.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv access #"+chan+" del "+info1+"");
		}
	}
	if (cmd == "cs35") { //access list.
		var info1 = prompt("Type the entry number or group of numbers to list or leave blank for full list. Example: 2-5,7-9 will list 2 through 5 and 7 through 9.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv access #"+chan+" list "+info1+"");
		}
		else {
			sendToChan("/msg chanserv access #"+chan+" list");
		}
	}
	if (cmd == "cs36") { //access clear.
		if (confirm("This will remove all users from the access list.")) {
			sendToChan("/msg chanserv access #"+chan+" clear");
		}
	}	
	if (cmd == "cs37") { //levels set.
		var info1 = prompt("Type the level type you wish to modify.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type the channel/room access level to be associated with this level type.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg chanserv levels #"+chan+" set "+info1+" "+info2+"");
			}
		}
	}
	if (cmd == "cs38") { //level disable.
		var info1 = prompt("Type the level type you wish to disable.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv levels #"+chan+" disable "+info1+"");
		}
	}
	if (cmd == "cs39") { //levels list.
		sendToChan("/msg chanserv levels #"+chan+" list");
	}
	if (cmd == "cs40") { //access clear.
		if (confirm("This will reset the channel/room's levels to their default values.")) {
			sendToChan("/msg chanserv levels #"+chan+" reset");
		}
	}
	if (cmd == "cs41") { //akick add.
		var info1 = prompt("Type the nickname or mask to add to the akick list.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type a reason for the akick or leave blank.","");
			if (info2 == null) {
				info2 = "";
			}
			sendToChan("/msg chanserv akick #"+chan+" add "+info1+" "+info2+"");
		}
	}
	if (cmd == "cs42") { //akick del.
		var info1 = prompt("Type the nickname or mask to delete from the akick list.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv akick #"+chan+" del "+info1+"");
		}
	}
	if (cmd == "cs43") { //akick list.
		var info1 = prompt("Type the mask to list matches to from the akick list or leave blank for the full list.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv akick #"+chan+" list "+info1+"");
		}
		else {
			sendToChan("/msg chanserv akick #"+chan+" list");
		}
	}	
	if (cmd == "cs44") { //akick view.
		var info1 = prompt("Type the mask to list matches to from the akick list or leave blank for the full list.\nNote: This is the same as 'list' but more verbose.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg chanserv akick #"+chan+" view "+info1+"");
		}
		else {
			sendToChan("/msg chanserv akick #"+chan+" view");
		}
	}	
	if (cmd == "cs45") { //akick enforce.
		sendToChan("/msg chanserv akick #"+chan+" enforce");
	}
	if (cmd == "cs46") { //akick clear.
		if (confirm("This will clear the channel/room's akick list.")) {
			sendToChan("/msg chanserv akick #"+chan+" clear");
		}
	}	
	if (cmd == "cs47") { //drop.
		sendToChan("/msg chanserv drop #"+chan+" ");
	}	
	if (cmd == "cs48") { //sendpass.
		sendToChan("/msg chanserv sendpass #"+chan+" ");
	}
	if (cmd == "cs49") { //clear modes.
		if (confirm("This will clear the channel/room's modes.")) {
			sendToChan("/msg chanserv clear #"+chan+" modes");
		}
	}
	if (cmd == "cs50") { //clear bans.
		if (confirm("This will clear the channel/room's bans.")) {
			sendToChan("/msg chanserv clear #"+chan+" bans");
		}
	}
	if (cmd == "cs51") { //clear ops.
		if (confirm("This will clear the channel/room's ops.")) {
			sendToChan("/msg chanserv clear #"+chan+" ops");
		}
	}
	if (cmd == "cs52") { //clear voices.
		if (confirm("This will clear the channel/room's voices.")) {
			sendToChan("/msg chanserv clear #"+chan+" voices");
		}
	}
	if (cmd == "cs53") { //clear users.
		if (confirm("This will clear the channel/room's users.")) {
			sendToChan("/msg chanserv clear #"+chan+" users");
		}
	}				
	if (cmd == "cs54") { //deop.
		var info1 = prompt("Enter the nickname to deop.","")
		if (info1 != "" && info1 != null) {
			sendToChan("/msg chanserv deop #"+chan+" "+info1+" ");
		}
	}	
	if (cmd == "cs55") { //devoice.
		var info1 = prompt("Enter the nickname to devoice.","")
		if (info1 != "" && info1 != null) {	
			sendToChan("/msg chanserv devoice #"+chan+" "+info1+" ");
		}
	}
	if (cmd == "cs56") { //getkey.
		var info1 = prompt("Type the name of the channel/room you want the key to.","");
		if (info1 != null && info1 != "") {
			channel = fixChan(info1);
			sendToChan("/msg chanserv getkey "+channel+"");
		}
	}
	if (cmd == "cs57") { //info.
		var info1 = prompt("Type the name of the channel/room you want info on or leave blank to get info on the channel/room your in.","");
		if (info1 != null && info1 != "") {
			channel = fixChan(info1);
			sendToChan("/msg chanserv info "+channel+"");
		}
		else {
			sendToChan("/msg chanserv info #"+chan+" ");
		}
	}
	if (cmd == "cs58") { //info all.
		var info1 = prompt("Type the name of the channel/room you want all info on or leave blank to get all info on the channel/room your in.","");
		if (info1 != null && info1 != "") {
			channel = fixChan(info1);
			sendToChan("/msg chanserv info "+channel+" all");
		}
		else {
			sendToChan("/msg chanserv info #"+chan+" all");
		}
	}
	if (cmd == "cs59") { //invite.
		var info1 = prompt("Type the name of the channel/room you want to be invited to.","");
		if (info1 != null && info1 != "") {
			channel = fixChan(info1);
			sendToChan("/msg chanserv invite "+channel+"");
		}
	}
	if (cmd == "cs60") { //kick.
		var info1 = prompt("Type the nickname to kick from the channel.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type a reason for the kick or leave blank.","");
			if (info2 == null) {
				info2 = "";
			}
			sendToChan("/msg chanserv kick #"+chan+" "+info1+" "+info2+"");
		}
	}
	if (cmd == "cs61") { //list.
		sendToChan("/msg chanserv list *");
	}
	if (cmd == "cs62") { //logout.
		var info1 = prompt("Enter the nickname to log out.","")
		if (info1 != "" && info1 != null) {
			sendToChan("/msg chanserv logout #"+chan+" "+info1+" ");
		}
	}
	if (cmd == "cs63") { //op.
		var info1 = prompt("Enter the nickname to @p.","")
		if (info1 != "" && info1 != null) {	
			sendToChan("/msg chanserv op #"+chan+" "+info1+" ");
		}
	}
	if (cmd == "cs64") { //unban.
		var info1 = prompt("Type the name of the channel/room you want to be unbanned from.","");
		if (info1 != null && info1 != "") {
			channel = fixChan(info1);
			sendToChan("/msg chanserv unban "+channel+"");
		}
	}
	if (cmd == "cs65") { //voice.
		var info1 = prompt("Enter the nickname to voice.","")
		if (info1 != "" && info1 != null) {	
			sendToChan("/msg chanserv voice #"+chan+" "+info1+" ");
		}										
	}
	doReset();
}
function doMemoServ () {
	cmd=document.myMemoserv.MEMOSERV.options[document.myMemoserv.MEMOSERV.selectedIndex].value;
	if (cmd == "help") { //request help.
		sendToChan("/msg memoserv help");
	}
	if (cmd == "ms1") { //send memo.
		var info1 = prompt("Type the nickname or channel name to send the memo to.","");
		if (info1 != null && info1 != "") {
			var info2 = prompt("Type your memo here.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg memoserv send "+info1+" "+info2+"");
			}			
		}
	}
	if (cmd == "ms2") { //cancel memo.
		var info1 = prompt("Type the nickname or channel name to cancel memo to.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg memoserv cancel "+info1+"");
		}
	}
	if (cmd == "ms3") { //list channel.
		sendToChan("/msg memoserv list #"+chan+" ");
	}
	if (cmd == "ms4") { //list #.
		var info1 = prompt("Type the number of memos to list.\nExample: 2-5,7-9 will list memos 2 through 5 and 7 through 9. ","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg memoserv list "+info1+"");
		}
	}
	if (cmd == "ms5") { //list new memos.
		sendToChan("/msg memoserv list new");
	}
	if (cmd == "ms6") { //read channel.
		sendToChan("/msg memoserv read #"+chan+" ");
	}	
	if (cmd == "ms7") { //read #.
		var info1 = prompt("Type the number of memos to read.\nExample: 2-5,7-9 will read memos 2 through 5 and 7 through 9. ","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg memoserv read "+info1+"");
		}
	}
	if (cmd == "ms8") { //read last.
		sendToChan("/msg memoserv read last");
	}
	if (cmd == "ms9") { //read new.
		sendToChan("/msg memoserv read new");
	}
	if (cmd == "ms10") { //del channel.
		sendToChan("/msg memoserv del #"+chan+" ");
	}				
	if (cmd == "ms11") { //del #.
		var info1 = prompt("Type the number of memos to delete.\nExample: 2-5,7-9 will delete memos 2 through 5 and 7 through 9. ","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg memoserv del "+info1+"");
		}
	}
	if (cmd == "ms12") { //del all.
		sendToChan("/msg memoserv del all");
	}
	if (cmd == "ms13") { //set notify on.
		sendToChan("/msg memoserv set notify on");
	}
	if (cmd == "ms14") { //set notify logon.
		sendToChan("/msg memoserv set notify logon");
	}
	if (cmd == "ms15") { //set notify new.
		sendToChan("/msg memoserv set notify new");
	}
	if (cmd == "ms16") { //set notify off.
		sendToChan("/msg memoserv set notify off");
	}
	if (cmd == "ms17") { //set limit channel.
		var info1 = prompt("Type the limit number of channel/room memos to recieve (max is 20).","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg memoserv set limit #"+chan+" "+info1+"");
		}
	}
	if (cmd == "ms18") { //set limit #.
		var info1 = prompt("Type the limit number of memos to recieve (max is 20).","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg memoserv set limit "+info1+"");
		}
	}	
	doReset();						
}
function doBotServ () {
	cmd=document.myBotserv.BOTSERV.options[document.myBotserv.BOTSERV.selectedIndex].value;
	if (cmd == "help") { //request help.
		sendToChan("/msg botserv help");
	}
	if (cmd == "bs1") { //botlist.
		sendToChan("/msg botserv botlist");
	}
	if (cmd == "bs2") { //assign a bot.
		var info1 = prompt("Type the name of the bot you want in your channel/room.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv assign #"+chan+" "+info1+"");
		}
	}
	if (cmd == "bs3") { //set dontkickops on.
		sendToChan("/msg botserv set #"+chan+" dontkickops on");
	}
	if (cmd == "bs4") { //set dontkickops off.
		sendToChan("/msg botserv set #"+chan+" dontkickops off");
	}
	if (cmd == "bs5") { //set dontkickvoices on.
		sendToChan("/msg botserv set #"+chan+" dontkickvoices on");
	}
	if (cmd == "bs6") { //set dontkickvoices off.
		sendToChan("/msg botserv set #"+chan+" dontkickvoices off");
	}
	if (cmd == "bs7") { //set greet on.
		sendToChan("/msg botserv set #"+chan+" greet on");
	}
	if (cmd == "bs8") { //set greet off.
		sendToChan("/msg botserv set #"+chan+" greet off");
	}
	if (cmd == "bs9") { //set fantasy on.
		sendToChan("/msg botserv set #"+chan+" fantasy on");
	}
	if (cmd == "bs10") { //set fantasy off.
		sendToChan("/msg botserv set #"+chan+" fantasy off");
	}								
	if (cmd == "bs11") { //set symbiosis on.
		sendToChan("/msg botserv set #"+chan+" symbiosis on");
	}
	if (cmd == "bs12") { //set symbiosis off.
		sendToChan("/msg botserv set #"+chan+" symbiosis off");
	}
	if (cmd == "bs13") { //kick bolds on.
		var info1 = prompt("Type the number of strikes before banning offendin bolds user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" bolds on");
		}
		else {
			sendToChan("/msg botserv kick #"+chan+" bolds on "+info1+"");		
		}
	}
	if (cmd == "bs14") { //kick bolds off.
			sendToChan("/msg botserv kick #"+chan+" bolds off");
	}
	if (cmd == "bs15") { //kick badwords on.
		var info1 = prompt("Type the number of strikes before banning offending badwords user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" badwords on");
		}
		else {
			sendToChan("/msg botserv kick #"+chan+" badwords on "+info1+"");		
		}
	}
	if (cmd == "bs16") { //kick badwords off.
			sendToChan("/msg botserv kick #"+chan+" badwords off");
	}
	if (cmd == "bs17") { //kick caps on.
		var info1 = prompt("Type the number of strikes before banning offending CAPS lock user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" caps on");
		}
		else {
			var info2 = prompt("Type the minimum number of CAPS allowed in a sentance.","");
			if (info2 != null && info2 != "") {
				var info3 = prompt ("Type the maximum percentage of CAPS allowed in a sentance.","");
				if (info3 != null && info3 != "") { 	
					sendToChan("/msg botserv kick #"+chan+" caps on "+info1+" "+info2+" "+info3+"");		
				}
				else {
					sendToChan("/msg botserv kick #"+chan+" caps on");
				}
			}
			else {
				sendToChan("/msg botserv kick #"+chan+" caps on");
			}
		}
	}
	if (cmd == "bs18") { //kick caps off.
			sendToChan("/msg botserv kick #"+chan+" caps off");
	}						
	if (cmd == "bs19") { //kick colors on.
		var info1 = prompt("Type the number of strikes before banning offending colors user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" colors on");
		}
		else {
			sendToChan("/msg botserv kick #"+chan+" colors on "+info1+"");		
		}
	}
	if (cmd == "bs20") { //kick colors off.
			sendToChan("/msg botserv kick #"+chan+" colors off");
	}
	if (cmd == "bs21") { //kick flood on.
		var info1 = prompt("Type the number of strikes before banning offending flood user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" flood on");
		}
		else {
			var info2 = prompt("Type the number of lines allowed in X number of seconds.","");
			if (info2 != null && info2 != "") {
				var info3 = prompt ("Type the number of seconds that "+info2+" lines is constitutes a flood.","");
				if (info3 != null && info3 != "") { 	
					sendToChan("/msg botserv kick #"+chan+" flood on "+info1+" "+info2+" "+info3+"");		
				}
				else {
					sendToChan("/msg botserv kick #"+chan+" flood on");
				}
			}
			else {
				sendToChan("/msg botserv kick #"+chan+" flood on");
			}
		}
	}
	if (cmd == "bs22") { //kick flood off.
			sendToChan("/msg botserv kick #"+chan+" flood off");
	}
	if (cmd == "bs23") { //kick repeat on.
		var info1 = prompt("Type the number of strikes before banning offending repeat user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" repeat on");
		}
		else {
			var info2 = prompt("Type the number of repeats allowed.","");
			if (info2 != null && info2 != "") {
				sendToChan("/msg botserv kick #"+chan+" repeat on "+info1+" "+info2+"");		
			}
			else {
				sendToChan("/msg botserv kick #"+chan+" repeat on");
			}
		}
	}
	if (cmd == "bs24") { //kick repeat off.
			sendToChan("/msg botserv kick #"+chan+" repeat off");
	}
	if (cmd == "bs25") { //kick reverses on.
		var info1 = prompt("Type the number of strikes before banning offending reverses user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" reverses on");
		}
		else {
			sendToChan("/msg botserv kick #"+chan+" reverses on "+info1+"");		
		}
	}
	if (cmd == "bs26") { //kick reverses off.
			sendToChan("/msg botserv kick #"+chan+" reverses off");
	}
	if (cmd == "bs27") { //kick underlines on.
		var info1 = prompt("Type the number of strikes before banning offending underlines user or leave blank to disable banning.","");
		if (info1 == "") {
			sendToChan("/msg botserv kick #"+chan+" underlines on");
		}
		else {
			sendToChan("/msg botserv kick #"+chan+" underlines on "+info1+"");		
		}
	}
	if (cmd == "bs28") { //kick underlines off.
			sendToChan("/msg botserv kick #"+chan+" underlines off");
	}
	if (cmd == "bs29") { //badwords add single.
		var info1 = prompt("Type a badword to add to the list of badwords.\n This word will only activate kick if whole word is used.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv badwords #"+chan+" add "+info1+" single");
		}
	}
	if (cmd == "bs30") { //badwords add start.
		var info1 = prompt("Type a badword to add to the list of badwords. This word will only\nactivate kick if the badword is at the beginning of another word.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv badwords #"+chan+" add "+info1+" start");
		}
	}
	if (cmd == "bs31") { //badwords add end.
		var info1 = prompt("Type a badword to add to the list of badwords. This word will only\nactivate kick if the badword is at the end of another word.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv badwords #"+chan+" add "+info1+" end");
		}
	}
	if (cmd == "bs32") { //badwords del.
		var info1 = prompt("Type a badword to delete from the list of badwords.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv badwords #"+chan+" del "+info1+"");
		}
	}
	if (cmd == "bs33") { //badwords del #.
		var info1 = prompt("Type the number of the entry to delete from the list of badwords.\nYou may specify groups. Example 2-5 deletes entries 2 through 5.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv badwords #"+chan+" del "+info1+"");
		}
	}
	if (cmd == "bs34") { //badwords list #.
		var info1 = prompt("Type the number(s) of badwords to list.\nYou may specify groups. Example 2-5,7-9 will list badwords 2 through 5 and 7 through 9.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv badwords #"+chan+" list "+info1+"");
		}
	}
	if (cmd == "bs35") { //badwords clear.
		if (confirm("This will remove all badwords from the list.")) {
			sendToChan("/msg botserv badwords #"+chan+" clear");
		}
	}
	if (cmd == "bs36") { //act.
		var info1 = prompt("Type the text to be used in the bot's action.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv act #"+chan+" "+info1+"");
		}
	}
	if (cmd == "bs37") { //info channel.
		var info1 = prompt("Type the channel/room name you want info for.","");
		if (info1 != null && info1 != "") {
			channel = fixChan(info1);
			sendToChan("/msg botserv info "+channel+"");
		}
	}
	if (cmd == "bs38") { //act.
		var info1 = prompt("Type the nickname of the bot you want info for.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv info "+info1+"");
		}
	}
	if (cmd == "bs39") { //say.
		var info1 = prompt("Type the text to have the bot say.","");
		if (info1 != null && info1 != "") {
			sendToChan("/msg botserv say #"+chan+" "+info1+"");
		}
	}
	if (cmd == "bs40") { //unassign a bot.
		sendToChan("/msg botserv unassign #"+chan+" ");
	}			
	doReset();	
}

var fhug = "¯°•·›.›.{{{";
var bhug = "}}}.›·•°";
var mhug = bhug + fhug;

function doCommand() {
	cmd=document.myCommands.COMMANDS.options[document.myCommands.COMMANDS.selectedIndex].value;
	if (cmd.indexOf("/") == 0) {
		sendToChan(cmd);
	}
	else if (cmd.indexOf("fhttp://") >= 0) {
		furl=cmd.substring(1,cmd.length);
		displayURL(furl);
	}
	else if (cmd.indexOf("join") >= 0) {
		cmd2=cmd.substring(5,cmd.length);
		changeChan(cmd2);
	}
	else {
		if (cmd == "pop1") {
			sendToChan("   Something smells fishy here.....              ");
			sendToChan("              °       >}}}°›      °         °    ");
			sendToChan("        °     ‹°{{{<           °           ‹°{{{<");
			sendToChan("              °          >}}}°›     °         °  ");
			sendToChan("   °    ‹°{{{<              °           ‹°{{{<   ");		
		}
		if (cmd == "pop2") {
			var Digital=new Date();
			var hours=Digital.getHours() +1;
			var minutes=Digital.getMinutes();
			var seconds=Digital.getSeconds();
			var dn="PM";
			if (hours<12){dn="AM"};
			if (hours>12){hours=hours-12};
			if (hours==0){hours=12};
			if (minutes<=9){minutes="0"+minutes};
			if (seconds<=9){seconds="0"+seconds};
			myClock=""+hours+":"+minutes+":"+seconds+" "+dn+"";
			sendToChan("/me holds a clock up to the screen... "+myClock+".");		
		}
		if (cmd == "pop3") {
			var info1 = prompt("Type the front half of the hug. %B = bold, %U = underline, %R = reverse, %C = color (also view help ?)",fhug);
			if (info1 != null && info1 != "") {
				var info2 = prompt("Type the back half of the hug. %B = bold, %U = underline, %R = reverse, %C = color (also view help ?)",bhug);
				if (info2 != null && info2 != "") {
					fhug = info1;
					bhug = info2;
					mhug = info2 + info1;
					alert("All done.\nNow hug Someone!");
				}			
			}
		}		
		if (cmd == "pop4") {
			var info1 = prompt("Who do you want to give a big hug to?","")
			if (info1 != "" && info1 != null) {
				sendToChan(fhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + mhug + " "+info1+" " + bhug);
			}
		}
		if (cmd == "pop5") {
			var info1 = prompt("Who do you want to give a hug to?","")
			if (info1 != "" && info1 != null) {
				sendToChan(fhug + " "+info1+" " + bhug);
			}
		}
		if (cmd == "pop6") { 
			var n = prompt("Type the sentance you want to say backwards.","")
			if (n != "" && n != null) {
				var len = n.length; 
				var j; 
				var backtext = ""; 
				for(j = len; j >= 0; j--) { 
					backtext=backtext+n.charAt(j); 
				} 
				sendToChan(backtext);
			}
		}

		if (cmd == "pop7") {
			var i;
			var sx = prompt("Enter the sentance to send elite styled.","")
			if (sx != "" && sx != null) {
				var sx = sx.toLowerCase();
				var sy = "";
				for(i=0; i <= sx.length; i++) {
					var c = sx.charAt(i);
					if(c!="a"&&c!="b"&&c!="c"&&c!="d"&&c!="e"&&c!="f"&&c!="g"&&c!="h"&&c!="i"&&c!="j"&&c!="k"&&c!="l"&&c!="m"&&c!="n"&&c!="o"&&c!="p"&&c!="q"&&c!="r"&&c!="s"&&c!="t"&&c!="u"&&c!="v"&&c!="w"&&c!="x"&&c!="y"&&c!="z"&&c!=""&&c!="?"&&c!="!"&&c!=""){
						sy=sy+""+c;
					}
					if(c=="a"){sy=sy+"Å"}; if(c=="b"){sy=sy+"ß"}; if(c=="c"){sy=sy+"Ç"};
					if(c=="d"){sy=sy+"Ð"}; if(c=="e"){sy=sy+"é"}; if(c=="f"){sy=sy+"ƒ"};
					if(c=="g"){sy=sy+"g"}; if(c=="h"){sy=sy+"h"}; if(c=="i"){sy=sy+"î"};
					if(c=="j"){sy=sy+"J"}; if(c=="k"){sy=sy+"K"}; if(c=="l"){sy=sy+"£"};
					if(c=="m"){sy=sy+"m"}; if(c=="n"){sy=sy+"Ñ"}; if(c=="o"){sy=sy+"Ø"};
					if(c=="p"){sy=sy+"p"}; if(c=="q"){sy=sy+"q"}; if(c=="r"){sy=sy+"R"};
					if(c=="s"){sy=sy+"§"}; if(c=="t"){sy=sy+"†"}; if(c=="u"){sy=sy+"Ü"};
					if(c=="v"){sy=sy+"V"}; if(c=="w"){sy=sy+"w"}; if(c=="x"){sy=sy+"×"};
					if(c=="y"){sy=sy+"Ý"}; if(c=="z"){sy=sy+"Z"}; if(c==" "){sy=sy+" "};
					if(c=="?"){sy=sy+" ?¿"}; if(c=="!"){sy=sy+" !¡"};
					if (sx.charAt(i)==""){
						i=sx.length+20
					}
				}
				sendToChan(sy);
			}
		}		
		if (cmd == "cmd1") { //send email.
			TO=prompt("Send Email: Enter WebTV User Name or Full Email Address")
			if (!TO || null) {return false}
			if (TO.indexOf("@")< 0) {TO=TO+"@webtv.net"}
			SUB=prompt("Enter Subject of Email Message")
			if (!SUB || null) {return false}
			MSG=prompt("Enter Email Message Text")
			if (!MSG || null) {return false}
			if (navigator.appName != "WebTV Plus Receiver") {
				NS="";
				for(i=0; i< SUB.length; i++) {
					SV=SUB.substring(i,i+1)
					if (SV == " ") { SV="_" }
					NS=NS+SV;
				}
				SUB=NS;
			}
			document.Email.TEXT.value=MSG;
			mail=document.Email;
			mail.action="mailto:"+TO+"?Subject="+SUB;
			mail.submit();
		}
		if (cmd == "cmd2") { //list users with /who.
			sendToChan("/who");
		}
		if (cmd == "cmd3") { //open whisper pannel
			window.open('whisper.panel', 'whisper') 
		}
		if (cmd == "cmd4") { //set away.
			var info1 = prompt("Type your away message here or use the default message.",awaymsg);
			if (info1 != null && info1 != "") {
				awaymsg = info1;
				acrutime = 0;
				duration = "";
				setaway = true;
				anounceAway();
				countTimeAway();
			}
		}
		if (cmd == "cmd5") { //set back.
			if (setaway) {
				setaway = false;
				timeAway = getTimeAway();
				sendToChan("/me is back! Gone for "+timeAway+".");
				clearTimeout(awayID);
				acrutime = 0;
				triptime = 0;
			}		
		}
	}
	doReset();
}

var acrutime = 0;
var duration = "";
var setaway = false;
var awaymsg = "Stepped away from the keys...";
var awayID;
var saywhen = 1000;
var triptime = 0;
var triptime2 = 0;

function anounceAway() {
	if (setaway) {
		sendToChan("/me is away. (Reason: "+awaymsg+") "+duration+"");
	}
}
function countTimeAway () {
	acrutime = acrutime + 1;
	triptime = triptime + 1;
	triptime2 = triptime2 + 1;
	if (triptime2 == 300) {
		triptime2 = 0;
		sendToChan("/who");
	}
	if (triptime == 1200) {
		timeAway = getTimeAway();
		duration = "(Elapsed Time: "+timeAway+")";
		triptime = 0;
		anounceAway();
	}
	awayID = setTimeout("countTimeAway()",saywhen);
}
function getTimeAway  () {
	timeAway = "";
	remainder = acrutime;
	awayhours = 0;
	awayminutes = 0;
	awayseconds = 0;
	if (remainder >= 3600) {
		trim = remainder % 3600;
		awayhours = (remainder - trim) / 3600 ;
		remainder = trim;
		if (awayhours > 1) {
			timeAway = timeAway + awayhours + " hours";
		}
		else {
			timeAway = timeAway + awayhours + " hour";
		}		
	}
	if (remainder >= 60) {
		trim = remainder % 60;
		awayminutes = (remainder - trim) / 60;
		remainder = trim;
		if (awayhours >= 1) {
			comma = ", "
		}
		else {
			comma = "";
		}
		if (awayminutes > 1) {
			timeAway = timeAway + comma + awayminutes + " minutes";
		}
		else {
			timeAway = timeAway + comma + awayminutes + " minute";
		}		
	}
	if (remainder >= 1) {
		awayseconds = remainder / 1;
		if (awayminutes >= 1) {
			comma = ", "
		}
		else {
			comma = "";
		}		
		if (awayseconds > 1) {
			timeAway = timeAway + comma + awayseconds + " seconds";
		}
		else {
			timeAway = timeAway + comma + awayseconds + " second";
		}		
	}
	return timeAway;		
}
function fixChan(channel) {
	if (channel.indexOf("#") ==0) {
		return (channel);
	} else {
		return ("#"+channel);
	}
}
function sendMessage() {
	myMessage=document.textinput.chatinput.value;
	if (myMessage == "" || myMessage == null) {
		document.textinput.chatinput.focus();
		return false;
	}
	else {
		document.textinput.chatinput.value = "";
		sendToChan(myMessage);
		document.textinput.chatinput.focus();
		return false;
	}
}
function sendToChan(text) {
	Chat.addChannelMessage(text);
	doReset();
}
function doReset() {
	document.textinput.chatinput.focus();
	myCommands.reset();
	myNickserv.reset();
	myChanserv.reset();
	myBotserv.reset();
	myMemoserv.reset();
	return false;
}
function updateClock() {
	var Digital=new Date();
	var hours=Digital.getHours() +1;
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds();
	if (hours>12){hours=hours-12};
	if (hours==0){hours=12};
	if (minutes<=9){minutes="0"+minutes};
	if (seconds<=9){seconds="0"+seconds};
	myClock=""+hours+":"+minutes+":"+seconds+"";
	document.sysclock.clock.value=myClock;
	setTimeout("updateClock()",1000); 
}
function displayURL(frameloc){
	parent.abc.location=frameloc
	if (frameloc == "http://www.chattersonline.com/webtv/black.html") {
    	window.location="#top"
	}
}

function gotoloc(form){
	musicloc=document.myMusic.musicURL.options[document.myMusic.musicURL.selectedIndex].value;
	if (musicloc != "" && musicloc != null) {
	    window.location.href=musicloc
	}
	window.location="#top"
}

var chatURL = "http://www.chattersonline.com/ads/webtv/wtvchat.php";
function changeChan(newchan) {
	if (newchan == "" || newchan == null) {
		mychan=prompt("Enter Room Name to Join.",newchan)
	}
	else {
		mychan = newchan;
	}
	if (mychan != "" && mychan != null) {
		document.location.href=chatURL+"?serv="+serv+"&port="+port+"&chan="+mychan
	}
}
function Welcome() {
	Chat.addChannelMessage("/who")
	Chat.addChannelMessage("/me waves hello to everyone. =)")
}
