$(function() {

	$('h2.latest_startups').click(function() {

		$('div.latest_news').hide();

		$('div.latest_startups').show();

		$('h2.latest_news').addClass('unfocused');

		$('h2.latest_startups').removeClass('unfocused');

	});

	$('h2.latest_news').click(function() {

		$('div.latest_startups').hide();

		$('div.latest_news').show();

		$('h2.latest_startups').addClass('unfocused');

		$('h2.latest_news').removeClass('unfocused');

	});

	$('#topnav .nav2').mouseover(function() {

		$('#topnav .nav2 ul').show();

	});

	$('#topnav .nav2').mouseout(function() {

		$('#topnav .nav2 ul').hide();

	});

});

$(document).ready(function () { 	
							
		$("#body_contain #left .middle_content_below .para_1 + p").each(function(index) {
			$(this).html( $(this).html().substr(0,100) + "..");
		});
		
		/*$("#body_contain #right #bottom_wrap .box_one p.quotes + p").each(function(index) {
			$(this).html( $(this).html().substr(0,160) + "..");
		});*/
		
		$("#body_contain .top_content .menu .blog").each(function(index) {
			$(this).html( $(this).html().substr(0,27) + "..");
		});
		
		$("#body_contain .top_content .menu .video").each(function(index) {
			$(this).html( $(this).html().substr(0,27) + "..");
		});
		
		$("#body_contain .top_content .menu .howto").each(function(index) {
			$(this).html( $(this).html().substr(0,27) + "..");
		});
		
		$("#body_contain .top_content .menu .tools").each(function(index) {
			$(this).html( $(this).html().substr(0,27) + "..");
		});
		
		$('#header_nav a[href="/about/"]').mouseenter(function() { 
			$('#about_drop_down').show();											 
		});
		
		$('#about_roll_off').mouseenter(function() { 
			$('#about_drop_down').hide();											 
		});
		
		
		$('#about_drop_down').mouseleave(function () { 
			$(this).hide();
		});
		
		$('#header_nav a[href!="/about/"]').mouseover(function () { 
			$('#about_drop_down').hide();
		});
		
		$('#content .menu .form').mouseover(function () { 
			$('#content .top_content .text').hide();
			$('#content .top_content #forum').show();
			$('#content .menu .form').addClass('form_onstate');
			$('#content .menu .blog').removeClass('blog_onstate');
			$('#content .menu .video').removeClass('video_onstate');
			$('#content .menu .howto').removeClass('howto_onstate');
			$('#content .menu .tools').removeClass('tools_onstate');
		});
		
		$('#content .menu .blog').mouseover(function () { 
			$('#content .top_content .text').hide();
			$('#content .top_content #blog').show();
			$('#content .menu .form').removeClass('form_onstate');
			$('#content .menu .blog').addClass('blog_onstate');
			$('#content .menu .video').removeClass('video_onstate');
			$('#content .menu .howto').removeClass('howto_onstate');
			$('#content .menu .tools').removeClass('tools_onstate');
		});
		
		$('#content .menu .video').mouseover(function () { 
			$('#content .top_content .text').hide();
			$('#content .top_content #video').show();
			$('#content .menu .form').removeClass('form_onstate');
			$('#content .menu .blog').removeClass('blog_onstate');
			$('#content .menu .video').addClass('video_onstate');
			$('#content .menu .howto').removeClass('howto_onstate');
			$('#content .menu .tools').removeClass('tools_onstate');
		});
		
		$('#content .menu .howto').mouseover(function () { 
			$('#content .top_content .text').hide();
			$('#content .top_content #howto').show();
			$('#content .menu .form').removeClass('form_onstate');
			$('#content .menu .blog').removeClass('blog_onstate');
			$('#content .menu .video').removeClass('video_onstate');
			$('#content .menu .howto').addClass('howto_onstate');
			$('#content .menu .tools').removeClass('tools_onstate');
		});
		
		$('#content .menu .tools').mouseover(function () { 
			$('#content .top_content .text').hide();
			$('#content .top_content #tools').show();
			$('#content .menu .form').removeClass('form_onstate');
			$('#content .menu .blog').removeClass('blog_onstate');
			$('#content .menu .video').removeClass('video_onstate');
			$('#content .menu .howto').removeClass('howto_onstate');
			$('#content .menu .tools').addClass('tools_onstate');
		});
		
		$("#body_contain .top_content .menu").show();
		$("#body_contain #left .middle_content_below .para_1 + p").show();
		$("#body_contain #right #bottom_wrap .box_one p.quotes + p").show();
		
		$('.box22').focus(function(){ 
			$(this).val('');						  
		});
		$('.box22').blur(function(){ 
			if ($(this).val() == '') {
				$(this).val('First Name');		
			}
		});
		
		$('.box55').focus(function(){ 
			$(this).val('');						  
		});
		$('.box55').blur(function(){ 
			if ($(this).val() == '') {
				$(this).val('Email Address');		
			}
		});
		
		$('.box44').focus(function(){ 
			$(this).val('');						  
		});
		$('.box44').blur(function(){ 
			if ($(this).val() == '') {
				$(this).val('Last Name');		
			}
		});

       $('#new_blog_toggle').click(function () {                          
            $(this).addClass('new_blog_toggle_focus');
            $(this).removeClass('new_blog_toggle');
            
            $('#latest_news_toggle').addClass('latest_news_toggle');
            $('#latest_news_toggle').removeClass('latest_news_toggle_focus');
            $('#new_startup_toggle').addClass('new_startup_toggle');
            $('#new_startup_toggle').removeClass('new_startup_toggle_focus');
            
            $('#new_blog_box').show();
            $('#latest_news_box').hide();
            $('#new_startup_box').hide();
            
            $('#mrn_toggle_link').attr('href','/blog/');
            $('#mrn_toggle_link').html('More Blog Posts');
        });    
        
        $('#latest_news_toggle').click(function () {                          
            $(this).addClass('latest_news_toggle_focus');
            $(this).removeClass('latest_news_toggle');

            $('#new_blog_toggle').addClass('new_blog_toggle');
            $('#new_blog_toggle').removeClass('new_blog_toggle_focus');
            $('#new_startup_toggle').addClass('new_startup_toggle');
            $('#new_startup_toggle').removeClass('new_startup_toggle_focus');
            
            $('#latest_news_box').show();
            $('#new_startup_box').hide();
            $('#new_blog_box').hide();
            
            $('#mrn_toggle_link').attr('href','/news/');
            $('#mrn_toggle_link').html('More Recent News');
        });    
        
        $('#new_startup_toggle').click(function () { 
            $(this).addClass('new_startup_toggle_focus');
            $(this).removeClass('new_startup_toggle');

            $('#new_blog_toggle').addClass('new_blog_toggle');
            $('#new_blog_toggle').removeClass('new_blog_toggle_focus');
            $('#latest_news_toggle').addClass('latest_news_toggle');
            $('#latest_news_toggle').removeClass('latest_news_toggle_focus');
            
            $('#new_startup_box').show();
            $('#latest_news_box').hide();
            $('#new_blog_box').hide();
            
            $('#mrn_toggle_link').attr('href','/startups/');
            $('#mrn_toggle_link').html('More Startups');
        });
		
		//$('#blog_category > ul > li > a').after('<div class="sponsor"><a href="/advertise/">Your Business Here</a></div>');

		$('#blog_category').height( $('#blog_content').height() );
		
		if ($('').height() > $('#right').height()) {
			$('#right').height( $('').height() );
			$('.general_third').height( $('').height() );
		}
		
		if ($('').height() < $('#right').height()) {
			$('').height( $('#right').height() );
			$('.general_third').height( $('#right').height() );
		}
});
