/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


// We define a function that takes one parameter named $.
(function ($) {
  // Use jQuery with the shortcut:
     $(function() {
        $('#daystocamp').append(function(){
            // Date(year, month, day) month is index by 0, remember to subtrack 1 from month
            //var campstartDate = new Date(2011, 8, 13);
            var campstartDate = new Date(2012, 5, 11);
            campstart = campstartDate.getTime();
            //console.log('startdate: '+ campstartDate.toLocaleString());
            var today = new Date().getTime();
            
            if(today > campstart){
                var days = 0;
            }else{
                var days = Math.ceil((campstart - today)/86400000);
                
            }
            return "<span id='daycount'>"+days+"</span>";
        });
        
        $('<img />').attr('src',"/sites/all/themes/hirem_house_camp/images/signpost-hover.png").appendTo('body').css('display','none');
        
        
        // for getting IE to display help text in search box
        $("#edit-search-block-form--2").addClass("idle");
        $("#edit-search-block-form--2").focus(function(){
            $(this).removeClass("idle");
            //alert('in focus');
        }).blur(function(){
            $(this).addClass("idle");
            //alert('out of focus');
        });
        
        /*
         * Adding hover text to slider
         */
        $('.view-featured-slider .field-content a').attr('title', 'click for details');
        
        if($("#webform-client-form-75")){
            // moving other box on financial aid page
            $raceOther = $("#webform-component-race-group--race-other");
            $("#edit-submitted-race-group-race div.form-item:last-child").append($raceOther);
            
            // moving other box on financial aid page
            $countyOther = $("#webform-component-county--county-other");
            $("#edit-submitted-county-county-of-residence div.form-item:last-child").append($countyOther);
            
        }
        
    }); // end on-load 
// Here we immediately call the function with jQuery as the parameter.
}(jQuery));;

