var nStartX = 0;
var nStartY = 0;
var nFactor = 3.14 / 180;
var oTimer = null;

function clock(){
	clearTimeout(oTimer);
	var oNow = new Date();
	var nDay = oNow.getDay();
	var nDayNr = oNow.getDate();
	var nMonth = oNow.getMonth() + 1;
	var nYear = oNow.getFullYear();
	var nHrs = oNow.getHours();
	var nMins = oNow.getMinutes();
	var nSecs = oNow.getSeconds();

	drawHand('hours', (nHrs * 30) - 90 + Math.floor(nMins / 2), 2);
	drawHand('minutes', (nMins * 6) - 90, 3);
	drawHand('seconds', (nSecs * 6) - 90, 4);

	oTimer = setTimeout('clock()', 1000);
}

function drawHand(p_sName, p_nAngle, p_nMaxLen){
	for(i = 0, nLen = 0; i <= p_nMaxLen; i++, nLen += 5){
		drawPos(p_sName + i, p_nAngle, nLen, 0, 4);
	}
}

function drawPos(p_sName, p_nAngle, p_nLen, p_nOffsetX, p_nOffsetY){
	nXPos = nStartX + p_nOffsetX + (p_nLen * Math.cos(p_nAngle * nFactor));
	nYPos = nStartY + p_nOffsetY + (p_nLen * Math.sin(p_nAngle * nFactor));

	oObj = document.getElementById(p_sName);
	oObj.style.left = nXPos;
	oObj.style.top = nYPos;
}

function showClock(){
	for(i = 0; i <= 2; i++){
		oObj = document.getElementById('hours' + i);
		oObj.style.visibility = 'visible';;
	}

	for(i = 0; i <= 3; i++){
		oObj = document.getElementById('minutes' + i);
		oObj.style.visibility = 'visible';;
	}

	for(i = 0; i <= 4; i++){
		oObj = document.getElementById('seconds' + i);
		oObj.style.visibility = 'visible';;
	}
}

function init(){
	showClock();
	clock();
}

function jsEmail(p_sAddress, p_sDomain){
	location.href = "mailto:" + p_sAddress + "@" + p_sDomain;
}

function writeEmail(p_sAddress, p_sDomain){
	document.write(p_sAddress + "@" + p_sDomain);
}
