//if (top.location != document.location) top.location = document.location;

var dn;
c1 = new Image(); c1.src = "numerals/c1.gif";
c2 = new Image(); c2.src = "numerals/c2.gif";
c3 = new Image(); c3.src = "numerals/c3.gif";
c4 = new Image(); c4.src = "numerals/c4.gif";
c5 = new Image(); c5.src = "numerals/c5.gif";
c6 = new Image(); c6.src = "numerals/c6.gif";
c7 = new Image(); c7.src = "numerals/c7.gif";
c8 = new Image(); c8.src = "numerals/c8.gif";
c9 = new Image(); c9.src = "numerals/c9.gif";
c0 = new Image(); c0.src = "numerals/c0.gif";
cb = new Image(); cb.src = "numerals/cb.gif";
cam = new Image(); cam.src = "numerals/cam.gif";
cpm = new Image(); cpm.src = "numerals/cpm.gif";
function extract(h,m,s,type) {
if (!document.images) return;
if (h <= 9) {
document.images.a.src = cb.src;
document.images.a.width = 1;
document.images.b.src = eval("c"+h+".src");
}
else {
document.images.a.width = document.images.b.width;
document.images.a.src = eval("c"+Math.floor(h/10)+".src");
document.images.b.src = eval("c"+(h%10)+".src");
}
if (m <= 9) {
document.images.d.src = c0.src;
document.images.e.src = eval("c"+m+".src");
}
else {
document.images.d.src = eval("c"+Math.floor(m/10)+".src");
document.images.e.src = eval("c"+(m%10)+".src");
}
if (s <= 9) {
document.g.src = c0.src;
document.images.h.src = eval("c"+s+".src");
}
else {
document.images.g.src = eval("c"+Math.floor(s/10)+".src");
document.images.h.src = eval("c"+(s%10)+".src");
}
if (dn == "AM") document.j.src = cam.src;
else document.images.j.src = cpm.src;
}
function show3() {
if (!document.images)
return;
var Digital = new Date();
var hours = Digital.getHours();
var minutes = Digital.getMinutes();
var seconds = Digital.getSeconds();
dn = "AM";
//old: from text input
//var alarmTime = document.thisForm.alarm.value;
var alarmTime = "" + document.thisForm.alarm_hour.value + ":" + document.thisForm.alarm_minute.value + "";
/*if (document.thisForm.mode.checked == true){
var alarmType = document.thisForm.mode.value;
}*/
if (hours + ":" + minutes == "" + alarmTime) {
//window.location.href= alarmType+".html";
window.location.href= "http://onlineclock.net/alarm.html";
}
if ((hours >= 12) && (minutes >= 1) || (hours >= 13)) {
dn = "PM";
hours = hours-12;
}
if (hours == 0)
hours = 12;
extract(hours, minutes, seconds, dn);
setTimeout("show3()", 1000);
}
//  End -->

function changeImageSize(widthA,heightA,widthB,heightB)
{
	//image array 0-8
	for (i = 0; i <= 7; i++)
	{
		//small colon images
		if( (i==2)||(i==5) )
		{
			document.images[i].width = widthB;
			document.images[i].height = heightB;
		}
		//normal numbers
		else
		{
			document.images[i].width = widthA;
			document.images[i].height = heightA;
		}
	}
}
function changeBackground(color)
{
	document.bgColor=color;
}
function removeUnderline(linknumber)
{
	for (i = 0; i <4; i++)
	{
		if(i==linknumber)
		{
			document.links[i].style.textDecoration = "none";
			document.links[i].style.fontWeight = "normal";
		}
		else
		{
			document.links[i].style.textDecoration = "underline";
			document.links[i].style.fontWeight = "bold";
		}
	}
}
function removeUnderline2(linknumber)
{
	for (i = 4; i <9; i++)
	{
		if(i==linknumber)
		{
			document.links[i].style.textDecoration = "none";
			document.links[i].style.fontWeight = "normal";
		}
		else
		{
			document.links[i].style.textDecoration = "underline";
			document.links[i].style.fontWeight = "bold";
		}
	}
}
