Cufon.replace('.block_links_item a span, h1, h2, h3, .menu li a, .menu2 li span, .showDiv span, .pointer_link, .related_block dl dt a, .store_locator_block h4, .b2b_menu td a, .homepanel_text');

var params = {
  wmode: "transparent"
};
swfobject.embedSWF("lumino.swf", "lumino", "864", "396", "9.0.0", "expressInstall.swf", params);

$(function(){
	$('#slides').slides({
		play: 5000,
		pause: 2500,
		hoverPause: true,
		effect: 'fade',
		generatePagination: true
	});
});

// Credits: Robert Penners easing equations (http://www.robertpenner.com/easing/).
jQuery.easing['BounceEaseOut'] = function(p, t, b, c, d) {
	if ((t/=d) < (1/2.75)) {
		return c*(7.5625*t*t) + b;
	} else if (t < (2/2.75)) {
		return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
	} else if (t < (2.5/2.75)) {
		return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
	} else {
		return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
	}
};



jQuery(document).ready(function() {	

	Cufon.now(); 

	$('.faq_list li .open_link').click( function() {
		$(this).next().slideToggle(300);
	});
	
	$('.store_locator_carousel > ul').jcarousel({
    	easing: 'swing',
        animation: 3000,
		wrap: 'last',
		scroll: 3,
		itemVisibleInCallback:{
        	onBeforeAnimation: function(){} , 
        	onAfterAnimation: function(a, b, c)
        	{ 
        		//a object, b html element (li), c index
        		//alert(b);
        		jQuery(b).addClass('visible-carousel-item');
        	}
        },
        itemFirstInCallback: function(a, b, c){ jQuery(b).addClass('left-item')},
        itemLastInCallback: function(a, b, c){ jQuery(b).addClass('right-item')}

    });
	
	$('.press_carousel > ul, .rings_carousel > ul').jcarousel({
    	easing: 'swing',
        animation: 1000,
		wrap: 'last',
		scroll: 6
    });	
	
	
	$('.textbox').jScrollPane({
		scrollbarWidth: 17,
		dragMinHeight: 70,
		dragMaxHeight: 70
	});
	$('#store_finder_scroll').jScrollPane({
		scrollbarWidth: 17,
		dragMinHeight: 70,
		dragMaxHeight: 70,
		animateTo:true, 
		animateInterval:150, 
		animateStep:4
	});	
	

	
	/**$('.textarea > textarea').cuText({
        scrollbarWidth: 16,
		resizable: true
    });
	**/
	
	$('.b2b_menu td:first').addClass('first_cell');
	$('.b2b_menu td:last').addClass('last_cell');
	
	var params = {
		changedEl: 'select',
		visRows: 5,
		scrollArrows: true
	}
	//cuSel(params)
	
	
	$("img.a").hover(
		function() {
			$('.a').stop().animate({"opacity": "1"}, "slow");
			$(this).stop().animate({"opacity": "0"}, "slow");
		});
	
	
	
	
	$("img.a1").hover(
		function() {
			$(this).stop().animate({"opacity": "0"}, "slow");
		},function() {
			$(this).stop().animate({"opacity": "1"}, "slow");
	});	
	
	$("img.video_small").hover(
		function() {
			$(this).stop().animate({"opacity": "0"}, "slow");
		},function() {
			$(this).stop().animate({"opacity": "1"}, "slow");
	});	
	
	$("img.video_large").hover(
		function() {
			$(this).stop().animate({"opacity": "0"}, "slow");
		},function() {
			$(this).stop().animate({"opacity": "1"}, "slow");
	});		
	
	$("#player, #video1, #video2, #video3, #video4").fancybox({
		'width'				: 740,
		'height'			: 416,			
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoDimensions'	: 'true',
		'type'				: 'iframe'
	});
	
	$("#venetian").fancybox({
		'width'				: 626,
		'height'			: 416,			
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoDimensions'	: 'true',
		'type'				: 'swf'
	});
	
	$("#email_friend, .email_friend").fancybox({
		'width'				: 516,
		'height'			: 544,			
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoDimensions'	: 'true',
		'type'				: 'iframe'
	});
	
	$("#make-appointment").fancybox({
		'width'				: 496,
		'height'			: 637,			
		'autoScale'			: true,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoDimensions'	: 'true',
		'type'				: 'iframe'
	});
	
	
	//$("a#enlarge").fancybox();
	
		$("a#enlarge").fancybox({
		'width'				: 729,
		'height'			: 510,			
		'autoScale'			: false,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'autoDimensions'	: 'true',
		'type'				: 'inline'
	});
	
	$('.top > ul > li.nav2').hover(
		function() {
			$(this).addClass('show_sub');
			$(this).next().addClass('no_bg');
		},function() {
			$(this).removeClass('show_sub');
			$(this).next().removeClass('no_bg');
	});

	$('.top > ul > li.nav5').hover(
		function() {
			$(this).addClass('show_sub');
			$(this).next().addClass('no_bg');
		},function() {
			$(this).removeClass('show_sub');
			$(this).next().removeClass('no_bg');
	});
	
	$('#slider2').find('a:first').addClass('left-slider');	
	$('#slider2').find('a:last').addClass('right-slider');	
	
	$('#search-criteria, #search-criteria-two').focus(function(){
		var $val = $(this).val();
		if ($val == 'Enter Style #')
		{
			$(this).val('');
		}
	}).blur(function(){
		var $val = $('#search-criteria').val();
		var $val2 = $('#search-criteria-two').val();
		if ($val == '')
		{
			$('#search-criteria').val('Enter Style #');
		}
		
		if ($val2 == '')
		{
			$('#search-criteria-two').val('Enter Style #');
		}
	});
		
	$('#locatestring').focus(function(){
		var $val = $(this).val();
		if ($val == 'Enter Zip Code')
		{
			$(this).val('');
		}
	}).blur(function(){
		var $val = $('#locatestring').val();
		if ($val == '')
		{
			$(this).val('Enter Zip Code');
		}
	});
});



function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function numts(){
	return parseInt(new Date().getTime().toString().substring(0, 10));
}

/**
function returnHash(a_sLink){
   // Check for anchor and select active image from nav
   var hash = 0;
   if((a_sLink.match(/#(\w.*)/) != null)){
     if((isNumeric(a_sLink.match(/#(\w.*)/)[1]) == true)){
       hash = a_sLink.match(/#(\w.*)/)[1] – 1;
     }
  }
  return hash;
}
**/
