 /**
 * TSStatus: Teamspeak 3 viewer for php5
 * @author Sebastien Gerard <sebeuu@gmail.com>
 * @see http://tsstatus.sebastien.me/
 * 
 **/

function tsstatusconnect(host, port, channel)
{
	var command = "ts3server://" + host + "/?port=" + port;
        
    var password=window.prompt('Enter teamspeak server password');
    if (password == null) {
        return;
    } else if (password == "") {
        window.alert('Could not enter the teamspeak server because you did not enter a server password');
        return;
    }
    command += "&password=" + password;
	
    var nick=window.prompt('Enter nickname');
    if (nick == null) {
        return;
    } else if (nick == "") {
        window.alert('Could not enter the teamspeak server because you did not enter a nickname');
        return
    }
    command += "&nickname=" + nick;

	if(channel != undefined)
	{
		command += "&channel=" + channel;
	}

	var popup = window.open(command);
	popup.close();
}


