window.onerror = null;

var menuActive = 0;
var onLayer;
var timeOn = null;
var useMenu = 0;

var hide  = true;

rollovers = 1;


function preloadimages() {
if (rollovers) {
n1 = new Image(); 
n1.src ="./uiparts/nav_solutions_1.gif";
}
}

function am(name) {
	if (rollovers) {
	}
}
function dm2(name) {
	if (rollovers) {
	}
}

function dm(name) {
	if (rollovers) {
	}
	btnTimer();
}

function setLyr(obj,lyr)
{
	am(lyr);
	lyr = 'menu_'+lyr;
	if (timeOn != null) {
		clearTimeout(timeOn);
		hideLayer(onLayer);
	}
  
	var newX = findPosX(obj);
	var newY = findPosY(obj);
	newY += 17;
	var x = new getObj(lyr);
	x.style.top = newY + 'px';
	x.style.left = newX + 'px';

	onLayer = lyr;
}


function showLayer(layerName) {
	am(layerName);
	layerName = 'menu_'+layerName;
	if (timeOn != null) {
    clearTimeout(timeOn);
    hideLayer(onLayer);
  }
  if (document.getElementById) {
    document.getElementById(layerName).style.visibility = "visible";
  } else if (document.layers) {
    document.layers[layerName].visibility = "show";
  } else if (document.all) {
    document.all[layerName].style.visibility = "visible";
  }
  onLayer = layerName;
}



function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	var printstring = '';
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


function getObj(name)
{
	if (document.getElementById)
	{
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
		document.getElementById(name).style.visibility = "visible";
	}
	else if (document.all)
	{
		this.obj = document.all[name];
		this.style = document.all[name].style;
		document.all[name].style.visibility = "visible";
	}
	else if (document.layers)
	{
	if (document.layers[name])
	{
		this.obj = document.layers[name];
		this.style = document.layers[name];
		document.layers[name].visibility = "show";
	}
	else
	{
		this.obj = document.layers.testP.layers[name];
	this.style = document.layers.testP.layers[name];
	}
	}
}

// Hide the given layer
function hideLayer(layerName) {
  if (menuActive == 0) {
    if (document.getElementById) {
      document.getElementById(layerName).style.visibility = "hidden";
    } else if (document.layers) {
      document.layers[layerName].visibility = "hidden";
    } else if (document.all) {
      document.all[layerName].style.visibility = "hidden";
    }
  }
}

// Timer for button mouse out
function btnTimer() {
  timeOn = setTimeout("btnOut()", 400);
}

// Button mouse out
function btnOut(layerName) {
	if (menuActive == 0) {
		hideLayer(onLayer);
	}
}

// Menu mouse over
function menuOver(itemName) {
	clearTimeout(timeOn);
	 menuActive = 1;
}

// Menu mouse out
function menuOut(itemName) {
	menuActive = 0;
	timeOn = setTimeout("hideLayer(onLayer)", 1000);
}



function popupoffer(thefile) {
	newWindow = window.open('webspecialoffer.cfm', "offer" ,"statusbar=no,menubar=no,location=no,scrollbars=yes,toolbar=no,directories=no,resizable=yes,width=220,height=340")
	newWindow.focus();
}

function popupwin(thefile) {
	newWindow = window.open(thefile, "offer" ,"statusbar=no,menubar=no,location=no,scrollbars=yes,toolbar=no,directories=no,resizable=yes,width=640,height=530")
	newWindow.focus();
}

function popupfile(thefile) {
	newWindow = window.open(thefile, "offer" ,"statusbar=no,menubar=no,location=no,scrollbars=yes,toolbar=no,directories=no,resizable=yes,width=520,height=500")
	newWindow.focus();
}

function popupWindow(thefile) {
	newWindow = window.open('pop_'+thefile+'.html', "graphic" ,"statusbar=no,menubar=no,location=no,scrollbars=yes,toolbar=no,directories=no,resizable=yes,width=520,height=500")
	newWindow.focus();
}

function popupPhoto(theID) {
	newWindow = window.open('photo.cfm?ID='+theID, "graphic" ,"statusbar=no,menubar=no,location=no,scrollbars=yes,toolbar=no,directories=no,resizable=yes,width=520,height=560")
	newWindow.focus();
}

