jQuery(document).ready(function(){
	//allow $ to be used within this set of functions
	var $ = jQuery.noConflict();

	//get ride of link love completely, not just hide
	$('p.linklove').remove();
	
	//make sure users window isnt to smalll
	var ww = $(window).width();
	if (ww <= 1048)
	{
		$('#carousel').hide();
		$('#viewing').addClass('top');
	}


/* ===mail chimp sign up === */
	if ($('#newsletter-wrapper').length)
	{
		$('#newsletter-wrapper form#mc-embedded-subscribe-form').hide();
		
		$('a#newsletter').click(function(){
			$(this).toggleClass('active');
			$('#newsletter-wrapper form#mc-embedded-subscribe-form').slideToggle(350, function(){
				//if the form is visible move focus to the first input text element
				if($('form#mc-embedded-subscribe-form').is(':visible'))
				{
					$('form#mc-embedded-subscribe-form input#mce-EMAIL').focus();
				}
			});
			
			return false;
		});
		
		$('a#mc_embed_close').click(function(){
			$('#newsletter-wrapper form#mc-embedded-subscribe-form').slideUp(350);
			$('a#newsletter').removeClass('active');
			
			return false;
		});
	}
	

/* === client login form === */
	if ($('#client-form').length)
	{
		$('#client-wrapper #client-form').hide();
		
		$('a.login').click(function(){
			$(this).toggleClass('active');
			$('#client-wrapper #client-form').slideToggle(350, function(){
				//if the form is visible move focus to the first input text element
				if($('#client-form').is(':visible'))
				{
					$('#client-form form#login fieldset ul#login_list li input#email_address:first').focus();
				}
			});
			
			return false;
		});
	}
	
	/* === greeting width === */
	
	var gh = $('#user-options').width();
	$('#user-content').css('width', gh-3);	


//============= same size columns ===============//	
	
/*function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).outerHeight();
		if(thisHeight > tallest) 
		{
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

//check is mobile viewing and if not do some layout manipulations
if (parseInt($.cookie('style')) !== 4)
{
	equalHeight($(".top_column"));
	equalHeight($(".bottom_column"));
}
/*
var sh = $('#sidebar-shop-cats').height();
var ph = $('.page').height();
 
if (ph < sh)
{
	$('.page').height(sh); 
	$('#whats_next_wrapper').css('margin-top', '10px');
}
*/

//===============================misc stuff===============================//
	

	//someone elses functions to set element height on each page load and maintain a consitent look... 
	/*jQuery.fn.setOuterWidth  = function( newWidth ) {
		var difference = this.outerWidth(true) - this.width();
		return this.width( newWidth - difference );
	};
	
	jQuery.fn.setOuterHeight = function( newHeight ) {
		var difference = this.outerHeight(true) - this.height();
		return this.height( newHeight - difference );
	};
	
	
	/*function setMidHeight(){
		//get both height of sidebar and content area
		var mid = $('#content').outerHeight();
		var side = $('#sidebar_wrapper').outerHeight();
		
		//if sidebar is larger than content area in focus
		if (side <= mid)
		{
			//reset both heights to auto
			//alert('1');
			$('#content').css('height', 'auto');
			$("#sidebar_wrapper").css('height', 'auto'); 
				if (side >= mid)
				{
					//alert('2');
					var mid = $('#content').outerHeight();
					$("#sidebar_wrapper").setOuterHeight(mid); 
				}
			//$("#sidebar_wrapper").setOuterHeight(mid);  	
		}
		else	if (side >= mid)
		{
			//alert('4');
			//set sidebar to mid's height
			$("#sidebar_wrapper").setOuterHeight(mid);  				
		}
	}*/



});
