jQuery(function() {
	
	//OPEN/CLOSE BOXES
	jQuery('div.greybox h2.closed').each(function(){
		content = jQuery(this).parent().find('div:first');
		content.slideUp(0);
	
	});
	jQuery('div.greybox h2').click(function(){
		content = jQuery(this).parent().find('div:first');
		if(jQuery(this).hasClass('closed')){
			content.slideDown(500);
			jQuery(this).removeClass('closed');
		} else {
			content.slideUp(500);
			jQuery(this).addClass('closed');
		}
	});
	
	//JQTIP
	jQuery('.showtip').each(function(){
		var title = jQuery(this).find('span:first').text();
		title = (title == '') ? jQuery(this).text() : title;
		jQuery(this).qtip({ 
			content:title,
			position: {
				corner: {
					target: 'topLeft',
					tooltip: 'topRight'
				}
			},
			background: '#EFEFF0',
			border: {
				width: 7,
				radius: 5,
				color: '#A2D959'
			},
			width: {
				min: 0,
				max: 350
			},
		});
	});
	
	
});

$(window).load(function() {
	jQuery('.newsslider').each(function(){
		jQuery(this).nivoSlider({
			effect: 'sliceDown', // Specify sets like: 'fold,fade,sliceDown'
			slices: 15, // For slice animations
			boxCols: 8, // For box animations
			boxRows: 4, // For box animations
			animSpeed: 500, // Slide transition speed
			pauseTime: 8000, // How long each slide will show
			startSlide: 0, // Set starting Slide (0 index)
			directionNav: false, // Next & Prev navigation
			directionNavHide: false, // Only show on hover
			controlNav: false, // 1,2,3... navigation
			controlNavThumbs: false, // Use thumbnails for Control Nav
			controlNavThumbsFromRel: false, // Use image rel for thumbs
			controlNavThumbsSearch: '.jpg', // Replace this with...
			controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
			keyboardNav: false, // Use left & right arrows
			pauseOnHover: true, // Stop animation while hovering
			manualAdvance: false, // Force manual transitions
			captionOpacity: 0.8, // Universal caption opacity
			prevText: 'Prev', // Prev directionNav text
			nextText: 'Next', // Next directionNav text
			randomStart: false // Start on a random slide
		});
	});
});
