//--   JAVASCRIPT FOR MEDIA SIGN-UP FORM  ---------------------------------------------------------------------


//-- set focus when page loads  -------------------------------------------------------
document.booking.email.focus();
document.booking.email.select();

//-- error messages  -------------------------------------------------------
var nogroupmsg = "Group(s) being booked has not been indicated";


var emailmsg0 = "No email address has been given";
var emailmsg = "Invalid email address has been given";

var namemsg = "Contact Name  has not been given"; 

var phonemsg1 = "No phone number has been given"; 
var phonemsg2 = "Phone number is incomplete"; 
var phonemsg3 = "Phone extension given is not numeric";

var tabmsg1 = "Area code of phone number";
var tabmsg2 = "First 3 digits of phone number";
var tabmsg3 = "Last 4 digits of phone number";

var tabmsg = " is not numeric<br />"
				 + "PLEASE RE-ENTER NUMBER";
var tabmsgfull;



//-- not required fields ---
//var companyname = "";
//var websiteURL = "";

var eventnamemsg = "Event request is for has not been given";
var eventdatemsg = "Date of event has not been given";

var eventtimemsg = "Event time range has not been given";
var eventtimeSmsg = "Start time of event has not been given";
var eventtimeFmsg = "End time of event has not been given";

var venuemsg = "Location of event has not been given";
var addressmsg = "Address has not been given"; 
var citymsg = "City has not been given"; 
//-- state is pre-set to Washington
//var statemsg = "State has not been given";

var zipmsg1 = "Zip Code has not been given";
var zipmsg2 = "Invalid Zip Code has been given";


var audiencemsg = "Expected size of audience has not been indicated";

var agerangemsg = "Age range of audience has not been indicated";
var ageLomsg = "Low end of audience age range has not been indicated";
var ageHimsg = "Hi end of audience age range has not been indicated";

var lengthmsg = "Length of performance desired has not been indicated";

var feemsg = "Please indicate whether or not a fee will be offered";
var feeamtmsg = "Fee entered is not numeric<br>"
				  + "PLEASE RE-ENTER AMOUNT";
var nofeemsg = "Amount of Budget / Fee offered for performance as not been indicated";


var pianomsg = "Please indicate whether a keyboard / piano is available at the venue<br>"
				+ "If unknown - select \'???\'";
				
var soundmsg = "Please indicate whether a sound system is available at the venue<br>"
				+ "If unknown - select \'???\'";

var lgbtmsg = "Please indicate whether it is a gay / gay-friendly event";

var sellmsg = "Please indicate whether our merchandise can be sold at the event";

var waivemsg = "Please indicate whether commission fees will be waived on merchandise sold";



//-- validate form on submission  -------------------------------------------------------
function validateBooking()
{	 
//--  get values from form
	//-- hidden fields - 
	var bookgroup = document.booking.bookgroup.value;
	//-- below only used for determining page to load
	//var section = document.booking.section.value;
	//-- hidden fields - 

	var smc, swc, ae, csp, ss;
	
	switch ( bookgroup )
	 {  case "all":
			smc = document.booking.smcALL.checked;
			swc = document.booking.swcALL.checked;
			//ae = document.booking.aedonisALL.checked;
			csp = document.booking.cspALL.checked;
			ss = document.booking.ssALL.checked;
			break;
		case "smc":
			//ae = document.booking.aedonis.checked;
			csp = document.booking.csp.checked;
			break;
		case "swc":
			ss = document.booking.ss.checked;
			break;

	 } //-- end switch 


	var emailOK = true;
	var email = document.booking.email.value;

	var fullname = document.booking.contactname.value;

	var phoneOK = true;
	var HM_area = document.booking.phoneHM_area.value;
	var HM_prefix = document.booking.phoneHM_prefix.value;
	var HM_suffix = document.booking.phoneHM_suffix.value;
	

	//-- optional fields - 
	var WK_area = document.booking.phoneWK_area.value;
	var WK_prefix = document.booking.phoneWK_prefix.value;
	var WK_suffix = document.booking.phoneWK_suffix.value;
	var WK_ext = document.booking.phoneWK_ext.value;

	var nameCompany = document.booking.contactcompany.value;
	//var websiteURL = document.booking.contactURL.value;
	//-- optional fields - 

	//-- event fields --
	var eventname = document.booking.eventname.value;
	var eventdate = document.booking.eventdate.value;
	var eventtimeS = document.booking.eventtimeS.value;
	var eventtimeF = document.booking.eventtimeF.value;
	
	var venue = document.booking.venue.value;
	var address = document.booking.address.value;
	var city = document.booking.city.value;
	var state = document.booking.state.value;
	var zip = document.booking.zip.value;
		
	var audiencesize = document.booking.audiencesize.value;
	var agerangeLo = document.booking.agerangeLo.value;
	var agerangeHi = document.booking.agerangeHi.value;
	var performlength = document.booking.performancelength.value;
	

	var fee = document.booking.fee.checked;
	var feeamount = document.booking.feeamount.value;
	
	//-- rollthru radio buttons below
	//var piano = document.booking.piano.value;
	var keypianoK = document.booking.keypiano_K.checked;
	var keypianoP = document.booking.keypiano_P.checked;
	//var sound = document.booking.sound.value;
	//var lgbt = document.booking.lgbt.value;
	//var sell = document.booking.sell.value;
	//var waive = document.booking.waive.value;

	//-- optional fields - 	
	var eventdetails = document.booking.eventdetails.value;
	var questions = document.booking.questions.value;
	//-- optional fields - 
	

		
//-- clear previous error markers
	for ( var i = 0; i < document.booking.elements.length; i++ )
		{  document.booking.elements[ i ].style.backgroundColor = "";		}

//-- validate group fields  -------------------------------------------------------	
	if ( bookgroup == "all")
	  { if ( (!smc) && (!swc) && (!csp) & (!ss)  )
		{  //document.booking.smcALL.style.backgroundColor = errcolor;
		   window.scrollTo(0,0);
		   document.booking.smcALL.focus();
		   anon_pop( nogroupmsg, 'smcALL' );
	        return false;  }
	  } //-- end if block    

	
//-- validate email field  -------------------------------------------------------	
	//-- if email address is given, check to see if it is valid
	if ( !email )
		{   emailOK = false;		}
		
	if ( !emailOK ) 
		{  window.scrollTo(0,0);
		   document.booking.email.style.backgroundColor = errcolor;
		   anon_pop( emailmsg0, 'email' );
		   return false;
		 }   //-- end if block  [ emailOK ]

	
	//-- if email address is given, check to see if it is valid
	if ( email != "" )
		{   emailOK = validateEmail( email );		}
		
	if ( !emailOK ) 
		{  window.scrollTo(0,0);
		   document.booking.email.style.backgroundColor = errcolor;
		   document.booking.email.select();
		   anon_pop( emailmsg, 'email' );
		   return false;
		 }   //-- end if block  [ emailOK ]


//-- verify that name field is completed  ------------------------
	if ( fullname == "" ) 
		{  window.scrollTo(0,0);	
		   document.booking.contactname.style.backgroundColor = errcolor;
		   document.booking.contactname.focus();
		   anon_pop( namemsg, 'contactname' );
		   return false;
		}


//-- validate phone number fields  -------------------------------
	
	//-- validate HOME phone number -------------------------------
	var phoneOK = validHomePhone( HM_area, HM_prefix, HM_suffix )

	if (!phoneOK)
	  { return false; }

	var phoneOK = validWorkPhone( WK_area, WK_prefix, WK_suffix, WK_ext )
	if (!phoneOK)
	  { return false; }


//-- verify that eventname is complete
	if ( !eventname )
		{	document.booking.eventname.style.backgroundColor = errcolor;
			document.booking.contactcompany.focus();
			document.booking.eventname.focus();
			anon_pop( eventnamemsg, 'eventname' );
			return false;
		} //-- end if block  [ eventname ]


//-- verify that eventdate is complete
	if ( !eventdate )
		{	document.booking.eventdate.style.backgroundColor = errcolor;
			document.booking.contactcompany.focus();
			document.booking.eventdate.focus();
			anon_pop( eventdatemsg, 'eventdate' );
			return false;
		} //-- end if block  [ no eventdate ]


//-- verify that eventtime is complete
	if ( !eventtimeS && !eventtimeF )
		{	document.booking.eventtimeS.style.backgroundColor = errcolor;
		    document.booking.eventtimeF.style.backgroundColor = errcolor;
			document.booking.contactcompany.focus();
			document.booking.eventtimeS.focus();
			anon_pop( eventtimemsg, 'eventtimeS' );
			return false;
		} //-- end if block  [ no eventtime ]

	//-- no start time - end time given
	if ( !eventtimeS || !eventtimeF )
	 {	
		if ( !eventtimeS )
		  {	document.booking.eventtimeS.style.backgroundColor = errcolor;
			document.booking.contactcompany.focus();
			document.booking.eventtimeS.focus();
			anon_pop( eventtimeSmsg, 'eventtimeS' );
			return false;
		   } 

		if ( !eventtimeF )
		  {	document.booking.eventtimeF.style.backgroundColor = errcolor;
			document.booking.contactcompany.focus();
			document.booking.eventtimeF.focus();
			anon_pop( eventtimeFmsg, 'eventtimeF' );
			return false;
		  } 

	  } //-- end if block   [ eventtime incomplete ]

//-- verify that venue is complete
	if ( !venue )
		{	document.booking.venue.style.backgroundColor = errcolor;
			document.booking.venue.focus();
			anon_pop( venuemsg, 'venue' );
			return false;
		} //-- end if block  [ venue ]


//-- verify that address fields are complete
	if ( !address ) 
		{ 	document.booking.address.style.backgroundColor = errcolor;
			document.booking.address.focus();
			anon_pop( addressmsg, 'address' );
			return false;
		}

	if ( !city )
		{ 	document.booking.city.style.backgroundColor = errcolor;
			document.booking.city.focus();
			anon_pop( citymsg, 'city' );
			return false;
		}


	if ( !zip )
		{ 	document.booking.zip.style.backgroundColor = errcolor;
			document.booking.zip.focus();
			anon_pop( zipmsg1, 'zip' );
			return false;
		}
	else
		{	zipOK = validateZip( zip );		}

	if ( !zipOK )
		{ 	document.booking.zip.style.backgroundColor = errcolor;
			document.booking.zip.focus();
			document.booking.zip.select();
			anon_pop( zipmsg2, 'zip' );
			return false;
		}
	

//-- verify that audience size is complete
	if ( !audiencesize )
		{	document.booking.audiencesize.style.backgroundColor = errcolor;
			document.booking.zip.focus();
			document.booking.audiencesize.focus();
			anon_pop( audiencemsg, 'audiencesize' );
			return false;
		} //-- end if block  [ audience size ]


//-- verify that age range is complete
	if ( ( !agerangeLo ) && ( !agerangeHi ) )
		{	document.booking.agerangeLo.style.backgroundColor = errcolor;
			document.booking.agerangeHi.style.backgroundColor = errcolor;
			document.booking.zip.focus();
			document.booking.agerangeLo.focus();
			anon_pop( agerangemsg, 'agerangeLo' );
			return false;
		} //-- end if block  [ agerange empty ]


	if (( !agerangeLo ) || ( !agerangeHi ) )
		{ if ( !agerangeLo ) 
		     { document.booking.agerangeLo.style.backgroundColor = errcolor;
			   document.booking.zip.focus();
			   document.booking.agerangeLo.focus();
				anon_pop( ageLomsg, 'agerangeLo' );
				return false;  }
		  
		  if ( !agerangeHi ) 
		     { document.booking.agerangeHi.style.backgroundColor = errcolor;
			   document.booking.zip.focus();
			   document.booking.agerangeHi.focus();
				anon_pop( ageHimsg, 'agerangeHi' );
				return false;  }
				
		} //-- end if block  [ agerange incomplete ]


//-- verify that performance length is complete
	if ( !performlength )
		{	document.booking.performancelength.style.backgroundColor = errcolor;
			document.booking.zip.focus();
			document.booking.performancelength.focus();
			anon_pop( lengthmsg, 'performancelength' );
			return false;
		} //-- end if block  [ performance length ]



//-- verify fee has been indicated
	var feeOK = false;
	var feeyes = false;
	
	for ( var i = 0; i < document.booking.fee.length; i++ )
	  { if ( document.booking.fee[i].checked )
		    { if ( document.booking.fee[i].value == "yes")
		       { feeyes = true; }
		      feeOK = true;	}
	  }    
	
	if ( !feeOK )
		{ anon_pop( feemsg, 'feeY' );
		  return false;
		}
	else
	   { if ( feeyes && !feeamount )
	       { document.booking.performancelength.focus();
	         document.booking.feeamount.focus();
	         anon_pop( nofeemsg, 'feeamount');
	         return false;
	       }
	   }


//-- verify piano has been indicated
	var pianoOK = false;

	for ( var i = 0; i < document.booking.piano.length; i++ )
	  { if ( document.booking.piano[i].checked )
		    { pianoOK = true;	}
	  }    
	
	if ( !pianoOK )
		{ anon_pop( pianomsg, 'pianoY' );
		  return false;
		}

//-- verify sound has been indicated
	var soundOK = false;

	for ( var i = 0; i < document.booking.sound.length; i++ )
	  { if ( document.booking.sound[i].checked )
		    { soundOK = true;	}
	  }    
	
	if ( !soundOK )
		{ anon_pop( soundmsg, 'soundY' );
		  return false;
		}

//-- verify lgbt has been indicated
	var lgbtOK = false;

	for ( var i = 0; i < document.booking.lgbt.length; i++ )
	  { if ( document.booking.lgbt[i].checked )
		    { lgbtOK = true;	}
	  }    
	
	if ( !lgbtOK )
		{ anon_pop( lgbtmsg, 'lgbtY' );
		  return false;
		}


//-- verify sell has been indicated
	var sellOK = false;
	var sellcheck = false; 
	
	for ( var i = 0; i < document.booking.sell.length; i++ )
	  { if ( document.booking.sell[i].checked )
		  { if( document.booking.sell[i].value == "yes")
		   	  {sellcheck = true;}
		    sellOK = true;	}
	  }    
	
	if ( !sellOK )
		{ anon_pop( sellmsg, 'sellY' );
		  return false;
		}

//-- verify waive has been indicated
	var waiveOK = false;

	for ( var i = 0; i < document.booking.waive.length; i++ )
	  { if ( document.booking.waive[i].checked )
		    { waiveOK = true;	}
	  }    
		
	//if ( sellcheck && !waiveOK )
	if ( !waiveOK )
	  { anon_pop( waivemsg, 'waiveY' );
	    return false;
	  }
	//else
	//  { document.booking.waive[1].checked = true; }

	return true;

}	//-- end function  [ validateInfo ]



//-- validate email address  -------------------------------------------------------
//--  min req. for email is 6 chars, which are:  4 - alpha/numeric, 1 - at  '@' sign, and 1 - period
function validateEmail ( address )
{
	var toggle = true;

	if ( address == "" ) 
		{ return toggle;	}
	
  if ( ( address.indexOf("@") == -1 ) || ( address.indexOf(".") == -1 ) || ( address.length <6 ) )
	{	toggle = false;	}

	return toggle;

}	//-- end function  [ validateEmail ]



//-- validate zipcode  -------------------------------------------------------
function validateZip( zippy )
{		var toggle = true;
		
		if (  ( zippy.length == 5 )  ||  ( zippy.length == 9 ) )
				{	if  ( reg.test( zippy ) ) 
						{  toggle = false;  }
				}
		else if ( zippy.length == 10 )  
				{	zipreg = /[0-9]{1,5}[-]{1,1}[0-9]{1,4}/;
					if  ( !zipreg.test( zippy ) ) 
						{  toggle = false;  }
				}
		else
				{   toggle = false;		}

		return toggle;
		
} //--  end function  [ validateZip ]



//-- auto-tab to next phone number  field -------------------------------------------------------
function phonetab( currfield, currvalue )
{	
	var numlen = 3;
	
	if (( currfield == "phoneHM_suffix" ) || ( currfield == "phoneWK_suffix" ) )
		{  numlen = 4;	}

	var currlen = new String( currvalue );
	var currlen = currlen.length;
	var currlen = new Number( currlen );
	
	if ( currlen == numlen ) 
		{ 
			if  ( reg.test( currvalue ) ) 
				{   if ( ( currfield == "phoneHM_area" ) || ( currfield == "phoneWK_area" ) )
						{	tabmsgfull = tabmsg1 + tabmsg;  }
					else if ( ( currfield == "phoneHM_prefix" ) || ( currfield == "phoneWK_prefix" ) )
						{	tabmsgfull = tabmsg2 + tabmsg;  }
					else if ( ( currfield == "phoneHM_suffix" ) || ( currfield == "phoneWK_suffix" ) )
						{	tabmsgfull = tabmsg3 + tabmsg;  }				
					
					anon_pop( tabmsgfull, currfield );
					return false;
				} //-- end if block  [ reg test ]
		
			switch ( currfield )
				{		case "phoneHM_area" :
								document.booking.phoneHM_prefix.focus();
								break;
						case "phoneHM_prefix" :
								document.booking.phoneHM_suffix.focus();
								break;
						case "phoneHM_suffix" :
								document.booking.phoneWK_area.focus();
								break;
						case "phoneWK_area" :
								document.booking.phoneWK_prefix.focus();
								break;
						case "phoneWK_prefix" :
								document.booking.phoneWK_suffix.focus();
								break;
						case "phoneWK_suffix" :
								document.booking.phoneWK_ext.focus();
								break;
				} //-- end switch block		
	
	}  //-- end if block

}	//-- end function  [ phonetab ]




//-- show hide fee amount table row  ------------------------------------------
function feeoffered( state )
{
	if(state)
	  { document.getElementById("feerow").style.display = "block";
	    //document.getElementById("feerowY").style.display = "block";
	    //document.getElementById("feerowN").style.display = "block";
	    document.getElementById("feeamount").focus(); 
	    document.getElementById("feeamount").select();
	  }
	else
	  { document.getElementById("feeamount").value = "";
	    document.getElementById("feerow").style.display = "none";
	    //document.getElementById("feerowY").style.display = "none";
	    //document.getElementById("feerowN").style.display = "none";
	  } 

} //-- end function  [ feeoffered ]



//-- validate fee amount is numeric -------------------------------------------
function validateFeeAmt( currfield, currvalue )
{
	if  ( reg.test( currvalue ) ) 
		{ //document.booking.performancelength.focus();
		  document.booking.feeamount.focus();
		  document.booking.feeamount.select();
		  anon_pop( feeamtmsg, currfield );
		  return false;  }
	
} //-- end function  [ validateFeeAmt ]



//-- show hide have piano table row  ------------------------------------------
function havepiano( state )
{
	if(state)
	  { document.getElementById("pianorow").style.display = "block";
	    document.getElementById("keypiano_K").focus(); 
	  }
	else
	  { document.getElementById("keypiano_K").checked = false;
	    document.getElementById("keypiano_P").checked = false;
	    document.getElementById("pianorow").style.display = "none";
	  } 

} //-- end function  [ havepiano ]


function validHomePhone( area, prefix, suffix )
{  var phoneOK = true;

//-- verify that phone fields are complete
	if (  ( !area ) && ( !prefix ) && ( !suffix )  )
		{	phoneOK = false;			}
	
	//-- if all 3 fields are empty 
	if ( !phoneOK ) 
		{  window.scrollTo(0,0);
		   document.booking.phoneHM_area.style.backgroundColor = errcolor;
		   document.booking.phoneHM_prefix.style.backgroundColor = errcolor;
		   document.booking.phoneHM_suffix.style.backgroundColor = errcolor;
		   document.booking.email.focus();
		   document.booking.phoneHM_area.focus();
		   anon_pop( phonemsg1, 'phoneHM_area' );
		   return false;
		} // end if block  [ phoneOK  - empty fields ]


//-- verify that any phone fields are complete
	if (  ( !area ) || ( !prefix ) || ( !suffix )  )
		{	phoneOK = false;			}

	if ( !phoneOK ) 
		{    var thisbox = "";
				document.booking.email.focus();	
				document.booking.phoneHM_suffix.focus();
				
				if ( !suffix )
					{	thisbox = "phoneHM_suffix";
						document.booking.phoneHM_suffix.style.backgroundColor = errcolor;		}

				if ( !prefix )
					{	thisbox = "phoneHM_prefix";
						document.booking.phoneHM_prefix.style.backgroundColor = errcolor;	}

				if ( !area )
					{	thisbox = "phoneHM_area";
						document.booking.phoneHM_area.style.backgroundColor = errcolor;		}
			
			window.scrollTo(0,0);
			anon_pop( phonemsg2, thisbox );
			return false;
		
		} // end if block  [ phoneOK  - empty fields ]



	//-- verify value of all 3 fields are digits
	if ( phoneOK )
		{	
			if  ( reg.test( area ) ) 
				{  	window.scrollTo(0,0);
				    document.booking.phoneHM_area.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneHM_area.focus();
					document.booking.phoneHM_area.select();
					anon_pop( tabmsg1 + tabmsg, 'phoneHM_area' );
					return false;
				}
			else
				{  if ( area.length != 3 )
						{  	window.scrollTo(0,0);
						    document.booking.phoneHM_area.style.backgroundColor = errcolor;
							document.booking.email.focus();
							document.booking.phoneHM_area.focus();
							document.booking.phoneHM_area.select();
							anon_pop( phonemsg2 + "<br>" + tabmsg1, 'phoneHM_area' );
							return false;		}
				} //-- end if block  [ reg test ]


			if  ( reg.test( prefix ) ) 
				{  	window.scrollTo(0,0);
				    document.booking.phoneHM_prefix.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneHM_prefix.focus();
					document.booking.phoneHM_prefix.select();
					anon_pop( tabmsg2 + tabmsg, 'phoneHM_prefix' );
					return false;
				}
			else
				{  if ( prefix.length != 3 )
						{  	window.scrollTo(0,0);
						    document.booking.phoneHM_prefix.style.backgroundColor = errcolor;
							document.booking.email.focus();
							document.booking.phoneHM_prefix.focus();
							document.booking.phoneHM_prefix.select();
							anon_pop( phonemsg2 + "<br>" + tabmsg2, 'phoneHM_prefix' );
							return false;		}
				} //-- end if block  [ reg test ]


			if  ( reg.test( suffix ) ) 
				{  window.scrollTo(0,0);
				   document.booking.phoneHM_suffix.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneHM_suffix.focus();
					document.booking.phoneHM_suffix.select();
					anon_pop( tabmsg3 + tabmsg, 'phoneHM_suffix' );
					return false;
				}
			else
				{  if ( suffix.length != 4 )
						{  window.scrollTo(0,0);	
						   document.booking.phoneHM_suffix.style.backgroundColor = errcolor;
							document.booking.email.focus();
							document.booking.phoneHM_suffix.focus();
							document.booking.phoneHM_suffix.select();
							anon_pop( phonemsg2 + "<br>" + tabmsg3, 'phoneHM_suffix' );
							return false;		}
				} //-- end if block  [ reg test ]

			
		} //-- end if block   [ phoneOK - all digits ]

	return phoneOK;

} //-- end function [ validHomePhone ]




function validWorkPhone( area, prefix, suffix, ext )
{  var phoneOK = true;

//-- verify that phone fields are complete
	if (  ( !area ) && ( !prefix ) && ( !suffix )  )
		{	return phoneOK;			}

//-- verify that any phone fields are complete
	if (  ( !area ) || ( !prefix ) || ( !suffix )  )
		{	phoneOK = false;			}

	if ( !phoneOK ) 
		{    var thisbox = "";
				document.booking.email.focus();	
				document.booking.phoneWK_suffix.focus();
				
				if ( !suffix )
					{	thisbox = "phoneWK_suffix";
						document.booking.phoneWK_suffix.style.backgroundColor = errcolor;		}

				if ( !prefix )
					{	thisbox = "phoneWK_prefix";
						document.booking.phoneWK_prefix.style.backgroundColor = errcolor;	}

				if ( !area )
					{	thisbox = "phoneWK_area";
						document.booking.phoneWK_area.style.backgroundColor = errcolor;		}
			
			window.scrollTo(0,0);
			anon_pop( phonemsg2, thisbox );
			return false;
		
		} // end if block  [ phoneOK  - empty fields ]



	//-- verify value of all 3 fields are digits
	if ( phoneOK )
		{	
			if  ( reg.test( area ) ) 
				{  window.scrollTo(0,0);	
				   document.booking.phoneWK_area.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneWK_area.focus();
					document.booking.phoneWK_area.select();
					anon_pop( tabmsg1 + tabmsg, 'phoneWK_area' );
					return false;
				}
			else
				{  if ( area.length != 3 )
						{  window.scrollTo(0,0); 	
						   document.booking.phoneWK_area.style.backgroundColor = errcolor;
							document.booking.email.focus();
							document.booking.phoneWK_area.focus();
							document.booking.phoneWK_area.select();
							anon_pop( phonemsg2 + "<br>" + tabmsg1, 'phoneWK_area' );
							return false;		}
				} //-- end if block  [ reg test ]


			if  ( reg.test( prefix ) ) 
				{  window.scrollTo(0,0);	
				   document.booking.phoneWK_prefix.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneWK_prefix.focus();
					document.booking.phoneWK_prefix.select();
					anon_pop( tabmsg2 + tabmsg, 'phoneWK_prefix' );
					return false;
				}
			else
				{  if ( prefix.length != 3 )
						{  window.scrollTo(0,0);	
						   document.booking.phoneWK_prefix.style.backgroundColor = errcolor;
							document.booking.email.focus();
							document.booking.phoneWK_prefix.focus();
							document.booking.phoneWK_prefix.select();
							anon_pop( phonemsg2 + "<br>" + tabmsg2, 'phoneWK_prefix' );
							return false;		}
				} //-- end if block  [ reg test ]


			if  ( reg.test( suffix ) ) 
				{  window.scrollTo(0,0);
				   document.booking.phoneWK_suffix.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneWK_suffix.focus();
					document.booking.phoneWK_suffix.select();
					anon_pop( tabmsg3 + tabmsg, 'phoneWK_suffix' );
					return false;
				}
			else
				{  if ( suffix.length != 4 )
						{  window.scrollTo(0,0);	
						   document.booking.phoneWK_suffix.style.backgroundColor = errcolor;
							document.booking.email.focus();
							document.booking.phoneWK_suffix.focus();
							document.booking.phoneWK_suffix.select();
							anon_pop( phonemsg2 + "<br>" + tabmsg3, 'phoneWK_suffix' );
							return false;		}
				} //-- end if block  [ reg test ]

			
		} //-- end if block   [ phoneOK - all digits ]


//-- verify extension is all digits
	if ( ext )
		{   if  ( reg.test( ext ) ) 
				{	//document.booking.phoneext.value = "";
					window.scrollTo(0,0);
					document.booking.phoneWK_ext.style.backgroundColor = errcolor;
					document.booking.email.focus();
					document.booking.phoneWK_ext.select();
					anon_pop( phonemsg3, 'phoneWK_ext' );
					return false;
				} //-- end if block  [ reg test ]
		
		}//-- end if block  [ ext not blank ]

	return phoneOK;	  

} //-- end function [ validPhone ]

