var nam;
var nam_1=null;//=window.close,canClose = window.opener;
function dok(url,h,w){
	if (nam!=null && !nam.closed)nam.close();
	tops(h,w);
	nam=window.open(url,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
	nam.focus();
}
function dok_yes(url,h,w){
	if (navigator.userAgent.toLowerCase().indexOf("opera")==-1 && nam_1!=null && !nam_1.closed)nam_1.close();
	tops(h,w);
	nam_1=window.open(url,'',"height="+h+",width="+w+",status=no,toolbar=no,menubar=no,location=no,top="+top_+",left="+left_+",scrollbars=yes,resizable=yes");
	nam_1.focus();
}
function tops(h,w){
	if (navigator.appName == "Netscape") {
		top_=window.innerHeight/2-h/2;
		left_=window.innerWidth/2-w/2;
	}
	else {
		top_=document.body.clientHeight/2-h/2;
		left_=document.body.clientWidth/2-w/2;
	}
}



function wrapTag(txtarea, lft, rgt) {
	lft = unescape(lft);
	rgt = unescape(rgt);
	if (document.all) {
		WrapIE(lft, rgt);
	}
	else if (document.getElementById) {
		wrapMoz(txtarea, lft, rgt);
	}
}
// IE only - wraps selected text with lft and rgt
function WrapIE(lft, rgt) {
	strSelection = document.selection.createRange().text;
	if (strSelection!="") {
		document.selection.createRange().text = lft + strSelection + rgt;
	}
}
// Moz only - wraps selected text with lft and rgt
function wrapMoz(txtarea, lft, rgt) {
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd==1 || selEnd==2) selEnd=selLength;
	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + lft + s2 + rgt + s3;
}
function setText_li(form_){
	form_.value=form_.value+'\n<ul>\n<li>\n<li>\n</ul>';
}

var timeout;
var div_show='';
function hideAll(){
	if(document.getElementById(div_show)){
		document.getElementById(div_show).style.display='none';
		document.getElementById(div_show).style.zIndex=1;
	}
}
function show(menu){
	hideAll();
	div_show=menu; 
	if(document.getElementById(menu)){
		document.getElementById(menu).style.display='block';
		document.getElementById(div_show).style.zIndex=100;
	}
}
/*function w_check_date(obv){
    if (obv.length == 0)return true;
	isplit = obv.indexOf('-');
	if (isplit == -1 || isplit == obv.length)return false;
    sDay = obv.substring(0, isplit);
	monthSplit = isplit + 1;
	isplit = obv.indexOf('-', monthSplit);
	if (isplit == -1 ||  (isplit + 1 )  == obv.length)return false;
    sMonth = obv.substring((sDay.length + 1), isplit);
	sYear = obv.substring(isplit + 1);
	
	if(!w_check_range(sYear,2000,9999))return false;
	if(!w_check_range(sMonth,1,12))return false;
	if(!w_check_day(sYear,sMonth,sDay))return false;
	return true;
}
function w_check_day(checkYear, checkMonth, checkDay){
	maxDay = 31;
	if (checkMonth == 4 || checkMonth == 6 || checkMonth == 9 || checkMonth == 11)maxDay = 30;
	else if (checkMonth == 2){
		if (checkYear % 4 > 0)maxDay =28;
		else if (checkYear % 100 == 0 && checkYear % 400 > 0)maxDay = 28;
		else maxDay = 29;
	}
	return w_check_range(checkDay, 1, maxDay); //check day
}
function w_check_range(obv, min_value_, max_value_){
    if(obv<=max_value_ && obv>=min_value_)return true;
    return false;
}
function w_its_empty(string_value) {
    if (string_value == "" || string_value == null) {
        return true;
    }
    return false;
}
function test_field(s){
	if (s==0) return true;
	else{
		var a0=document.forms[0].elements['input0'];
		var a1=document.forms[0].elements['input1'];
		var a2=document.forms[0].elements['input2'];
		var a3=document.forms[0].elements['input3'];
		var a4=document.forms[0].elements['input4'];
		if(w_its_empty(a0.value) || !w_check_date(a0.value)){	alert("Peer Review is wrong");			a0.focus();	return false;	}
		if(w_its_empty(a1.value) || !w_check_date(a1.value)){	alert("Clearance by RR/DRR is wrong");	a1.focus();	return false;	}
		if(w_its_empty(a2.value) || !w_check_date(a2.value)){	alert("Cover Page is wrong");			a2.focus();	return false;	}
		if(w_its_empty(a3.value) || !w_check_date(a3.value)){	alert("Report Published is wrong");		a3.focus();	return false;	}
		if(w_its_empty(a4.value) || !w_check_date(a4.value)){	alert("Launch is wrong");				a4.focus();	return false;	}
		return true;
	}
}*/

function submit_form(a){
	var f=document.forms['form_adm'];
	f.select_all.value=a;
	f.submit();
	f.select_all.value='';
}
function ident_form(a){
	var f=document.forms['form_adm'];
	f.select_name.value=a;
}
function conf_func(a){
	return confirm('Подтвердите удаление:\n'+a);
}
function displays(a){
	if (a==1){
		if (document.getElementById('text_1').style.display=='none'){
			document.getElementById('text_1').style.display='block';
			document.getElementById('text_2').style.display='none';
			parent.document.getElementById("div_knopka_text").innerHTML='<a href="" onclick="displays(1);return false;"><img src="/img/t_s.gif" width="63" height="14" alt="вставить текст"></a>';
			parent.document.getElementById("div_knopka_pict").innerHTML='<a href="" onclick="displays(2);return false;"><img src="/img/r_b.gif" width="63" height="14" alt="вставить рисунок"></a>';
		}
		else if (document.getElementById('text_1').style.display=='block'){
			document.getElementById('text_1').style.display='none';
			document.getElementById('text_2').style.display='none';
			parent.document.getElementById("div_knopka_text").innerHTML='<a href="" onclick="displays(1);return false;"><img src="/img/t_b.gif" width="63" height="14" alt="вставить текст"></a>';
			parent.document.getElementById("div_knopka_pict").innerHTML='<a href="" onclick="displays(2);return false;"><img src="/img/r_b.gif" width="63" height="14" alt="вставить рисунок"></a>';
		}
	}
	else{
		if (document.getElementById('text_2').style.display=='none'){
			document.getElementById('text_1').style.display='none';
			document.getElementById('text_2').style.display='block';
			parent.document.getElementById("div_knopka_text").innerHTML='<a href="" onclick="displays(1);return false;"><img src="/img/t_b.gif" width="63" height="14" alt="вставить текст"></a>';
			parent.document.getElementById("div_knopka_pict").innerHTML='<a href="" onclick="displays(2);return false;"><img src="/img/r_s.gif" width="63" height="14" alt="вставить рисунок"></a>';
		}
		else if (document.getElementById('text_2').style.display=='block'){
			document.getElementById('text_1').style.display='none';
			document.getElementById('text_2').style.display='none';
			parent.document.getElementById("div_knopka_text").innerHTML='<a href="" onclick="displays(1);return false;"><img src="/img/t_b.gif" width="63" height="14" alt="вставить текст"></a>';
			parent.document.getElementById("div_knopka_pict").innerHTML='<a href="" onclick="displays(2);return false;"><img src="/img/r_b.gif" width="63" height="14" alt="вставить рисунок"></a>';
		}
	}
	parent.document.getElementById("textiik").value='';
	parent.document.getElementById("name_submit").value='добавить к сообщению текст';
	parent.document.getElementById("name_submit2").value='добавить к сообщению рисунок';
}
function refresh_func(){
	
	if(window.refresh_iframe){
		parent.document.getElementById("div_sig").innerHTML='<img src="/img/pogoda/sig_red.gif" width="10" height="10" alt="">';
		window.refresh_iframe.location.href='/index.html?id=79&ref=1';
	}
	setTimeout("refresh_func()",60000);
}