// Home Page Main image switcher -- writes out image tag based on modulus of current second
// divided by total number of images
iTotalNumberOfImages = 3;
oToday = new Date();
iThisSecond = oToday.getSeconds();
iImageNumber = iThisSecond % iTotalNumberOfImages;
sMainImageTag = "<img src=\"img/hmpg/hmpg_main_image_" + iImageNumber + ".jpg\" width=\"269\" height=\"216\" alt=\"\" border=\"0\">";

// preload home page level 1 buttons
var aBtn = new Array();
aBtn = ["","markets","solutions","products","services","news","company","alliances"];
for (i = 0; i < aBtn.length; i++) {
  eval("A" + i + "on = new Image();");	eval("A" + i + "off = new Image();");
  eval("A" + (i) + "on.src = \"" + folderDepth + "img/hmpg/l1_btn_" + aBtn[i] + "_r.gif\";");
  eval("A" + (i) + "off.src = \"" + folderDepth + "img/hmpg/l1_btn_" + aBtn[i] + "_0.gif\";");
}

// preload sublevel level 1 buttons
var bBtn = new Array();
bBtn = ["","markets","solutions","products","services","news","company","alliances"];
for (i = 0; i < bBtn.length; i++) {
  eval("B" + i + "on = new Image();");	eval("B" + i + "off = new Image();");
  eval("B" + (i) + "on.src = \"" + folderDepth + "img/btns/l1_btn_sub_" + bBtn[i] + "_r.gif\";");
  eval("B" + (i) + "off.src = \"" + folderDepth + "img/btns/l1_btn_sub_" + bBtn[i] + "_0.gif\";");
}

// preload sublevel level 1 buttons new
var dBtn = new Array();
dBtn = ["","markets","solutions","products","services","news_&_events","company","alliances"];
for (i = 0; i < dBtn.length; i++) {
  eval("D" + i + "on = new Image();");	eval("D" + i + "off = new Image();");
  eval("D" + (i) + "on.src = \"" + folderDepth + "images/new/" + dBtn[i] + "_on.gif\";");
  eval("D" + (i) + "off.src = \"" + folderDepth + "images/new/" + dBtn[i] + ".gif\";");
}

// preload constant buttons
var cBtn = new Array();
cBtn = ["","home","contact","sitemap","shopping-cart"];
for (i=0;i<cBtn.length;i++) { 
	eval("C"+i+"on = new Image();"); eval("C"+i+"off = new Image();");
	eval("C"+(i)+"on.src = \"" + folderDepth + "img/btns/cnst_" + cBtn[i] + "_r.gif\";");
	eval("C"+(i)+"off.src = \"" + folderDepth + "img/btns/cnst_" + cBtn[i] + "_0.gif\";");
}

// image-swapping function
function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) { 
  		document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src"); 
	}
  }
}

// open in a new window function
function openWin(file) {
  var numImages3 = 500;
  var rndImg3 = Math.round(Math.random() * (numImages3-1)) + 1;
  attrib = "scrollbars=yes,resizable=yes,width=625,height=450,top=60,left=10"
  window.open(file,rndImg3,attrib)
}

// open images in a new window function
function showThumbnail(WindowLocation,PopWidth,PopHeight) {
 newWin1=window.open (WindowLocation, "Thumbnail", "height=" + PopHeight + ", width=" + PopWidth + ",left=10,top=60,toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, directories=no, status=no'");
newWin1.focus();
}

// functions from old site
function go(where) {
	if (where != "-") {
	top.location = where;

	}
}

function CellOvr(src,clrOver){ 
	if (!src.contains(event.fromElement)){ 
		src.style.cursor = 'hand'; 
		src.bgColor = clrOver; 
	} 
} 
function CellOut(src,clrIn){ 
	if (!src.contains(event.toElement)){ 
		src.style.cursor = 'default'; 
		src.bgColor = clrIn; 
	} 
} 
function CellClk(src){ 
	if(event.srcElement.tagName=='TD')
		src.children.tags('A')[0].click();
}

function showHelpWindow(WindowLocation,WindowTitle,WindowHeight,WindowWidth) {
newWin1=window.open(WindowLocation,WindowTitle,'toolbar=0,status=0,menubar=0,location=0,resizable=yes,scrollbars=no,width='+WindowWidth+',height='+WindowHeight+',left=5,top=5,screenX = 5,screenY = 5');
newWin1.focus();
}
// new customer rotating on home page at bottom
function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
