$(function() {
	
	//Home Page Slideshow
	$('#slideshow').cycle({
		fx: 'fade',
		speed: 'fast',
		timeout: 6000,
		pager: '#nav',
		pagerAnchorBuilder: function (idx, slide) {
			// return sel string for existing anchor
			return '#nav li:eq(' + (idx) + ') a';
		}
	});

	$('#direct').click(function () {
		$('#nav li:eq(2) a').triggerHandler('click');
		return false;
	});
	
	$('#nav a').click( function() {
    	$('#slideshow').cycle('pause');
 	});
	//Product Tabs

	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
});



$(function() {

	$('#user-login-form label').perfectForm({ignore:".label_checkbox"});
	
});

	jQuery.fn.perfectForm = function(options)
	{
		var settings = {
			overlap: true,
			ignore: ''             
		}
		
		if(!this.length) return this;
	
		if(options) {
			jQuery.extend(settings, options);
		};
		
		this.not(settings.ignore).each(function(){
			var input = $(this).next('input[type=text], textarea, input[type=password]');
			var label = $(this);
			
			// first check all inputs for values, then hide it's label if it has a value
			if( settings.overlap ) {
				label.addClass('overlap');
			}
			
			if( settings.overlap && input.val() != '' ) {
				label.hide();
			}
			
			label.click(function(){
				label.hide();
				input.focus();
			}, function(){
				if( input.val() == '' ) {
					label.show();
				}
			});
			
			// then add a focus event to all inputs to hide their labels when focused on, 
			// and remain hidden on blur if a value is entered
			input.focus(function(){
				label.hide();
			}).blur(function(){
				if( $(this).val() == '' ) {
					label.show();
				}
			});
		});
	}

