I want the product pages on my site to not look like poop on IE7 / 8 / 9.

I discovered today, that while I had tested site ~2008 / 2009 in IE7 and it was working, now IE 8 / 9 goes to quirks mode. Though I haven't changed anything. From research I believe it is because some of the <% %> snippet was written before the <!DOCTYPE>

So....

Where is best practice for placing the
Code:
<!-- include=””-->
<% Dim tab1, tab5, switchtabs
    switchtabs = Trim(request.querystring("o"))
    if isnumeric(switchtabs) then
        tab1="style='display:none'"
        tab5="style='display:block'"
    else
        tab1="style='display:block'"
        tab5="style='display:none'"
end if %>
After <html> but before the <head>,
in the <head></head>
first thing in the <body></body> other ideas?

From research today and experimentation, it seems that removing a classic .asp snippet and include from before

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
allows it to display correctly in IE 7 /8 /9 but leaves for me the question of where to put the snippet that calls a particular portion of page to display

Code:
<!--#include file="store/pc/include-metatags.asp"-->

<!-- 'default to order tab or not -->
<% Dim tab1, tab5, switchtabs
    switchtabs = Trim(request.querystring("o"))
    if isnumeric(switchtabs) then
        tab1="style='display:none'"
        tab5="style='display:block'"
    else
        tab1="style='display:block'"
        tab5="style='display:none'"
end if %>
My situation:

classic asp
site is hosted on Windows Server 2003 Microsoft-IIS/6.0 All of the page files are .asp the site was designed / built by an agency. I push the pieces around. Yet it seemed that it was working on my test of ie 6 / 7. It seems to default to quirks mode in ie9, presently

Presently code that breaks in IE 7/8/9 looks like this:
Code:
<!--#include file="store/pc/include-metatags.asp"-->

<!-- 'default to order tab or not -->
 <% Dim tab1, tab5, switchtabs
    switchtabs = Trim(request.querystring("o"))
    if isnumeric(switchtabs) then
        tab1="style='display:none'"
        tab5="style='display:block'"
    else
        tab1="style='display:block'"
        tab5="style='display:none'"
end if %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    </head>
    <body>
    <!-- sample for stackoverflow -->
        <div class="scontentsub">
            <div id="leftcolprod">
                <h5>Hello</h5><img src=”big-product.jpg”>
            </div>
            <div id="rightcolprod">
                <div class="models_container" id='tab1' <%=tab1%>>
                    <h4>features</h4>
                </div>
                <div class="models_container" id='tab5' <%=tab5%>>
                    <h4>Order Now</h4>
                </div>
            </div>
        </div>
    </body>
</html>
What I have researched:

I read ~6+ stackoverflows on IE 7 / 8/ 9 quirks mode and found the initially correction of pulling anything from before the <!DOCTYPE html> out of the file. I also experimented with, what I read on one Q&A,
Code:
<meta http-equiv="X-UA-Compatible" content="IE=7" />
, and while I got IE to render correctly the layout, I wasn't certain it was a best practice from what I was readoing.

I also read but did not try but this may be relevant with my server question try doing this other response I found,

Code:
Response.AddHeader "X-UA-Compatible", "IE=edge,chrome=1"
My experimentation were working in IE 9 and not defaulting to quirks mode when I inspected in the developers tool:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    </head>
    <body>
    <!-- sample for stackoverflow -->
        <div class="scontentsub">
            <div id="leftcolprod">
                <h5>Hello</h5><img src=”big-product.jpg”>
            </div>
            <div id="rightcolprod">
                <div class="models_container" id='tab1' <%=tab1%>>
                    <h4>features</h4>
                </div>
                <div class="models_container" id='tab5' <%=tab5%>>
                    <h4>Order Now</h4>
                </div>
            </div>
        </div>
    </body>
</html>

After experimenting with pulling any text that is before <!DOCTYPE> I began to wonder what is best practice on where to place a operation that renders pages uniquely based on inbound link query. To answer this I read another half-dozen stackoverflow post / sitepoint forums / reviewed w3schools.com / asp intro through a few segments (which I had read previously)

Question restated:

Where is best practice for placing the

<!-- include=””-->
and

<!-- 'default to order tab or not -->

After <html> but before the <head>,
in the <head></head>
first thing in the <body></body> other ideas?

Thanks Casey enthusiast / learner