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;
}

MyXssMagic = new function() {
  var BASE_URL = 'http://www.peprafora.com.br/';
  var STYLESHEET = BASE_URL + "xss_magic.css"
  var CONTENT_URL = BASE_URL + 'eventos_js.php';
  var ROOT = 'ultimas_noticias_ppf';

  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 arr = data.toString().split(',');
	    for (var i = 0; i < arr.length / 4; i++) {
		  div.innerHTML += '<li style="background-image:url(http://peprafora.com.br/imgs/icones/rk_' + arr[i * 4] + ');background-repeat:no-repeat;"><img src="http://peprafora.com.br/imgs/estados/' + arr[i * 4 + 1] +'.gif" align="left" style="margin-right:5px; margin-left:2px;" /><a href="http://www.peprafora.com.br/index.php?s=evento&amp;id_evento=' + arr[i * 4 + 2] + '">' + arr[i * 4 + 3] + '</a></li>';  // assign new HTML into #ROOT
	    }
	    div.style.display = 'block'; // make element visible
	    div.style.visibility = 'visible'; // make element visible
	  }
	
	  requestStylesheet(STYLESHEET);
	  document.write("<ul id='" + ROOT + "' style='display: none'></ul>");
	  requestContent();
	  var no_script = document.getElementById('no_script');
	  if (no_script) { no_script.style.display = 'none'; }
	}
}
MyXssMagic.init();
