function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


monthNames = new Array("января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря");

function showTime () {
	if(document.getElementById) {
	nowtime = new Date()
	if (parseInt(nowtime.getHours()) > 9) { var nowtimeHours = nowtime.getHours()} else { var nowtimeHours = '0' + nowtime.getHours() }
	if (parseInt(nowtime.getMinutes()) > 9) { var nowtimeMinutes = nowtime.getMinutes()} else { var nowtimeMinutes = '0' + nowtime.getMinutes() }
	if (parseInt(nowtime.getSeconds()) > 9) { var nowtimeSeconds = nowtime.getSeconds()} else { var nowtimeSeconds = '0' + nowtime.getSeconds() }

	year = (navigator.appName.search("Microsoft") >= 0)? nowtime.getYear() : nowtime.getYear()+1900;

	var TimeString = nowtime.getDate() + ' ' + monthNames[nowtime.getMonth()] + ' ' + year + ' (' +  nowtimeHours + ':' + nowtimeMinutes + ':' + nowtimeSeconds + ')';
	if(document.getElementById('ShowTime')) {
		document.getElementById('ShowTime').innerHTML = TimeString;
		setTimeout("showTime()", 1000);
	}                                      	
	}
}

 function Pic(Width,Height,Path,Name) {
	WinFeatures = "top=100,left=100,width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	BigW = window.open("","PictureWindow",WinFeatures);
	BigW.document.open();
	BigW.document.write("<head><title>"+Name+"</title></head>");
	BigW.document.write("<body bgcolor='#000000' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><IMG src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='"+Name+"'></body>"); 
	BigW.document.close();
   }
   
  function formValid(form) {
	f1 = document.forms[form].name.value;
	f2 = document.forms[form].mail.value;
	f3 = document.forms[form].text.value;
	
	if (f1 == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if (f3 == "") {
		alert("Введите, пожалуйста, Ваше сообщение");
		return false;
	}
	else return true;
}

function createPrintWindow(Num,Title)
{
	_content=document.getElementById('content').innerHTML;
	_location = this.location;
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+p+q;
	WinFeatures = "top=100,left=100,width=780,height=600,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<html><head><title>Газета журналистских расследований "ДЕЛО №" '+Num+' / '+Title+'</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write('<body onload="window.print()"><p><small>Адрес статьи: '+_location+'</small></p><h2>Газета журналистских расследований "ДЕЛО №" '+Num+'</h2><h3>'+Title+'</h3>'+_content+'</body></html>'); 
	w.document.close();
}
