function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

var ie=(document.all && document.all.item && !window.opera)?1:0;
var def_normal_class = 'menu';
var def_hightlight_class = 'menu_';

/* @todo заставить работать в Mozille */
function Show(div, evnt, elem1, class_highlight) {
	class_normal = def_normal_class;
	if(!class_highlight) class_highlight = def_hightlight_class;

	if (evnt) highlight(evnt, class_highlight);
	
	if ((obj=MM_findObj(div))!=null) {
		if(ie){
			obj.style.left = event.clientX - event.offsetX + 3;
			obj.style.top = event.clientY - event.offsetY + document.body.scrollTop + 44;
		} else {
			if (event.srcElement.tagName=='TD') {
				obj.style.left = event.clientX - event.offsetX + 5;
				obj.style.top = event.clientY - event.offsetY + document.body.scrollTop + 28;
			}
		}
		ShowHide('show', obj, elem1, class_normal, class_highlight);
	}
}

function Hide(div, evnt, elem1, class_normal) {
	if(!class_normal) class_normal = def_normal_class;
	class_highlight = def_hightlight_class;

	if(evnt) highlight(evnt, class_normal);
	
	if ((obj=MM_findObj(div))!=null)
		ShowHide('hide', obj, elem1, class_normal, class_highlight);
}

function ShowHide(v, obj, elem1, class_normal, class_highlight) {
	//if(!class_normal) class_normal = def_normal_class;
	//if(!class_highlight) class_highlight = def_hightlight_class;
//	if (event.fromElement.tagName!='DIV') return;
	obj1 = MM_findObj(elem1);
	//obj2 = MM_findObj(elem2);
//	if (obj1 && obj2) {
	if (obj1) {
		//if (v=='hide') obj1.className=class_normal;
		//else obj1.className=class_highlight;
	}
	if (obj.style) {
		obj=obj.style;
		v=(v=='show')?'block':(v=='hide')?'none':v;
	}
	obj.display=v;
}

function highlight(obj, class_name){
	obj.className = class_name;
}

function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');
}

function SendLink(link_name) {
	window.open("/send/?link="+link_name, "SendLink", "scrollbars=0, resizable=1, width=370, height=230").focus();
}

function OpenPrint(link_name) {
	window.open("/view/"+link_name, "OpenPrint", "scrollbars=1, resizable=1, width=600, height=500").focus();
}

function openImage(src) {
	window.open("/popup.php?img="+src, "popupimage", "scrollbars=0, resizable=0").focus();
}

function openLink(link_id) {
	obj = MM_findObj(link_id);
	if (obj.href) window.open(obj.href, '_self');
}

function rusoft() {
  window.open('http://www.rusoft.ru');
}