var	ns4 = (document.layers)? true:false
var	ie4 = (document.all)? true:false
var	ns6 = (document.getElementById)? true:false
var agent = navigator.userAgent.toLowerCase();


function DigitalTime() { 
	var DigitalClock = new Date();
	var hours = DigitalClock.getHours();
	var minutes = DigitalClock.getMinutes();
	var seconds = DigitalClock.getSeconds();
	var day = DigitalClock.getDate();
	var month = DigitalClock.getMonth();
	var year = DigitalClock.getYear();
	var dn = "AM";

	if (hours >= 12) { dn = "PM"; hours = hours - 12;}

	if (hours == 0) hours = 12;
	if (minutes <= 9)	minutes = "0" + minutes;
	if (seconds <= 9)	seconds = "0" + seconds;

	// Change font size here..
	digclock = "<span class='clock'>"+ hours +":"+ minutes +":"+ seconds +" "+ dn  + " - "+ day +"/"+ (month+1) +"/"+ year +"</span>";

// if Netscape 4.*
	if (document.layers) {
		document.layers.liveclock.document.write(digclock);
		document.layers.liveclock.document.close();
	}
// if Internet Explorer
	else if (document.all) {
		liveclock.innerHTML = digclock;
	}
// if Netscape 6
	else if (document.getElementById) {
		clockDiv = document.getElementById("liveclock");
		clockDiv.innerHTML = digclock;
	}
// if PC then refresh second

	if (agent.indexOf('win')>0)	{
		setTimeout("DigitalTime()", 1000)
	}
}


// popup a window to display website
function leaderBoard() {
	popupWindow2('leaderBoard.php', 807,475);
}

// popup a window to display website
function tShirt() {
	popupWindow('tshirtfront.htm', 544,553);
}
// popup a window to display website
function stats() {
	popupWindow('stats.htm', 544,360);
}
// popup a window to display website
function postCard() {
	popupWindow('postcardfront.htm', 544,553);
}

// popup a window to display website
function aboveSpec() {
	popupWindow('abovespec.htm', 500,600);
}

// popup a window to display website
function mailingList() {
	popupWindow('blank.htm', 250,150);
}

// popup a window to display website
function viewGallery(claire) {
	popupWindow('viewGallery.php?id='+claire, 630,470);
}


// generic window popup function... resizes as it opens
function popupWindow(popupLocation, popupWidth, popupHeight) {

	var heightspeed = 15; 	// vertical speed
	var widthspeed 	= 15;  	// horizontal speed
	var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
	var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
	if (document.all) {
		var popup = window.open("","pop","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=no,resizable=no,toolbar=no,menubar=no,location=no,status=no","focus();");
		for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) {
			popup.resizeTo("1", sizeheight);
			}

		for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) {
			popup.resizeTo(sizewidth, sizeheight);
			}	

		popup.resizeTo(popupWidth, popupHeight);
		popup.location = popupLocation;
	} 
	else {
		var popup = window.open(popupLocation,"pop","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,location=yes,status=yes","focus();");
		}
		
		popup.focus();
}


// generic window popup function... resizes as it opens, with no features
function popupWindow2(popupLocation,  popupWidth, popupHeight) {

	var heightspeed = 15; 	// vertical speed
	var widthspeed 	= 15;  	// horizontal speed
	var leftdist 	= (screen.width - popupWidth) / 2;    	// distance to left edge of window
	var topdist 	= (screen.height - popupHeight) / 2;   	// distance to top edge of window
	if (document.all) {
		var popup = window.open("", "pop","left=" + leftdist + ",top=" + topdist + ",width=4,height=4,scrollbars=yes,resizable=no,toolbar=no,menubar=no,location=no,status=no","focus();");
		for (sizeheight = 1; sizeheight < popupHeight; sizeheight += heightspeed) {
			popup.resizeTo("1", sizeheight);
			}

		for (sizewidth = 1; sizewidth < popupWidth; sizewidth += widthspeed) {
			popup.resizeTo(sizewidth, sizeheight);
			}	

		popup.resizeTo(popupWidth, popupHeight);
		popup.location = popupLocation;
	} 
	else {
		var popup = window.open(popupLocation,"pop","left=" + leftdist + ",top=" + topdist + ",width=" + popupWidth + ",height=" + popupHeight + ",scrollbars=yes,resizable=no,toolbar=no,menubar=no,location=no,status=no","focus();");
		}
		popup.focus();
}



