
function populateIFrame(pixel) {
	var ifrm = document.getElementById('pixelsIframe');
	ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
	ifrm.document.open();
	ifrm.document.write(pixel);
	ifrm.document.close();
}

// Make AJAX call to host.php (it is synchronous call)
// host.php will return the URL to make the cross-server javascript call
// The AJAX response will be used to populate 'host' javascript variable
var host = '';
var hostname = 'mycleanpc.com';

new Ajax.Request('host.php', {
	method: 'post',
	asynchronous: false,
	onSuccess: function(request) {
		host = request.responseText;
	},
	onFailure: function(request) {
		alert("An AJAX error occured");
	}
});

var gr_url = String(document.location);
var landing_regex = new RegExp("home.html", "i");
var post_download_regex = new RegExp("download.html", "i");
var area = '';

if (gr_url.match(landing_regex)) {
	area = 'GR Sites Landing';
}
else if (gr_url.match(post_download_regex)) {
	area = 'GR Sites Post Download';
}

var url =  host + '/js/gr_pixels.js?area=' + area + '&hostname=' + hostname;

// Make the cross-server javascript call
Event.observe(window, 'load', function() {
	var script = document.createElement("script");
	document.getElementsByTagName('body')[0].appendChild(script);
	script.src = url;
});

