	var its;
	var browserName;
	var browserNameLong;
	var browserNew;
	var preloadFlag = false;
	var Macintosh = navigator.userAgent.indexOf('Mac')>0;

	function its() {
		var n = navigator;
		var ua = ' ' + n.userAgent.toLowerCase();
		var pl = n.platform.toLowerCase();
		var an = n.appName.toLowerCase();

		// browser version
		this.version = n.appVersion;
		this.nn = ua.indexOf('mozilla') > 0;

		// 'compatible' versions of mozilla aren't navigator
		if(ua.indexOf('compatible') > 0) {
			this.nn = false;
		}
		
		this.opera = ua.indexOf('opera') > 0;
		this.ie = ua.indexOf('msie') > 0;
		this.major = parseInt( this.version );
		this.minor = parseFloat( this.version );

		// platform
		this.mac = ua.indexOf('mac') > 0;
		this.win = ua.indexOf('win') > 0;

		// workaround for IE5 which reports itself as version 4.0
		if(this.ie) {
			if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
			}
		}

		return this;
	}

	function browserNaming() {
		its = new its();
		
		// is it a DOM-enabled browser?
		if (!document.getElementById) {
			browserNew = false;
		}
		else {
			browserNew = true;
		}

		// need the name, too
		if (its.opera) {
			browserName = "Opera";
		}
		else if (its.ie) {
			browserName = "IE";
		}
		else {
			browserName = "NS";
		}

		// and the number
		browserNameLong = browserName + its.major;
	
	}
	
	// we might as well pick up the variables here
	browserNaming();


// Given an id and a property (as strings), return the given property of that id.
// original code from http://www.alistapart.com/

	function getIdProperty( id, property ) {
		if (browserNew) {
			var styleObject = document.getElementById( id );
			if (styleObject != null) {
				styleObject = styleObject.style;
					if (styleObject[property]) {
						return styleObject[ property ];
					}
				}
			return (styleObject != null) ?
			styleObject[property] :
			null;
		}
	}


// Given an id and a property (as strings), set the given property of that id to the value provided.
// original code from http://www.alistapart.com/

	function setIdProperty( id, property, value ) {
		if (browserNew) {
			var styleObject = document.getElementById( id );
			if (styleObject != null) {
				styleObject = styleObject.style;
				styleObject[ property ] = value;
			}
		}
	}

// VARS
		theShownBorder = '';
		theDelay = true;


// NS4 VALUE GETTERS
	function getImageXfromRight(imgID) {
		return eval(imgID).x
	}
	
	function getImageYfromTop(imgID) {
		return eval(imgID).y
	}

// OLD NETSCAPE 4 REFRESH BUG
	function MM_reloadPage(init) {
		if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
		else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	
	MM_reloadPage(true);

// CROSS-BROWSER SCRIPT TO WRITE OUT A NEW DIV
// WORKS IN IE4.+, NS4.+ (INCL. NS6)
function writeNewDiv(id,imgSrc) {
	// generate the div contents
	thisDiv = '<div style="position: absolute;"><img src="../images/dailypix/'+imgSrc+'" width="320" height="240" border="0" usemap="#'+id+'textmap"></div>';
	// does the insertion
	if (browserNew) {
		if (theShownBorder != "") {
			setIdProperty("sml" + theShownBorder,"borderColor","#6E7580");
		}
		setIdProperty("sml" + id,"borderColor","#4D452C");
		theShownBorder = id;
		document.getElementById("dailyimg").innerHTML=thisDiv;
	}
	else {
		if (browserName == "NS") {
			var holdingImage = document.images["topleft"];
			var thisRight = getImageXfromRight(holdingImage) + 0;
			var thisTop = getImageYfromTop(holdingImage) + 34;
			document.layers["dailyimg"].document.write(thisDiv);
			document.layers["dailyimg"].document.close();
			document.layers["dailyimg"].top = thisTop;
			document.layers["dailyimg"].Right = thisRight;
		}
		else {
			//IE4 crashes if you set the innerhtml without a delay, strange
			if (browserNameLong == "IE4") {
				if (theDelay == true) {
					thisID = id;
					thisImgSrc = imgSrc;
					setTimeout("writeNewDiv(thisID,thisImgSrc);",100);
					theDelay = false;
				}
				else {
					document.all["dailyimg"].innerHTML=thisDiv;
					theDelay = true;
				}
			}
			else {
				document.all["dailyimg"].innerHTML=thisDiv;
			}
		}
	}
}

// DOES SOME CSS WRITEOUT BECAUSE OF THE EVIL NS4
if (browserNameLong == "NS4") {
	document.write('<style type="text/css">');
	document.write('.boxoff { border: 0px; }');
	document.write('</style>');
}
else {
	document.write('<style type="text/css">');
	document.write('.boxoff { border-color: #6E7580; border-style: solid; }');
	document.write('</style>');
}
