Need to split email address and have two alert outputs

I need to use string split to get two outputs for an email address, one output the user name and the second to be the domain name, for example xxxxx@xxxx.com needs to be seperated at the @ symbol so one output would be the xxxx and the second would be xxxx.com. Here is what I got so far, the problem I have is I can’t figure out how to get the second output right.

<html>
<body>

<script type=“text/javascript”>

function convertEmail(inEmail)
{
var atPosition;
var stringLength;
var username;
var domain;
username = inEmail.indexOf(“@”);
stringLength = inEmail.length;
domain = inEmail.substr(0,atPosition);
username = inEmail.substr(atPosition+1, stringLength);
domain = inEmail.substr(atPosition+1, stringLength);
return username ;
return domain;
}
emailIn = prompt(“Enter username@domain”, “Doe@Jane”);
alert (convert (inEmail))
alert (convert (inEmail))

</script>

</body>
</html>

I think you’ll find it easier and with much less code if you use split()