I have this javascript modal which I want to use for error reporting. Everything works well only that the code gets executed before page load. So the result is that I have my javascript before the head tag which means nothing gets executed!

Any help?

```
public void showError(string error)
{
    string script = "<script type=\"text/javascript\">$.facebox.settings.opacity = 0.4;jQuery.facebox(\""+error+"\");</script>";        
    System.Web.HttpContext.Current.Response.Write(script);        
}

```

By the way, my ShowError method is within a class called ErrorDisplay
This is how I call it:

```
string strErr = "error here";
            ErrorDisplay myError = new ErrorDisplay();
            myError.ShowError(strErr);

```