/* quick and dirty script to allow only one selection from
   the vroom.net shopping selection - and education location
   or a non-profit...cant select both..This could be cleaned up
   a little by consolidating the final domain destination (which
   is currently in the selectForm.php page.  Could also make this login
   a little cleaner. Could be made a bit more abstract too, but time
   is of the essence. bb 2/27/2007
*/


var destination = 'undefined'; //final page destination initially undefined to force a selection

function changeSelect(form){
	//this function is called onChange in either select box
	//the form variable passed is collected from the onChange(this.name) in the select box
	//on selectForm.php page
	var changeForm; //the form select element that will be reset when this is called
	//alert(form); //alert being used for testing
	if(form == 'educationlocation'){
		//if it's the educationlocation form (by name) then change the other to index 0
		changeForm = document.getElementById('nonplocationform');
		changeForm.value = 0;
		destination = document.getElementById('edlocationform').value;
	}
	if(form == 'nonprofitlocation'){
		//if it's the nonprofitlocation form (by name then change the other to index 0
		changeForm = document.getElementById('edlocationform');
		changeForm.value = 0;
		destination = document.getElementById('nonplocationform').value;
	}
	//alert(destination); // alert being used for testing
}
function changeLocation(){
	//changeLocation is used by the link on the button at page bottom "shop now"
	if(destination == 0 || destination == 'undefined'){
		alert('Please select an organization you want to support\n from one of the drop-down lists below before\n proceeding to shop');
	}else{
		window.location = destination;
	}
}
/* this is all be done in the page without the use of form tags.  just the select boxes
this could cause issues in teh future or on other browsers...tested on FF1.5 and IE6
bb 2/27/07
*/