_ajaxConfigMenu = {'_cfscriptLocation':'/ims/globaltestsupply/CategoryMenu.cfc', '_jsscriptFolder':'/ims/js'};

function expandMenu(category_id) {
	
	document.getElementById(category_id + 'Parent').style.background = '#fff';
	document.getElementById(category_id).style.visibility='';
}

function collapseMenu(category_id) {
	
	document.getElementById(category_id + 'Parent').style.background = '#e9e9e9';
	document.getElementById(category_id).style.visibility='hidden';
}


function expandCategory(department)	{
		

		document.getElementById('menuCatDropCopy').innerHTML = '<center><br><br><img 	src="http://www.globaltestsupply.com/ims/images/blueloader.gif"><br><font size=-2><b>LOADING<BR>MENU</b></font></center><br><br>';
		document.getElementById('menuCatDropCopy').style.display = '';
		
		if (document.getElementById('menuCatDropCopyFooter')) {
			document.getElementById('menuCatDropCopyFooter').style.display = '';
		}
		
		
		var str = department;

		// send data to CF
		DWREngine._execute(_ajaxConfigMenu._cfscriptLocation, null, 'CategoryMenu', str, expandCategoryResult);
		}
	
// call back function
function expandCategoryResult (r) {
	$('menuCatDropCopy').innerHTML = r;
	if (document.getElementById('menuCatDropCopyFooter')) {
		$('menuCatDropCopyFooter').innerHTML = r;
	}
}


function closeDropMenu() {
	document.getElementById('menuCatDropCopy').style.display = 'none';
	document.getElementById('menuCatDropCopyFooter').style.display = 'none';

}	

	
function loadMenu(department) {
	if (document.getElementById('menuCatDropCopyFooter')) {
		document.getElementById('menuCatDropCopyFooter').innerHTML = '<center><br><br><img 	src="http://www.globaltestsupply.com/ims/images/blueloader.gif"></center><br><br>';
		var str = department;
		// send data to CF
		DWREngine._execute(_ajaxConfigMenu._cfscriptLocation, null, 'CategoryMenu', str, expandCategoryFooter);
		setTimeout( "end();", 3000); 
	}
		
}	

function expandCategoryFooter (r) {
	if (document.getElementById('menuCatDropCopyFooter')) {
		document.getElementById('menuCatDropCopyFooter').innerHTML = r;
	}
}





//Pop up information box II (Mike McGrath (mike_mcgrath@lineone.net,  http://website.lineone.net/~mike_mcgrath))
//Permission granted to Dynamicdrive.com to include script in archive
//For this and 100's more DHTML scripts, visit http://dynamicdrive.com

var Xoffset=200;    // modify these values to ...
var Yoffset=-200;    // change the popup position.

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if (ns4)
skn=document.dek
else if (ns6)
skn=document.getElementById("dek").style
else if (ie4)
skn=document.all.dek.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;

function popup(msg,bak){
var content="<TABLE  WIDTH=150 BORDER=0 BORDERCOLOR=black CELLPADDING=6 CELLSPACING=1 "+
"BGCOLOR="+bak+"><TD ALIGN=left bgcolor=ffffff><FONT face=arial COLOR=black SIZE=-2>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
 if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
 if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
 if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}

function kill(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}






var DDSPEED = 3;
var DDTIMER = 5;
var OFFSET = -40;
var ZINT = 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';
	h.style.background = '#fff';
    if(c.maxh && c.maxh <= c.offsetHeight){return}
	else if(!c.maxh){
//	alert(h.offsetWidth);
      c.style.left = (h.offsetWidth + OFFSET) + 'px';
	// c.style.left = (h.offsetWidth) + '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);
	h.style.background = '#e9e9e9';
  }
}

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';
  }
}