// slide toggle js 
$(document).ready(function(){

//facebook
$('.fb').click(function()
	{
		window.open('http://www.facebook.com/freeportjewelers');
	});
	
	$('.company_more_info').click(function() {
  		$('.about_company').show();
  		$('.company_poster').slideUp({height:"hide"},1500, "easeIn");
  		
	});
	
	$('.close').click(function() {
  		$('.about_company').hide();
  		$('.company_poster').slideDown({}, 1500 , "easeOut");
  		
	});
	$('a[rel="external"]').live('click', function() {
			window.open( $(this).attr('href') );
			return false;
		});
	
//


//home page slider 

	$('.kwicks').kwicks({
			max : 427,
			duration: 600,  
			easing: 'easeOutQuint'
	});


// menu brands

	$('.menu_brands li a').hover(function() {
		
		
		var menuBrand = $(this).attr('rel');
		//alert (menuBrand);
		$('.first_brand_image').attr('src',menuBrand);
	});

	

// footer promo


	$('.promo_close').hide(); $('.promo1_left').show();
	$('.promo2_close').hide(); $('.promo2_right').show();
	$('.promo1_go').hide();

	
	$('.promo1_left').click(function(event){
	event.preventDefault();
	$('div .promo2').animate({width: 'toggle', marginRight: 'toggle', opacity:0}, 100);
	$('div .promo1').animate({width: 614},  200);
	$('.promo1_left').hide(); $('.promo_close').show({duration:210});
	$('.promo1_go').show({duration:210});
	});
	
	$('.promo_close').click(function(event){
	event.preventDefault();
	$('.promo_close').hide(); $('.promo1_left').show();
	$('.promo1_go').hide(); 
	$('div .promo1').animate({width: 306},  500);
	$('div .promo2').animate({width: 'toggle', marginRight: 'toggle', opacity: 1}, 498);

	});

	
	$('.promo2_right').click(function(event){
	event.preventDefault();
	$('div .promo1').animate({width: 0, marginRight: 0, opacity: 0}, 298);	
	$('div .promo2').animate({width: 614}, 300);
	$('.promo2_right').hide(); $('.promo2_close').show({duration:350});
	$('.promo1_go').show({duration:210});

	});
	
	$('.promo2_close').click(function(event){
	event.preventDefault();
	$('.promo1_go').hide(); 
	$('.promo2_close').hide(); $('.promo2_right').show();
	$('div .promo2').animate({width: 306},  500);
	$('div .promo1').animate({width: 306, marginRight: 2, opacity: 1}, 498);
	});
	
// light box
		
	$('.fancybox').fancybox({
	'width' : 795,
	'height' : 670,
	'autoDimensions' : false,
	'autoScale' : true,
	'transitionIn' : 'easing',
	'transitionOut' : 'none',
	'scrolling' : 'yes',
	'padding' :0,
	'margin' :0
	});  
	
	
	$('.signup').fancybox({
	'width' : 600,
	'height' : 500,
	'autoDimensions' : true,
	'autoScale' : true,
	'transitionIn' : 'none',
	'transitionOut' : 'none',
	'scrolling' : 'no',
	'padding' :0,
	'margin' :0,
	'type': 'iframe'
	}); 
	
	$('.product').hoverIntent(function() 
	{
		$(this).find('.product_info').animate({marginTop: 157}, 500)
	}
	, function()
	{
		$(this).find('.product_info').animate({marginTop: 250}, 500)
	});
	
// news promo slideshow

	$('.article_left_content').cycle({
	fx: 'fade',
	speed: 2000,
	pager:  '.news_promotion'
	});


	// gallery
	$('.gallery_main').css('backgroundImage','url('+$('.thumb_container ul li a:first').attr('href')+')');
	$('.thumb_container ul li a:first').addClass('selected');

	$('.thumb_container ul li a').click(function(event){
		event.preventDefault();
		
		$('.thumb_container ul li a').removeClass('selected');
		$('.thumb_container ul li a').children().css('opacity','.4');
	
		$(this).addClass('selected');
		$(this).children().css('opacity','1');
		
		var photo_fullsize = $(this).attr('href');
		
		$('.gallery_main').fadeOut(250, function(){
			
			$('.gallery_main').css('backgroundImage','url('+photo_fullsize+')');
			$('.gallery_main').fadeIn(250);
			
		});

	});
	
	// gallery prev and next set
	
	
	if(children=$('.thumb_container').find('ul').children())
	{
	if(children.size()>7)
	{
		$('.thumb_container').jCarouselLite({
			btnNext: ".next_thumb",
			btnPrev: ".prev_thumb",
			speed: 800,
			visible: 7,
			scroll: 7
		});
	}
	}
	
	// brands carousel
	
	if(children=$('.brands_column_container').children())
	{
	if(children.size()>4)
	{
		$('.brands_column_container').jCarouselLite({
			btnNext: ".next_brandnames",
			btnPrev: ".prev_brandnames",
			speed: 400,
			visible: 4,
			scroll: 1,
			circular:true,
			start:0
		});	
	}
	}
	
	
	$('.spinlogo').hover(function()
	{
		$(this).find('span').slideToggle('slow');
	},function()
	{
		$(this).find('span').slideToggle();
	});

	

});


