var bName = navigator.appName;
var bVer = parseInt(navigator.appVersion);
var ie4 = (bName=="Microsoft Internet Explorer" && bVer>=4);
var nn4 = (bName=="Netscape" && bVer>=4);
var cnt = 0;
var aImages = new Array(20);
var aDigits = new Array(10);

function preLoadImage(name) {
	if (document.images) {	
		cnt++;
		aImages[cnt] = new Image();
		aImages[cnt].src = name;
	}
}
function preLoadDigits(path) {
	if (document.images) {	
		for (i=0; i<10; i++) {
			aDigits[i] = new Image(); aDigits[i].src = path+i+".gif";
		}
	}
}
function imgClock() {
	if (document.images) {
		var time = new Date();
		var temp = ""+((time.getHours()<10)?"0":"")+time.getHours()+((time.getMinutes()<10)?"0":"")+time.getMinutes()+((time.getSeconds()<10)?"0":"")+time.getSeconds();
		for (i=1; i<=6; i++) {
			if (aDigits[i].complete) {
				document.images["d"+i].src = aDigits[parseInt(temp.substr(i-1,1))].src;
			}
		}
		id = setTimeout("imgClock()",1000);
	}
}
function txtClock() {
	var time = new Date();
	var temp = ""+((time.getHours()<10)?"0":"")+time.getHours()+((time.getMinutes()<10)?":0":":")+time.getMinutes()+((time.getSeconds()<10)?":0":":")+time.getSeconds();
	if (ie4) document.all['clock'].innerText = temp;
	else	 document.layers['clock'].innerText = temp;
	id = setTimeout("txtClock()",1000);
}
function showInWindow(name) {
	var wndType = arguments[1] ? arguments[1] : 'main';
	var nameWindow = arguments[2] ? arguments[2] : 'wnPopup';
	var addParam = ",resizable=no,scrollbars=yes,toolbar=no,location=no,menubar=no,fullscreen=no,status=no";
	breakAnkorLoading();
	if (wndType=='popup') {
		WinWidth  = 496;
		WinHeight = 284+screen.height-482;
		LeftPos   = (screen.width-780)/2+19;
		TopPos    = 116;
	} else {
		WinWidth  = screen.width;
		WinHeight = screen.height;
		LeftPos   = 0;
		TopPos    = 0;
	}
	HostAddr  = new String(document.location);
	if (name.substr(0,5)=='http:')
		where = name;
	else
		where = HostAddr.substr(0,HostAddr.lastIndexOf("/")+1)+name;
	wnd = window.open(where, nameWindow, "width="+WinWidth+",height="+WinHeight+",left="+LeftPos+",top="+TopPos+",screenX="+LeftPos+",screenY="+TopPos+addParam);
	window.wnd.focus();
}
function dummy() {
;
}
function objDisplay(obj) {
	var dispStr="";
	for (var prop in obj) {
		dispStr += prop+"="+obj[prop]+"<BR>";
//		document.write(prop+"="+obj[prop]+"<BR>");
	}
	return dispStr;
}
function breakAnkorLoading() {
	if (ie4 && eval('window.event')) {
		window.event.cancelBubble = true;
		window.event.returnValue = false;
	}
}
function getRusDate() {
	dt=new Date();
	num=dt.getMonth()+1;
	rez=""+dt.getDate()+" ";
	mn=new String("|января|февраля|марта|апреля|мая|июня|июля|августа|сентября|октября|ноября|декабря|");
	n=0;
	for (i=0; i<mn.length; i++) {
		w=mn.charAt(i);
		if (w=="|") {
			n++;
			continue;
		}
		if (n>num)
			break;
		else if (n==num)
			rez += w;
	}
	return rez+" "+(dt.getYear()<2000 ? dt.getYear()+1900 : dt.getYear())+" года";
}
