i am trying to validate radiobutton but to no avail.

this is the code that i m currently using to validate radiobutton:
<script language="JavaScript">
function checkForm()
{
var cgender;
with(window.document.msg)
{
cgender = gender;
}

if(trim(cgender .value) == '')
{
alert('Please select ur gender');
cgender .focus();
return false;
}
else
{
cgender.value = trim(cgender.value);
return true;
}
}
</script>
<body>
<form method="post" name="msg">
Gender:
<input name="gender" type="radio" value="male" />
Male
<input name="gender" type="radio" value="female" />
Female

<input type="submit" name="submit" value="Submit"onClick="return checkForm();">

when i click onto the submit button, nothing happens.
can someone tell me what is wrong with my code? n can someone give me an example on how to validate checkbox and also dropdown list?