/*
  Custom ready function
  This should be used to reposition elements or to define and use custom functions
*/
$(document).ready(function(){

        //reposition header elements
        $('.logo').after($('.byline'));
        $('.header').append($('.mainnav'));
        $('.content-right').before($('.content-left'));
        $('.content-form').before($('.content-left'));
        
       if($('.interior').length > 0){
            $('.content-left').prepend($('.bg-testimonial'));
            $('.content-left').prepend($('.form-interior'));
            $('.content-right').append($('.protected'));
            $('.content-right').prepend($('.photo-interior'));     
            $('.content-left').append($('.benefits'));
            $('.content-left').prepend($('.photo-form'));
        }
        else{
            $('.wrapper').prepend($('.photo-block'));
            $('.photo-block').append($('.form'));
            $('.content-right').append($('.protected'));
            $('.content-right').prepend($('.features'));
            $('.features').append($('.benefits'));
            $('.content-left').prepend($('.bg-articles'));
            $('.features').append($('.testimonial'));
        }

        // append clear fix to each ul with floated children 
        $('.content-right ul, .sitemap ul, .home_articles ul, .state_articles ul').each(function(){
            $(this).append('<div class="clear0"><!--ie--></div>');   
        });
        
        // add to to_digits() to phone fields
        $('#homephone, #workphone').blur(function(){
            to_digits( $(this).attr('id'), true );
        });

});//ready



