// JavaScript Document

$(document).ready(function() { 
	
	
	$('.newsHook .hiddenTwo').hide();
	$(".newsHook h2 span").css('cursor','pointer')
	$(".newsHook h2 span").click(function(){
			if($('.newsHook .hiddenTwo').is(':hidden')){	
				$('.newsHook .hiddenTwo').slideDown();
			}else{
				$('.newsHook .hiddenTwo').slideUp();
			}
	});
	
	
	$('.team .person').css('cursor','pointer')
	$('.team .person .text .cont').hide();
	$('.team .person').click(function(){
			if ($(this).children('.text').children('.cont').is(':hidden'))
			{
				$('.team .person .text .cont').slideUp();
				$(this).children('.text').children('.cont').slideDown();
			}
	});
	
	
	
	$('.keywordBox').clearType();
	
	
	
	
	$(".hotJobs").children('.job').hide();
	$(".hotJobs").children('.job:first').addClass('active').show();
	
	$(".hotJobs .controls a.left").click(function(){
		if ($(".hotJobs").children('.active').prev('.job').size() > 0)
			{
				$(".hotJobs").children('.active').removeClass('active').fadeOut('slow').prev('.job').addClass('active').fadeIn('slow');
			}
		else
			{
				$(".hotJobs").children('.active').removeClass('active').fadeOut('slow');
				$(".hotJobs").children('.job:last').addClass('active').fadeIn('slow');
			}
	});
	
	$(".hotJobs .controls a.right").click(function(){
		if ($(".hotJobs").children('.active').next('.job').size() > 0)
			{
				$(".hotJobs").children('.active').removeClass('active').fadeOut('slow').next('.job').addClass('active').fadeIn('slow');
			}	
		else
			{
				$(".hotJobs").children('.active').removeClass('active').fadeOut('slow');
				$(".hotJobs").children('.job:first').addClass('active').fadeIn('slow');
			}
	});
	
	
	setInterval(function(){
		if ($(".hotJobs").children('.active').next('.job').size() > 0)
			{
				$(".hotJobs").children('.active').removeClass('active').fadeOut('slow').next('.job').addClass('active').fadeIn('slow');
			}
		else
			{
				$(".hotJobs").children('.active').removeClass('active').fadeOut('slow');
				$(".hotJobs").children('.job:first').addClass('active').fadeIn('slow');
			}
		}, 3000);





});

$.fn.clearType = function () {
	var thisVal = $(this).val();
	
	// CLEAR/FILL TEXT BOXES 
	$(this).focus(function() {
		if($(this).val()==thisVal){
			$(this).val('');
		}
	});
	$(this).blur(function() {
		if($(this).val()==''){
			$(this).val(thisVal);
		}					  
	});
	
};
