function chekRndGen(frm, nom){
	if (frm.rnd_gen.value!=nom)
	{
		alert("Неверный секретный код") ;
		return false;
	}
return true;
}


function emo_pop1(url,w,h)
{
if(!w)w=400;
if(!h)h=580;
  window.open(url,'ipvisits','width='+w+',height='+h+',resizable=no ,scrollbars=yes');
}

// Блокировка на ввод символов кроме цыфр , -
function EnsureNumeric(){
var k = window.event.keyCode; 
	if (k==46)
		window.event.keyCode=45;

	if ((k < 48 || k > 57))
		window.event.returnValue = false; 
}

function insert(url) {
	var count=window.prompt('Введите количество элементов для добавления (1-50):', 5);
	if (count && count>0) {
		if (count>50){	count=50;	}
		fast_insert.href=url+'&count='+count;
		fast_insert.click();
	}
}

function del_one(url,n) {
	if (confirm("Удалить запись #"+n+"?")) {
		fast_insert.href=url;
		fast_insert.click();
	}
}


function do_once(id,id2)
{
	if(document.getElementById(id2).style.display==""){
		document.getElementById(id2).style.display="none";
		document.getElementById(id2).disabled = "false";
		document.getElementById(id).style.display = "";
	}else{
		document.getElementById(id2).style.display = "";	
		document.getElementById(id2).disabled = "true";
		document.getElementById(id).style.display = "none";
	}
}

// на пустоту (! '' или '   ')
function isEmpty(text) {
  var msg = "Поле \"%d\". Должно быть заполнено;\n";
  text = "" + text;
  for (var i=0; i < text.length; i++) {
    if (text.substring(i, i+1) != " ") {return false} 
  }
  return msg;
}

 function CheckMulti(multiname,count,contextid){
 var str="",a='',v="",nn="";
for (i = 0; i < count ; i++){
	ell=multiname+'['+i+']';
	a=document.getElementById(ell).selected;
	if(a==true){
		v=document.getElementById(ell).text;
		str+=nn+v;
		nn=", ";
	}
}

ell=contextid;
document.getElementById(ell).value=str;
//document.getElementById(contextid).innerHTML=(str);
}

// cb_lst(this.form, 'ehide', '1,25')
function cb_lst(fm, name, idstr) {
  var ids=idstr.split(','); 
	if (!ids[0] || !fm.elements[name+'['+ids[0]+']']) {return} 
	var status=(fm.elements[name+'['+ids[0]+']'].checked ? 0 : 1); 
	for(var i=0; i<ids.length; i++) {fm.elements[name+'['+ids[i]+']'].checked=status;} 
}