// Библиотека...

//-------------------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------

function fShowDiv(divID){
	D=document.getElementById(divID);
	if(D!=null)
		D.className="div_visible";
}
function fHideDiv(divID){
	D=document.getElementById(divID);
	if(D!=null)
		D.className="div_hidden";
}

//-------------------------------------------------------------

function fDateSelect(IDDay,IDMonth,IDYear,nDay,nMonth,nYear,fOnChange){
	// IDDay, IDMonth, IDYear - идентификаторы полей выбора
	// nDay, nMonth, nYear - дата для отображения
	
	var n=new Date();
	
	var ny=1900+n.getYear();
	ny=nYear || ny;
	
	var nm=1+n.getMonth();
	nm=nMonth || nm;
	if(nm>0 && nm<10)
		nm="0"+nm;
		
	var nd=n.getDate();
	nd=nDay || nd;
	if(nd>0 && nd<10)
		nd="0"+nd;
		
	//document.write("<input type='text' name='newsDate' style='width:70px;' value='"+nd+"."+nm+"."+ny+"'; />");
	//var ld=n.toLocaleString()
	//document.write("<input type='text' name='newsDate' style='width:170px;' value='"+ld+"'; />");

	document.write("<select name='"+IDDay+"' id='"+IDDay+"' style='width:40px;' onChange='"+fOnChange+"();'>");
	var Str="";
	Str+="<option value='-1' selected>-</option>";
	for(var d=1;d<=31;d++){
		Str+="<option value='"+d+"'";
		if(d==nd)
			Str+=" selected";
		Str+=">"+d+"</option>"
	}
	document.write(Str);
	document.write("</select>");
	document.write(" ");
	
	var Month=new Array("январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь");
	document.write("<select name='"+IDMonth+"' id='"+IDMonth+"' style='width:80px;' onChange='"+fOnChange+"();'>");
	var Str="";
	Str+="<option value='-1' selected>-</option>";
	for(var m=1;m<=12;m++){
		Str+="<option value='"+m+"'";
		if(m==nm)
			Str+=" selected";
		Str+=">"+Month[m-1]+"</option>"
	}
	document.write(Str);
	document.write("</select>");
	document.write(" ");
	
	document.write("<select name='"+IDYear+"' id='"+IDYear+"' style='width:55px;' onChange='"+fOnChange+"();'>");
	var Str="";
	Str+="<option value='-1' selected>-</option>";
	for(var y=2005;y<=2040;y++){
		Str+="<option value='"+y+"'";
		if(y==ny)
			Str+=" selected";
		Str+=">"+y+"</option>"
	}
	document.write(Str);
	document.write("</select>");

}

//-------------------------------------------------------------

function fTimeSelect(IDHour,IDMinute,nHour,nMinute){
	var n=new Date();
	
	var nh=+n.getHours();
	nh=nHour || nh;
	
	var nm=n.getMinutes()+1;
	nm=nMinute || nm;
	if(nm>0 && nm<10)
		nm="0"+nm;
		
	/*document.write("<input type='text' name='newsDate' style='width:70px;' value='"+nd+"."+nm+"."+ny+"'; />");
	var ld=n.toLocaleString()
	document.write("<input type='text' name='newsDate' style='width:170px;' value='"+ld+"'; />");*/

	document.write("<select name='"+IDHour+"' style='width:40px;'>");
	var Str="";
	Str+="<option value='-1' selected>-</option>";
	for(var h=0;h<=23;h++){
		Str+="<option value='"+h+"'";
		if(h==nh)
			Str+=" selected";
		Str+=">"+h+"</option>"
	}
	document.write(Str);
	document.write("</select>");
	document.write(" ");
	
	document.write("<select name='"+IDMinute+"' style='width:40px;'>");
	var Str="";
	Str+="<option value='-1' selected>-</option>";
	for(var m=0;m<=59;m++){
		Str+="<option value='"+m+"'";
		if(m==nm)
			Str+=" selected";
		var sm=m;
		if(m<10)
			sm="0"+m;
		Str+=">"+sm+"</option>"
	}
	document.write(Str);
	document.write("</select>");
	
}

//-------------------------------------------------------------
//-------------------------------------------------------------
//-------------------------------------------------------------

