var ns = 0; var ie = 0; var w3c = 0; var i = 1; 

if (document.getElementById) 	w3c = 1;  // W3C compatible
if (document.all)       			ie = 1;   // IE4 und IE5 compatible
if (document.layers)    			ns = 1;   // Netscape compatible


//*** Status-Changer ***//

var defaultStatusText = "Welcome to the homepage of neoBeo -=- Chill-out DJ & Juggle Artist";
window.defaultStatus = defaultStatusText;

function dispStatus(StatusText) {
	if (StatusText!="") {
		self.status = StatusText;
	} else {
		self.status = defaultStatusText;
	}
	return true;
}


//*** Cookie-Handling ***//

var jetzt = new Date();
jetzt = new Date(jetzt.getTime()+1000*60*60*24*1095);

function deleteCookie(name, path, domain) {
   if(getCookie(name)) document.cookie = escape(name) + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function setCookie(name, value, expires, path, domain, secure) { 
   var curCookie = escape(name) + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); 
   document.cookie = curCookie; 
}

function getCookie(name) { 
   var prefix = escape(name) + "="; 
   var nullstring = ""; 
   var cookieStartIndex = document.cookie.indexOf(prefix); 
   if (cookieStartIndex == -1) 
       return nullstring; 
   var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length); 
   if (cookieEndIndex == -1) 
       cookieEndIndex = document.cookie.length; 
   return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex)); 
}

//*** Cookie-Zaehler ***//

function countCookie(name) {
	var cookieCount = parseInt(getCookie(name));
	if (isNaN(cookieCount)) {
		cookieCount = 1;
	} else {
		cookieCount = cookieCount + 1;
	}
	setCookie(name, cookieCount, jetzt, "/", self.location.host);
	window.defaultStatus = defaultStatusText + " -=- This is your " + String(cookieCount) + ". visit!";;
}


//*** Window-Opener ***//

function openWindow(mywinurl,mywintitle) {
	var mywinheight = screen.availHeight - 80;
	var mywinwidth = screen.availWidth - 50;
	var mywintop = ((screen.availHeight - mywinheight) / 2)-30;
	var mywinleft = (screen.availWidth - mywinwidth) / 2;
	var mywinoptions = "hotkeys=yes,dependent=no,status=no,location=no,scrollbars=yes,resizable,";
	var mywinsize = "top="+mywintop+",left="+mywinleft+",width="+mywinwidth+",height="+mywinheight;
	var mywinobject = window.open(mywinurl,mywintitle,mywinoptions+mywinsize);
	if(mywinobject == null) {
		self.location.href = mywinurl;
	} else {
		mywinobject.focus();
	}
}

function openGuestbook() {
	var mywinurl = "http://www.neobeo.de/guestbook/";
	var mywintitle = "neoBeosGuestbook";
	var mywinheight = screen.availHeight - 200;
	var mywinwidth = 500;
	var mywintop = ((screen.availHeight - mywinheight) / 2)-30;
	var mywinleft = (screen.availWidth - mywinwidth) / 2;
	var mywinoptions = "hotkeys=yes,dependent=no,status=no,location=no,scrollbars=yes,resizable,";
	var mywinsize = "top="+mywintop+",left="+mywinleft+",width="+mywinwidth+",height="+mywinheight;
	var mywinobject = window.open(mywinurl,mywintitle,mywinoptions+mywinsize);
	if(mywinobject == null) {
		self.location.href = mywinurl;
	} else {
		mywinobject.focus();
	}
}


//*** Focus-Border-Remover ***//

function removeFocusBorders() {
  var tags = [ "img", "a" ];
  for (var i=0; i<tags.length; i++) {
    var nodes = document.getElementsByTagName(tags[i]);
    for (var j=0; j<nodes.length; j++)
      if ((tags[i] == "input" && nodes[j].getAttribute("type") != "text" && nodes[j].getAttribute("type") != "password" && nodes[j].getAttribute("type") != "file") || tags[i] != "input")
        nodes[j].onfocus = function() { if(this.blur) this.blur(); }
  }
}


//*** Mail-Link-Creator ***//

function printMailLink() {
	var emailTitle = "send mail to neoBeo";
	var emailLabel = "zen" + "&nbsp;" + "@" + "&nbsp;" + "neobeo" + "." + "de";
	document.write("<a href=\"javascript:openMailLink();\" title=\"" + emailTitle + "\" onMouseOver=\"return dispStatus('" + emailTitle + "')\" onMouseOut=\"dispStatus('')\">" + emailLabel + "</a>");
}

function openMailLink() {
	var beforeAt = "zen";
  var behindAt = "neobeo" + "." + "de";
  document.location.href = "ma" + "il" + "to:" + beforeAt + "@" + behindAt;
}

//*** Effekte ***//

//the functions that mimick a link highlight effect
function highlight() {
	new Effect.Opacity(fixedElement, { duration: 0.5, from: 0.2, to: 1.0 });
}
function lowlight() {
	new Effect.Opacity(fixedElement, { duration: 0.5, from: 1.0, to: 0.2 });
}