var root_path = 'http://www.labeko.ru/';
var tipwidth='20px' //default tooltip width
var tipbgcolor='lightyellow'  //tooltip bgcolor
var disappeardelay=250  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="-38px" //horizontal offset of tooltip from anchor link
var horizontal_offset="8px" //horizontal offset of tooltip from anchor link
var ie4=document.all
isDOM=document.getElementById?true:false
isOpera=isOpera5=window.opera && isDOM
isOpera6=isOpera && window.print
isOpera7=isOpera && document.readyState
isMSIE=isIE=document.all && document.all.item && !isOpera
isStrict=document.compatMode=='CSS1Compat'
isNN=isNC=navigator.appName=="Netscape"
isNN4=isNC4=isNN && !isDOM
isMozilla=isNN6=isNN && isDOM
var cur_menu=''
var ns6=document.getElementById&&!document.all
if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')
function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function showhide(obj, e, visible, hidden, tipwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}
function fixedtooltip(menucontents, obj, e, tipwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidetip()
dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
dropmenuobj.innerHTML=menucontents
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
}
function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}
function delayhidetip(){
if (ie4||ns6)
delayhide=setTimeout("hidetip()",disappeardelay)
}
function clearhidetip(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
function DS(element){
window.open('/data/m_2.php?css=css/default.css&target=form_fulltext_struct['+element+']', 'myWin', 'Toolbar=0, Location=0, Directories=0, Status=0, Menubar=0, Scrollbars=0, Resizable=0, Copyhistory=1, Width=190, Height=270');
}
function open_div(id){
rg = new RegExp("<!--NO_ITEMS-->");
id_text = document.getElementById(id).innerHTML;
//alert(id_text);
if (!rg.exec(id_text)){
document.getElementById(id).style.display='';
}
}
function close_div(id){
document.getElementById(id).style.display='none';
}
function show_hide(id)
{
var	el = document.getElementById(id);
if (el.style.display == 'none')
{
el.style.display = '';
}
else
{
el.style.display = 'none';
}
}
function showhidemultiselect(id, id2, act)
{
var	el = document.getElementById(id);
var el2 = document.getElementById(id2);
var parentel = el.parentNode;
//parentel.style.zindex='9999';
//el.style.zindex='10000';
el.style.position='absolute';
el.style.left=el2.style.left;
el.style.top=el2.style.top;
if(act=='change')
{
if (el.style.display == 'none')
{
el.style.display = '';
document.getElementById('mulselimage').src=root_path+'image/default/selbtn_down.gif';
}
else
{
el.style.display = 'none';
document.getElementById('mulselimage').src=root_path+'image/default/selbtn_up.gif';
}
}
else
{
	if(act=='hide')
	{
		el.style.display = 'none';
		document.getElementById('mulselimage').src=root_path+'image/default/selbtn_up.gif';
	}
	if(act=='show')
	{
		el.style.display = 'none';
		document.getElementById('mulselimage').src=root_path+'image/default/selbtn_up.gif';
	}
}
}
function light_selected(id,color)
{
document.getElementById('row'+id).setAttribute('bgcolor', color, 0);
}
function show_attach_form(get_p)
{
var path = root_path+'includes/attach.php?'+get_p;
window.open(path, 'nWin', 'Toolbar=0, Location=0, Directories=0, Status=0, Menubar=0, Scrollbars=1, Resizable=1, Copyhistory=1, Width=800, Height=150');
}
function show_tree(id,block)
{
	var path = root_path+'includes/tree.php?id='+id+'&block='+block;
	window.open(path, 'nWin', 'Toolbar=0, Location=0, Directories=0, Status=0, Menubar=0, Scrollbars=1, Resizable=1, Copyhistory=1, Width=600, Height=500');
}
function show_order()
{
var path = root_path+'order/index.html';
window.open(path, 'nWin', 'Toolbar=0, Location=0, Directories=0, Status=0, Menubar=0, Scrollbars=0, Resizable=0, Copyhistory=1, Width=700, Height=620');
}
function add_new_line(get)
{
window.location.href = get+'?add_line=1#bottom';
}
function submitForm(form_)
{
F= document.forms[form_];
F.submit();
}
function el(e)
{
var elem = document.getElementById(e);
return elem;
}
function show_menu(elem,menu)
{
cur_menu = 1;

if (menu != 'menu1')
{
var	el = document.getElementById('menu1');
el.style.visibility = 'hidden';
}
if (menu != 'menu2')
{
var	el = document.getElementById('menu2');
el.style.visibility = 'hidden';
}
if (menu != 'menu3')
{
var	el = document.getElementById('menu3');
el.style.visibility = 'hidden';
}
if (menu != 'menu4')
{
var	el = document.getElementById('menu4');
el.style.visibility = 'hidden';
}

var	el = document.getElementById(menu);

if(!self.menu || !self.submenu)
{
submenu=layer(menu);
menu=layer(elem);
}
if (isMSIE)
{
el.style.filter="progid:DXImageTransform.Microsoft.GradientWipe(GradientSize=0.25,wipestyle=1,motion=forward,duration=0.5)";
el.filters[0].Apply();
}
submenu.moveTo(menu.getAbsoluteLeft()-(submenu.getWidth() - menu.getWidth())/2, menu.getAbsoluteTop() + menu.getHeight()+4);
submenu.show();
if (isMSIE)
{
el.filters[0].Play();
}
}
function h_menu(menu)
{
var	el = document.getElementById(menu);
if (cur_menu == '')
{
el.style.visibility = 'hidden';
}
}
function hide_menu(menu)
{
setTimeout('h_menu("'+menu+'")',500);
}
function preload_images()
{
var d=document;
if(d.images)
{
if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=preload_images.arguments;
for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0)
{
d.MM_p[j]=new Image;
d.MM_p[j++].src=a[i];
}
}
}
function find_img(n, d) { //v4.01
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=find_img(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n);
return x;
}
function load_image(elem,image)
{
var path = root_path;
elem.src = path+image;
}
function preload_image()
{

}
function f_image(elem,sr_c)
{
	var el = document.getElementById(elem);
	el.src = root_path+sr_c;
}
function getCookie(name) {
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}
function deleteCookie( name, path, domain )
{
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
function addcounter(idel, id, cat)
{
     var el = document.getElementById(idel);
     if(document.getElementById('img'+id) == null){el.innerHTML+='<img id="img'+id+'" src="'+root_path+'image/default/image.php?b='+cat+'&d='+id+'"  width="1" height="1" alt="">';}
}
function popupwin(url, height, width)
{
	window.open(url,'_blank','toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width='+width+', height='+height+', left=250, top=250');
}
function change_url(elem,url)
{
	elem.src = url+'&rand='+Math.random();
}