You would need to wrap the script in a CDATA block. (importing it from a separate .js file would be even better)
<script type="text/javascript">
<![CDATA[
function mine()
{
var x= doxument.getElementById(divid).getElementsByTagName('div')[0];
x.innerHTML="Varun tested!";
}
]]>
</script>
Good luck!