function changeClockType() {
	bln24hr = ! bln24hr;
	setCookie('ampm', ! bln24hr, 1000);
	if ( bln24hr ) UpdateSpan('hrmode', '24-hr'); 
	else UpdateSpan('hrmode', '12-hr');
}
function setCookie(c_name, value, expiredays) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie = c_name+ "=" +escape(value)+
		(( expiredays == null ) ? "" : ";path=/;expires=" + exdate.toGMTString());
}

function StartClock() {
	clockID = setTimeout("UpdateClock()", 500);
}

function KillClock() {
	if(clockID) {
		clearTimeout(clockID);
		clockID  = 0;
	}
}	
function Left(str, n){
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
}
function Right(str, n){
	if (n <= 0)
	   return "";
	else if (n > String(str).length)
	   return str;
	else {
	   var iLen = String(str).length;
	   return String(str).substring(iLen, iLen - n);
	}
}
function UpdateSpan(strID, strNewText) {
	var newTextNode = document.createTextNode(strNewText.toString());
	document.getElementById(strID).replaceChild(newTextNode, document.getElementById(strID).firstChild);
}		
function OpenClockWindow() {
	var strURL = window.location.href;
	strURL = strURL.replace(/.info/, ".info/popup");
	WinPopup = 'toolbar=no,menubar=no,directories=0,formulabar=no,status=0,location=yes,resizable=no,scrollbars=no,copyhistory=0,'
		 + 'left=200,top=200,height=100,width=200';
	WinPopup = window.open(strURL, "", WinPopup);
	WinPopup.focus();
}

