function findId(idd)
{
    return document.getElementById(idd);
}

function whichElement(e)
{
    var targ
    if (!e) var e = window.event
    if (e.target) targ = e.target
    else if (e.srcElement) targ = e.srcElement
    if (targ.nodeType == 3){ // defeat Safari bug
       targ = targ.parentNode }
    return targ
}

function whichElementClicked(e)
{
     var targ = whichElement(e)
     if (targ.tagName=="DIV" )
     {
         targ.className  = ( targ.className =="header" ) ? "header2" : "header"
         var obj = findId(targ.id.replace("h","c"))
         obj.className = (obj.className == "submenu") ? "submenu2" : "submenu"
     }
}

function whichElementOver(e)
{
    var targ=whichElement(e)

    if (targ.nodeName == "A")
    {
        var tcName = targ.parentNode.className
        var tcName2 = tcName.replace ("a","")
        if (tcName == tcName2) 
            targ.parentNode.className = tcName+"a"
    }
}

function whichElementOut(e)
{
    var targ=whichElement(e)

    if (targ.nodeName == "A" && targ.parentNode.id != "const")
    {
        var tcName = targ.parentNode.className
        targ.parentNode.className = tcName.replace ("a","")
    }
}

function ShowHide(targ)
{
      var cn = targ.parentNode.className
      targ.parentNode.className = (cn == "cat_price") ? "cat_price_act" :"cat_price"
}

function CheckAll(num)
{
    var obj = findId('label')
    if (obj.innerHTML=='Отметить все')
    {
        for (i = 0; i < num; i++)
            findId('zone'+i).checked = true
        obj.innerHTML = 'Снять пометки'
    }   
    else
    {
        for (i = 0; i < num; i++)
            findId('zone'+i).checked = false
        obj.innerHTML = 'Отметить все'
    }   
}