$(function() {
	if (window.PIE) {
		$('.SideNav, .Graph, .ImageFloatWithCaption img').each(function() {
			PIE.attach(this);
		});
	}
	
	$('.TwoCol').columnize({columns: 2}); <!--Columnizer-->
	
	// Use the each() method to gain access to each elements attributes
   $('area').each(function()
   {
      $(this).qtip(
      {
         content: $(this).attr('tooltip'), // Use the tooltip attribute of the element for the content
         style: {
            name: 'dark', // Give it the preset dark style
            border: {
               width: 0, 
               radius: 4 
            }, 
            tip: true // Apply a tip at the default tooltip corner
         }
      });
   });
   
});




jQuery(document).ready(function(){
	initOpenBox();
});

function initOpenBox(){
	jQuery('.slide-block').NVslideBlock({
		opener: '.open-close',
		slideBlock: '.slide-text',
		openClass:'active'
	});
}
jQuery.fn.NVslideBlock = function(_options){
	var _options = jQuery.extend({
		//Options plugin
		opener: '.opener',
		slideBlock: '.slide',
		openClass:'opened',
		animationSpeed: 500
	},_options);

	return this.each(function(){
		var _this = jQuery(this);
		var _opener = jQuery(_options.opener, _this);
		var _slideBlock = jQuery(_options.slideBlock, _this);
		var _openClass = _options.openClass;
		var _animationSpeed = _options.animationSpeed;
		if(!_slideBlock.length) return;
		if(_this.hasClass(_openClass)) _slideBlock.show();
		else _slideBlock.hide();
		_opener.bind('click', function(){
			if(_animationSpeed == 0){
				if(_this.hasClass(_openClass)){
					_slideBlock.hide();
					_this.removeClass(_openClass);
				}
				else {
					_slideBlock.show()
					_this.addClass(_openClass);
				};
			}
			else {
				if(_this.hasClass(_openClass)){
					_slideBlock.slideUp(_animationSpeed);
					_this.removeClass(_openClass);
				}
				else {
					_slideBlock.slideDown(_animationSpeed);
					_this.addClass(_openClass);
				};
			}
			return false;
		})
	});
}
