function delet(text,link){
	if(text=='') text='Вы действительно хотите удалить?';
	if(confirm(text)){
		self.location.href=link;
	} else{
		return;
	}
}

cit = new Array;
var st = 0;

function show() {
	clearTimeout(st);
	hide();
	for (i=0; i<show.arguments.length; i++) {
//		alert(show.arguments[i]);
		if (!document.all) {
			document.getElementById(show.arguments[i]).style.visibility='visible';
		} else {
			document.all[show.arguments[i]].style.visibility='visible';
		}
	}
	cit = show.arguments;
}

function hide() {
	for  (i=0; i<cit.length; i++) {
		if (!document.all) {
			document.getElementById(cit[i]).style.visibility='hidden';
		} else {
			document.all[cit[i]].style.visibility='hidden';
		}
	}
}

function showdesc(file, w, h) {
	dw=window.open(file, 'dw', 'height='+h+',width='+w+',screenX=50,screenY=50,top=50,left=50,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	dw.resizeTo(w, h);
	dw.focus();
}

function showpic(pic, w, h, tit) {
	pw=window.open('', 'pw', 'height='+h+28+',width='+w+6+',screenX=50,screenY=50,top=50,left=50,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
	if(!tit) tit='Картинка';
	buf = '<html><head><title>'+tit+'</title></head><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0><a href=# onClick=self.close()><img src='+pic+' alt="Щелкните на картинке, чтобы закрыть окно" border=0></a></body></html>'
	pw.document.write(buf);
	pw.document.close();
	pw.resizeTo(w+6, h+28);
	pw.focus();
}

function _findObj(n, d) {
  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=_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n);
  return x;
}

function chan(o){
	object=_findObj(o);
	if	(object.style.display ==""){
		object.style.display = "none";
	} else {
		object.style.display = "";
	}
}

function checkmail(txt){
	if (txt == "") {
		return(false)
	}
	if (txt.indexOf(".") == -1) {
		return(false)
	}
	dog = txt.indexOf("@");
	if (dog == -1) {
		return(false)
	}
	if ((dog < 1) || (dog > txt.length - 5)) {
		return(false)
	}
	if ((txt.charAt(dog - 1) == '.') || (txt.charAt(dog + 1) == '.')) {
		return(false);
	}
	return true;
}

function showpr(o){
	str='';
	j=0;
	for(i in o){
		str+=i + "\n";
		j++;
		if(j==10){
			alert(str);
			str='';
			j=0;
		}
	}
	alert(str);
} 

function checkline(f){
	err='';
	if(f.name.value=="") err+="Введите имя\n";
	if(f.phone.value=="") err+="Введите телефон\n";
	if(!checkmail(f.mail.value)) err+="Введите e-mail\n";
	if(f.text.value=="") err+="Введите сообщение\n";
	if(err){
		alert(err);
		return false;
	} else return true;
}

function newword(id, w){
	neww=prompt("Введите слово", w);
	if(neww){
		self.location.href='admin.php?action=editword&id=' + id + "&w=" + neww;
	}
}
