
function validateVisit(vid,uid){
	var url = "http://"+domainName+"/includes/validateQuery.php?vid="+vid+"&uid="+uid;
	$.get(url,showValidationResult);
}

function validateExport(uid){
	if(uid == null)
		return false;
	var url = "http://"+domainName+"/includes/validateExport.php?uid="+uid;
	$.get(url, showExportResult);
}

function checkEmailForRegistration(email){
	var url = "http://"+domainName+"/includes/validateRegister.php?email="+email;
	$.get(url, showRegistrationResult);
}

function showValidationResult(data){
	var root_node = data.getElementsByTagName('validVisit')[0].childNodes[0].nodeValue;
	if(root_node == 1)
		BuildLoad(marketType);
	else
		showInvalidQueryLogin();
}

function showExportResult(data){
	var root_node = data.getElementsByTagName('validExport')[0].childNodes[0].nodeValue;
	if(root_node == 1)
		exportResults();
	else
		showInvalidExport();
}

function showRegistrationResult(data){
	var root_node = data.getElementsByTagName('validRegister')[0].childNodes[0].nodeValue;
	var registerResultDiv = getElement('registerResultDiv');
	var emailAddress = getElement('email').value;
	if(root_node == 1){
		registerResultDiv.innerHTML = "Thank you for your interest in www.okcmarketdata.com, you now have access and can use your existing Price Edwards login.  If you need to reset your password please visit <a href=\"http://www.priceedwards.com/?task=Reset%20Password\">http://www.priceedwards.com/?task=Reset%20Password</a>";
	}else if(root_node == 2){
		registerResultDiv.innerHTML = "Thank you for your interest in www.okcmarketdata.com, our records show the email address you entered already has access.  If you need to reset your password please visit <a href=\"http://www.priceedwards.com/?task=Reset%20Password\">http://www.priceedwards.com/?task=Reset%20Password</a>";
	}
	else{
		registerResultDiv.innerHTML = "The email address "+emailAddress+" was not found in our system.  Please try again or <a href='?task=Register'>register</a> for more access";
	}
}