function switchStylestyle(styleName){
        $('link[@rel*=style]').each(function(i)
        {
                this.disabled = true;
                if (this.getAttribute('title') == styleName) this.disabled = false;
        });
}

function form_swap_values(){
    swapValues = [];
    $(".swap_value").each(function(i){
        swapValues[i] = $(this).val();
        $(this).focus(function(){
            if ($(this).val() == swapValues[i]) {$(this).val("");}}).blur(function(){
            if ($.trim($(this).val()) == "") {$(this).val(swapValues[i]);}});});
}   

function init_form_fields(){
var inputs = $(":text");
for(x=0;x < inputs.length;x++){

     switch(inputs[x].id){
        
        case "qsEmail":
        $(inputs[x]).bind("focus", function(){
          if(this.value == 'Enter your email address here')
             this.value = '';
        });
        $(inputs[x]).bind("blur", function(){
          if(this.value == '')
             this.value = 'Enter your email address here';
        });
        break;

        case "esEmail":
        $(inputs[x]).bind("focus", function(){
          if(this.value == 'Enter your email address here')
             this.value = '';
        });
        $(inputs[x]).bind("blur", function(){
          if(this.value == '')
             this.value = 'Enter your email address here';
        });
        break;

        case "searchQ":
        $(inputs[x]).bind("focus", function(){
          if(this.value == 'Search wecansolveit.org')
             this.value = '';
        });
        $(inputs[x]).bind("blur", function(){
          if(this.value == '')
             this.value = 'Search wecansolveit.org';
        });
        break;
   }
}
}


$(document).ready(function() {

  init_form_fields();
  form_swap_values();

  $('input[@name=email]').addClass('input_email');
  $('input[@name=firstname]').addClass('input_firstname');
  $('input[@name=lastname]').addClass('input_lastname');
  $('input[@name=addr1]').addClass('input_addr1');
  $('input[@name=addr2]').addClass('input_addr2');
  $('input[@name=city]').addClass('input_city');
  $('input[@name=zip]').addClass('input_zip');
  $('select[@name=state_cd]').addClass('select_state_cd');
  $('select[@name=country]').addClass('select_country');
  $('input[@name=phone]').addClass('input_phone');

  $('input[type="text"]').addClass('text');
  $('input[type="password"]').addClass('text');
  $('input[type="checkbox"]').addClass('checkbox');
  $('input[type="radio"]').addClass('radiobutton');
  $('input[type="submit"]').addClass('submit');
  $('input[type="image"]').addClass('buttonImage');

  var section = $.query.get('style');
  if (section) switchStylestyle(section);

  var submit = $('<h1>My Community</h1><p>Please create an account to sign up for an event, add an event, join a group and other activities.</p>').insertBefore('#constituent');

});