var iTimeout;


function setupTextFields(objTextField,defaultString)
{
	$(objTextField).focus(function(){
		if($(objTextField).val()==defaultString)
		{
			$(objTextField).val("");
		}
	});
	$(objTextField).blur(function(){
		if($(objTextField).val()=="")
		{
			$(objTextField).val(defaultString);
		}
	});
}
function featured_listing()
{
	$("#featured-listing").delegate("li","click mouseover mouseout",function(e){
		if(e.type =="click")
		{
			var indexPos =$(this).index();
			var xPos = 50 + (indexPos*70); 
			
			$id = $(this).children("div.job-id").html();
			$title = $(this).children("div.job-title").children("a").html();
			$location = $(this).children("div.job-location").html();
			$duration = $(this).children("div.job-duration").html();
			$description = $(this).children("div.job-description").html();
			
			$("#featured-jobs #list-popup .title").html($title);
			$("#featured-jobs #list-popup .job-location").html($location);
			$("#featured-jobs #list-popup .job-duration").html($duration);
			$("#featured-jobs #list-popup .description").html($description);
			$("#featured-jobs #list-popup a.read-more").attr("href","/jobs/details/" + $id);
			
			$("#featured-jobs #list-popup").fadeIn("fast");
			$("#featured-jobs #list-popup").css("top",xPos);
			$("#featured-jobs #list-popup").css("left",200);
		}else if(e.type == "mouseover")
		{
			$(this).addClass("list-active");
		}else if(e.type == "mouseout"){
			$(this).removeClass("list-active");
			clearTimeout(iTimeout);
			iTimeout= setTimeout('hidePopup()',3000);	
		}
	});
	
}

function hidePopup()
{
	$("#featured-jobs #list-popup").fadeOut("fast");
	clearTimeout(iTimeout);
}

function slideShow() 
{
	$('#overlay a').css({opacity: 0.0});
	$('#overlay a:first').css({opacity: 1.0});
	$('#overlay .caption').css({opacity: 0.7});
	$('#overlay .caption').css({width: 300});
	$('#overlay .content').html($('#overlay a:first').find('img').attr('rel'))
	.animate({opacity: 1}, 500);
	setInterval('gallery()',10000);	
}

function gallery() 
{
	var current = ($('#overlay a.show')?  $('#overlay a.show') : $('#overlay a:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#overlay a:first') :current.next()) : $('#overlay a:first'));	
	var caption = next.find('img').attr('rel');	
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	$('#overlay .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '90px',marginLeft:-300}, { queue:true, duration:300 });	
	$('#overlay .caption').animate({opacity: 0.7},100 ).animate({height: '90px',marginLeft:0},500 );
	$('#overlay .content').html(caption);
	sIFR.replace(helvetica, {
  selector: 'h3',
  css: '.sIFR-root {color: #FFFFFF; }',
  wmode : 'transparent'
});
}

