function Login(){
    //alert('here');return;
	var email = $('email').value;
	var password = $('password').value; 
	
	var NOemail = '';
	var NOpassword = '';
	var numtodo = 0;
	
	if (email.length == 0) {
		NOemail = 'Email Address';
		numtodo = numtodo + 1;
	}
	
	if (password.length == 0) {
		NOpassword = 'Password';
		numtodo = numtodo + 1;
	}
	
	if (numtodo > 0) {
		alert('Missing: ' + NOemail + '  ' + NOpassword);
		return;
	}
	
	var atemail = email.indexOf('@');
	if (atemail < 0) {
		alert('Invalid email');
		return;
	}
	
	var url = 'ClientLogin.asp?email=' + email + '&pw=' + password;
	
	new Ajax.Request(url, 
		{	method: 'get', 
			onSuccess: function(transport)	{
			
				eval(transport.responseText);
				
				var WhatDo = nWhatToDo;
				var AgentID = nAgentID;
				var MailCode = nMailCode;
				var DB = nDB;
				
				if (WhatDo == 0)		{	
					alert ('Sorry, this Login ID is not valid.');
				} 
				else if (WhatDo == 1)	{
					alert ('While your Login ID is valid, it is no longer authorized for Client Service access.');
				}
				else {
					{window.location = 'CS_Marketplace.asp?AgID=' + AgentID + '&MC=' + MailCode;}
				}
			},
			onFailure: function(transport)	{
				alert('Login Failed');
				return;
			}
		}
	)
	
}

function Login2(AgentID, MailCode){
    window.location = 'CS_Marketplace.asp?AgID=' + AgentID + '&MC=' + MailCode;
}

function SendPW(){

	var email = $('email').value;
	var numtodo = 0;
	
	if (email.length == 0) {
		alert('Missing: email');
		return;
	}
	
	var atemail = email.indexOf('@');
	if (atemail < 0) {
		alert('Invalid email');
		return;
	}
	
	var url = 'ClientPW.asp?email=' + email;
	new Ajax.Request(url, 
		{	method: 'get', 
			onSuccess: function(transport)	{
			
				eval(transport.responseText);
				var WhatDo = nWhatToDo;
				if (WhatDo == 0)		{	
					alert ('Sorry, this Login ID is not valid.');
				} 
				else if (WhatDo == 1)	{
					alert ('While your Login ID is valid, it is no longer authorized for Client Service access.');
				}
				else {
					alert ('An email has been sent with your password.');
				}
			},
			onFailure: function(transport)	{
				alert('Login Failed');
				return;
			}
		}
	)
	
}
