
// CUFON

Cufon.replace('#phone', {
	fontFamily: 'WhitneyMedium',
	fontSize: '18px',
	textShadow: '#fff 0 1px'
});

Cufon.replace('#panels div.panel h2', {
	fontFamily: 'WhitneyLight',
	fontSize: '54px',
	letterSpacing: '-1px',
	textShadow: '#000 0 1px'
});

Cufon.replace('#panels div.panel p', {
	fontFamily: 'WhitneyMedium',
	fontSize: '18px',
	textShadow: '#0f4671 0 1px'
});

Cufon.replace('#columnsContainer div.column h3', {
	fontFamily: 'WhitneyMedium',
	fontSize: '24px'
});

Cufon.replace('#main h2', {
	fontFamily: 'WhitneyMedium',
	fontSize: '36px'
});

Cufon.replace('#sidebar div.box div.widget h3, #main div.columns-container h3', {
	fontFamily: 'WhitneyMedium',
	fontSize: '24px'
});

Cufon.now();



// PANELS

$('#panels')

	.before('<ol id="pagination">')

	.cycle ({

		fx: 'fade',
		speed: 1500,
		timeout: 8000,
		pause: 1,
		pager: '#pagination'

});



// TABS

$('#tabs').show();
$('#productsContainer div.products-gallery h3').hide();
$('#productsContainer div.products-gallery').hide();
$('#productsContainer div.products-gallery:nth-child(1)').show();

var panels = $('#productsContainer div.products-gallery').length;

for (i = 1; i <= panels; i++) {

	eval (

		'$(\'ul#tabs li:nth-child('+ i +') a\').click(function() {'

			+ '$(\'#productsContainer div.products-gallery\').hide();'
			+ '$(\'ul#tabs li\').removeClass(\'active\');'
			+ '$(this).parent(\'li\').addClass(\'active\');'
			+ '$(\'#productsContainer div.products-gallery:nth-child('+ i +')\').fadeIn(800);'

		+'})'

	);

}



// FANCYBOX

$('#productsContainer div.products-gallery ul li p.img a').fancybox({

	'centerOnScroll': true,
	'overlayColor': '#000',
	'overlayOpacity': 0.7,
	'overlayShow': true

});



// FORM VALIDATION

$(document).ready(function() {

	$('#contact').submit(function() {

		$('#contact span.message').remove();

		$('#contact .required').removeClass('error');

		$('#contact .required').focus(function() {
			$(this).removeClass('error');
		});

		var hasError = false;

		$('#contact .required').each(function() {

			if(jQuery.trim($(this).val()) == '') {

				var labelText = $(this).prev('label').text().replace(':','');

				$(this).parent().append('<span class="message">Please enter your '+labelText+'.</span>');

				$(this).addClass('error');

				hasError = true;

			}

		});

		if(hasError) {
			return false;
		}

	});

});
