function submenu(b) {

	document.getElementById("sub"+b+"_1");

	document.getElementById("sub"+b+"_2");

	document.getElementById("sub"+b+"_3");

	document.getElementById("sub"+b+"_4");

	document.getElementById("sub"+b+"_5");

	document.getElementById("sub"+b+"_6");
	
	document.getElementById("sub"+b+"_7");

	for(var i=1;i<=7;i++) {

		document.getElementById("sub"+i+"links").style.display=(i==b)?"block":"none";

	}
}

function cs_clip_nav(id) {
	cs_clip_id = id;
  if(document.getElementById("span_" + id).style.display == 'none') {
    document.getElementById("img_" + id).src = document.getElementById("img_" + id).src.replace(/plus/g,'minus');
    document.getElementById("span_" + id).style.display = "block";
  }
  else {
    document.getElementById("img_" + id).src = document.getElementById("img_" + id).src.replace(/minus/g,'plus');
    document.getElementById("span_" + id).style.display = "none";
  }
}

function cs_clip_home(id) {
	cs_clip_id = id;
  if(document.getElementById("span_" + id).style.display == 'none') {
    document.getElementById("span_" + id).style.display = "block";
  }
  else {
    document.getElementById("span_" + id).style.display = "none";
  }
}

/*** Rolldown ***/

var pixel = 0;
var content = '';
var speed = 5;

function menu(contentid, rows) {
  
  if (pixel != 0) return;
  content = document.getElementById('navcontent' + contentid);
  if (content.style.display == 'block') {
    height = rows * 20;
    pixel = height - 1;
    document.getElementById('pointer' + contentid).src = document.getElementById('pointer' + contentid).src.replace(/plus/g,'minus');
    closing = window.setInterval("MenuClose()",1);
  } else {
    height = rows * 20;
    pixel = 1;
    content.style.height = '0px';
    content.style.display = 'block';
    document.getElementById('pointer' + contentid).src = document.getElementById('pointer' + contentid).src.replace(/minus/g,'plus');
    opening = window.setInterval("MenuOpen()",1);
  }
}

function MenuOpen() {
  
  relation = 100 * pixel / height;
  movement = Math.ceil((-0.0004 * (relation - 50) * (relation - 50) + 1) * speed);
  pixel += movement;
  if (pixel > height) pixel = height;
  
  content.style.height = pixel + 'px';
  
  if (pixel >= height) {
    window.clearInterval(opening);
    pixel = 0;
  }
}

function MenuClose() {
  
  relation = 100 * pixel / height;
  movement = Math.ceil((-0.0004 * (relation - 50) * (relation - 50) + 1) * speed);
  pixel -= movement;
  if (pixel < 0) pixel = 0;
  
  content.style.height = pixel + 'px';
  
  if (pixel <= 0) {
    window.clearInterval(closing);
    pixel = 0;
    content.style.display = 'none';
  }
}
