
function selectMenuFtu (mark) {

	var noShowSubmenu = false;
	for (i in noSubMenu) if (noSubMenu[i] == mark) noShowSubmenu = true;
	
	hideAllSubmenu ();
    hideAllSubmenuFtu ();
	
    try {
        document.getElementById('td_menu_ftu_'+mark).style.backgroundImage = "url(/images/ftu/menu_bg_sel.jpg)";
        document.getElementById('div_menu_ftu_'+mark).style.backgroundImage = "url(/images/ftu/select_menu_arrow.jpg)";
        
       
        document.getElementById('div_submenu_ftu_'+mark).style.display = "block";
   

	}
    catch(e) {
    
    }
    
    create_over();
}

function _delete_over() {
    try{
        hideAllSubmenu ();
        hideAllSubmenuFtu ()
        removeElement(_parent);
    }
    catch(e) {
    }
}

function create_over() {  //ohh, javascript :(
    try{
        removeElement(_parent);
    }
    catch(e) {
    }
    _border = 60;
    _spacer_src = "/images/spacer.gif";
    _background = "transparent"
    
    _parent = document.createElement("DIV");
    _parent.style.position = "absolute";
    _parent.style.top = "0px";
    _parent.style.left = "0px";
    document.body.appendChild(_parent);

    el1 = document.getElementById("menu_start"); 
    set_coords_property(el1);
    
    el2 = document.getElementById("menu_end"); 
    set_coords_property(el2);
    
    el3 = document.getElementById("menu_bottom"); 
    set_coords_property(el3);
    
    _x1 = el1.absolute_x-_border;
    _y1 = el1.absolute_y-_border;
    w1 = el2.absolute_x - el1.absolute_x + _border*2;

    b1 = document.createElement("DIV");
    
    b1.style.width = w1 + "px";
    b1.style.height = _border + "px";
    b1.style.background = _background;
    b1.style.position = "absolute";
    b1.style.top = _y1 + "px";
    b1.style.left = _x1 + "px";
    b1.innerHTML = "<img src='" + _spacer_src + "' height='" + _border + "px' width='" + w1 + "px' onmouseover='_delete_over()'>";
    _parent.appendChild(b1);
    
    _x1 = _x1;
    _y1 = _y1;
    _h1 = el3.absolute_y + _border * 2 - el1.absolute_y;
    
    b2 = document.createElement("DIV");
    b2.style.width = _border + "px";
    b2.style.height = _h1 + "px";
    b2.style.background = _background;
    b2.style.position = "absolute";
    b2.style.top = _y1 + "px";
    b2.style.left = _x1 + "px";
    b2.innerHTML = "<img src='" + _spacer_src + "' height='" + _h1 + "px' width='" + _border + "px' onmouseover='_delete_over()'>";
    _parent.appendChild(b2);
    
    _x1 = _x1;
    _y1 = el3.absolute_y;
    _w1 = el2.absolute_x - el1.absolute_x + _border*2;
    
    b3 = document.createElement("DIV");
    b3.style.width = _w1 + "px";
    b3.style.height = _border + "px";
    b3.style.background = _background;
    b3.style.position = "absolute";
    b3.style.top = _y1 + "px";
    b3.style.left = _x1 + "px";
    b3.innerHTML = "<img src='" + _spacer_src + "' height='" + _border + "px' width='" + _w1 + "px' onmouseover='_delete_over()'>";
    _parent.appendChild(b3);
    
    _x1 = _x1 + _w1 - _border;
    _y1 = el1.absolute_y - _border;
    _h1 = el3.absolute_y + _border * 2 - el1.absolute_y;
    
    b4 = document.createElement("DIV");
    b4.innerHTML = " ";
    b4.style.width = _border + "px";
    b4.style.height = _h1 + "px";
    b4.style.background = _background;
    b4.style.position = "absolute";
    b4.style.top = _y1 + "px";
    b4.style.left = _x1 + "px";
    b4.innerHTML = "<img src='" + _spacer_src + "' height='" + _h1 + "px' width='" + _border + "px' onmouseover='_delete_over()'>";
    _parent.appendChild(b4);

}


function hideAllSubmenuFtu() {
    for (i = 0; i <= ftu_menu.length; i++) {
		ind = ftu_menu[i];
        try {
            document.getElementById('td_menu_ftu_'+ind).style.backgroundImage = "";
    		document.getElementById('div_menu_ftu_'+ind).style.backgroundImage = "";
    		document.getElementById('div_submenu_ftu_'+ind).style.display = "none";
        }
        catch(e) {
   
        }
	}
}

function is_element(el)
{
    try
    {
        ret_obj = document.getElementById(el);
        return ret_obj;
    }
    catch(e)
    {
        return false;
    }
}

function set_coords_property(obj_1)
{
    tmp_obj = obj_1;
    scroll_top = document.documentElement.scrollTop;
    
    var selectedPosX = 0;
    var selectedPosY = 0;
    while(tmp_obj != null)
    {
        selectedPosX += tmp_obj.offsetLeft;
        selectedPosY += tmp_obj.offsetTop;
        tmp_obj = tmp_obj.offsetParent;     
    }

    obj_1.absolute_x = selectedPosX;
    obj_1.absolute_y = selectedPosY;
}

function removeElement(elem)
{
    elem.parentNode.removeChild(elem);
}


function ie_png()
{
    if(navigator["userAgent"].toLowerCase().indexOf("msie")!=-1)
    {
        for(i=0;i<document.images.length;i++)
        {
            img_type = document.images[i].src.split(".").pop().toLowerCase();
            if(img_type=="png")
            {
                img_src = document.images[i].src;
                img_class = document.images[i].className;
                img_width = document.images[i].currentStyle.width;
                img_height = document.images[i].currentStyle.height;
                
                style_str = "width:"+img_width+";height:"+img_height+";filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img_src+"', sizingMethod='scale')";
                document.images[i].outerHTML = "<img src='/images/spacer.gif' style=\""+style_str+"\" class='"+img_class+"' border='none'>"; 
            }
        }
    }        
}



// Оочень полезная функция для кеширования бэкграундов

var  m = document.uniqueID /*IE*/
&& document.compatMode  /*>=IE6*/
&& !window.XMLHttpRequest /*<=IE6*/
&& document.execCommand ;
try{
    if(!!m){
        m("BackgroundImageCache", false, true) /* = IE6 only */
    }
}catch(oh){};
