$(document).ready(function(){
						   
 //email form response
  $(function () {
        $('#subForm').submit(function (e) {
            e.preventDefault();
            $.getJSON(
            this.action + "?callback=?",
            $(this).serialize(),
            function (data) {
                if (data.Status === 400) {
                    alert("Error: " + data.Message);
                } else { // 200
                    alert("Success: " + data.Message);
                }
            });
        });
    });
	
	
function changeColor(el,color){
	$(el).addClass(color);	
}

var randColor = 'purple';

changeColor('h1 a, #donate, #keystone_footer',randColor);

//focus the text fields

function focusFields(){

$(".text_box, #keywords").focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
		
	}
}).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	}
});
}

focusFields();

$(function(){
      // bind change event to select
      $('#keystone_sites').bind('change', function () {
          var url = $(this).val(); // get selected value
          if (url) { // require a URL
              window.location = url; // redirect
          }
          return false;
      });
    });

});
