var clock;

var mbW=750;
var mbA,mbT,mbTf,mbSf;
var mbR = [];

function getElementPosition(elemId)
{
  var elem = document.getElementById(elemId);
  var w = elem.offsetWidth;
  var h = elem.offsetHeight;
  var l = 0;
  var t = 0;
  while (elem)
  {
    l += elem.offsetLeft;
    t += elem.offsetTop;
    elem = elem.offsetParent;
  }
 return {"left":l, "top":t, "width": w, "height":h};
}

function getPosition(id){
var_x = getElementPosition("flash_button").width;
var_a = (var_x-770)/2;
coordX = getElementPosition("flash_button").top + 60;

  if(id==1)
  {
   coordY = var_a+15;
  }
  if(id==2)
  {
   coordY = var_a+248;
  }
  if(id==3)
  {
   coordY = var_x-var_a-285;
  }
     elem(id).style.top=coordX;
     elem(id).style.left=coordY;
     
}


function elem(id){
  var elem = document.getElementById(id);
  return elem;
}

function hide_menu(id){
  elem(id).style.display='none';
}

function clock_off(id){
 clearTimeout(clock);
 clock = setTimeout('hide_menu('+id+')',1500);
}

function clock_on(id){
 clearTimeout(clock);
 clock = setTimeout('hide_menu('+id+')',90000);
}


function child_clock_off(id){
 clearTimeout(child_clock);
 child_clock = setTimeout('hide_menu('+id+')',1000);
}

function child_clock_on(id){
 clearTimeout(child_clock);
 child_clock = setTimeout('hide_menu('+id+')',90000);
}


function clock_first(id){
 clearTimeout(clock);
 clock = setTimeout('hide_menu('+id+')',3000);
}


function flashMenuClick(p){
clock_first(p);
getPosition(p);
if(p==1)
{
  elem(1).style.display='inline';
  elem(2).style.display='none';
  elem(3).style.display='none';
}
if(p==2)
{
  elem(1).style.display='none';
  elem(2).style.display='inline';
  elem(3).style.display='none';
}

if(p==3)
{
  elem(1).style.display='none';
  elem(2).style.display='none';
  elem(3).style.display='inline';
}


}





function mbSet(m,c) {
if (document.getElementById&&document.createElement) {
	var m=document.getElementById(m);
	m.className=c;
//	m.class=c;
	mbR[mbR.length] = m;
	var i;

	e=m.getElementsByTagName('a');
	if (!mbTf) mbTf=new Function('mbHT();');
	if (!mbSf) mbSf=new Function('mbS(this);');
	for (i=0;i<e.length;i++) {
		e[i].onmouseout=e[i].onblur=mbTf;
		e[i].onmouseover=e[i].onfocus=mbSf;
	}

	m=m.getElementsByTagName('ul');
	for (i=0;i<m.length;i++) {
		mbH(mbL(m[i]));
	}
}}

function mbHA() {
	if (mbA) {
		while (mbA) mbH(mbA);
		mbHE('visible');
	}
}

function mbHT() {
	if (!mbT) mbT=setTimeout('mbHA();', mbW);
}

function mbTC() {
	if (mbT) {
		clearTimeout(mbT);
		mbT=null;
	}
}

function mbS(m) {
	mbTC();
	if (mbA) while (mbA&&m!=mbA&&mbP(m)!=mbA) mbH(mbA);
	else mbHE('hidden');

	if (mbM(m)) {
		mbSH(m,'visible');
		mbA=m;
	}
}

function mbH(m) {
	if (m==mbA) mbA=mbP(m);
	mbSH(m,'hidden');
	mbT=null;
}

function mbL(m) {
	while (m && m.tagName != 'A') m = m.previousSibling;
	return m;
}

function mbM(l) {
	while (l && l.tagName != 'UL') l = l.nextSibling;
	return l;
}

function mbP(m) {
	var p = m.parentNode.parentNode;
	if (p.tagName == 'UL') {
		var i = 0;
		while (i < mbR.length) {
			if (mbR[i] == p) return null;
			i++;
		}
	} else {
		return null;
	}
	return mbL(p);
}

function mbSH(m,v) {
	m.className=v;
	mbM(m).style.visibility=v;
}

function mbHE(v) {
	mbHEV(v,document.getElementsByTagName('select'));
}

function mbHEV(v,e) {
	for (var i=0;i<e.length;i++) e[i].style.visibility=v;
}

