this.focus();
window.defaultStatus = "hover over logo in upper left corner to get menu";

function openCP(errURL,errMsg,errLine) {
	W=300;H=300;
	report = 'URL='+ errURL +'&MSG='+ errMsg +'&LN='+ errLine;
	setup='toolbar=no,location=no,directories=no,status=no,menubar=no,width=' + W + ',height=' + (H+50) + ',left=10,top=10';
	setup += ',scrollbars=no,resizable=no';
	pop = window.open ("/tdm/cp_mini.asp?"+report,"CP",setup);
}

//Errorhandling begin
	var errors = new errorObjMaker()
	var count = 0
	
function MyError(msg,url,ln) {
	errors[count] = msg;
	errors[count += 1] = ln;
	count += 1;
	openCP(url,msg,ln);
	alert('Greetings CARPE TDM visitor..\r\n\nAn error occurred in file:\r\n\t' + url +'\r\n\nin line : ' + ln +'\r\n\nand the error message is :\r\n\t' + msg +'\r\n\nPlease report this error.\r\n\n\tThank you')
	return true;	//geen foutmelding geven
	windows('CP').focus();
}
	
function errorObjMaker() {
}
window.onerror = MyError;
	
//end ErrorHandling

//AlienFramesBuster
if (top.location.host != location.host) {
	//insert procedure to write top.location with date to dbase
	top.location = this.location;
	}

MyUrl = location.href
MyFileNoExtension = MyUrl.substring(MyUrl.lastIndexOf('/')+1,MyUrl.lastIndexOf('.'))

var arrDay = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
var arrMonth = new Array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');
dNow = new Date();
strlastMod = (document.lastModified && MyUrl.indexOf('.asp')<0) ? document.lastModified : '01/01/01 02:02:02' ;
iYearLastMod = ( eval(strlastMod.substring(6,8)) >= 70 && dNow.getYear() < 2070 ) ? eval(strlastMod.substring(6,8)) + 1900 : eval(strlastMod.substring(6,8)) + 2000;
dLastModDate = new Date();
dLastModDate.setYear(iYearLastMod);
dLastModDate.setMonth(eval(strlastMod.substring(0,2)-1));
dLastModDate.setDate(eval(strlastMod.substring(3,5)));

strLocation = location;
strCopyright = '<A CLASS="innewwindow" HREF="http://www.carpe-tdm.net/copyright.html" TARGET="_blank" TITLE="about copyright">&copy; copyright</A>'
strLastmodified =  arrDay[dLastModDate.getDay()] + ' ' + arrMonth[dLastModDate.getMonth()] + ' '+ dLastModDate.getDate() + DateAppendix(dLastModDate.getDate()) +', ' + dLastModDate.getYear();
strCurrDate = arrDay[dNow.getDay()] + ' ' + arrMonth[dNow.getMonth()] + ' '+ dNow.getDate() + DateAppendix(dNow.getDate()) +', ' + dNow.getYear();


function WriteBack() {
if (window.document.referrer) {
	if (window.document.referrer.domain == location.domain) document.write ('<A HREF="'+ document.referrer +'" TARGET="_top">&lt;&lt; back</A></FONT>')
	}
else document.write ('<A HREF="http://www.carpe-tdm.net" TARGET="_top">to the homepage</A></FONT>');
}

function InfoWindow(thefile,W,H) {
	T = (screen.height - H) /2;L = (screen.width - W) /2;
	window.open(thefile,'InfoWindow','resizable=yes,toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width='+ W +',height='+ H +',top='+ T +',left='+ L );
}

function Inflate(pic,W,H,info) {
	if (document.forms["ShowView"]) strOnBlur = (document.forms["ShowView"].onblur_close.checked == true) ? ' onblur="this.close();"' : ''
	else strOnBlur = ''	//onblur="this.close();"';
	MyDate = new Date();
	MyTime = MyDate.getTime();
	setup='toolbar=no,location=no,directories=no,status=no,menubar=no,width=' + W + ',height=' + (H+50) + ',left=100,top=100';
	setup += ',scrollbars=no,resizable=no';
	pop = window.open ("","Showview"+MyTime,setup);
	strInflate = '<HTML><head><Title>' + info +' ( @ Carpe TDM )</Title></head>'+
		'<BODY BGCOLOR="#ffffff" topmargin="0" leftmargin="0" rightmargin="0"'+ strOnBlur +' onload="this.focus();"><BASEFONT SIZE=2 face="verdana">'+
		'<A HREF="/tdm/index.html" TARGET="_blank"><IMG SRC="' + pic + '" HEIGHT='+ H + ' WIDTH=' + W +' VSPACE="0" BORDER="0" ALT="click away to close, click on image to go to the HomePage"></A>'+
		'<DIV ALIGN="center">' + info +'</DIV></body></HTML>';
	pop.document.write(strInflate);
	pop.document.close();//for the onBlur to work.
}

function DateAppendix(d) {
	d= d.toString();
	if (eval(d) <10 || eval(d) >=20) {
		switch(d.charAt(d.length-1)) {
			case '0':
				return 'st';
				break;
			case '1':
				return 'st';
				break;
			case '2':
				return 'nd';
				break;
			case '3':
				return 'rd';
				break;
			default :
				return '';
				break;
			}
		}
	else return 'th';
}

function writeFooter(){
MyString = '<BR CLEAR="all"><DIV ALIGN="center"><FONT SIZE=1>'+
	'<B><A HREF="http://www.carpe-tdm.net/" TARGET="_top" TITLE="homepage">www.carpe-tdm.net</A></B>'+
	document.location.pathname +	//	'<BR>modified ' + strLastmodified +
	'<BR>'+
	strCopyright +
	'</FONT></DIV><BR CLEAR="all">'
document.write(MyString);
}

//overlib
var MenuTitle = '<FONT SIZE=1>'+ arrDay[dNow.getDay()] + ' ' + arrMonth[dNow.getMonth()] + ' '+ dNow.getDate() + DateAppendix(dNow.getDate()) +', ' + dNow.getYear() +'</FONT>';
var MsgInMenu = '' //'<FONT COLOR=red><SPAN CLASS=warning><B>UNDER CONSTRUCTION</B></SPAN></FONT><BR>'
var textMenu =	MsgInMenu +
		'<A HREF="/tdm/mainmenu.html" TARGET="_top">main menu</A>'+
		'<BR><A HREF="/tdm/updates.html" TARGET="_top">updates</A>'+
		'<BR><a href="/tdm/forum/" TARGET="_blank" CLASS="innewwindow">talkabout</A>'+
		'<BR><A HREF="/tdm/chapters/" TARGET="_top">clubhouse</A>'+
		'<BR><A HREF="/tdm/shop/" TARGET="_top">shop</A>'+
		'<BR><A HREF="/tdm/garage.html" TARGET="_top">garage</A>'+
		'<BR><A HREF="/tdm/library.html" TARGET="_top">library</A>'+
		'<BR><A HREF="/tdm/gallery.asp" TARGET="_top">gallery</A>'+		//'<BR><A HREF="/tdm/lounge.html" TARGET="_blank" CLASS="innewwindow">lounge</A>'+
		'<BR><A HREF="/tdm/market.html" TARGET="_top">market</A>'+
		'<BR><A HREF="/tdm/links.html" TARGET="_top">links</A>'+
		'<BR><FONT SIZE=1>'+
	//	'<HR><A HREF="/tdm/form.asp?REF=joinMC" TARGET="_top">join the MC</A>'+
		'<HR><A HREF="/tdm/reception.asp" TARGET="_blank" CLASS="innewwindow">contact Carpe TDM</A>'+
		'<BR><A HREF="javascript:InfoWindow(\'infowindow.asp?INFO=conversion\',400,500);" CLASS="innewwindow">convertor</A>'+
		'<BR><A HREF="javascript:openCP()" CLASS="innewwindow">report an error</A></FONT>';

if (MyUrl.indexOf('/garage/')>-1) MyFileNoExtension = 'garage';
if (MyUrl.indexOf('/library/')>-1) MyFileNoExtension = 'library';
if (MyUrl.indexOf('mainmenu')>-1) MyFileNoExtension = 'main menu';
if (textMenu.indexOf(MyFileNoExtension+'</A>')>0) textMenu = textMenu.substring(0,textMenu.lastIndexOf(MyFileNoExtension)) +
	'<DIV CLASS="HiMenu">&nbsp;<I>'+ MyFileNoExtension + '</I></DIV></A>'+
	textMenu.substring(textMenu.lastIndexOf(MyFileNoExtension)+MyFileNoExtension.length+8, textMenu.length);


/*  overLIB 2.22 By Erik Bosrup (erik@bosrup.com) http://www.bosrup.com/web/overlib/
  Portions by Dan Steinman, Landon Bradshaw and Gnowknayme.
*/
if (typeof fcolor == 'undefined') { var fcolor = "#CCCCCC";}
if (typeof backcolor == 'undefined') { var backcolor = "#626262";}
if (typeof textcolor == 'undefined') { var textcolor = "#000000";}
if (typeof capcolor == 'undefined') { var capcolor = "#FFFFFF";}
if (typeof closecolor == 'undefined') { var closecolor = "#ffff00";}
if (typeof width == 'undefined') { var width = "170";}
if (typeof border == 'undefined') { var border = "1";}
if (typeof offsetx == 'undefined') { var offsetx = 3;}
if (typeof offsety == 'undefined') { var offsety = 10;}

// || document.getElementById

ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
ns6 = (document.getElementById && !document.all) ? true:false;

if (ie4) {
	if (navigator.userAgent.indexOf('MSIE 5')>0) {
		ie5 = true;
	} else {
		ie5 = false; }
} else {
	ie5 = false;
}

var x = 0;var y = 0;var snow = 0;var sw = 0;var cnt = 0;var dir = 1;var tr = 1;

if ( (ns4) || (ie4) ) {
	if (ns4) over = document.overDiv
	if (ie4) over = overDiv.style
	document.onmousemove = mouseMove
	if (ns4) document.captureEvents(Event.MOUSEMOVE)
}

// Simple popup right
function drs(text) {
	dts(1,text);
}

// Caption popup right
function drc(text, title) {
	dtc(1,text,title);
}

// Sticky caption right
function src(text,title) {
	stc(1,text,title);
}

// Sticky Menu right
function doMenu() {
	MyMenu(1,textMenu,MenuTitle);
}

// Simple popup left
function dls(text) {
	dts(0,text);
}

// Caption popup left
function dlc(text, title) {
	dtc(0,text,title);
}

// Sticky caption left
function slc(text,title) {
	stc(0,text,title);
}

// Simple popup center
function dcs(text) {
	dts(2,text);
}

// Caption popup center
function dcc(text, title) {
	dtc(2,text,title);
}

// Sticky caption center
function scc(text,title) {
	stc(2,text,title);
}

// Clears popups if appropriate
function nd() {
	if ( cnt >= 1 ) { sw = 0 };
	if ( (ns4) || (ie4) ) {
		if ( sw == 0 ) {
			snow = 0;
			hideObject(over);
	window.status = 'hover over logo for menu';
		} else {
			cnt++;
		}
	}
}

// Simple popup
function dts(d,text) {
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><FONT FACE=\"Arial,Helvetica\" COLOR=\""+textcolor+"\" SIZE=\"-2\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
}

// Caption popup
function dtc(d,text, title) {
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
}

// Sticky
function stc(d,text, title) {
	sw = 1;
	cnt = 0;
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD><TD ALIGN=RIGHT><A HREF=\"/\" onMouseOver=\"cClick();\" ID=\"PCL\"><IMG SRC=\"/tdm/scripts/menu_close.gif\" ALT=\"Close\" WIDTH=16 HEIGHT=14 BORDER=0></A></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
	snow = 0;
}

//Menu
function MyMenu(d,text, title) {
	sw = 1;
	cnt = 0;
	txt = "<TABLE WIDTH="+width+" BORDER=0 CELLPADDING="+border+" CELLSPACING=0 BGCOLOR=\""+backcolor+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><SPAN ID=\"PTT\"><B><FONT COLOR=\""+capcolor+"\">"+title+"</FONT></B></SPAN></TD><TD ALIGN=RIGHT><A HREF=\"/\" onMouseOver=\"cClick();\" ID=\"PCL\"><IMG SRC=\"/tdm/scripts/menu_close.gif\" ALT=\"Close\" WIDTH=16 HEIGHT=14 BORDER=0></A></TD></TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 BGCOLOR=\""+fcolor+"\"><TR><TD ALIGN=right><FONT SIZE=1><I><A HREF=\"#top\">top of page</A></I></FONT></TD></TR><TR><TD ALIGN=left><SPAN ID=\"PST\"><FONT COLOR=\""+textcolor+"\">"+text+"</FONT><SPAN></TD></TR></TABLE></TD></TR></TABLE>"
	layerWrite(txt);
	dir = d;
	disp();
	snow = 0;
}

// Common calls
function disp() {
	if ( (ns4) || (ie4) ) {
		if (snow == 0) 	{
			if (dir == 2) { // Center
				moveTo(over,x+offsetx-(width/2),y+offsety);
			}
			if (dir == 1) { // Right
				moveTo(over,x+offsetx,y+offsety);
			}
			if (dir == 0) { // Left
				moveTo(over,x-offsetx-width,y+offsety);
			}
			showObject(over);
			snow = 1;
		}
	}
// text to statusbar.
}

// Moves the layer
function mouseMove(e) {
	if (ns4) {x=e.pageX; y=e.pageY;}
	if (ie4) {x=event.x; y=event.y;}
	if (ie5) {x=event.x+document.body.scrollLeft; y=event.y+document.body.scrollTop;}

	if (snow) {
		if (dir == 2) { // Center
			moveTo(over,x+offsetx-(width/2),y+offsety);
		}
		if (dir == 1) { // Right
			moveTo(over,x+offsetx,y+offsety);
		}
		if (dir == 0) { // Left
			moveTo(over,x-offsetx-width,y+offsety);
		}
	}
}

// The Close onMouseOver function for Sticky
function cClick() {
	hideObject(over);
	sw=0;
}

// Writes to a layer
function layerWrite(txt) {
        if (ns4) {
                var lyr = document.overDiv.document
                lyr.write(txt)
                lyr.close()
        }
        else if (ie4) document.all["overDiv"].innerHTML = txt
}

// Make an object visible
function showObject(obj) {
        if (ns4) obj.visibility = "show"
        else if (ie4) obj.visibility = "visible"
}

// Hides an object
function hideObject(obj) {
        if (ns4) obj.visibility = "hide"
        else if (ie4) obj.visibility = "hidden"
}

// Move a layer
function moveTo(obj,xL,yL) {
        obj.left = xL
        obj.top = yL
}


//Site Logo Script (Geocities Watermark)© Dynamic Drive (www.dynamicdrive.com)
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

var logowidth=100
var logoheight=80
var staticlogo=new Image(logowidth,logoheight)
staticlogo.src="/tdm/img/ct_logo_100x80a.gif"
var logolink="/tdm/mainmenu.html"
var alttext="Carpe TDM"
fadeintoview=(!document.getElementById && document.all) ? 1 : 0;
var visibleduration=0

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (ns4)
setTimeout("window.onresize=regenerate",400)
}


var fadeset=''
if (fadeintoview)
fadeset="filter:alpha(opacity=0)"

if (ie4)
document.write('<span id="logo" style="'+fadeset+';position:absolute;top:100;width:'+staticlogo.width+';height:'+staticlogo.height+'"></span>')

function bringintoview(){
if (logo.filters.alpha.opacity<=95)
logo.filters.alpha.opacity+=5
else{
clearInterval(viewit)
if (visibleduration!=0)
setTimeout("logo.style.visibility='hidden'",visibleduration*1000)
}
}

function createlogo(){
staticimage=new Layer(100)
staticimage.left=-300
staticimage.top=120
staticimage.document.write('<a href="javascript://use X to close menu;" TARGET="_top" onmouseover="doMenu(); window.status=\'use the X to close the menu\';return false;" onmouseout="window.status=\'\';return false;"><img src="'+staticlogo.src+'" border=1 alt="'+alttext+'"></a>')
staticimage.document.close()
staticimage.visibility="show"
regenerate2()
staticitns()
dynamiclink
}

if (ns4)
	window.onload=createlogo;
else if (ie4)
	crosslogo=document.all.logo
else if (ns6)
	crosslogo=document.getElementById("logons6")

if (ie4||ns6){
w=2
h=2
crosslogo.style.left=w
crosslogo.style.top=h
dynamiclink
}

function logoit(){
var w2=ns6? pageXOffset+w : document.body.scrollLeft+w
var h2=ns6? pageYOffset+h : document.body.scrollTop+h
crosslogo.style.left=w2
crosslogo.style.top=h2
}
function logoit2(){
staticimage.left=pageXOffset+2
staticimage.top=pageYOffset+2
}

function insertimage(){
crosslogo.innerHTML='<a href="javascript://use X to close menu;" TARGET="_top" onmouseover="doMenu(); window.status=\'use the X to close the menu\';return false;" onmouseout="window.status=\'\';return false;"><img src="'+staticlogo.src+'" border=1 STYLE="border-color=#CBF2C8;" alt="'+alttext+'"></a>'
if (ie4){
if (fadeintoview)
viewit=setInterval("bringintoview()",100)
else{
if (visibleduration!=0)
setTimeout("crosslogo.style.visibility='hidden'",visibleduration*1000)
}
}
}

if (ie4){
window.onscroll=logoit
window.onresize=new Function("window.location.reload()")
window.onload=insertimage
}
else if (ns6){
startstatic=setInterval("logoit()",100)
window.onload=insertimage
window.onresize=new Function("window.location.reload()")
if (visibleduration!=0)
setTimeout("crosslogo.style.visibility='hidden';clearInterval(startstatic)",visibleduration*1000)
}


function staticitns(){
startstatic=setInterval("logoit2()",90)
if (visibleduration!=0)
setTimeout("staticimage.visibility='hide';clearInterval(startstatic)",visibleduration*1000)
}

var mydomain="carpe-tdm.net"

//(1=yes, 0 will render a checkbox for manual selection)
var auto=1

if (!auto)
document.write('<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>')

function dynamiclink(){
	if (auto||(!auto&&document.targetmain.targetnew.checked)){
	for (i=0; i<=(document.links.length-1); i++) {
		if (document.links[i].hostname.indexOf(mydomain)==-1&&document.links[i].href.indexOf("http:")!=-1)
		document.links[i].target="_blank"
		}
	}
	else
	for (i=0; i<=(document.links.length-1); i++) {
		if (document.links[i].hostname.indexOf(mydomain)==-1)
		document.links[i].target=""
		}
}

//if (auto)
//window.onload=dynamiclink
