// Makes sure the document is ready before executing scripts
var $j = jQuery.noConflict();

$j(function(){

	/*** GENERAL FUNCTIONS ***/
	// Remove all prev links on single pages
	$j('.post [rel="prev"], .post a[rel="category tag"], .post a[rel="tag"]').css('display', 'none');
	$j('body[class*="page"]').removeAttr('<span>');
	$j('a[class^="ctc-tag"]').css({
		'text-decoration'	: 'none',
		'word-spacing'      : '3px;'
	});
	$j('textarea#cf_field_6').css({
		'position'	:  'relative',
		'top'		:  '-138px'
	});
	$j('.post #searchform').css('display', 'none');
	$j('textarea#smcf-message').css('display', 'inline');
	$j('textarea#comment').css({
		'display'	: 'block',
		'margin'	: '0px',
		'padding'	: '0px',
		'float'		: 'left',
		'width'		: '290px',
		'height'	: '150px'		
	});
	$j('[class^="comment-form"] span, [for="url"], [for="comment"]').append('<br />');
	$j('.form-submit').css({
		'float'			: 'left',
		'clear'			: 'both',
		'display'		: 'block'
	});
	$j('a[rel*="attachment"]').removeAttr('href');	
	$j('#sidebar input[type="image"]').css({
		'padding'		: '0px',
		'text-indent'	: '-9999px'
		});
	$j('.simplemodal-wrap').removeAttr('overflow', 'hidden');
	$j('.simplemodal-wrap').css({
		'position'		:		'absolute',
		'top'			:		'40px',	
		'height'		:		'1000px'	
	});
	$j('#smcf-container label').css({
		'color'		: '#000',
		'position'	: 'absolute',
		'top'		: '0px',
		'left'		: '0px'
	});
	$j('.smcf-input').attr('autocomplete', 'off');
	$j('#smcf-content label').inFieldLabels();
	
	// Adds Default Image to posts with no image
	$j('img.post-image[src=""]').attr('src', 'http://hyperdrivei.com/wp-content/uploads/2011/11/hdi-default.jpg');
	$j('span[class="meta-prep meta-prep-author"]').append('<br /><br />');
	$j('li#ws_widget__super_tags-2 .widget-title').html('Super Tags Widget').remove();
	
	// Home Page Functions
	
		// WHO WE ARE POPUP
		$j('#he_who_we_are').click(function() {
			$j('#mask').css({
				'opacity' : '.8',
				'z-index' : '0'
			});
			$j('#he_who_we_are_info').css({
				'position' : 'absolute',
				'left'	   : '0px',
				'z-index' : '999999',
				'opacity' : '1'
			});
			$j('#mask').fadeIn('1000');
			$j('#he_what_weve_done, #he_what_we_do_wrapper,#tagline').css('display', 'none');
			$j('#he_who_we_are_info').fadeIn('1000');
			$j('#close_wwa').click(function() {
				$j('#mask, #he_who_we_are_info').fadeOut('fast');
				$j('#he_what_weve_done, #he_what_we_do_wrapper, #tagline').css('display', '');
			});
		});
	
		// WHAT WEVE DONE POPUP
		$j('#he_what_weve_done').click(function() {
			$j('#mask').css('opacity', '.8');
			$j('#mask').fadeIn('1000');
			$j('#he_what_weve_done_info').css({
				'position' : 'absolute',
				'left'	   : '0px',
				'z-index' : '999999',
				'opacity' : '1'
			});
			$j('#he_what_weve_done_info').fadeIn('1000');
			$j('#he_who_we_are, #he_what_we_do_wrapper, #tagline').css('display', 'none');
			$j('#he_wwd-close').click(function() {
				$j('#mask, #he_what_weve_done_info').fadeOut('fast');
				$j('#he_who_we_are, #he_what_we_do_wrapper, #tagline').css('display', '');
			});
		});	

		// WHAT WE DO POPUP
		$j('#he_what_we_do_wrapper').click(function() {
			$j('#mask').css('opacity', '.8');
			$j('#mask').fadeIn('1000');
			$j('#he_what_we_do_info').css({
				'position' : 'absolute',
				'left'	   : '0px',
				'z-index' : '999999',
				'opacity' : '1'
			});
			$j('#he_what_we_do_info').css('z-index', '999999999');
			$j('#he_what_we_do_info').fadeIn('1000');
			$j('#he_what_we_do_wrapper, #he_who_we_are, #he_what_weve_done, #tagline').css('display', 'none');
			$j('#close_wwdo').click(function() {
				$j('#mask, #he_what_we_do_info').fadeOut('fast');
				$j('#he_what_we_do_wrapper, #he_who_we_are, #he_what_weve_done, #tagline').css('display', '');
			});
		});			
		$j('[rel*="tag"]').remove();

		/*** INDIVIDUAL POST PAGES ***/
		$j('body[class*="cheryl"] .post_container:last').append('<a href="http://hyperdrivei.com/who-we-are/cheryl-mischkulnig/">Back To Cheryl\'s Profile Page</a>');
		$j('body[class*="bernie"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/bernie-joyce-president/">Back To Bernie\'s Profile Page</a>');
		$j('body[class*="ali"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/ali-margello/">Back To Ali\'s Profile Page</a>')
		$j('body[class*="essen"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/brian-essen/">Back To Brian Essen\'s Profile Page</a>')
		$j('body[class*="szolosi"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/brian-szolosi/">Back To Brian Szolosi\'s Profile Page</a>')
		$j('body[class*="zivich"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/bryan-zivich/">Back To Bryan Zivich\'s Profile Page</a>')
		$j('body[class*="kehrer"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/charlie-kehrer/">Back To Charlie\'s Profile Page</a>')
		$j('body[class*="heimbrock"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/dan-heimbrock-our-ceo/">Back To Dan\'s Profile Page</a>')
		$j('body[class*="marcdavid"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/marcdavid-cohn/">Back To MD\'s Profile Page</a>')
		$j('body[class*="megan"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/megan-collins/">Back To Megans\'s Profile Page</a>')
		$j('body[class*="tim-"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/tim-koehler/">Back To Tim\'s Profile Page</a>')
		$j('body[class*="tom"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/tim-wright/">Back To Tom\'s Profile Page</a>')
		$j('body[class*="page-id-1557"] .post_container:last').append('<a style="float: left; clear: both; width: auto;" href="http://hyperdrivei.com/who-we-are/chris-timman/">Back To Chris\'s Profile Page</a>')

	});

