Welcome to WebmasterWorld Guest from 126.96.36.199
It behaves as intended and written when the page is called from the folder; i.e., example.com/subdom/index.htm - but breaks when called as subdom.example.com
Both parts of the script contain only absolute links.
If that is true, it's difficult to understand why you'd have a problem.
For further investigation, I'd suggest a review of your server error log file, and using a server headers checker such as the "Live HTTP Headers" add-on for Firefox and Mozilla-based browsers. Using these tools, you can get a better view of the requests that the server is receiving, the filepaths that the requested URLs resolve to, and the responses that your server is sending to the client.
There seems to be some unexpected results when calling included files from a sub-domain, but I can't find any "rule of Thumb" to explain so I can understand it.
I have had similiar problems in the past with Style sheets not working when requested from the root folder to a sub-domain.
If someone you point me to a solution to this I will be very grateful. (Please do not use tech language to explain) I have read lots of posts/replies about .htaccess and folders, but can't get my head around it because I don't understand the tech terminology.