var $j = jQuery.noConflict();
$j(document).ready(function() {
	$j("input#mc_mv_EMAIL").attr('value',"What's your email address?");
	
	$j("input#mc_mv_EMAIL").focus(function(){
		$j(this).attr('value',"");
	});
	
	$j("input#mc_mv_EMAIL").blur(function(){
		if($j(this).attr('value') == ""){
			$j(this).attr('value',"What's your email address?");
		}else{
		// Do nothing 	
		}
	});
	
	
	$j("input#field").focus(function(){
		$j(this).attr('value',"");
	});
	
	$j("input#field").blur(function(){
		if($j(this).attr('value') == ""){
			$j(this).attr('value',"search the site");
		}else{
		// Do nothing 	
		}
	});
	
	if($j('#category_list > li').length){
	
		$j('#category_list > li').mouseover(function(){
			var tempStr = $j(this).children('a').children('img').attr('src');
			var splitResult = tempStr.split('.jpg');
			//alert(splitResult[0]);
			tempStr = splitResult[0] + "_hover.jpg";
			//alert(tempStr);
			
			$j(this).children('a').children('img').attr('src',tempStr);
		});
		
		$j('#category_list > li').mouseout(function(){
			
			var tempStr = $j(this).children('a').children('img').attr('src');
			var splitResult = tempStr.split('_hover.jpg');
			//alert(splitResult[0]);
			tempStr = splitResult[0] + ".jpg";
			//alert(tempStr);
			
			$j(this).children('a').children('img').attr('src',tempStr);
			
		});
	
	}// End of category_list if statment
	
	// Newsletter scroll functionality
	if($j('a#newsletter').length){
		$j('a#newsletter').click(function(){
			$j('html,body').animate({scrollTop: $j("#footer_col_newsletter").offset().top},500);
		});
		
	}; // End of newsletter if statment
	
	
	if($j('#sidebar_category_list > li').length){
	
		$j('#sidebar_category_list > li').mouseover(function(){
			if($j(this).hasClass('current-cat')){
				//do nothing
			}else{
			
				var tempStr = $j(this).children('a').children('img').attr('src');
				var splitResult = tempStr.split('.jpg');
				//alert(splitResult[0]);
				tempStr = splitResult[0] + "_hover.jpg";
				//alert(tempStr);
				
				
				$j(this).children('a').children('img').attr('src',tempStr);
			}
		});
		
		$j('#sidebar_category_list > li').mouseout(function(){
			if($j(this).hasClass('current-cat')){
				//do nothing
			}else{
			
				var tempStr = $j(this).children('a').children('img').attr('src');
				var splitResult = tempStr.split('_hover.jpg');
				//alert(splitResult[0]);
				tempStr = splitResult[0] + ".jpg";
				//alert(tempStr);
				
				$j(this).children('a').children('img').attr('src',tempStr);
			}
		});
	
	} // End of sidebar_category_list if statment
	
	if($j('#sidebar_category_list > li').hasClass('current-cat')) {
		var tempStr = $j("li.current-cat").children('a').children('img').attr('src');
		var splitResult = tempStr.split('.jpg');
		//alert(splitResult[0]);
		tempStr = splitResult[0] + "_hover.jpg";
		//alert(tempStr);
		
		$j("li.current-cat").children('a').children('img').attr('src',tempStr);
	};
	
	
	//When page loads...
	$j(".tab_content").hide(); //Hide all content
	$j("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$j(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$j("ul.tabs li").click(function() {

		$j("ul.tabs li").removeClass("active"); //Remove any "active" class
		$j(this).addClass("active"); //Add "active" class to selected tab
		$j(".tab_content").hide(); //Hide all tab content

		var activeTab = $j(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$j(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	$j(".logo_image_link").mouseover(function() {
		$j(this).children(".overlay").css('display','block');
		})
	$j(".logo_image_link").mouseout(function() {
		$j(this).children(".overlay").css('display','none');
		})

});


