function tabManipulate(actTab, totTab) {
 var i = 0;
 var elements = document.getElementsByTagName( "div" );
 for (i=0;i<totTab;i++) {
  document.getElementById('atabdiv_' + i).style.display = "none";
  document.getElementById("atab_" + i).className = "";
 }
 document.getElementById("atabdiv_" + actTab).style.display = "";
 document.getElementById("atab_" + actTab).className = "selected";
}

function ajaxLoad(url,container) {
 var imgpath = "/images/siteimages/";
 var xmlhttp = getXmlHttp();
 if (xmlhttp == null) { 
  document.getElementById(container).innerHTML="Your web browser does not support AJAX functions.";
  return; 
 }

 // Update container to let the user know something is happening.
 document.getElementById(container).innerHTML="Loading...";

 // Send off the request.
 xmlhttp.open("GET",url,false);
 xmlhttp.send(null);
 document.getElementById(container).innerHTML=xmlhttp.responseText;
}

function getXmlHttp() {
 if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
 } else { // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
 }
 return null;
}

function ImageLoad(img, ext, container) {
 document.getElementById(container).innerHTML="<a href='javascript:void(0)' onClick='popUp(\"/images/siteimages/" + img + "." + ext + "\",950,633);'><img src='/images/siteimages/" + img + "-zoom." + ext + "' style='border: none;'></a>";
}

var scroller = null;
var scroller_box = null;
var scroller_val = null;
function divScroll(container, dir) {
 var y;
 scroller_box = container;
 if ( dir == "up" ) { scroller_val = -5; } else { scroller_val = 5; }
 scroller = window.setInterval("scrollBox()", 50);
}

function stop_scroll() {
 window.clearInterval(scroller);
 scroller = null;
 scroller_box = null;
 scroller_val = null;
}

function scrollBox() {
 ele = document.getElementById(scroller_box);
 ele.scrollTop = ele.scrollTop + scroller_val;
}

function busTab() { 
 if (document.getElementById('businessmain').style.display == "none") { 
  document.getElementById('businessmain').style.display = "";
  document.getElementById('businessContact').style.display = "none";
 } else {
  document.getElementById('businessmain').style.display = "none";
  document.getElementById('businessContact').style.display = "";
 }
}

function popUp(url, width, height) {
 var cwidth;
 var cHeight;
 cWidth = (window.screen.width/2) - (width/2 + 10);
 cHeight = (window.screen.height/2) - (height/2 + 50);
 window.open(url,"mywindow", "menubar=0,resizeable=1,scrollbars=1,width=" + width + ",height=" + height + ",top=" + cHeight + ",left=" + cWidth + ",screenX=" + cWidth + ",screenY=" + cHeight);
}

function winResize(width, height) {
 self.resizeTo(width,height);
 var cwidth;
 var cHeight;
 cWidth = (window.screen.width/2) - (width/2 + 10);
 cHeight = (window.screen.height/2) - (height/2 + 50);
 self.moveTo(cWidth,cHeight);
}
