var adblocks_ads = "w3xa"
var adblocks_msg = '';
// you may choose to provide a direct URL path for the PHP file. Use 'http://"+document.location.hostname+' for the main part of your website's name. For example if the direct URL path to my php file was located at "http://www.saurdo.com/files/adblocks/adblocks.php". I would put "var php_url = 'http://'+document.location.hostname+'/files/adblocks/'"
var adblocks_php_url = "http://"+document.location.hostname+"/?a=adblock_record";
	
function createXMLHttpRequest(){ 
    try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} 
    try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} 
    try { return new XMLHttpRequest(); } catch(e) {} 
    alert("XMLHttpRequest not supported"); 
    return null; 
} 
function recordBlock(b){ 
    xmlPost = createXMLHttpRequest(); 
    // add our "blocked" value to our request 
    xmlPost.open( "GET", adblocks_php_url+"&b="+b, true ); 
    // attach request header 
    xmlPost.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 
    xmlPost.send( null ); 
}

Event.observe(window, 'load',
		function()
		{
			// IE doesn't have a getElementByClassName function!
			if (document.getElementsByClassName == undefined) {
				document.getElementsByClassName = function(className)
				{
					var hasClassName = new RegExp("(?:^|\\s)" + className + "(?:$|\\s)");
					var allElements = document.getElementsByTagName("*");
					var results = [];
		
					var element;
					for (var i = 0; (element = allElements[i]) != null; i++) {
						var elementClass = element.className;
						if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
							results.push(element);
					}
		
					return results;
				}
			}
		
		    blocked = 0; 	
			var ad_nodes = document.getElementsByClassName(adblocks_ads);
			for(i in ad_nodes){
			    // detect if container has a height (has content) 
				if (ad_nodes[i].offsetHeight == 0){ 
					blocked = 1;
					//alert("blocked");
					ad_nodes[i].innerHTML = adblocks_msg;
				}
			}
			
		    // activate recordBlock function 
		    recordBlock(blocked); 
		}		
);
