/*

BASE Functions

==================================================================================================================*/	

// Cufon Setup
Cufon.replace('h1, h2, h3, h4, h5, h6, #nav li a.level-top', { fontFamily: 'Avenir LT Std' });	
	

//jQuery Load
var $j = jQuery.noConflict();
jQuery(document).ready(function() {
	$j('#hero-slides').cycle({ 
			fx:     'scrollLeft', 
			speed:  'slow', 
			timeout: 7000,
			pause:	true,
			pager:  '#slide-nav',
			pagerAnchorBuilder: function(idx, slide) { 
				// return selector string for existing anchor 
				return '#slide-nav li:eq(' + idx + ') a'; 
			}     
		});
	
	$j('#slider1').bxSlider({
		auto: true,
		speed: 'slow',
		displaySlideQty: 3,
		moveSlideQty: 1           
	});
	
	$j('#top-link a').click(function() {
		$j(document).scrollTo($j(this).attr('href'),1000);
		return false;
	});
	
	$j(".launch > a").click(function() {								
				$j.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'overlayShow'	: false,
				'titleShow'		: false,
				'width'			: 640,
				'height'		: 390,
				'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
				'type'			: 'swf',
				'swf'			: {
					'wmode'		: 'transparent',
					'allowfullscreen'	: 'true'
				}
			});

			return false;
		});
		
	$j('.accordion').accordion({
			collapsible: true,
			navigation: false,
			autoHeight: false
	});
	$j('.accordion h2').unbind('click');
	$j('.accordion h2').click(function(){
		if (lfiForm.validator.validate()) {
			var $t = $j(this);			
			$j('.accordion').accordion('activate', $t.parents('div.accordion').children('h2').index($t));
		}
	});
	$j('button.continue').click(function(){
		if (lfiForm.validator.validate()) {
			var $t = $j(this);			
			$j('.accordion').accordion('activate', $t.parents('div.accordion').children('div.fieldset').index($t.parents('div.fieldset')) + 1);
		}
		
		return false;
	});	

},function(){
	//GUnload();
});


// Print Page
function printThis() {
	(window.print) ? window.print() : alert('To print his page press Ctrl-P on your keyboard \nor choose print from your browser or device after clicking OK');
}
