// МЕНЮ
function TopMOver(id) {
	document.getElementById('tmenu'+id).className='topm_over';
	document.getElementById('imgtm1_'+id).src='/images/topm_hover1.gif';
	document.getElementById('imgtm2_'+id).src='/images/topm_hover2.gif';
}
function TopMOut(id) {
	document.getElementById('tmenu'+id).className='topm_out';
	document.getElementById('imgtm1_'+id).src='/images/sp.gif';
	document.getElementById('imgtm2_'+id).src='/images/sp.gif';
}

function show_photo(path) {
	popupWin = window.open('/show_photo.php?photo=' + path, "фото","directories=no,height=240,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=320");
	popupWin.focus();
	return false;
}

function popup_open(path,w,h,label) {
	popupWin = window.open(path, label ,"directories=no,width=" + w + ",height=" + h + ",location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,top=50,left=50");
	popupWin.focus();
	return false;
}

// Список - меню
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// Ввод только численных значений
function EnsureNumeric() {
	var k = window.event.keyCode; 
	// Только Цифры + "."
	if ((k < 48 || k > 57) && k != 8  && k != 46) 
		window.event.returnValue = false; 
}

function init_len(val, len) {
	val= document.new_blank.comp_addres.value;
	real_len=val.length;
	//alert(val);
	if(real_len>=len)
		window.event.returnValue = false; 
}
if (!eve) var eve = window.event;
function showtip (v,eve) {
	if (document.getElementById('idt'+v)) {
		var sw = document.body.clientWidth;
		var sh = document.body.clientHeight;
		var dw = document.getElementById('idt'+v).clientWidth;
		var dh = document.getElementById('idt'+v).clientHeight;
		var cx = eve.clientX;
		var cy = eve.clientY;
		if (sw < cx+dw+20) cx=sw-dw-20;
		if (sh < cy+dh+20) cy=sh-dh-20;
		document.getElementById('idt'+v).style.top=cy+document.body.scrollTop+15;
		document.getElementById('idt'+v).style.left=cx+document.body.scrollLeft+10;
		document.getElementById('idt'+v).style.visibility='visible';
	}
}
function hidetip (v,event) {
	if (document.getElementById('idt'+v)) {
		document.getElementById('idt'+v).style.visibility='hidden';
	}
}

function to_title(page,body_title,body_descr,body_keyw){
window.open('/title/index.php?page='+page+'&body_title='+body_title+'&body_descr='+body_descr+'&body_keyw='+body_keyw, 'Заголовок', 'toolbar=no,location=no,directoties=no,status=no,scrollbars=yes,menubar=no,resizable=no,width=750,height=500');
}

