Please try it like this:
<script type="text/javascript" >
<!-- #include file="../jscripts/script368.js" -->
function newSearchWindow()
{
cugval = window.showModalDialog('CUGSearch.aspx','CUGSearch','dialogWidth:900px;dialogHeight:600px;center:yes;status:no;');
if (cugval != "")
{
alert(cugval);
var element = document.getElementById("<%=cugcode.ClientID%>");
element.value = cugval;
alert( element.value);
document.forms[0].submit();
}
}
</script>
Hope that helps!