<!--

function MM_openBrWindow2(theURL1,winName,w,h) { //v2.0
//window.open(theURL,winName,w,h);
var tmp=window.open(theURL1,winName,
'Width='+w+',Height='+h+
',Left='+Math.ceil(screen.width/2-w/2)+
',Scrollbars=1,'+
'Top='+Math.ceil(screen.height/2-h/2-7));
}

function _frm()
{
 if ((event.keyCode != 46) && (event.keyCode != 44))
   if((event.keyCode < 48) || (event.keyCode > 57))
     event.returnValue = false;
}

function _frm_digits()
{
  if((event.keyCode < 48) || (event.keyCode > 57))
     event.returnValue = false;
}

function _frm_digits_float()
{
  if ((event.keyCode !=44) && (event.keyCode!=45) && (event.keyCode!=46))
   if ((event.keyCode < 48) || (event.keyCode > 57))
     event.returnValue = false;
}

function show_win_top(width,height,s_top,s_url)
{
 var p_top=s_top, p_left=(window.screen.width-width)/2;
 var win=window.open(s_url,"imgswin","resizable=yes,scrollbars=yes,toolbar=no,location=yes,titlebar=no, directoties=no,status=no,menubar=no,width="+width+",height="+height+",top="+p_top+",left="+p_left);
 win.focus();
}

function show_win_top2(width,height,s_top,s_url)
{
 window.showModalDialog(s_url, "", "dialogWidth:"+width+"px; dialogHeight:"+height+"px; border:thin; edge:Raised;center:Yes;help:No;resizable:Yes;status:no");
 //window.showModalDialog(s_url, "", "dialogWidth:60em; dialogHeight:300; border:thin; center:1; maximize:0; minimize:0; help:no;");
}


function show_div2(id_cur1,id_cur2)
{
  var div_set1=null;
  var div_set2=null;

  div_set1=document.getElementById(id_cur1);
  div_set2=document.getElementById(id_cur2);
  if (div_set1!=null)
  {
    if (div_set1.style.display=="block") div_set1.style.display="none";
    else div_set1.style.display="block";
  }
  if (div_set2!=null)
  {
    if (div_set2.style.display=="block") div_set2.style.display="none";
    else div_set2.style.display="block";
  }
}

// находит единственный чекбокс в каждой строке таблички и отчечает/снимает отметки
function markRows(container_id, is_checked) {
	var rows = document.getElementById(container_id).getElementsByTagName('tr');
    var unique_id;
    var checkboxs;
    var checkbox;

    for ( var i = 0; i < rows.length; i++ ) {
    	checkboxs = rows[i].getElementsByTagName( 'input' );
        for (var j = 0; j < checkboxs.length; j++)
        {
        	checkbox = checkboxs[j];
        	if ( checkbox && checkbox.type == 'checkbox' ) {
                   checkbox.checked = is_checked;
            }
        }
    }

    return true;
}

// устанавливает / снимает стиль display: "none" для указанной секции
function showOrHideSection (secNum) {
	secNum.style.display =
		(secNum.style.display == "none") ? "" : "none";
}

function showOrHideSectionById (blockId) {
	var block = document.getElementById(blockId);
	block.style.display =
		(block.style.display == "none") ? "" : "none";
}


function goToURL(sUrl){
	if(sUrl){
		parent.document.location.href = sUrl;
	}
}

function getDeclensionString(n,stringArray){
	if(!stringArray){
		stringArray = ['день','дня','дней'];
	}
	n = Math.abs(n) % 100;
	n1 = n % 10;
	if (n > 10 && n < 20){
		return stringArray[2];
	}
	if (n1 > 1 && n1 < 5){
		return stringArray[1];
	}
	if (n1 == 1){
		return stringArray[0];
	}
	return stringArray[2];
}

$(document).ready(function(){
	$("input[name=login]").attr('title',$("input[name=login]").attr('value'));
	$("input[name=login]").focus(function(){
		if($(this).attr("value") == $(this).attr("title")){
			$(this).attr("value",'');
		}
	});
	$("input[name=login]").blur(function(){
		if($(this).attr("value") == ''){
			$(this).attr("value",$(this).attr("title"));
		}
	});

	$("input[name=pass]").attr('title',$("input[name=pass]").attr('value'));
	$("input[name=pass]").focus(function(){
		if($(this).attr("value") == $(this).attr("title")){
			$(this).attr("value",'');
		}
	});
	$("input[name=pass]").blur(function(){
		if($(this).attr("value") == ''){
			$(this).attr("value",$(this).attr("title"));
		}
	});
});

-->
