
// JavaScript Document
startList = function()
{
    this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0

    this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6;
    
    if(this.ie)
    {

        if (document.all&&document.getElementById)
        {
            navRoot = document.getElementById("ulmenu");
            for (i=0; i<navRoot.childNodes.length; i++)
            {
                node = navRoot.childNodes[i];            

                if (node.nodeName=="LI" && node.id != "submenu" && node.childNodes.length > 2)
                {
                    node.onmouseover=function()
                    {
                        this.className+=" over";
                    

                        var TrueTop = parseInt(this.offsetTop);
                        var UpperTop = selcity.offsetTop + selcity.clientHeight; // нижняя граница верхнего предела
                        var UpperLimit = TrueTop - UpperTop; // максимальное количество пикселей на которое можно поднять меню вверх
                        var TrueH = TrueTop + parseInt(this.childNodes(2).clientHeight); // реальная координата меню
                        //var CurH = document.body.clientHeight; // текущий размер документа
                        var CurH = document.documentElement.scrollTop+ document.documentElement.clientHeight; // нижняя граница окна    
                        var DownerLimit = CurH - TrueH; // разница высоты документа и нижней границы меню. Если отрицательная, то меню в пределах документа
                    
                        if(DownerLimit < 0)
                        {
	    					if(-DownerLimit < UpperLimit)
                            { // если разница высот меньше чем верхний предел, то нужно поднимать по размеру разницы
							    this.childNodes(2).style.top = DownerLimit;
    						} 
                            else 
                            {
    							this.childNodes(2).style.top = -UpperLimit;
	    					}
                        }
                    }

                    node.onmouseout=function()
                    {
                        this.className=this.className.replace(" over", "");
                    }
                }
                else if (node.nodeName=="LI" && node.id != "submenu" && node.childNodes.length == 2)
                {
                    node.onmouseover=function()
                    {
                        this.className+=" over";
                    }

                    node.onmouseout=function()
                    {
                        this.className=this.className.replace(" over", "");
                    }              
                }
            }
        }   
    }
}





/*
 * __title
 */
function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.isO   = this.isO5 = window.opera && this.dom; //Opera 5+
	this.isO6  = this.isO && window.print //Opera 6+
	this.isO7  = this.isO && document.readyState //Opera 7+
	var isMZ  = this.dom && (navigator.appName=="Netscape")
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}

var bw=new lib_bwcheck()

/*
 * __title
 */
function makeObj_(obj ){
	this.elm=obj;
	this.css = bw.ns4?this.elm:this.elm.style;
	this.scrollWidth = bw.ns4?this.css.document.width:this.elm.offsetWidth;
	this.scrollHeight = bw.ns4?this.css.document.height:this.elm.offsetHeight;
	this.x = bw.ns4?this.css.left:this.elm.offsetLeft;
	this.y = bw.ns4?this.css.top:this.elm.offsetTop;
	return this;
}

/*
 * __title
 */
function makeObj1_(obj ){
	this.elm=obj;
 	this.css = bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval('document.'+obj):0;
	this.scrollWidth = bw.ns4?this.css.document.width:this.elm.offsetWidth;
	this.scrollHeight = bw.ns4?this.css.document.height:this.elm.offsetHeight;
	this.x = bw.ns4?this.css.left:this.elm.offsetLeft;
	this.y = bw.ns4?this.css.top:this.elm.offsetTop;
	return this;
}

/*
 * __title
 */
function wfobj_(_classname,_id,_par)
{
	this.hi=0;
	this.classname=_classname;
	this.id=_id;
	this.dom_parent=makeObj_(_par);
	this.path=function()
	{
		return "123";
	}
	this.hilight= function ()
	{
		if(this.hi==0)
		{
			this.hi=1;
			this.help1=this.dom_parent.css.border;
			this.dom_parent.css.border=" dashed 1px ";
		}
	}
	this.un_hilight= function ()
	{
		if(this.hi==1)
		{
			this.hi=0;
			this.dom_parent.css.border=this.help1;
		}
	}
	this.get = function (a)
	{
		for(i=0; i< this.keys.length ;i++)
			if(this.keys[i]==a)
				return this.vars[i];
		return "";
	}

	this.say= function ()
	{
		str1="";
		for(i=0; i< this.vars.length ;i++)
		{
			str1=str1+""+this.keys[i]+" = "+this.vars[i]+" <br>\n";
		}
		return (str1);
	}	

	this.hi;
	this.help1="";
	this.vars=new Array();
	this.keys=new Array();
}

/*
 * __title
 */
function obj_by_class( uniqueop)
{
	var str="";
	var a=null;
	var _id=0;
	str=uniqueop.className.split("?")
	if( str.length>=2 && str[0]=="wfobject" )
	{
		str=str[1];
		class_name=str[0];
		str=str.split("&");
		vals= new Array();
		keys= new Array();
		for(i in str)
		{
		
			h1=(str[i].split("="));
			if( h1.length>=2 )
			{
				vals[i]=h1[1];
				keys[i]=h1[0];
				if(h1[0]=="id")
				id=h1[1];
				//alert(keys[i]);
				//alert(vals[i]);
			}
		}
		 a= new wfobj_(class_name,id,uniqueop);
		 a.vars=vals;
		 a.keys=keys;
		return a;
	}
	return null;
}


if(bw.ie || bw.isO){
  document.ondblclick=function(){
    op = event.srcElement;
	a1=null;
	var ret= Array();
	while(op){
		a1=obj_by_class(op);
		if(a1 && a1!=null)
		{
			//a1.hilight();
			//a1.say();
			ret[ret.length]=a1;
		}
		op=op.parentElement;
	}
	
	if(ret.length>0)
	{
		document.all.java_collector.obj_array=ret;
		document.all.java_collector.www_dir=www_dir;
		document.all.java_collector.popup=popup;
		
		//path=www_dir+"/client_nav.php";
		path=www_dir+"/index_admin2.php/sitemanager/case_nav/";
		popup(path);
	}
    return true;
  }
}else if (bw.isMZ) {
document.addEventListener("dblclick", mouseClick, true);
}

/*
 * __title
 */
function mouseClick(event) 
{
    op = event.target;
    while (op!=null && ((op.className!=frame) && (op.className!=frame2)) && op.tagName!="BODY")
      op=op.parentNode;
    if (op!=null && ((op.className==frame) || (op.className==frame2))) {
     document.location=edit;
    }
}
 
function hidden_mail(login, serv)
{
	hidden_one.href = '\x6d\x61\x69\x6c\x74\x6f\x3a' + login + '\x40' + serv;
	hidden_one.click();
	hidden_one.href = '';
}


