function goToByScroll(id){
     	$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
$(function(){
$(".tiptip").tipTip({delay:0});
});
function subscribe() {
var yournameid = document.getElementById('yourname');
var youremailid = document.getElementById('youremail');
if (yournameid.value != '' && youremailid.value != '') {
$.fancybox({ 
'width'			: 450,
'height'		: 260,
'padding'		: 0,
'centerOnScroll'	: true,
'overlayOpacity'	: 0.3,
'overlayColor'		: '#111',
'opacity'		: true,
'autoScale'		: false,
'transitionIn'		: 'elastic',
'transitionOut'		: 'elastic',
'href'		: '/wp-content/themes/nmdc/_inc/js/createsend/Subscriber.Add.php?name='+yournameid.value+'&email='+youremailid.value,
'type'			: 'iframe'
});
} else {
alert('Please enter a valid name and email.');
}
}

/**
 * jQuery fontscale - A plugin to alter the font size of DOM elements 
 * Copyright (c) 2010 Ben Byrne - ben(at)fireflypartners(dot)com | http://www.fireflypartners.com
 * Dual licensed under MIT and GPL.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Date: 07/21/2010
 * @author Ben Byrne
 * @version 0.2
 *
 */

/**
 * For complete documentation, visit http://byrnecreative.com/blog/fontscale
 * @example jQuery("#fontgrow").fontscale("p","+");
 * @desc Bind scaling up the font size of all P elements to the element #fontgrow with default settings.
 * @example jQuery("#fontshrink").fontscale("p","-",{unit:"percent",increment:25,useCookie:false,adjustLeading:true});
 * @desc Bind scaling down the font size of all P elements to the element #fontshrink with custom settings.
 * @example jQuery("#reset").fontscale("p","reset");
 * @desc Eliminate all fontscale resizing 
 */
 
(function(jQuery) {
  jQuery.fn.fontscale = function(selectors, adjustment, parameters) {

    var settings = jQuery.extend( jQuery.fn.fontscale.defaults, parameters);
    
    //only use cookies if we can
		if ( ! jQuery.isFunction( jQuery.cookie )  ) settings.useCookie = false;
		
    // if the cookie exists, we're supposed to use it, and we haven't before, then load it 
	  if (!settings.cookieLoaded && jQuery.cookie(settings.cookieName)  && settings.useCookie) {
      cookieSettings = jQuery.fn.fontscale.readcookie( settings.cookieName );
	    //only actually apply the data from the cookie if its unit settings match!
			if (cookieSettings.unit == settings.unit && !settings.cookieLoaded) jQuery.fn.fontscale.scale( selectors, cookieSettings.delta, settings, true );
	  }
		
    this.each( function() {

		  // bind to elements
		  jQuery(this).bind(settings.event, function() {
        jQuery.fn.fontscale.scale( selectors, adjustment, settings, false);
        if (jQuery.isFunction(settings.onAfter)) settings.onAfter(selectors, adjustment, settings); //is this okay?				
		  });
		});
		
		return this;
		
  };

  jQuery.fn.fontscale.reset = function( object, settings ) {
    
    //remove any scaling done inline (assumed to be from this plugin)
    jQuery(object).each(function(i) {
      jQuery(this).css('font-size','');
      if (settings.adjustLeading) jQuery(this).css('line-height','');
    });
    
    //if we're using a cookie, reset it too
    if ( settings.useCookie ) {
      jQuery.fn.fontscale.savecookie("delete", settings );
    }
  }

	jQuery.fn.fontscale.scale = function( object, adj, settings, fromcookie) {
	
    //make delta an int that changes nothing to start
    var delta = 0;
	
    if (adj == "+" || adj == "up") {
      //set the delta as an increase
      delta = settings.increment;
    } else if (adj == "-" || adj == "down") {
      //set the delta as a decrease
      delta = settings.increment * -1;
    } else if (adj == "reset") {
      //remove applied changes and do nothing else
      return jQuery.fn.fontscale.reset( object, settings );
    } else if (fromcookie) {
      //get a pre-calibrated delta from the cookie if 
      delta = parseFloat(adj);
      settings.cookieLoaded = true;
	  }
	 	 
    //change the value into a percent if we have to
    if (settings.unit == "percent" && !fromcookie) {
      delta = 1 + (delta / 100);
    }
    	 
    jQuery(object).each(function(i) {

      var currentSize = parseInt(jQuery(this).css("font-size"));
      var currentLeading = parseInt(jQuery(this).css("line-height"));
      
      if (settings.unit == "percent") {
        jQuery(this).css("font-size", Math.round( currentSize * delta));
        if (settings.adjustLeading) jQuery(this).css("line-height", Math.round( currentLeading * delta));
      } else {
        jQuery(this).css("font-size", currentSize + delta);
        if (settings.adjustLeading) jQuery(this).css("line-height", currentLeading + delta);
      }
  
	 });

  if (settings.useCookie && !fromcookie)  jQuery.fn.fontscale.savecookie( delta, settings );
 
  return;
  
  };
  
  jQuery.fn.fontscale.savecookie = function( delta, settings ) {

    //delete the cookie if we're performing a reset, do nothing else
    if (delta == "delete") {
      jQuery.cookie( settings.cookieName, null, settings.cookieParams );
      return true;
    }
        
    if (jQuery.cookie( settings.cookieName )) {
      properties = jQuery.fn.fontscale.readcookie( settings.cookieName );
    } else {
      properties = {"delta":0}
    }
        
    //if we have a cookie that matches, just change the delta
    if (settings.unit == properties.unit) {  

      if (settings.unit == "percent") {
        properties.delta = (delta) ? properties.delta * delta : 1 ;
      } else {
        properties.delta = parseInt(properties.delta) + delta;
      }
    
      return jQuery.cookie( settings.cookieName, "delta="+properties.delta+"&unit="+properties.unit, settings.cookieParams);
    
    //no cookie that matches, create a new     
    } else {
      jQuery.cookie( settings.cookieName, "delta="+delta+"&unit="+settings.unit, settings.cookieParams);
      return true;
    }
      
  };
  
  jQuery.fn.fontscale.readcookie = function( the_cookie ) {
  
    val_string = jQuery.cookie( the_cookie );
                
    var objResult = {};
    jQuery.each(val_string.split("&"), function() { 
      var prm=this.split("=");
      objResult[prm[0]] = prm[1]; 
    });
    return objResult;
  };

})(jQuery);

jQuery.fn.fontscale.defaults = {
  useCookie:true,
  cookieName:'fontscale',
  cookieParams:{
    expires:30,
    path:"/"},
  increment:2,
  unit:"px",
  adjustLeading:false,
  event:"click",
  cookieLoaded:false
};

/* Cookie plugin * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php & http://www.gnu.org/licenses/gpl.html */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

jQuery(document).ready(function(){
	jQuery("a#fontup").fontscale("p,li,h1,h2,h3,h4,h5,h6","up");
	jQuery("a#fontreset").fontscale("p,li,h1,h2,h3,h4,h5,h6","reset");
	jQuery("a#fontdown").fontscale("p,li,h1,h2,h3,h4,h5,h6","down");
	$('.featuretable').corner();
});
