Firstly, you have a million and one problems here besides the PHP variable things. Firstly, you really shouldn't be using the onmouseover attribute anymore. Take a look at JavaScript & Events - Best Practice
So to replicate your problem with nicer code, you would do something like this.
<!-- This should be in an external JS file -->
<script>
    // IE Event Listener "Polyfill"
    var addEvent = function(element, event, callback) {
        if (document.addEventListener) {
            element.addEventListener(event, callback);
        } else {
            element.attachEvent('on' + event, callback);
        }
    };
    addEvent(document, 'load', function() {
        var element = document.getElementById('element');
        attachEvent(element, 'onmouseover', function() {
            myTimer = setTimeout('imageswitcher(<?php echo $imagename; ?>)', 2000);
        });
    }
</script>
<!-- Not an actual element, used for example purposes only -->
<element id="element"></element>
Variables should be assigned using 'var'
Your next problem is that your assigning myTimer without var. Now, it's not likely to be causing the issue here, it's good to keep it in mind.
var myTimer = setTimeout('imageswitcher(<?php echo $imagename; ?>)', 2000);
Function Strings
I don't know what your trying to do, but you're passing a string instead of a function to setTimeout. Let's fix that.
var myTimer = setTimeout(function() {
    imageswitcher(<?php echo $imagename; ?>);
}, 2000);
Addressing the issue
Now, let's address the actual issue here.
$imagename is probably a string, which you're not accounting for in your javascript. Let's fix that.
imageswitcher('<?php echo $imagename; ?>');
Putting it all together
<!-- This should be in an external JS file -->
<script>
    var addEvent = function(element, event, callback) {
        if (document.addEventListener) {
            element.addEventListener(event, callback);
        } else {
            element.attachEvent('on' + event, callback);
        }
    };
    addEvent(document, 'load', function() {
        var element = document.getElementById('element');
        attachEvent(element, 'onmouseover', function() {
            var myTimer = setTimeout(function() {
                imageswitcher('<?php echo $imagename; ?>');
            }, 2000);
        });
    };
</script>
<!-- Not an actual element, used for example purposes only -->
<element id="element"></element>