//Parameters: URL, height of window, width of window
function popIt(url, height, width)
        {
        newwindow=window.open(url,'name','height='+height+',width='+width+',left=400,top=200,resizable=no,location=no,scrollbars=no,toolbar=no,status=no');
                if (window.focus) {newwindow.focus()}
        }

function get_radio_value()
{
var value = "";

for (var i=0; i < document.form.accountType.length; i++)
   {
   if (document.form.accountType[i].checked)
      {
      value = document.form.accountType[i].value;
      }
   }
return value;
}

//Validates the form wich is passed when a new users registers.
function validateForm() {
	var accountType		= get_radio_value();
        var username            = document.getElementById('username').value;
        var username2           = document.getElementById('username2').value;
        var password            = document.getElementById('password').value;
        var password2           = document.getElementById('password2').value;
        var yourname            = document.getElementById('yourname').value;
	var passphrase		= document.getElementById('passphrase').value;
        var success             = false;
        var passwordFinal       = '';
        var usernameFinal       = '';
        success 		= (accountType != null)  ? true : false;
        var usernameOK		= (username == username2) ? true : false;
        var passwordsOK         = (password == password2) ? true : false;

        if(usernameOK) { usernameFinal = username; }
        if(passwordsOK) { passwordFinal = password; }

        success = success ? ((usernameFinal.length != null && usernameFinal.length >= 6) ? true : false) : false;
	// check if passphrase is ok
        success = success ? ((passwordFinal.length != null && passwordFinal.length >= 3) ? true : false) : false;
        success = success ? ((yourname.length != null && yourname.length >= 3) ? true : false) : false;

        if(success) {
                document.forms['form'].submit()
        } else {
                alert("Please check input fields and try again");
        }
}

function showLogin() {
        document.getElementById('loginForm').style.display = "inline";
        document.getElementById('myVRLogInButton').style.display = "none";
}

function logout() {
        document.forms['myVRLogoutForm'].submit();
}

function confirmDeletionOfAccount() {
	if(confirm("Click \"Ok\" to completely delete your account! All data will be removed")) {
alert('Your subscription has been cancelled!');
	}
}

