So, this is definatly one of the worst times i ever had with javascript and the blatent incompitancy of IE, below is my code, i realise that IE does not know of "addEventListener" although support was surpossed to be added in IE9 which still does not work, i have tried every fix i can think of and done all the research i can do on something that should just work anyway.

		google.load("swfobject", "2.1");
		var fired = 0;
		function getQueryString() {
			var result = {},
				queryString =,
				re = /([^&=]+)=([^&]*)/g,

			while (m = re.exec(queryString)) {
				result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
			return result;

		function track (vid) {
			var params = {
				allowScriptAccess: "always"
			var atts = {
				id: "player"
			var urlString = "" + vid + "&enablejsapi=1&playerapiid=ytplayer";
			swfobject.embedSWF(urlString, "embed", "640", "390", "10", "8", null, null, params, atts);
		function onYouTubePlayerReady(playerId){
			var player = document.getElementById("embed");
			player.addEventListener('onStateChange', 'onytplayerStateChange');
		function onytplayerStateChange(newState){
			if(newState != -1 && newState != 5 && !fired){
				fired = 1;
				var trackingPixel = new Image();
				trackingPixel.src = getQueryString()["unloadUrl"];
The function "onYouTubePlayerReady" does not get fired by IE for some(no) reason.

There are many threads on this issue but none seem resolved.

See it in action here:

Thanks for any help, this has been a very trying time for me, sometimes i love javascript but IE forces me to hate it, nothing like spending 30mins coding something then 4 hours making it work in IE.