//--------------------------------
 var mousex=0,mousey=0,ox=0,oy=0
 var maxzi=3,current=''

 var old_mousemove=document.onmousemove
if (document.all) {
        browser = "ie" ;
} else if (navigator.userAgent.indexOf("Opera")>-1) {
        browser = "opera";
} else {
        browser = "mozilla";
}


 function showAddMenu(name,a_obj)
 {
     obj=getObject(name);




     
     if (obj)
     { 
     
    
     
     
     
    if (browser != 'ie') {
        clientWidth  = window.innerWidth;
        clientHeight = window.document.height;
    } else {
        clientWidth  = window.document.body.clientWidth;
        if (window.document.body.scrollHeight < window.document.body.clientHeight)
                clientHeight = window.document.body.clientHeight;
        else
         clientHeight = window.document.body.scrollHeight;// + getBodyScrollTop();
    }

    if (clientWidth > getObjectLeft(a_obj)+ a_obj.offsetWidth + 160) {
        obj.style.left = getObjectLeft(a_obj) + a_obj.offsetWidth;
    } else {
        obj.style.left = getObjectLeft(a_obj) - 160;
    }

    if (clientHeight > getObjectTop(a_obj)  + obj.clientHeight) {
        obj.style.top = getObjectTop(a_obj);
    } else {
        obj.style.top = getObjectTop(a_obj) - obj.clientHeight;
    }
     /*
        obj.style.left = 100;
        obj.style.top = 100;*/
     
     
     
     obj.style.visibility = 'visible';
     }
   
 }

 function hideMoveable(name)
 {
   hideAddMenu(name)
 } 

 function hideAddMenu(name)
 {
     enabl=true;
     obj=getObject(name);
   
     if (obj)
     { obj.style.visibility = 'hidden';
     }
 }

 function multipleCreateClick(name)
 {
   alert('Множественное добавление');
   obj=getObject(name);
   if (!obj||!obj.href) return;
   count=parseInt(prompt('Количество объектов ?',2));
   if (count>0)
      window.open(obj.href+"&count="+count,'_blank');
 }


 function getBodyScrollTop(){
    return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
function getSummRelativeProperty(o, relativeTagName, property) {
    var par = o.offsetParent;
    var val = o[property];
    while(par.tagName != relativeTagName) {
        val += par[property];
        par = par.offsetParent;
    }
    return val;
} 

function getObjectTop(object) {
    return getSummRelativeProperty(object, "BODY", "offsetTop");
}

function getObjectLeft(object){
    return getSummRelativeProperty(object, "BODY", "offsetLeft");
}
