// javascript for  PropertyTaxLoansTexas.com



    // global validators
    var gNonBlankValidator      = /\w/                                                                                  ; // must contain at least 1 word character
    var gEmailValidator         = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ ;
    var gOneFieldPhoneNumber    = /^\(?[\d]{3}\)?[ .\/_\-]?[\d]{3}[ .\/_\-]?[\d]{4}/                                    ; // 3 part phone number in one field.



    function validateThePropertyTaxRequest(pageLanguage) {

        var nameIsValid  = false;
        var phoneIsValid = false;
        var theMessage   = "" ;
        var fieldToFocus = "";

        nameIsValid  = gNonBlankValidator   .test( $('#firstAndLastName')   .val() );
        phoneIsValid = gOneFieldPhoneNumber .test( $('#phone')              .val() );

        if ( nameIsValid && phoneIsValid ) {
        	if (pageLanguage == 'es') {
				theMessage =  "Gracias por solicitar una applicacion para un estimaci\363n de preastamo para sus impuestos inmobilarios. \n\n" ;
				theMessage += "Siguiente nos pondremos en contacto con usted:\n\n" ;
				theMessage += "* juntar alguna informaci\363n y proporcionar la estimaci\363n\n" ;
				theMessage += "* contestar cualquier pregunta que usted tiene sobre pr\351stamos de impuestos inmobilarios.\n\n" ;
				theMessage += "Le llamaremos dentro de poco o llamenos gratis al 866-456-3839.\nGracias." ;
				alert(theMessage);
				return true;
        	} else {
				theMessage =  "Thank you for requesting a property tax loan estimate.\n\n" ;
				theMessage += "Next, we will contact you to:\n\n" ;
				theMessage += "* gather some information and provide the estimate\n" ;
				theMessage += "* answer any questions you have about property tax loans\n\n" ;
				theMessage += "We will call you shortly or feel free to call us at 866-456-3839.\nThank you." ;
				alert(theMessage);
				return true;
            }

        } else {
        	if (pageLanguage == 'es') {
           		theMessage = "Necesitamos un poco m\341s informaci\363n para ponernos en contacto con usted.\n\n" ;
			} else {
           		theMessage = "We need a little more information to contact you.\nPlease complete the following.\n\n" ;
            }

            if ( !nameIsValid ) {
				if (pageLanguage == 'es') {
                	theMessage += "* Por favor entre en su nombre y apellido.\n" ;
                } else {
                	theMessage += "* Please enter your first and last names.\n" ;
                }
                fieldToFocus = "#firstAndLastName" ;
            }
            if ( !phoneIsValid ) {
				if (pageLanguage == 'es') {
					theMessage += "* Por favor entre su n\372mero de tel\351fono incluso el prefijo local.\n  Ejemplo: 512 123-4567\n" ;
                } else {
					theMessage += "* Please enter your phone number including area code.\n  Example:  512 123-4567\n" ;
                }
                if ( fieldToFocus == "") {fieldToFocus = "#phone";}
            }
            $(fieldToFocus).focus();
            alert(theMessage);
            return false;
        }

    }



    function setupAStandardPage(pageLanguage) {
        $('input#firstAndLastName').focus();

        if (pageLanguage == 'es') {
			$('input#applyNowButton').hover(
				function(){ $(this).attr({src : "resources/button-RecibaUnEstimadoGratisHover.gif" 		});},
				function(){ $(this).attr({src : "resources/button-RecibaUnEstimadoGratis.gif"      		});}
			);
        } else {
			$('input#applyNowButton').hover(
				function(){ $(this).attr({src : "resources/button-ApplyForApropertyTaxloanNowHover.gif" });},
				function(){ $(this).attr({src : "resources/button-ApplyForApropertyTaxloanNow.gif"      });}
			);
        }
    }



// utilities

function cnsl(whatToLog) {
    if( navigator.appName == "Microsoft Internet Explorer" ) {return;}
    console.log(whatToLog);
}



