function returnObjById( id ) 
{ 
	if (document.getElementById) 
		var returnVar = document.getElementById(id); 
	else if (document.all) 
		var returnVar = document.all[id]; 
	else if (document.layers) 
		var returnVar = document.layers[id]; 
	return returnVar; 
}

function changePassBox()
{
	var the_div = returnObjById('passwordinput');
	the_div.innerHTML = '<input type="password" name="password" id="passwordpassbox" />';
	var the_box = returnObjById('passwordpassbox');
	the_box.focus();
	the_box.select();
}

function setPassFocus()
{
	var the_box = returnObjById('passwordpassbox');
	the_box.focus();
	the_box.select();
}

function openCVV()
{
	window.open('/join/cvv2.html', 'cvv2', 'width=500,height=400,scrollbars=no,resizable=no,location=no,menubar=no,status=no,toolbar=no');
}

/* AJAX */
function getHTTPObject()
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
	try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
		xmlhttp = false;
	  }
	}
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
	try {
	  xmlhttp = new XMLHttpRequest();
	} catch (e) {
	  xmlhttp = false;
	}
  }
  return xmlhttp;
}

function getContent(url,location) {
	xObj = false;
	xObj = getHTTPObject();
	xObj.open('GET', url,true);
	xObj.onreadystatechange=function() {
		if (xObj.readyState==4) {
			document.getElementById(location).innerHTML = xObj.responseText;
			if(xObj.responseText.indexOf('<' + 'script') != -1) {
				beginning = xObj.responseText.indexOf('<' + 'script');
				beginning = xObj.responseText.indexOf('>',beginning) + 1;
				ending = xObj.responseText.indexOf('</' + 'script')-1;
				scriptText = xObj.responseText.substring(beginning, ending);
				eval(scriptText);
			}
		}
	}
	xObj.send(null)
}

/* Invite a Friend */
function doInvite()
{
	var the_email = document.invitefriend_form.friendemail.value;
	getContent('/ajax/invite_friend.php?email=' + the_email,'invitefriend');
}
