$(function(){
	if($('.photoBoxWrap')){
		var ng = $('.ngg-galleryoverview');
		var th = $('.ngg-gallery-thumbnail-box');
		$(th).each(function(){
			var re = $(this).find('a').attr('rel');
			var hr = $(this).find('a').attr('href');
			var ti = $(this).find('a').attr('title');
			var im = $(this).find('a').html();
			$('.photoBoxWrap').append('<div class="photoBox"><div class="pressImg">'+im+'</div><a rel="'+re+'" href="'+hr+'" title="'+ti+'" class="overlay">view Photo</a></div>');
		});
		$(ng).remove();
	}
	
	if($('.wp-paginate')){
		$('.wp-paginate').find('.title').parent().remove();
		$('.wp-paginate').find('.prev').parent().addClass('prevNext');
		$('.wp-paginate').find('.next').parent().addClass('prevNext');
	}
	
	if($('.pressNav').length>0){
		$('.pressNav a[rel=prev]').addClass('prev');
		$('.pressNav a[rel=next]').addClass('next');
	}
	
	$('.btn-fshow').click(function(){
		//$(this).siblings('#slides').find('.slides_control').find('div:visible').find('a').trigger('click');
		var sh = $(this).siblings('#slides').find('.slides_control').find('div:visible').find('a');
		var attr = $(sh).attr('class');
		if (typeof attr !== 'undefined' && attr !== false) {
			//console.log('noclass');
			window.open( $(sh).attr('href') );
		}else{
			$(sh).trigger('click');
		}

		return false;
	});
	
	if($('#fade').length>0){
		$('#fade').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: '341px' });	
	}
	
	
	if($('.link-top').length>0){
		$('.link-top').localScroll();
	}

	
	if($('#slides').length>0){
		$('#slides').slides({
			generateNextPrev: false,
			play: 5000,
			preload: true,
			effect: 'fade',
			crossfade: true,
			fadeSpeed: 1000 
		});
		
		$('#slides .pagination').clone().appendTo($('.featShow'));
		$('.featShow > ul.pagination').removeClass('pagination').addClass('pagiclone');
		$('.pagiclone li').removeAttr('class');
		$('.pagiclone a').click(function(){
			var c = ($(this).text()*1)-1;
			$('#slides .pagination a:eq('+c+')').trigger('click');
			return false;
		});
	}

	//
	//$("a[rel^='prettyPhoto']").prettyPhoto({opacity: 0.8, social_tools: ''});
	//$("a[rel^='prettyPhoto']").prettyPhoto({opacity: 0.8, social_tools: ''});
});

$(window).bind('load',function(){
	if($('.newtwitter').length>0){
		$('.newtwitter ul').innerfade({ speed: 'slow', timeout: 5000, type: 'sequence', containerheight: '150px' });
	}
			
});
