var adList = new Array();
var adPath = new Array();
function initAd() {return;}
function noop() {}

var ua = window.navigator.userAgent.toLowerCase();
navigator.family = "";
if (ua.indexOf('opera') != -1) 
	noop();
else if ((i = ua.indexOf('msie')) != -1)
	navigator.family = "ie";
else if (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')
	navigator.family = "gecko";
else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
	navigator.family = "nn";

var netscape4Template = "<img name='ad_<identifier>_pos' align='center' src='<IMAGEPATH>/spacer.gif' width='<theWidth>' height='<theHeight>'>";

function genNetscape4Tags (var_identifier, var_IMAGEPATH, var_theWidth, var_theHeight) {
	var theHtml = new String;
	theHtml = netscape4Template;
	var re = /<identifier>/g;
	theHtml = theHtml.replace(re, var_identifier);
	var re = /<IMAGEPATH>/g;
	theHtml = theHtml.replace(re, var_IMAGEPATH);
	var re = /<theWidth>/g;
	theHtml = theHtml.replace(re, var_theWidth);
	var re = /<theHeight>/g;
	theHtml = theHtml.replace(re, var_theHeight);
	return theHtml;
}

function writeAdForN4 (var_identifier, var_IMAGEPATH, var_theWidth, var_theHeight) {
	if(navigator.family == "nn")
		return genNetscape4Tags (var_identifier, var_IMAGEPATH, var_theWidth, var_theHeight);
	else
		return "";
}

function refreshAdN5() {

	var theRandomNum;
	var ordTag;
	theRandomNum = Math.round(Math.random() * 1000000);
	for(var i = 0; i < adList.length; i++) {
		ordTag = ";ord=" + theRandomNum + "?"; 
		var adObj = eval(adList[i]);
		if(navigator.family == "ie")
			adObj.location.replace(adPath[i] + ordTag);
		else
			adObj.location = adPath[i] + ordTag;
	}
}

function refreshAdN4() {

	var theRandomNum;
	var ordTag;
	theRandomNum = Math.round(Math.random() * 1000000);
	for(var i = 0; i < adList.length; i++) {
		ordTag = ";ord=" + theRandomNum + "?";
		var adObj = document.layers[adList[i]];
		adObj.src = adPath[i] + ordTag;
	}
}

function refreshAd() {
	if(navigator.family == "nn")
		refreshAdN4();
	else if(navigator.family == "ie" || navigator.family == "gecko")
		refreshAdN5();
	else
		return;
}

if(navigator.family == "nn" && !window.saveInnerWidth) {
	window.onresize = resize;
	window.saveInnerWidth = window.innerWidth;
	window.saveInnerHeight = window.innerHeight;
}

function resize() {
	if(navigator.family == "nn" &&
			(saveInnerWidth < window.innerWidth || 
			saveInnerWidth > window.innerWidth || 
			saveInnerHeight > window.innerHeight || 
			saveInnerHeight < window.innerHeight))
		window.history.go(0);
}
