var url_root = "/wp-content/themes/suitandtie";

jQuery(document).ready(function() {
  
  Cufon.replace('h2');
	Cufon.replace('h3');
	Cufon.replace('h4');
  
   
});
 
function checkWeather(){
  jQuery.simpleWeather({
        zipcode: '49423',
        unit: 'f',
        success: function(weather) {
          var message = "It's ";
            
            if( weather.temp > -20 && weather.temp <= 10){
              message = message + "bone chilling! and";
            }
            if( weather.temp > 10 && weather.temp <= 20){
              message = message + "FREEZING! and";
            }
            if( weather.temp > 20 && weather.temp <= 32){
              message = message + "cold out and ";
            }
            if( weather.temp > 32 && weather.temp <= 50){
              message = message + "not too bad out and ";
            }
            
            if( weather.currently.search( new RegExp( /snow/i )) || 
                    weather.currently.search( new RegExp( /snowing/i )) ||
                        weather.currently.search( new RegExp( /flurries/i ))
                  ){
                  message = message + "let it snow, let it snow, let it snow!";
                  jQuery.getScript( url_root + "/js/Snowstorm/snowstorm-min.js", function() {  
                    snowStorm.toggleSnow();
                    jQuery.delay(800);
                    snowStorm.toggleSnow();
                  });
             }else{
                  message = message + weather.currently;
             }   
            
            jQuery("#weather").append(message);
            
        },
        error: function(error) {
            jQuery("#weather").html('<p>'+error+'</p>');
        }
    });
} 
