/*----------------------------------------*/
// Dynamic Menu using layers
/*----------------------------------------*/
var openLayer = '';

   // Setup Variables
  var isIE, isNS, isNS6, isDOM, lR, sR, 
      vis, invis, myTimeOut, goName, layerTimer, l, l1, l2, l3;
  var middle_obj_width  = 772;
  var middle_obj_height = 0;
  var beforelast   = 1; 
  var total_layers = 3; 
  var startleft    = 0;
  var starttop     = 0;
  var width;

   // Internet Explorer  
  if (document.all) {
    isIE  = true;
    lR    = "document.all.";
    sR    = ".style"; 
    vis   = "visible";
    invis = "hidden";
    pixelsleft = ".pixelLeft";
    addmoretop  = 0;
    addmoreleft = 118;//---tong edit
  }

  // Netscape 4
  if (document.layers) {
    isNS       = true;
    lR         = "document.layers.";
    sR         = ""; 
    vis        = "show"; 
    invis      = "hide";
    pixelsleft = ".left";
    addmoretop  = 0;
    addmoreleft = 110;//---tong edit
  }
   
  // DOM browser
  if (document.getElementById && !isIE) {
    isDOM = true;
    lR    = "document.getElementById('";
    sR    = "').style";
    vis   = "visible";
    invis = "hidden";
    pixelsleft = ".left";
    addmoretop  = 0;
    addmoreleft = 110;//---tong edit
  }
 
  // Netscape 6/7
  if (isDOM == true && navigator.appName =="Netscape") {
    isNS6 = true;
    addmoretop  = 0;
    addmoreleft = 110;//---tong edit
  }

   // Hide menu
  function hidemenu() {
    for (i = 1; i <= total_layers; i++) {
      hidelayer = eval(lR + "l" + i + sR);
      hidelayer.visibility = invis;
    }

    //Always adjust layers
    moveLayers();
  }

  function layOver(str1, str2, str3) {
    //Always adjust layers
    moveLayers();

    // Stop all shown layers
    stopAll(beforelast);
    showlayer = eval(lR + "l" + str1 + sR);
    addmove (str1, str2, str3);
    showlayer.visibility = vis;
    beforelast  = str1;
  }

  function stopOver() {
    layerTimer = setTimeout("stopAll(" + beforelast + ")", 2000)
  }

  function stopAll(str) {
    stoplayer = eval(lR + "l" + str + sR);
    stoplayer.visibility = invis;
    clearTimeout(layerTimer);
  }

  function startOver() {
    clearTimeout(layerTimer);
  }

  function moveLayers() {

   // Internet Explorer
    if (isIE) { 
      height = document.body.clientHeight;
      width  = document.body.clientWidth;
    }

    // Netscape
    if (isNS || isNS6) {
      height = window.innerHeight;
      width  = window.innerWidth;
    }

    // Find Left pixel start border 
    if (width > middle_obj_width) {
	   startleft = parseInt((width - middle_obj_width) / 2) + 1;
    } else {
	   startleft = 1;
    }

    starttop  = 0;

    for (num = 1; num <= total_layers; num++) {
	   newlpos  = eval(lR + "l" + num + sR);
      if (isIE) {
        newlpos.pixelLeft = startleft;
        newlpos.pixelTop  = starttop;
      }
      else {
        newlpos.left = startleft;
        newlpos.top  = starttop;
      }
    }
  }

  // Pass: layer number, 
  //       pixels left from current position
  //       pixels top from current position
  function addmove (str1, str2, str3) {
    newlpos  = eval(lR + "l" + str1 + sR);

    if (isIE) {
      newlpos.pixelLeft = startleft + str2 + addmoreleft;
      newlpos.pixelTop  = starttop + str3 + addmoretop;
    }
    else {
      newlpos.left = startleft + str2 + addmoreleft;
      newlpos.top  = starttop + str3 + addmoretop;
    }
    return;
  }


/*--------------------------------------------------*/
/*--------------------------------------------------*/

function atOnMouseOverLight(o) {
	o.style.backgroundColor = 'D6E7EE';
	o.style.cursor = 'hand';
}

function atOnMouseOutLight(o) {
	o.style.backgroundColor = 'F7F6F4';
}

function Mover(o) {
	o.style.backgroundColor='839DCD';
	o.style.cursor='hand';
}

function Mout(o) {
	o.style.backgroundColor='12449F';
}

function Mover2(o) {
	o.style.backgroundColor='81B6CE';	
	o.style.cursor='hand';
}

function Mout2(o) {
	o.style.backgroundColor='0E73A1';
}

function Mover3(o) {
	o.style.backgroundColor='7BCDD2';	
	o.style.cursor='hand';
}

function Mout3(o) {
	o.style.backgroundColor='02A0A9';
}


//drop down menu function
function GoUrl(s)
{
	if (s == "no")
	{
		return 0 ;
	}


	var d = s.options[s.selectedIndex].value
	window.top.location.href = d
	s.selectedIndex=0
}	
		
	// create an array to store layer data
	var layList = new Array();

	
		layList[0] = 1;
		
		layList[1] = 2;
		
		layList[2] = 3;
		
	
	function findObj(n, d) { //v4.01
		var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	foldOpen = new Image();
	foldOpen.src = "images/top_15.gif";
	foldClose = new Image();
	foldClose.src = "images/top_15.gif";

	function showHideThem(layID) {
		var setToStyle, daImg;
		for (i = 0; i < layList.length; i++) {
			setToStyle = 'none';
			daImg = foldClose.src;
			if ((obj=findObj('qm_lvl'+layList[i]))!=null) {
				if ( (layID == layList[i]) && (obj.style.display == 'none') ) {
					setToStyle = 'block';
					daImg = foldOpen.src;
				}
				obj.style.display = setToStyle;
				//document.images["qm_fold" + layList[i]].src = daImg;
			}
		}
		return false;
	}
	

