function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

function changeRegion(obj,type,returnURL) {
  var region = obj;
  if (type!=0) {
    if ($(obj).value != '') {
      var region = $(obj).value;
    }
  }
  if (returnURL != "") {
  	if (returnURL == "promotions") {
  		returnStr = "company/promotions/";
	} else {
		returnStr = returnURL;
	}
  } else {
    returnStr = "";
  }
	var agree = confirm("Would you like this to be your default selection?");
	if (agree) {
	  window.location = '/'+returnStr+'?v=1&region=' + region;
	}else{
	  window.location = '/'+returnStr+'?v=0&region=' + region;
	}
}

function changeRegion2(region,type,returnURL) {
	var agree = confirm("Would you like this to be your default selection?");
  if (returnURL != "") {
  	if (returnURL == "promotions") {
  		returnStr = "company/promotions/";
	} else {
		returnStr = returnURL;
	}
  } else {
    returnStr = "";
  }
	if (agree) {
	  window.location = '/'+returnStr+'?v=1&region=' + region;
	}else{
	  window.location = '/'+returnStr+'?v=0&region=' + region;
	}
}

function changeRegion3() {
  window.location = '/?v=0&region=usa';
}

function showHilite(obj) {
  hideHilites();
  $(obj).style.display = 'block';
}

function hideHilites() {
  var hilites = getElementsByClass('hilite', $('globe'), 'div');
	for (i=0;i<hilites.length;i++) {
    hilites[i].style.display = 'none';    
  }
}