//POPUP WINDOW FUNCTION
//
function popUpWindow(sPage,sWindow,iTop,iLeft,iHeight,iWidth,sScrollbars){
	popup=window.open(sPage,sWindow,"top=" + iTop + ",left=" + iLeft + ",height=" + iHeight + ",width=" + iWidth + ",scrollbars=" + sScrollbars);
	popup.focus();
}


//TRIM FUNCTION
//
function trim(inputString) {
	   // Removes leading and trailing spaces from the passed string. Also removes
	   // consecutive spaces and replaces it with one space. If something besides
	   // a string is passed in (null, custom object, etc.) then return the input.
	   if (typeof inputString != "string") { return inputString; }
	   var retValue = inputString;
	   var ch = retValue.substring(0, 1);
	   while (ch == " ") { // Check for spaces at the beginning of the string
	      retValue = retValue.substring(1, retValue.length);
	      ch = retValue.substring(0, 1);
	   }
	   ch = retValue.substring(retValue.length-1, retValue.length);
	   while (ch == " ") { // Check for spaces at the end of the string
	      retValue = retValue.substring(0, retValue.length-1);
	      ch = retValue.substring(retValue.length-1, retValue.length);
	   }
	   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
	      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
	   }
	   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


//VALIDATE FUNCTION
//
function validateInput(theForm) {

	if (trim(theForm.txtfname.value)==""){ 
		alert("Please enter a first name!");
		return;
	}

	if (trim(theForm.txtlname.value)==""){ 
		alert("Please enter a last name!");
		return;
	}

	if (trim(theForm.txtaddr1.value)==""){ 
		alert("Please enter an address!!");
		return;
	}

	if (trim(theForm.txtcity.value)==""){ 
		alert("Please enter a city!");
		return;
	}

	if (trim(theForm.txtstate.value)==""){ 
		alert("Please enter a State!");
		return;
	}

	if (trim(theForm.txtzip.value)==""){ 
		alert("Please enter a ZIP Code!");
		return;
	}
	
	if (trim(theForm.txtphoneday.value)==""){ 
		alert("Please enter a daytime phone number!");
		return;
	}
	if (trim(theForm.txtphoneeve.value)==""){ 
		alert("Please enter an evening phone number!");
		return;
	}

	if (trim(theForm.txtdob.value)==""){ 
		alert("Please enter your date of birth!");
		return;
	}

	if (trim(theForm.txtemail.value)==""){ 
		alert("Please enter an Email address");
		return;
	}
	theForm.submit()
}


//Populate SUB LIST functions for Sign-Up form
var arrayData = new Array(); 
 
arrayData[0]	= 'Member|Seeker ($30-$149)|' 
arrayData[1]	= 'Member|Explorer ($150-$499)|' 
arrayData[2]	= 'Member|Scholar ($500-$999)|' 

arrayData[3]	= 'Sponsor|Bronze ($1,000)|' 
arrayData[4]	= 'Sponsor|Silver ($5,000)|' 
arrayData[5]	= 'Sponsor|Gold ($10,000)|' 
arrayData[6]	= 'Sponsor|Platinum ($25,000)|' 
 
arrayData[7]	= 'Center for Corporate Change|Founder ($2,500)|' 
arrayData[8]	= 'Center for Corporate Change|Corporate Program Sponsor ($10,000)|' 
arrayData[9]	= 'Center for Corporate Change|Corporate Sponsor ($25,000)|' 
arrayData[10]	= 'Center for Corporate Change|Research Underwriter ($50,000)|' 

arrayData[11]	= 'Exploring Leadership|Fall 2003|' 
arrayData[12]	= 'Exploring Leadership|Spring 2003|' 

arrayData[13]	= 'Leadership Vail Valley|2003|' 
arrayData[14]	= 'Leadership Vail Valley|2004|'

arrayData[15]	= 'Film Series|September 25, 2003|'
arrayData[16]	= 'Film Series|October 8, 2003|'
arrayData[17]	= 'Film Series|October 23, 2003|'
arrayData[18]	= 'Film Series|November 13, 2003|'
arrayData[19]	= 'Film Series|December 4, 2003|'

arrayData[20]	= 'Changing the Game Forum|June 2004|' 

arrayData[21]	= 'Introduction to Alignment|September 25, 2003|' 
 
function populateData( name ) { 
 
	select	= window.document.frmSignUp.lstSub; 
	string	= ""; 
 
		// 0 - will display the new options only 
		// 1 - will display the first existing option plus the new options 
 
	count	= 0; 
 
		// Clear the old list (above element 0) 
 
	select.options.length = count; 
 
		// Place all matching categories into Options. 
 
	for( i = 0; i < arrayData.length; i++ ) { 
		string = arrayData[i].split( "|" ); 
		if( string[0] == name ) { 
			select.options[count++] = new Option( string[1] ); 
		} 
	}  
} 
 
function enableForm(theForm) {

	if (theForm.chkcertify_21.checked==true) {
		//enable all form fields
		//alert('enable fields');
		for (var i = 1; i<theForm.length; i++)
    		theForm.elements[i].disabled=false;
	}
	else {
		//disable all form fields
		//alert('disable fields');		
		for (var i = 2; i<theForm.length; i++)
    		theForm.elements[i].disabled=true;
	}
}