/*/////////////////////////////////////////////////////////////////////////////////////////////////////*/
/* seydoggy.js.min */
/* @group phpjs.include */var include = function(script_filename) { document.write('<' + 'script'); document.write(' src="' + script_filename + '">'); document.write('</' + 'script' + '>'); };/* @end */
/* @group sdSetHeight 1.1.0 07-28-11 12:07 */ (function($) { $.fn.sdSetHeight = function(elem, value) { sdTallest = 0; $(elem).each(function() { var thisTallest = $(this).outerHeight(true); if (thisTallest > sdTallest) sdTallest = thisTallest; }); $(this).height(sdTallest + value); }; })(jQuery); /* @end */
/*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////*/
$(document).ready(function($){
	// external links
	$('a[rel=external]').attr('target', '_blank');
	// add link to title
	$('.titleContent').click(function(){
		location.href = 'http://seydesign.com';
	}).mouseover(function (){
		$(this).css({'cursor':'pointer'});
	});
	// add margin-bottom to navSide if sidebar is present
	if ($('.sidebarContent').length < 1) {
		$('.navSide').css('margin-bottom','0');
	};
	// set height .mainContent to that of .sidebarContent if shorter
	if ($('.sidebarContainer').css('display') != 'none') {
		$('.mainContent').css('min-height',$('.sidebarContainer').outerHeight(true));
	}
	// capture first and last items for toolbar_vertical
	$('.navSide ul:first li:first a:first').addClass('radiusTopNavSide').css('border-top','1px solid #D1D1D1');
	$('.navSide ul:first li:last a:last').addClass('radiusBottomNavSide').css('border-bottom','1px solid #D1D1D1');
	// bookmark notice
	$('.staticTips').hover(function (){
		$('.staticTips').css({'cursor':'pointer'});
	});
	// hide empty .headerContent
	if ($('.headerContent').length <= 0)
	{
		$('.bannerContainer').addClass('radiusBottom');
	}
	if ($('.headerContent').length > 0 || $('.bannerContainer').css('display') != "none")
	{
		$('.mainContainer').addClass('radiusAll').removeClass('radiusBottom');
		$('.headerContainer').css('margin-bottom','1em');
	}
	// vcenter styles
	if ($('.vcenter').length > 0) {
		var vcenterHeight = $('.vcenter').outerHeight(true);
		var vcenterParentHeight = $('.vcenter').parent().outerHeight(true);
		$('.headerContent .vcenter').css('margin-top',(vcenterParentHeight - vcenterHeight) / 2);
	}
	// thumbnail width
	if ($('.thumbnail').length > 0) {
		$('.thumbnail').width($($('.thumbnail').parent()).parent().width());
	}
	// Center Store Buttons
	if ($('.sdCenter').length > 0) {
		$('.sdCenter').css('margin-left',($('.sdCenter').parent().width() - $('.sdCenter').width()) / 2);
	}
	// navProduct functions
	if ($('.navProduct').length > 0) {
		$('.navProduct').width($('.navProduct .navList').width() + 7);
		$('.navProduct .navListItem:first').addClass('first');
		$('.navProduct .navListItem:last').addClass('last');
		$('.navProduct .navListItem a:first').addClass('radiusLeft');
		// if < IE 9
		if (jQuery.support.leadingWhitespace == false) {
			$('.navProduct .navListItem').addClass('ieGlitch');
		};
	}
	
	/*
		PAGE SPECIFIC
	*/
	// products: add hover
	if ($('.products').length) {
		var product = ['Themes','Stacks','Snippets'];
		for (var i = product.length - 1; i >= 0; i--){
			$('.products .headerContent .'+product[i]).mouseover(function (){
				$(this).addClass('hover').children().addClass('hover');
			}).mouseout(function (){
				$(this).removeClass('hover').children().removeClass('hover');
			});
		};
	}
	// home: set update height
	if ($('.home')) {
		var simplepieFeedUpdate = $('.simplepieFeed .update');
		simplepieFeedUpdate.sdSetHeight(simplepieFeedUpdate,-50);
	}
	
	// Themes: add hover
	if ($('.Themes').length) {
		var Themes = ['Weekly_Feature','Ultimate','Pro','Designer'];
		for (var i = Themes.length - 1; i >= 0; i--){
			$('.Themes .headerContent .'+Themes[i]).mouseover(function (){
				$(this).addClass('hover').children().addClass('hover');
			}).mouseout(function (){
				$(this).removeClass('hover').children().removeClass('hover');
			});
		};
	}
	
	// Stacks: add hover
	if ($('.Stacks').length) {
		var Stacks = ['Premium','Free'];
		for (var i = Stacks.length - 1; i >= 0; i--){
			$('.Stacks .headerContent .'+Stacks[i]).mouseover(function (){
				$(this).addClass('hover').children().addClass('hover');
			}).mouseout(function (){
				$(this).removeClass('hover').children().removeClass('hover');
			});
		};
	}
	
	// Themes/Stacks reveal change log
	$('.changelog').each(function(){
		$(this).children('a').css('text-decoration','none').click(function(event) {event.preventDefault()});
		$(this).click(function() {
			if (!$(this).hasClass('active')) {
				$(this).siblings().slideToggle().end().addClass('active').html('Hide Changes <a href="#" title="view the change log">[-]</a>');
			} else {
				$(this).siblings().slideToggle().end().removeClass('active').html('Show Changes <a href="#" title="view the change log">[+]</a>');
			}
			
		});
	});

	// support: add links to steps
	$('.support .theStep').each(function(){
		var link = $(this).children().children().attr('href');
		$(this).click(function(){
			location.href = link;
		}).mouseover(function (){
			$(this).css({'cursor':'pointer'});
			window.status = 'Go to "' + link + '"';
			$(this).addClass('hover');
			$(this).children().children().addClass('hover');
		}).mouseout(function(){
			window.status = '';
			$(this).removeClass('hover');
			$(this).children().children().removeClass('hover');
		});
	});
	// About Us: add link to email
	$('.General_Inquiries .sendMail').click(function(){
		$(this).attr('href','mailto:info@seydoggy.com');
	});
	// blog: styles
	$('.blog-tag-cloud li a:odd').css('color','#455878');
	$('.cartTagAll a').addClass('radiusAll');
	$('.cartTagLeft a').addClass('radiusLeft');
	$('.cartTagRight a').addClass('radiusRight');
	// theme pages: set equal height for overview columns
	$('.featuresAtGlance .three').sdSetHeight($('.featuresAtGlance .three'),30);
	// Trigger PrettyPhoto
	var sdPrettyPhoto = $("a[rel^='prettyPhoto']");
	if (sdPrettyPhoto.length) sdPrettyPhoto.prettyPhoto();

	// Gallery Function
	var sdGallery = (function(){
		var thumbsC = $('.thumbnailsContainer');
		var thumbs = $('.thumbnails');
		var display = $('.galleryDisplay');
		var button = $('.galleryClose');
		if (thumbs.length) {
		    // click function for thumbnail clicks
		    thumbs.each(function() {
			    // slideDown first thumbnail click
			    $(this).click(function() {
			        display.delay(100).slideDown(500, 'easeInOutQuad');
			        button.delay(1000).fadeIn();
			        thumbsC.addClass('innerShadowTop');
			    });
				// fade other thumbnail clicks
		        $(this).click(function() {
		            display.html($(this).clone().removeClass('feature thumbnails').fadeIn(500, 'easeOutQuad'));
		        });
		    });
		    // click function to hide button
		    button.click(function() {
		        $(this).fadeOut('fast');
		        display.delay(250).slideUp(500, 'easeInOutQuad');
		        thumbsC.removeClass('innerShadowTop');
		    });
		}
	})();
});
