function versionInfo() {
	popUp('/whichVersion.html', 'which', 550, 520);
}
function terms() {
	popUp('/subscribeTerms.html', 'terms', 450, 400);
}

function popUp(url, name, height, width) {
	window.open(url, name, "width=" + width + ",height=" + height + ",menubar=no,scrollbars=yes,toolbar=no,status=no,location=no");
}

// Common Functions 

// AddLoadEvent
function addLoadEvent(func){
  var oldonload = window.onload;
  if (typeof window.onload != 'function'){
    window.onload = func;
  }
  else{
    window.onload = function(){
      if (oldonload){
        oldonload();
      }
      func();
    }
  }
}

// getElementById
function $() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
			element = document.getElementById(element);
		if (arguments.length == 1)
			return element;
		elements.push(element);
	}
	return elements;
}

// Show Editions Menu
function showEditions(){
    var editions = $("dceditions");
	if (!editions) return false;
	var listELs = editions.getElementsByTagName("LI");
	for (var i=0; i<listELs.length; i++) {
		listELs[i].onmouseover = function() {
			this.className+=" over";
		}
		listELs[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" over\\b"), "");
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", showEditions);

// toggle visibility
function toggle(obj){
  var el = $(obj);
  el.style.display = (el.style.display != 'none' ? 'none' : '');
}
// everywhere help
function viewHelp(){
	
  if (!$("help")) return false;
  
  $("help").onmouseover = function(){
    toggle("note");
  }
  $("help").onmouseout = function(){
    toggle("note");
  }
}
// focus labels
function focusLabels(){
  if (!document.getElementsByTagName) return false;
  var labels = document.getElementsByTagName("label");
  for (var i = 0; i < labels.length; i++){
    if (!labels[i].getAttribute("for"))
      continue;
    labels[i].onclick = function(){
      var id = this.getAttribute("for");
      if (!document.getElementById(id))
        return false;
      var element = document.getElementById(id);
      element.focus();
    }
  }
}
// contact form select menu
function checkOption(sel) {
	if (!$("message")) return false;
	if (sel.options[sel.selectedIndex].value == 11)
		$('message').value = 'Please send us a short description of the problem and include the following info:\n1) Your Provider\n2) Your Number\n3) Handset age and make\n' + $('message').value;
}

// initialize onload functions
function init() {focusLabels(); viewHelp();}

addLoadEvent(init);
