function DOMGetElement(o) {
  if (document.getElementById) return document.getElementById(o);
  else if (document.all)             return document.all[o];
  else if (document.layers)          return document.layers[o];
  return null;
}

function DOMWindowGetXOffset() {
  if (document.getElementById || document.layers) return window.pageXOffset;
  else if (document.all)                          return document.body.scrollLeft;
}

function DOMWindowGetYOffset() {
  if (document.all)                                    return document.body.scrollTop;
  else if (document.getElementById || document.layers) return window.pageYOffset;
}

function DOMElementSetTopPos(o, val) {
  if (document.getElementById || document.all) o.style.top = val;
  else if (document.layers)                    o.pageY = val;
}

function DOMElementSetLeftPos(o,val) {
  if (document.getElementById || document.all) o.style.left = val;
  else if (document.layers)                    o.pageX = val;
}

function DOMElementSetVisible(o,val) {
  if (document.getElementById) o.style.visibility = val;
  else if (document.layers) {
    if (val == 'visible') val = 'show';
    o.visibility = val;
  }
}

function DOMWindowGetInnerWidth() {
  if (document.all)                                    return document.body.clientWidth;
  else if (document.getElementById || document.layers) return window.innerWidth;
}

function DOMWindowGetInnerHeight() {
  if (document.all)                                    return document.body.clientHeight;
  else if (document.getElementById || document.layers) return window.innerHeight;
}

function DOMElementGetHeight(o) {
  if (document.all)                 return o.clientHeight;
  else if (document.getElementById) return parseInt(o.offsetHeight);
  else if (document.layers)         return o.document.height;
}

function DOMElementGetWidth(o) {
  if (document.all)                 return o.clientWidth;
  else if (document.getElementById) return parseInt(o.offsetWidth);
  else if (document.layers)         return o.document.width;
}

function preloadImages() {
	var imgArray = document.images;
	var preloadImgArray = new Array();
	var regExp = /_off./g
	
	for (i = 0; i < imgArray.length; i++) {
		if (imgArray[i].src.indexOf("_off.") > -1) {
			preloadImgArray[i] = new Image();
			preloadImgArray[i].src = imgArray[i].src.replace(regExp, "_on.");
		}
	}
}

function buttonRollover(name, state){
	var imageSrc = eval('document.images["'+name+'"].src');
	if (state == 1) { var newImageSrc = imageSrc.replace("_off.","_on."); }
	else { var newImageSrc = imageSrc.replace("_on.","_off."); }
	document.images[name].src = newImageSrc;
}

function openWindow(objPage, popW, popH, bScroll, objName) {
  var w = 450, h = 340;
  if (document.all) {
    /* the following is only available after onLoad */
    w = document.body.clientWidth;
    h = document.body.clientHeight;
  } else if (document.layers) {
    w = window.innerWidth;
    h = window.innerHeight;
  }
  var leftPos = (w-popW)/2, topPos = (h-popH)/2;
  if (!window.windowRef) {
    // has not yet been defined
    windowRef = window.open(objPage,objName,'toolbar=0,scrollbars='+bScroll+',location=0,statusbar=0,menubar=0,resizable=no,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
  } else {
    // has been defined
    if (!windowRef.closed) {
      // still open
      windowRef.focus();
    } else {
      windowRef = window.open(objPage,objName,'toolbar=0,scrollbars='+bScroll+',location=0,statusbar=0,menubar=0,resizable=no,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos);
    }
  }
}


function mapStore(a_Long,a_Lat,a_Add) {
	window.open("http://mappoint.msn.com/map.aspx?L=USA&C=" + a_Lat + "%2c" + a_Long + "&A=7.16667&P=|" + a_Lat + "%2c" + a_Long + "|1|" + a_Add + "%2c+ON|L1|","map","width=650,height=600,toolbar=no,resizable=yes,scrollbars=yes,menubar=no");
}

