var debug = true;
function stopError()	{return true;}
if (!debug) window.onerror=stopError;

window.defaultStatus = "Rolotec.Datenintegration";
var admin = "info@rolotec.ch";
admin = "rolotec@delucamarketing.ch";
window.name = "";

if (top.location != location) top.location.href = location.href;

function openWindow(url, name, w, h, flags)
{
	//	flags = 'directories=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,toolbar=yes,resizable=yes';
	var winX = (screen.availWidth - w)*.5;
	var winY = (screen.availHeight - h)*.5;
	popupWin = window.open(url, name, 'width=' + w + ',height=' + h + ', left=' + winX + ',top=' + winY + ',screenX=' + winX + ',screenY=' + winY + ',' + flags);
	popupWin.focus();
}

function getBeat()
{
	var now = new Date();
	var off = (now.getTimezoneOffset() + 60)*60;
	var theSeconds = (now.getHours() * 3600) + (now.getMinutes() * 60) + now.getSeconds() + off;
	var beat = Math.floor(theSeconds/86.4);
	if (beat > 1000) beat -= 1000;
	if (beat < 0) beat += 1000;
	return beat;
}

function getStandardtime()
{
	var now = new Date();
	var h = now.getHours();
	var m = now.getMinutes();
	var s = now.getSeconds();
	h = ((h < 10) ? "0" : "") + h;
	m = ((m < 10) ? ":0" : ":") + m;
	s = ((s < 10) ? ":0" : ":") +s;
	return h + m;
}

function showtime()
{
	if (!document.getElementById('inettime').innerHTML) return false;
	if (!window.name || window.name == 0)
	{
		document.getElementById('inettime').innerHTML = '<a href="#time" name="time" onclick="window.name=1; this.blur(); showtime(); return false;" title="Umschalten auf Standard-Zeitanzeige">@' + getBeat() + '</a>';
	}
	else
	{
		document.getElementById('inettime').innerHTML = '<a href="#time" name="time" onclick="window.name=0; this.blur(); showtime(); return false;" title="Umschalten auf Internet-Zeitanzeige">' + getStandardtime() + '</a>';
	}
	window.setTimeout("showtime()", 10000);
}

function addEvent(obj, evType, fn, useCapture)
{
	if (obj.addEventListener)
	{
		obj.addEventListener(evType, fn, useCapture);
		return true;
	}
	else if (obj.attachEvent)
	{
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else
	{
		if (debug)
			alert("Handler could not be attached");
	}
}

function removeEvent(obj, evType, fn, useCapture)
{
	if (obj.removeEventListener)
	{
		obj.removeEventListener(evType, fn, useCapture);
		return true;
	}
	else if (obj.detachEvent)
	{
		var r = obj.detachEvent("on"+evType, fn);
		return r;
	}
	else
	{
		if (debug)
			alert("Handler could not be removed");
	}
}

function init()
{
	showtime();
}

onload = init;

function mailIt(url)
{
	var i = url.lastIndexOf("/");
	file = url.substr(++i,99);
   topic="Feedback%20zur%20Seite%20" + url;
//   location.href='mailto:'+admin+'?subject='+topic+' <'+url+'>' + '?body='+url;

	var txt = "mailto:" + admin;
	txt += "?subject=" + topic;
//	txt += "?body=" + url;
   location.href = txt;
}
