function init(){
//	document.body.onselectstart=function(){return false};
//	document.body.onselect=function(){return false};

	if(/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){
		var png=document.getElementsByTagName('img');
		var ext=/\.png$/i;
		for (var i=0;i<png.length;++i){
			if (ext.test(png[i].getAttribute('src'))){
				k=false;
				if (fixPNG(png[i])){k=true}
			};
		};
	};

	newsSetDate();
	newsSetDate_publ();
	document.getElementById('dat').innerHTML="Сегодня: "+vToday()+" | "+iToday();

	var host=new RegExp(window.location.protocol+"\\/\\/"+window.location.hostname,"i");
	var path=String(window.location.pathname).replace(/(\d+)\.htm(l)?/,"");
	var LeftMenu=document.getElementById("submenu");
	var a=LeftMenu.getElementsByTagName("a");
	var i=-1;
	do{i++}while(a[i]&&a[i].getAttribute("href").replace(host,'')!=path&&i<a.length );
	if(a[i]){
		a=a[i];
		if(document.getElementById(a.getAttribute('id').replace(/a/,'img'))){
			fClick(document.getElementById(a.getAttribute('id').replace(/a/,'img')))
		};
		do{
			fClick(document.getElementById(a.parentNode.parentNode.getAttribute('id').replace(/ch/,'img')));
			a=a.parentNode.parentNode
		}while(/^ch(\d+)/i.test(a.parentNode.parentNode.getAttribute("id")));
	};

if(document.getElementById('namaz').getElementsByTagName('p').length>0){document.getElementById('namaz').getElementsByTagName('p')[2].style.marginBottom="55px"}

//	fSetWorkHeight();
//	document.body.style.visibility="visible";
document.getElementById('IDcounters').style.visibility="visible";
};

function newsSetDate(){
	var months=['','января','февраля','марта','апреля','мая','июня','июля','августа','сентября','октября','ноября','декабря'];
	var news=document.getElementById('news').getElementsByTagName('div');
	var pat=/(\d+)\-(\d+)\-(\d+)\s+(\d+\:\d+\:\d+)/i;
	for (var i=0;i<news.length;++i){
		if (new RegExp('publdate','i').test(news[i].className)){
			pat.exec(news[i].firstChild.nodeValue);
			var day=RegExp["$3"];
			var month=RegExp["$2"];
			var year=RegExp["$1"];
			month=month.replace(/^0(\d)$/,"$1");
			
			news[i].firstChild.nodeValue=day+" "+months[month]+" "+year;
			news[i].style.visibility='visible';
		};
	};
};

function newsSetDate_publ(){
	var months=['','января','февраля','марта','апреля','мая','июня','июля','августа','сентября','октября','ноября','декабря'];
	var news=document.getElementById('publ').getElementsByTagName('div');
	var pat=/(\d+)\-(\d+)\-(\d+)\s+(\d+\:\d+\:\d+)/i;
	for (var i=0;i<news.length;++i){
		if (new RegExp('publdate','i').test(news[i].className)){
			pat.exec(news[i].firstChild.nodeValue);
			var day=RegExp["$3"];
			var month=RegExp["$2"];
			var year=RegExp["$1"];
			month=month.replace(/^0(\d)$/,"$1");
			
			news[i].firstChild.nodeValue=day+" "+months[month]+" "+year;
			news[i].style.visibility='visible';
		};
	};
};

function fixPNG(element){
	var src;
	if(element.tagName=='IMG'){
		if (/\.png$/.test(element.src)){
			src = element.src;
			element.src = "/1/tmpl/1/extra/img/blank.gif";
		};
	}
	else{
		src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);
		if(src){
			src = src[1];
			element.runtimeStyle.backgroundImage="none";
		};
	};
	if(src){
		element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='image')";
	};
	return true
};

function fonmouseover(el,act){
	if(act=="on"){el.className="H1nameOn"}
	else{el.className="H1name"};
};

function fSBoxSearch(){return false};
function fonclick(el){return false};

function fSetWorkHeight(){
	var IDmain=document.getElementById('IDmain');
	var IDmainLeft=document.getElementById("IDmainLeft");
	var IDmainCenter=document.getElementById("IDmainCenter");
	var IDmainRight=document.getElementById("IDmainRight");
	IDmainCenter.style.top=0;
//	var contH=parseInt(IDmain.offsetTop)+parseInt(IDmain.clientHeight);
	var contH=parseInt(IDmain.offsetTop);
//alert(document.body.clientHeight);
	if(contH<parseInt(document.body.clientHeight)){
//		IDmain.style.height=parseInt(IDmain.clientHeight)+parseInt(document.body.clientHeight)-contH;
		IDmain.style.height=parseInt(document.body.clientHeight)-contH;
	}
	else{
		IDmain.style.height=parseInt(IDmain.clientHeight);
	};
	IDmainRight.style.top=0;
	IDmainLeft.style.height=parseInt(IDmain.offsetHeight);
};

function fClick(el){
	if(new RegExp('img','i').test(el.getAttribute('id'))){
		var img=/img/i;
		var on=/_on$/i;
		var ch=document.getElementById(el.getAttribute('id').replace(img,"ch"));
		if(ch){
			if(on.test(ch.className)){ch.className=ch.className.replace(on,"")}
			else {ch.className+="_on"}
		};
	};
};

function fMouseover(el,act){
	var on=/_on$/i;
	var img=null;
	if (el.getAttribute('id')){img=document.getElementById(el.getAttribute('id').replace(/name/i,"img"))}
	if(on.test(el.className)){
		el.className=el.className.replace(on,"");
		if(img)img.className=img.className.replace(on,"");
	}
	else {
		el.className+="_on";
		if(img)img.className+="_on";
	};
};

function formValid(form,el){
	var fEl=el.split("|");
	var form=document.forms(form);
	for (var i=0;i<form.elements.length;++i){
		if (new RegExp(el,"i").test(form.elements[i].name)){
			if(form.elements[i].value.replace(/\s/g,"").length==0){
				alert('ОШИБКА: поля формы, отмеченные звездочкой (*), обязательны для заполнения');
				form.elements[i].focus();
				return false;
			};
		};
	};
	alert("Спасибо, Ваша информация отправленна!")
	return true;
};

window.onload=init;
//window.onresize=fSetWorkHeight;