jQuery(function($){
	$('#resume_upload').fileinput({
		buttonText: 'Upload',
		inputText: 'Upload resume*'
	});
	$('#cover_upload').fileinput({
		buttonText: 'Upload',
		inputText: 'Upload cover letter*'
	});
	$("input[type=text], input[type=password]").focus(function(){
		$("input[type=text], input[type=password]").removeClass("focus");
		$(this).addClass("focus");
	});
	$("input[type=text], input[type=password]").blur(function(){
		$(this).removeClass("focus");
	});
	$('.accordion_view').click(function() {
		$(this).css('outline','none');
		if($(this).parent().hasClass('active')) {
			$(this).siblings('.accordion').slideUp('medium',function() {
				$(this).parent().removeClass('active');
			});
		} else {
			$('.accordion').slideUp('medium',function() {
				$(this).parent().removeClass('active');
			});
			$(this).siblings('.accordion').slideToggle('medium',function() {
				$(this).parent().toggleClass('active');
			});
		}
		return false;
	});

	// ***********************************
	// USE ALT VALUE TO PUT IN FORM FIELD OF TYPE "TEXT"
	$("input[type=text]").each(function() { $(this).attr("alt", $(this).val()); });
	// CLEAR INPUT.TEXT ON FOCUS, IF STILL IN DEFAULT
	$("input[type=text]").focus(function() { if ($(this).val() == $(this).attr("alt")) { $(this).val(""); } });
	// IF FIELD IS EMPTY AFTERWARD, ADD TEXT AGAIN
	$("input[type=text]").blur(function() { if ($(this).val() == "") { $(this).val($(this).attr("alt")); } });
	// ***********************************
	
	$('input[type=checkbox],input[type=radio]').customRadioCheckbox();
	$('.apply_for_job').click(function(e){
		e.preventDefault();
		$('html, body').animate({
			scrollTop: $("#form").offset().top
		}, 2000);
	});
	var overlaytimer = new Array();
	$(".home_left_col .post, .thumb_list li").each(function(){
		var theIndex = $(this).index();
		$(this).mouseenter(function(){
			$(".overlay").not(theIndex).fadeOut(100);
			$(".overlay", this).fadeIn(400,function(){
				$(this).mouseleave(function(){
					$(this).fadeOut(400);
				});
				
			});
			$("a", this).click(function(e){
					//$(this).fancybox();
					$(this).parent().mouseleave();
					
				});	
		});
	}); 
});
