/*
 * __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)
{
	href = '\x6d\x61\x69\x6c\x74\x6f\x3a' + login + '\x40' + serv;
	window.location.href = href
}


function gbID(i) {return document.getElementById(i)}
function gbTN(i) {return document.getElementsByTagName(i)}
function dump(obj) {
	if (!document.getElementById) return false;
	a = 0;
	b = '';
	e = gbID('panel');
	if (!e) {
		body = gbTN('body')
		body = body[0]
		body.innerHTML = "<div id=\"panel\" ><\/div>" + body.outerHTML
		e = gbID('panel')
	}
	for (i in obj) b+= (a++) + '=> ' +i+ ' ' +obj[i]+ "<br />\n"
//	alert(b)
	old = e.outerHTML
	e.innerHTML = old + b;
	return true;
}

function showMenu () {
	WindowStatus () ;
}
window.onload=showMenu;
var ie = (navigator.userAgent.indexOf('Opera')==-1 && (document.getElementById && document.documentElement.behaviorUrns)) ? true : false;
var P = 14
var ULWidth = 593;
var navRoot = '';
function startList (i) {
	if ( (navRoot = gbID(i)) ) { 
		if (ie) TableHref (navRoot)
		for (i=0; i<navRoot.childNodes.length; i++) { 
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") { 
				node.onmouseover=function() {
					odlClassName = this.className
					this.className+= ' over';
					if ( odlClassName.indexOf('Last') === 0	)
					{
						ul = this.lastChild
						if (ie)
						{
							q  = 0 - (ULWidth - ul.offsetWidth - P)
							ul.style.left = q + 'px';
						}
						this.ulWidth = (this.ulWidth ? this.ulWidth : ul.offsetWidth )
						if (this.offsetWidth>ul.offsetWidth)
						{
							q =  (this.offsetWidth - this.ulWidth) - P;
						}
						else 
						{
							q =  0 - (this.ulWidth - this.offsetWidth) - P;
						}
						ul.style.left = q + 'px';
						ul.style.width = this.offsetWidth + 'px';
					}
				}
				node.onmouseout=function() {
					if ( this.className.indexOf('over') != -1 ) {
						this.className = this.className.replace( ((this.className==" over")?" over":"over"), "");
					}
//					this.className = this.className.replace( "/ +/", " ");
//					alert(this.className)
				}
			} 
		} 
	} 
}
function TableHref(i)
{
	A = i.getElementsByTagName('A')
	for (i=0; i<A.length; i++) {
		node = A[i];
//		alert(node.firstChild.nodeName)
		if (node.lastChild.nodeName == 'IMG')
		{
			node.href = A[i].href;
			node.onclick = function() {
				window.location.href = this.href;
				return false;
			}
		}
	}
}

function WindowStatus () {
	window.status = navigator.appName + navigator.appVersion ;
}
