//
// Portions Copyright(c) 2006, The GoHome Networks, Inc. All rights reserved.
// No reproduction, distribution, or transmission of the copyrighted
// materials at this site is permitted without the written permission
// of The GoHome Networks, unless otherwise specified. MLSWorks,
// BrokerWorks, ActiveListing, and AdTracker are Trademarks of
// The GoHome Networks, Inc.
// 
// ActiveAgent is a registered Service Mark of The GoHome Networks, Inc.
//

//
// ActiveAgent MLS Check
//

//
// Return a string in the format 'YYYY-MM-DD' from a date object
//

var valid_mls = new Array('RMLS', 'NTX', 'NTREIS', 'WVMLS', 'NWMLS', 'OMLS', 'MLSCO', 'CCAR', 'EBRDI', 'SOCAL','SOCALMLS', 'PCMLS');
var nexturl = new Array('/in_availability_left_no.shtml', '/in_availability_left_yes.shtml');
var intro   = new Array('The following agent has done an IDX availability check which was negative.', 'The following agent has done an IDX availability check which was positive.');

//
// Set Next-URL and Introduction
//
function CheckForValidMLS()
{
	var mlsfield = document.getElementsByName('require:MLS')[0].value;

	document.getElementsByName('ignore:next-url')[0].value = nexturl[0];
	document.getElementsByName('Introduction')[0].value = intro[0];

	mlsfield = mlsfield.toUpperCase();
	var m;
	var found = 0;
	for(m = 0; m < valid_mls.length; m++) {
		if (mlsfield == valid_mls[m]) {
			document.getElementsByName('ignore:next-url')[0].value = nexturl[1];
			document.getElementsByName('Introduction')[0].value = intro[1];
			return true;
		}
	}
	return true;
}
