$(document).ready(function(){

// Add last class to Primary Nav list item
	$("#PrimaryMenu > ul > li:last-child").addClass("last");
	
// loads the cycle or whatever on specific url in this case the home page
// //GET URL	
	 var url = window.location.pathname;
	 url = url.toLowerCase();
// //READ URL
	// // uncomment alert to see what the url is in browser if needed
	// //alert(url);
	 if (url == '/' || url == "/index.php") {
// //RUN CYCLE
		$("#cycle")
		.before('<div id="cycle-nav">')
		.cycle({
			fx: "fade",
			speed:   400,
			timeout: 8000,
			next:   '#next', 
    		prev:   '#prev',
			pager:  '#cycle-nav'
		});
	};

// Show/Hide Product Description details
	$('#expand-1').showhide({
			target_obj: $('#expand-1').parent().next()
	});
	$('#expand-2').showhide({
			target_obj: $('#expand-2').parent().next()
	});
	$('#expand-3').showhide({
			target_obj: $('#expand-3').parent().next()
	});
	$('#expand-4').showhide({
			target_obj: $('#expand-4').parent().next()
	});
	$('#expand-5').showhide({
			target_obj: $('#expand-5').parent().next()
	});
	$('#expand-6').showhide({
			target_obj: $('#expand-6').parent().next()
	});
	$('#expand-7').showhide({
			target_obj: $('#expand-7').parent().next()
	});
	$('#expand-8').showhide({
			target_obj: $('#expand-8').parent().next()
	});

//tshirt printing
	$('#tshirt-printing').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627849344584',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//indoor signs
	$('#indoor-business-signs').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627805943689',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//outdoor signs
	$('#outdoor-business-signs').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930553030',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//storefront signs
	$('#storefront-signs').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930558370',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//vehicle wraps
	$('#vehicle-wraps').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930562806',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//color banners
	$('#color-banners').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930565956',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//magnetic signs
	$('#magnetic-signs').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930569408',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//business cards
	$('#business-cards').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627745386875',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'			:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//yard signs
	$('#yard-signs').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930572652',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//business branding
	$('#small-business-branding').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627805969699',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//wallpaper
	$('#custom-wallpaper').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930577560',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//direct mail
	$('#direct-mail').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627805975113',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//vinyl stickers
	$('#vinyl-stickers').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627805977721',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//fine art
	$('#fine-art').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930588564',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//flyers
	$('#fliers').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627930591686',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//graphic design
	$('#graphic-design').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		tag: '',
		set: '72157627805987929',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600,
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//menus
	$('#menus').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627805993205',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

//trophies
	$('#trophies').jflickrfeed({
		feedapi: 'photoset.gne',
		limit: 12,
		qstrings: {
		set: '72157627805995417',
		nsid: '65698106@N04' 
		},
		itemTemplate:
		'<li>' +
			'<a rel="fancybox" href="{{image}}" title="{{title}}">' +
				'<img src="{{image_s}}" alt="{{title}}" />' +
			'</a>' +
		'</li>'
	}, function(data) {
		$('.thumbs a').fancybox({
			'transitionIn'	:	'fade',
			'transitionOut'	:	'fade',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	false
		});
	});

// Add new class to product main label descriptions
	if ($(".ProductDetailsGrid").length > 0) {
		$(".productAttributeRow label").each(function() {
			if ($(this).find(".name").html().indexOf("||") >= 0) {
					var part = $(this).find(".name").html().replace((/(")/g),"'").split("||")
				  $(this).find(".name").html("<div class='item-label'>"+part[0]+"</div><div class='item-desc'>"+"<a href='"+part[1]+"' class='fancy'><img src='/templates/__custom/img/help.png' alt='' title='' />"+"</div>")
			}
		});
	};

//Activate Fancybox
//	$(".fancy").fancybox({
//			'transitionIn'	:	'fade',
//			'transitionOut'	:	'fade',
//			'speedIn'		:	600, 
//			'speedOut'		:	200,
//			'overlayShow'	:	false,
//			'hideOnContentClick'	: false
//		});
	
//Replace text in inputs
	function textReplacement(input) {
		var originalvalue = input.val();
		input.focus(function() {
			if($.trim(input.val()) == originalvalue){ input.val(""); }
		});
		input.blur(function() {
			if($.trim(input.val()) == ""){ input.val(originalvalue); }
		});
	}

	textReplacement($("#search_query"));
	textReplacement($("#nl_first_name"));
	textReplacement($("#nl_email"));	

//Create an Active class Primary Menu
	var loc_href = window.location.pathname;
		$('#PrimaryMenu a').each(function () {
		if (loc_href == $(this).attr('href')) {
			$(this).addClass('activePageLink');
		}
		});

// Dispaly only 2 related products in fastcart
	$("#fastCartSuggestive.ProductList li:gt(1)").css("display","none");		

$("#ProductReviews > a > img").replaceWith("write a review");
$("#ProductReviews > a").addClass("button");

});
