$(document).ready(function() { 

var timerId = 0;

function fancy(){
$("a.fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200
	});
}

timerId = setInterval(fancy,500);

$(".anchor").click(function(){
var active = $(this);
$(active).addClass('active');
$('.anchor').not(active).removeClass('active');
});
$("a.fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200
	});

$('.bioList ul li').hover(function(){
var found = $(this).find('.bioImageName');
$(found).stop(true, true).fadeIn();
 }, 
  function () {
  var found = $(this).find('.bioImageName');
$(found).stop(true, true).fadeOut();

});

$('.morePhotosBox ul li').hover(function(){
var found = $(this).find('.photoImageName');
$(found).stop(true, true).fadeIn();
 }, 
  function () {
  var found = $(this).find('.photoImageName');
$(found).stop(true, true).fadeOut();

});

/*front page section*/
//------------------------front page slider
$('.inside ul li:first').before($('.inside ul li:last'));
	$('.inside ul').css({'top' : -119});
$('.btn_bottom').live('click',function(){
		var left_indent = parseInt($('.inside ul').css('top')) - 116;
		$('.inside ul').stop(true,true).animate({'top' : left_indent}, 600, 'easeInOutQuint',  function () {
		$('.inside ul li:last').after($('.inside ul li:first'));
		$('.inside ul').css({'top' : -119});
		});
		return false;
});
$('.btn_top').live('click',function(){
	var left_indent = parseInt($('.inside ul').css('top')) + 116;
		$('.inside ul').stop(true,true).stop(true,true).animate({'top' : left_indent}, 600, 'easeInOutQuint', function(){
		$('.inside ul li:first').before($('.inside ul li:last')); 
		$('.inside ul').css({'top' : -119});
		});
				return false; 
});

/*photo section*/
//------------------------slider photo slider
$('.featuredPhoto ul li:first').before($('.featuredPhoto ul li:last'));
	$('.featuredPhoto ul').css({'left' : -620});
$('.photoSlider ul li:first').before($('.photoSlider ul li:last'));
$('.photoSlider ul li:first').before($('.photoSlider ul li:last'));
	$('.photoSlider ul').css({'left' : -188});
$('.rightArrow').live('click',function(){
	
		var left_indent = parseInt($('.photoSlider ul').css('left')) - 187;
		$('.photoSlider ul').stop(true,true).animate({'left' : left_indent}, 600, 'easeInOutQuint',  function () {
		$('.photoSlider ul li:last').after($('.photoSlider ul li:first'));
		$('.photoSlider ul').css({'left' : -188});
		});
		var left_indent2 = parseInt($('.featuredPhoto ul').css('left')) - 620;
		$('.featuredPhoto ul').stop(true,true).animate({'left' : left_indent2}, 600, 'easeInOutQuint',  function () {
		$('.featuredPhoto ul li:last').after($('.featuredPhoto ul li:first'));
		$('.featuredPhoto ul').css({'left' : -620});
		});
		return false;
});
$('.leftArrow').live('click',function(){
	var left_indent = parseInt($('.photoSlider ul').css('left')) + 187;
		$('.photoSlider ul').stop(true,true).stop(true,true).animate({'left' : left_indent}, 600, 'easeInOutQuint', function(){
		$('.photoSlider ul li:first').before($('.photoSlider ul li:last')); 
		$('.photoSlider ul').css({'left' : -188});
		});
	var left_indent2 = parseInt($('.featuredPhoto ul').css('left')) + 620;
		$('.featuredPhoto ul').stop(true,true).stop(true,true).animate({'left' : left_indent2}, 600, 'easeInOutQuint', function(){
		$('.featuredPhoto ul li:first').before($('.featuredPhoto ul li:last')); 
		$('.featuredPhoto ul').css({'left' : -620});
		});
		return false; 
});
$('.loginLinks').click(function(){
    $('body').addClass("scroll")
	$('#overlay').fadeIn();
	$('#login_pop').fadeIn();
});
$('#overlay').click(function(){
    $('body').removeClass("scroll")
	$('#overlay').fadeOut();
	$('#login_pop').fadeOut();
});
/*video section*/
//------------------------slider video switch
	$('.videoSlider li').live('click', function(){
	var index3 = $(this).find('.vidHandle').attr('name');
	var index2 = parseInt(index3);
	var index = index2 -1;
	var title = $(this).find('.vidHandle').attr('title');
	var image = $(this).find('.vidHandle').attr('rel');
	$('.playTitle').html(title);
	Cufon.replace('.demonize');
	$('.posterImage img').attr('src', image);
	$('.posterImage').fadeIn();
	jwplayer().playlistItem(index);
	jwplayer().stop();
	$('#play2').fadeIn();
	});
	$('.slideContent li').hover(
  function () {
    $(this).find(".tabTitle").stop(true,true).animate({marginTop:'-99'}, 600, 'easeInOutQuint');
  },
  function () {
    $(this).find(".tabTitle").stop(true,true).animate({marginTop:'0'}, 600, 'easeInOutQuint');
  });
  
//------------------------slider movement

$('.videoSlider ul li:first').before($('.videoSlider ul li:last'));
$('.videoSlider ul li:first').before($('.videoSlider ul li:last'));
	$('.videoSlider ul').css({'left' : -188});
$('.rightArrow2 a').live('click',function(){
	
		var left_indent = parseInt($('.videoSlider ul').css('left')) - 187;
		$('.videoSlider ul').stop(true,true).animate({'left' : left_indent}, 600, 'easeInOutQuint',  function () {
		$('.videoSlider ul li:last').after($('.videoSlider ul li:first'));
		$('.videoSlider ul').css({'left' : -188});
		});
		return false;
});
$('.leftArrow2 a').live('click',function(){
	var left_indent = parseInt($('.videoSlider ul').css('left')) + 187;
		$('.videoSlider ul').stop(true,true).animate({'left' : left_indent}, 600, 'easeInOutQuint', function(){
		$('.videoSlider ul li:first').before($('.videoSlider ul li:last')); 
		$('.videoSlider ul').css({'left' : -188});
		});
		return false; 
});
//------------------------featured cars front page movement

$('.panel ul li:first').before($('.panel ul li:last'));
	$('.panel ul').css({'left' : -188});
$('.btn_right').live('click',function(){
	
		var left_indent = parseInt($('.panel ul').css('left')) - 187;
		$('.panel ul').stop(true,true).animate({'left' : left_indent}, 600, 'easeInOutQuint',  function () {
		$('.panel ul li:last').after($('.panel ul li:first'));
		$('.panel ul').css({'left' : -188});
		});
		return false;
});
$('.btn_left').live('click',function(){
	var left_indent = parseInt($('.panel ul').css('left')) + 187;
		$('.panel ul').stop(true,true).animate({'left' : left_indent}, 600, 'easeInOutQuint', function(){
		$('.panel ul li:first').before($('.panel ul li:last')); 
		$('.panel ul').css({'left' : -188});
		});
		return false; 
});
/*shop section*/
//------------------------shop video switch
$('.playerSlider li').live('click', function(){
	var index3 = $(this).find('.vidHandle').attr('name');
	var index2 = parseInt(index3);
	var index = index2 -1;
	var title = $(this).find('.vidHandle').attr('title');
	var image = $(this).find('.vidHandle').attr('rel');
	jwplayer().playlistItem(index);
	jwplayer().stop();
	var target = $('.dvdRight .dvdInfoLow ul li.' + index3)
	$('.dvdRight .dvdInfoLow ul li').not(target).css('z-index', '1').hide();
	$(target).css('z-index', '100').show();
	});
/*front page trailer*/
//------------------------front video switch
$('.inside li').live('click', function(){

	var index3 = $(this).find('.vidHandle').attr('name');
	var index2 = parseInt(index3);
	var index = index2 -1;
	var title = $(this).find('.vidHandle').attr('title');
	var image = $(this).find('.vidHandle').attr('rel');
	jwplayer().playlistItem(index);
	jwplayer().stop();
	});
	/*
//------------------------photo page album
$('.morePhotosBox.tar ul li a').scrollToTop();
$('.morePhotosBox.tar ul li a').click(function(e){
var target = $(this).attr('rel');
e.preventDefault();
$('.featuredBox').fadeOut();
$('.target').load('/photos/slider/' + target + '/', function() {
$('.featuredBox').delay(300).fadeIn();
$('.featuredPhoto ul li:first').before($('.featuredPhoto ul li:last'));
	$('.featuredPhoto ul').css({'left' : -620});
$('.photoSlider ul li:first').before($('.photoSlider ul li:last'));
$('.photoSlider ul li:first').before($('.photoSlider ul li:last'));
	$('.photoSlider ul').css({'left' : -188});
	
});

});  */

}); 

