window.print不再工作了

I have a php page with this javascript:

function printStuff($stuffdetails) {
<SCRIPT LANGUAGE="JavaScript" type="text/javascript"> 
window.print();
window.location = "<?=$stuffdetails['redirect']?>";
</script>

Nothing gets printed. When I remove

window.location = "<?=$stuffdetails['redirect']?>";

the print works. any idea whats going wrong? thanks!

I found the solution myself:

    window.print();
    setTimeout (function() {delayRedirect();},100);

    function delayRedirect()
    {window.location.href = "<?=$stuffdetails['redirect']?>";}

with a small timeout everything works