//alert (selState);

$(document).ready(function() {

// Tout
	$('.tout ol').removeClass('hide');
	var tabContainers = $('div.tout > div');
	
	$('div.tout ol a').click(function () {
		tabContainers.hide().filter(this.hash).show();
		
		$('div.tout ol a').removeClass('current');
		$(this).addClass('current');
		
		return false;
	}).filter(':first').click();
	
	var $randomNum = Math.floor(Math.random() * 4+1);
	if($randomNum == 1){
		$container = 'one';
	}else if($randomNum == 2){
		$container = 'two';
	}else if($randomNum == 3){
		$container = 'three';
	}else if($randomNum == 4){
		$container = 'four';
	}
	tabContainers.hide();
	//alert($container);
	$('#'+$container).show();
	$('div.tout ol a').removeClass('current');
	$('#link'+$container).addClass('current');
	
	$(document).everyTime(10000,'rotatingBanner',function(){
		
			$randomNum ++;
			if($randomNum > 4){
				$randomNum = 1;
			}
		
			if($randomNum == 1){
				$container = 'one';
			}else if($randomNum == 2){
				$container = 'two';
			}else if($randomNum == 3){
				$container = 'three';
			}else if($randomNum == 4){
				$container = 'four';
			}
			tabContainers.hide();
			//alert($container);
			$('#'+$container).show();
			$('div.tout ol a').removeClass('current');
			$('#link'+$container).addClass('current');
	},0);
// END Tout

// Job Search Tips
	$('#tips').hide();
	$('#tips-head a').click(function(){
		$('#tips').slideToggle('normal');
		return false;
	});
// END Job Search Tips

// Hide state select
/* There are actually regions for the other countries
	$('#form-state-select').hide();
	
	if($('#country').val() == 1){
		$('#form-state-select').show();
	}
	
	$('#country').change(function (){
		if($(this).val() == 1){
			$('#form-state-select').slideDown();
		} else { 
			$('#form-state-select').slideUp();
		}
	});
*/
// END Hide state select

// Table Striping
	$('.stripeMe table:even').addClass('alt');
	$('#job-listings #listings-wrapper table').each(function(){
		$('tbody tr:even').addClass('alt');
	});

// END Table Striping

	//restored by df to get clear link to work on search side bar
	//jobsearch bar reset button
		$('#reset-job-search').click(function(){
			$('#keywords').val('');
			$('#keywordsearch').val('ALL');
			$('#clearance').val('');
			$('#category').val('');
			$('#jobtype').val('');
			$('#country').val('');
			$('#state').val('');
			$('#zipcode').val('');
			$('#zipradius').val('');
			return false;
		});
	// END jobsearch bar reset button

	//resume search bar reset button
		$('#reset-resume-search').click( function(){
			$('#keywords').val('');
			$('#keywordsearch').val('ALL');
			$('#clearance').val('');
			$('#career').val('');
			$('#category').val('');
			$('#education').val('');
			$('#salary').val('');
			$('#jobtype').val('');
			$('#country').val('');
			$('#state').val('');
			$('#zipcode').val('');
			$('#zipradius').val('');
			$('#searchdate').val('');
			return false;
		} );
		
	//Extend the sidebar to be the same height as content area
	if($('.sidebarExtend').length) {
		var sidebarHeight = $('.section #sidebar .sidebarExtend').height();
		var contentHeight = $('.section #content').height();
		
		if(contentHeight > sidebarHeight) {
			$('.section #sidebar .sidebarExtend').height(contentHeight)
		}	
	}
	//END extend the sidebar to be the same height as content area


// This is stuff I think we don't need -bg
// ***************************************

/*
//Accordion
	$('ul#accordion a.heading').click(function() {
		$(this).css('outline','none');
		if($(this).parent().hasClass('current')) {
			$(this).siblings('.accordionContent').slideUp('slow',function() {
				$(this).parent().removeClass('current');
				$.scrollTo('#accordion',1000);
			});
		} else {
			$('ul#accordion li.current div.accordionContent').slideUp('slow',function() {
				$(this).parent().removeClass('current');
			});
			$(this).siblings('.accordionContent').slideToggle('slow',function() {
				$(this).parent().toggleClass('current');
			});
			$.scrollTo('#accordion',1000);
		}
		return false;
	});
// END Accordion
*/
	
// Add Location on My Resume Preferences page
/*
$("select#country").change(function(){
	$.getJSON("/includes/ajax/getState.php",{countryID: $(this).val(), ajax: 'true'}, function(j){
		var options = '';
		for (var i = 0; i < j.length; i++) {
			options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
		}
		$("select#state").html(options);
	});
});
*/
// END Add Location on My Resume Preferences page

/*
$('#addLocation').click(function(){
	var selCountry = $('#country option:selected').text();
	var selState = $('#state option:selected').text();
	
	var test = $('#locations li').length;
	
	$('#country').before('<ul id="locations"></ul>');
	$('ul#locations').append('<span id="location1">' + selCountry + '/' + selState + '</span> <span id="locationDelete1"><a href="">Delete</a></span>')
	
	alert (test);
	
	if($('#locations li').length == 3){
		$('#addLocation').fadeOut('slow',function(){
			$('#max-reached').fadeIn('slow');
		});
	}
});
*/
});