var smooth_timer;
var is_down;
is_down = 0;
function smoothHeight(id, curH, targetH, stepH, mode) {
  diff = targetH - curH;
  if (diff != 0) {
    newH = (diff > 0) ? curH + stepH : curH - stepH;
    ((document.getElementById) ? document.getElementById(id) : eval("document.all['" + id + "']")).style.height = newH + "px";
    if (smooth_timer) window.clearTimeout(smooth_timer);
    smooth_timer = window.setTimeout( "smoothHeight('" + id + "'," + newH + "," + targetH + "," + stepH + ",'" + mode + "')", 20 );
  }
  else if (mode != "o") ((document.getElementById) ? document.getElementById(mode) : eval("document.all['" + mode + "']")).style.display="none";
}

function silvsToggle(i) {
	if (is_down == 0) {
		silvsOC(i);
		is_down=i;
	} else {
		if(is_down==i) {
			silvsOC(i);
			is_down=0;
		} else {
			alert("im here :)");
			silvsOC(is_down);
			//silvsOC(i);
			///is_down=i;
		}
	}
}


function silvsOC(i, nColor) {
  var menuObj = (document.getElementById) ? document.getElementById('menu' + i) : eval("document.all['menu" + i + "']");
  var dropObj = (document.getElementById) ? document.getElementById('drop' + i) : eval("document.all['drop" + i + "']");
  if (menuObj != null) {
    if (dropObj.style.display=="none") {
      dropObj.style.display="";
      menuObj.style.background="rgb(0,128,108)";
      menuObj.style.color="#FFF";
      
      smoothHeight('drop' + i, 0, 30, 10, 'o');
    }
    else {
      menuObj.style.background="transparent";
      menuObj.style.color="rgb(0,128,108)";
      smoothHeight('drop' + i, 30, 0, 10, 'drop' + i);
    }
  }
}


function dropMenu() {
  var menuObj = (document.getElementById) ? document.getElementById('mainmenu') : eval("document.all['mainmenu']");
  var dropObj = (document.getElementById) ? document.getElementById('menudrop') : eval("document.all['menudrop']");
  if (menuObj != null) {
    if (dropObj.style.display=="none") {
      dropObj.style.display="";
      menuObj.style.background="rgb(0,128,108)";
      menuObj.style.color="#FFF";
      
      smoothHeight('menudrop', 0, 30, 20, 'o');
    }
    else {
      menuObj.style.background="transparent";
      menuObj.style.color="rgb(0,128,108)";
      smoothHeight('menudrop', 30, 0, 20, 'menudrop');
    }
  }
}
