I'm currently working on a script that does two things. First the php side sends a request to xfires server and checks if the user is signed on or off, if so it returns an online icon or an offline icon respectively.

The JavaScript part is this, I am trying to make it so when you click that icon it sends the add request via a short url like,

Code:
xfire:add_friend?user=
What I want it to do is that when I check to see if the program is installed and it finds that it isn't, a popup window goes to the download page. What I'm using right now pops up to the right page, but it isn't checking properly. Here is the script...

Code:
var activex = ((navigator.userAgent.indexOf('Win')  != -1) && (navigator.userAgent.indexOf('MSIE') != -1) && (parseInt(navigator.appVersion) >= 4 ));
var CantDetect = ((navigator.userAgent.indexOf('Safari')  != -1) || (navigator.userAgent.indexOf('Opera')  != -1));

function oopsPopup() {
    if((navigator.language && navigator.language.indexOf("ja") != -1) || (navigator.systemLanguage && navigator.systemLanguage.indexOf("ja") != -1) || (navigator.userLanguage && navigator.userLanguage.indexOf("ja") != -1)) {
        var URLtoOpen = "http://www.xfire.com/downloads/";
    } else {
        var URLtoOpen = "http://www.xfire.com/downloads/";
    }
	var windowName = "oops";
	var popW = 800, popH = 800;
	var scrollB = 'yes';
	w = screen.availWidth;
	h = screen.availHeight;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	oopswindow = window.open(URLtoOpen, windowName,'width=' + popW + ',height=' + popH + ',scrollbars=' + scrollB + ',screenx=' +leftPos +',screeny=' +topPos +',top=' +topPos +',left=' +leftPos);
	return false;
}

if(typeof(detected) == "undefined" && activex) {
    document.write(
        ['<script language="VBscript">',
        'Function isXfireInstalled()',
        'on error resume next',
        'Set oXfire = CreateObject("Xfire.Detection")',
        'isXfireInstalled = IsObject(oXfire)',
        'Set oXfire = nothing',
        'End Function',
        '</script>'].join("\n")
    );
}

function xfireCheck() {
    if(CantDetect) {
        return true;
    } else if(!activex) {
        var xfireMime = navigator.mimeTypes["application/x-xfire"];
        detected = true;
        if(typeof(xfireMime) == "object") {
            return true;
        } else {
            return oopsPopup();
        }
    } else {
        if(isXfireInstalled()) {
            detected = true;
            return true;
        }
    }
    
    detected = true;
    return oopsPopup();
}

function loadDetection() {
    if(document.getElementById && document.getElementsByTagName) {
        if (window.addEventListener) window.addEventListener('load', addDetection, false);
        else if (window.attachEvent) window.attachEvent('onload', addDetection);
    }
}

function addDetection() {
    var pageLinks = document.getElementsByTagName("a");
    for (var i=0; i < pageLinks.length; i++) {
        if(pageLinks[i].childNodes[0] && pageLinks[i].childNodes[0].src) {
{
                pageLinks[i].onclick = function sChk() { return xfireCheck(); }
            }
        }
    }
}

loadDetection();
This is the link users are currently clicking...

Code:
<!-- IF postrow.U_XFIRE --><li class="xfire-icon"><a href="xfire:add_friend?user={postrow.U_XFIRE}" onclick="return xfireCheck();"><img src="http://icon.alanedwardes.com/xfire/{postrow.U_XFIRE}" title="{L_XFIRE} {user_xfire}" border="0" /></a></li><!-- ENDIF -->
any help would be greatly appreciated.