//cufon
Cufon.replace('h1, .register a, .main_nav a, body.intro .intro_main a, .product_desc #descriptions span.description h4');   

$j = jQuery.noConflict();
$j(document).ready(function(){

	$j('a[rel="external"], a[rel="me"]').attr('target', '_blank'); 

	//about page slider hovers
	$j('.coll_1st').hover(function(){
		$j(this).children('div.valu_v1, div.valu_v2').stop(true,true).hide();
		$j(this).children('.collections_image_rollover').stop(true,true).fadeIn('fast');
		var ind = $j('.coll_1st').index(this);
		//alert(ind);
		$j('.top_level_frame_box div, .collections_top_level h3').stop(true,true).hide();
		$j('.top_level_frame_box div:eq('+ind+'), .collections_top_level h3:eq('+ind+')').stop(true,true).fadeIn();
	},function(){
		$j(this).children('.collections_image_rollover').stop(true,true).hide();
		$j(this).children('div.valu_v1, div.valu_v2').stop(true,true).fadeIn('fast');
	}); 

	//register form
	$j('#cfName').focus(function(){
		if($j(this).val() == 'NAME*') $j(this).val('');
	});
	$j('#cfName').blur(function(){
		if($j(this).val() == '') $j(this).val('NAME*');
	});
	$j('#cfDate').focus(function(){
		if($j(this).val() == 'ENGAGEMENT/WEDDING DATE*') $j(this).val('');
	});
	$j('#cfDate').blur(function(){
		if($j(this).val() == '') $j(this).val('ENGAGEMENT/WEDDING DATE*');
	});
	$j('#cfRing').focus(function(){
		if($j(this).val() == 'RING TYPE*') $j(this).val('');
	});
	$j('#cfRing').blur(function(){
		if($j(this).val() == '') $j(this).val('RING TYPE*');
	});
	$j('#cfContact').click(function(){
		if($j('#cfName').val() == 'NAME*' || $j('#cfDate').val() == 'ENGAGEMENT/WEDDING DATE*' || $j('#cfRing').val() == 'RING TYPE*'){
			$j('#form-error').fadeIn();
			return false
		}else{
			return true;
		}
	});
	
	//dealer locator search box
	$j('#addressInput').focus(function(){
		if($j(this).val() == 'ENTER YOUR ZIP CODE') $j(this).val('');
	});
	$j('#addressInput').blur(function(){
		if($j(this).val() == '') $j(this).val('ENTER YOUR ZIP CODE');
	});
	
	//search box
	$j('.flilnks_input').focus(function(){
		if($j(this).val() == 'SEARCH THIS SITE') $j(this).val('');
	});
	$j('.flilnks_input').blur(function(){
		if($j(this).val() == '') $j(this).val('SEARCH THIS SITE');
	});
	
	//wishlist
	if($j('#wishlist_functionality').length > 0){
		$j.each(wishlist.json, function(i, v){
			$j('#wishlist_gallery').append('<div class="ring_disp gallery"><div class="close"><a id="id_'+i+'" class="wishlist wishlist_x" href="javascript:;"><img src="images/close.jpg" /></a></div><div class="thumb"><a href="index.php?id='+i+'"><img src="assets/snippets/phpThumb/phpThumb.php?src=/'+v.image+'&w=100&h=90&zc=1&q=90" alt="'+v.name+'" height="90" /></a></div><div class="thumbdisc"><a href="index.php?id='+i+'">'+v.name+'</a></div></div>');
		});
	}
	
	$j('.whishlist_dispprev').click(function(){
		stepcarousel.stepBy('mygallery', -1);
	});
	$j('.whishlist_dispnext').click(function(){
		stepcarousel.stepBy('mygallery', 1);
	});
	
	//collections individual product
	$j('.rotating_images_small img:first').addClass('selected');
	$j('.rotating_images_small img').click(function(){
		var alt = $j(this).attr('alt');
		$j('.rotating_images_large img').hide();
		$j('.rotating_images_small img.selected').removeClass('selected');
		$j('.rotating_images_large img[alt='+alt+']').fadeIn();
		$j('.rotating_images_small img[alt='+alt+']').addClass('selected');
	});
	
	//individual ring page description tooltips
	/*
	$j(".rotating_images_small img").hover(function() {
		var ind = $j('.rotating_images_small img').index(this);
		$j('#descriptions span:eq('+ind+')').stop(true, true).animate({opacity: "show", top: "50"}, "slow"); 
	}, function() {
		var ind = $j('.rotating_images_small img').index(this);
		$j('#descriptions span:eq('+ind+')').animate({opacity: "hide", top: "40"}, "fast"); //same as css
	});
	*/
	
	$j(".rotating_images_large img").hover(function() {
		var ind = $j('.rotating_images_large img').index(this);
		$j('#descriptions span:eq('+ind+')').stop(true, true).animate({opacity: "show", top: "50"}, "slow"); 
	},function(){});
	$j("#descriptions span").hover(function(){}, function() {
		var ind = $j('#descriptions span').index(this);
		$j('#descriptions span:eq('+ind+')').animate({opacity: "hide", top: "40"}, "fast"); //same as css
	});

});
