function iecheck() {
    if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var iever = (rslt != null && Number(rslt[1]) >= 5.5 && Number(rslt[1]) <= 7 );
    }
    return iever;
}
function gup( name )
{
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec( window.location.href );
    if( results == null )
	return "";
    else
	return results[1];
}
MyXssMagic = new function() {

	var BASE_URL = 'http://webweary.dev.clicknowlogy.com/widget/';
	var STYLESHEET = BASE_URL + "widget.css";
        var CONTENT_URL = BASE_URL + 'contentWidget.php' + '?sid=' + sid;
	var ROOT = 'my_xss_magic';

	function requestStylesheet(stylesheet_url) {
	    stylesheet = document.createElement("link");
	    stylesheet.rel = "stylesheet";
	    stylesheet.type = "text/css";
	    stylesheet.href = stylesheet_url;
	    stylesheet.media = "all";
	    document.lastChild.firstChild.appendChild(stylesheet);
	}

	function requestContent( local ) {
	    var script = document.createElement('script');
	    // How you'd pass the current URL into the request
	    // script.src = CONTENT_URL + '&url=' + escape(local || location.href);
	    script.src = CONTENT_URL;
	    document.getElementsByTagName('head')[0].appendChild(script);
	}

	this.init = function() {
	    this.serverResponse = function(data) {
		if (!data) return;
		var div = document.getElementById(ROOT);
		var txt = "<ul>";
		for (var i = 0; i < data.length; i++) {
		    // if (txt.length > 0) { txt += ", "; }
		    txt += "<li><a href='" + data[0][0] + "'>" + data[0][0] + "</a>";
		}
		    txt += "<li><a href='" + data[0][1] + "'>" + data[0][1] + "</a>";
                //		    txt += "<li><a href='linking somewhere'>" + data[0].article + "</a>";
		//		    txt += "<li><a href='http://webweary.dev.clicknowlogy.com/widget/contentWidget.php'>Test Domain</a>";
                txt += "</ul>";
		div.innerHTML = "<strong>Partner Links:</strong> " + txt;  // assign new HTML into #ROOT
		div.style.display = 'block'; // make element visible
		div.style.visibility = 'visible'; // make element visible
	    }
	    
	    requestStylesheet(STYLESHEET);
	    document.write("<div id='" + ROOT + "' style='display: none'></div>");
	    requestContent();
	    var no_script = document.getElementById('no_script');
	    if (no_script) { no_script.style.display = 'none'; }
	}
    }
    MyXssMagic.init();

