var screenWidth = screen.width;
var screenHeight = screen.height;
var key = "QJd8R4soP2bV@1dLkz49W";

var width;
var height;

switch (parseInt(banner_type))
{
	case 1:
		// Leaderboard
		width = 728;
		height = 90;
		break;

	case 2:
		// Vertical Skyscraper
		width = 120;
		height = 600;
		break;

	case 3:
		// Email
		width = 234;
		height = 60;
		break;

	case 4:
		// Normal Banner
		width = 472;
		height = 65;
		break;

	case 5:
		// Rectangle
		width = 300;
		height = 250;
		break;

	case 6:
		// Other
		width = banner_width;
		height = banner_height;
		break;

	default:
		// Custom banner
		width = banner_width;
		height = banner_height;
		break;
}

// Add some leverage to the width and height.
width = parseInt(width) + 0;
height = parseInt(height) + 0;

var url = "http://www.advertiseme.com.au/admanagement/Impressions.asp?key=" + key + "&bid=" + banner_id + "&btype=" + banner_type + "&bw=" + width + "&bh=" + height + "&alt=" + alt_text + "&w=" + screenWidth + "&h=" + screenHeight;
//var url = "http://server/admanagement/Impressions.asp?key=" + key + "&bid=" + banner_id + "&btype=" + banner_type + "&bw=" + width + "&bh=" + height + "&alt=" + alt_text + "&w=" + screenWidth + "&h=" + screenHeight;

document.write("<iframe src=\"" + url + "\" frameborder=\"0\" width=\"" + width + "\" height=\"" + height + "\" scrolling=\"no\" marginwidth=\"0\" marginheight=\"0\"></iframe>");

//sendRequest(url,handleRequest);
/*
function sendRequest(url,callback,postData) {
	var req = createXMLHTTPObject();
	if (!req) return;
	var method = (postData) ? "POST" : "GET";
	req.open(method,url,true);
	req.setRequestHeader('User-Agent','XMLHTTP/1.0');
	if (postData)
		req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
	req.onreadystatechange = function () {
		if (req.readyState != 4) return;
		if (req.status != 200 && req.status != 304) {
//			alert('HTTP error ' + req.status);
			return;
		}
		callback(req);
	}
	if (req.readyState == 4) return;
	req.send(postData);
}

function XMLHttpFactories() {
	return [
		function () {return new XMLHttpRequest()},
		function () {return new ActiveXObject("Msxml2.XMLHTTP")},
		function () {return new ActiveXObject("Msxml3.XMLHTTP")},
		function () {return new ActiveXObject("Microsoft.XMLHTTP")}
	];
}

function createXMLHTTPObject() {
	var xmlhttp = false;
	var factories = XMLHttpFactories();
	for (var i=0;i<factories.length;i++) {
		try {
			xmlhttp = factories[i]();
		}
		catch (e) {
			continue;
		}
		break;
	}
	return xmlhttp;
}

function handleRequest(req) {
	document.write(req.responseText);
}
*/
