﻿var DDSPEED1 = 10;
var DDTIMER1 = 15;
var OFFSET1 = 200;//g-200
var ZINT1 = 100;//g-100

function ddMenu1(id,d){
//alert(id+","+d);
  var h = document.getElementById(id + '-ddheader');
  //alert("h :"+h);

  var c = document.getElementById(id + '-ddcontent');
  //alert("c :"+c);
  clearInterval(c.timer);
  if(d == 1){
   //alert("d :"+d);
    clearTimeout(h.timer);
    c.style.display = 'block';
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.left = (h.offsetWidth + OFFSET1) + 'px';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    ZINT1 = ZINT1 + 1;
    c.style.zIndex = ZINT1;
    c.timer = setInterval(function(){ddSlide1(c,1)},DDTIMER1);
  }else{
    h.timer = setTimeout(function(){ddCollapse1(c)},50);
  }
}

function ddCollapse1(c){
  c.timer = setInterval(function(){ddSlide1(c,-1)},DDTIMER1);
}

function cancelHide1(id){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide1(c,1)},DDTIMER1);
  }
}

function ddSlide1(c,d){
//alert("c-c :"+c);
//alert("d-d :"+d);
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = Math.round((c.maxh - currh) / DDSPEED1);
  }else{
    dist = Math.round(currh / DDSPEED1);
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if(currh > (c.maxh - 2) && d == 1){
    clearInterval(c.timer);
  }else if(dist < 1 && d != 1){
    clearInterval(c.timer);
    c.style.display = 'none';
  }
}


/////







var DDSPEED = 10;
var DDTIMER = 15;
var OFFSET = 1;//g-2
var ZINT = 100;//g-100

function ddMenu(id,d){
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearInterval(c.timer);
  if(d == 1){
    clearTimeout(h.timer);
    c.style.display = 'block';
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.left = (h.offsetWidth + OFFSET) + 'px';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
      c.style.height = '0px';
    }
    ZINT = ZINT + 1;
    c.style.zIndex = ZINT;
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }else{
    h.timer = setTimeout(function(){ddCollapse(c)},50);
  }
}

function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

function cancelHide(id)
{
  var h = document.getElementById(id + '-ddheader');
  var c = document.getElementById(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = Math.round((c.maxh - currh) / DDSPEED);
  }else{
    dist = Math.round(currh / DDSPEED);
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if(currh > (c.maxh - 2) && d == 1){
    clearInterval(c.timer);
  }else if(dist < 1 && d != 1){
    clearInterval(c.timer);
    c.style.display = 'none';
  }
}
/*var co='#9ac1c9';
     var back_img='url(images/header.gif)';
     var back_img_over='url(images/header_over.gif)';
        document.write("<style>* {padding:0; margin:0} +"
+" body {font:12px Verdana, Arial, Helvetica} "
+" #wrapper {width:750px;  margin:0 auto}"
+" #leftcolumn {float:left; width:225px}"
+" #rightcolumn {float:left; width:525px}"
+" .dropdown {display:block; position:relative}"
+" .dropdown dt {width:188px; border:2px solid "+co+"; padding:3px; font-weight:bold; cursor:pointer; background:"+back_img+"}"
+" .dropdown .upperdd {border-bottom:none}"
+" .dropdown dt:hover {background:"+back_img_over+"}"
+" .dropdown dd {position:absolute; top:0; overflow:hidden; width:208px; display:none; background:#fff; opacity:0}"
+" .dropdown ul {width:204px; border:2px solid "+co+"; list-style:none}"
+" .dropdown li {display:inline}"
+" .dropdown .aa, .dropdown .aa:active, .dropdown .aa:visited "
+" {"
	+" display:block; padding:3px; color:#333; text-decoration:none; background:#eaf0f2; width:194px"
	+" }"
+" .dropdown .aa:hover {background:#d9e1e4; color:#000}"
+" .dropdown .underline {border-bottom:1px solid #b9d6dc}"
+" .dropdown .head{ text-decoration:none;color:#333; }</style>");
*/





/*
var over='e6e6fa';
var dd_back='FBFDFC';
//d9e1e4
 document.write("<style>* {padding:0; margin:0} +"
+" body {font:12px Verdana, Arial, Helvetica} "
+" #wrapper {width:750px;  margin:0 auto}"
+" #leftcolumn {float:left; width:205px}"
+" #rightcolumn {float:left; width:205px}"
+" .dropdown {display:block; position:absolute}"
+" .dropdown dt {padding-right:3px;cursor:pointer; }"
+" .dropdown .upperdd {border-bottom:none}"
//+" .dropdown dt:hover {background-color:#"+dd_back+"}"
+" .dropdown dd {top:0; overflow:hidden;display:none;text-align:left;  opacity:0.6}"
+" .dropdown ul {padding-left:3px; border:2px solid #"+over+"; list-style:none}"
+" .dropdown li {display:inline}"
+" .dropdown .aa, .dropdown .aa:active, .dropdown .aa:visited "
+" {"
	+" display:block; padding-left:3px; color:#333; text-decoration:none; background:#"+dd_back+";"
	+" }"
+" .dropdown .aa:hover {background:#"+over+"; color:#000}"
+" .dropdown .underline {border-bottom:1px solid #"+over+"}"
+" .dropdown .head{ text-decoration:none;color:#333; }</style>");
*/
