
function getFile(fileName)
{
    oxmlhttp = null;

    try
	{
        oxmlhttp = new XMLHttpRequest();
        oxmlhttp.overrideMimeType("text/xml");
    }

    catch(e)
	{
        try
		{
            oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        }

        catch(e)
		{
            return null;
        }
    }

    if(!oxmlhttp) return null;

    try
	{
       oxmlhttp.open("GET",fileName,false);
       oxmlhttp.send(null);
    }

    catch(e)
	{
       return null;
    }

    return oxmlhttp.responseText;
}

function addReferers()
{
	var referers = document.getElementById('referers');
	var referersCache = getFile('http://www.babedot.com/cache/top_referers.txt');

	referers.innerHTML = referersCache;
}

/* XHTML target attribute */
function externalLinks() 
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");

	for (var i=0; i<anchors.length; i++) 
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "external" || anchor.getAttribute("rel") == "nofollow external")) 
		{
			anchor.target = "_blank";
		}
	}
} 

/* Bookmark Function */
function bookmark(title, url)
{
	if (document.all)
	{
		window.external.AddFavorite(url, title);
	}
	else if (window.sidebar)
	{
		window.sidebar.addPanel(title, url, "")
	}
}

/* Adjust Layout */
function adjustLayout()
{
  // Get content heights
  var cHeight = xHeight('galleries');
  var lHeight = xHeight('plugs');
  var rHeight = xHeight('right');

  // Find the maximum height
  var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));

  // Assign maximum height to all columns
  xHeight('galleries', maxHeight);
  xHeight('plugs', maxHeight);
  xHeight('right', maxHeight);
}

function show(selection)
{
	div = document.getElementById(selection);
	
	if (div.style.display == 'none')
	{
		div.style.display = '';
	}
	else
	{
		div.style.display = 'none';
	}
}

window.onload = function()
{
	//xAddEventListener(window, "resize", adjustLayout, false);
	//adjustLayout();
	externalLinks();
	tracker();
} 