// JavaScript Document
var xmlHttp

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function taketest(id)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url=location.protocol+"//edifferentstrokes.com/ds_login_proc.asp?";

if(id==1){
	if(document.getElementById("username").value.search("@") ==-1){
   		url=url+"username=";
	}else{
		url=url+"email=";
	}	
	url=url+document.getElementById("username").value+"&password="+document.getElementById("password").value;
	
}
else if(id==2){
url=url+"instid="+queryString("instid")+"&authcode="+document.getElementById("authcode").value;
}
else if(id==3){
   url=url+"email="+document.getElementById("email").value+"&password="+document.getElementById("password").value;
}
else if(id==4){
url=url+"instid="+document.getElementById("select1").value+"&authcode="+document.getElementById("authcode").value;
}
//alert(url);
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return false;
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{
		if(xmlHttp.responseText=="good"){
			window.location.assign("ds_userinfo.asp");
		}
		else if(xmlHttp.responseText=="auth"){
			window.location.assign("ds_results.asp");
		}
		else if(xmlHttp.responseText=="client"){
			window.location.assign("ds_clientadmin.asp");
		}
		else{
			alert(xmlHttp.responseText);
			//document.getElementById("content_wrapper").innerHTML=xmlHttp.responseText;
		}
	}
}
function showexisting(){
	document.getElementById("returning_user_link").style.display="none"
	document.getElementById("returning_user").style.display="block"
	document.getElementById("new_user_link").style.display="block"
	document.getElementById("login").style.display="none"
}

function shownew(){
	document.getElementById("returning_user_link").style.display="block"
	document.getElementById("returning_user").style.display="none"
	document.getElementById("new_user_link").style.display="none"
	document.getElementById("login").style.display="block"
}

function logout()
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="ds_login_proc.asp?logout=true";
xmlHttp.onreadystatechange=logout_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function logout_stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{
			window.location.assign("http://edifferentstrokes.com/default.asp");
	}
}
