/*********************************************************************************************************************************/
/* DOCUMENT READY CALLS **********************************************************************************************************/
/*********************************************************************************************************************************/
$(document).ready(function(){
	
	/* EXTERNAL LINKS start ***********************************************************/
	$('a[rel="external"]').click(function(){
		this.target = "_blank";
	});
	/* EXTERNAL LINKS end *************************************************************/
	
	$('html').addClass('js');

	/*SEARCH start ********************************************************************/
	$('#site-search input[type="text"]')
		.val('SEARCH')
		.focus(function(){ if(this.value=='SEARCH') { $(this).val('');} })
		.blur(function(){ if(this.value =='') { $(this).val('SEARCH');} });
	/*SEARCH end **********************************************************************/
	
	$browse_by = $('#browse-by');
	
	if( $.cookie('type') ){
		$('ul.type',$browse_by).slideDown();
		$('h2.type',$browse_by).addClass('active');
	}
	if( $.cookie('price') ){
		$('ul.price',$browse_by).slideDown();
		$('h2.price',$browse_by).addClass('active');
	}
	$('h2',$browse_by).click(function(){
		var cookie = $(this).attr('class').replace(/\sactive/,'');
		
		if($(this).hasClass('active')){
			$(this).next().slideUp();
			$(this).removeClass('active');
			$.cookie(cookie,null, {path: '/',domain:'.heritagetimecapsules.com'});
			$.cookie(cookie,null, {path: '/',domain:'.3dcartstores.com'});
		}else{
			$(this).next().slideDown();
			$(this).addClass('active');
			$.cookie(cookie,true,{expires: (365 * 2), path: '/',domain:'.heritagetimecapsules.com'});
			$.cookie(cookie,true,{expires: (365 * 2), path: '/',domain:'.3dcartstores.com'});
			
		}
	});
	
		
}); //close document.ready

/*********************************************************************************************************************************/
/* DOCUMENT READY FUNCTIONS ******************************************************************************************************/
/*********************************************************************************************************************************/

