//Freelance Students Generic Javascript

jQuery(document).ready(function() {

	/*
		Rounded Corners
	*/
	
	jQuery('#message').corner('5px');
	jQuery('ul.pagination li').corner('5px');
	jQuery('a.button').corner('5px');
	jQuery('button.button').corner('5px');
	//jQuery('#search').corner('5px');
	jQuery('ul.post_info').corner('5px');
	jQuery('.navigation a').corner('5px');
	jQuery('li.administrator').corner('5px');
	jQuery('.highlight').corner('5px');
	jQuery('#employers_button').corner('5px bottom');

	//Quick fix, we want to be able to round buttons, but IE throws errors
	if(jQuery.support.opacity){
		jQuery('.button').corner('5px');
	}

	/*
		Front Page Slider
	*/
	
	if(jQuery('#front_feature').length){
		jQuery('#front_feature').nivoSlider({
			directionNavHide: false,
			pauseTime: 8000
		});
	}

	/*
		Textarea auto-expand
	*/
	
/*
	if(jQuery('#job_desc').length){
		jQuery('#job_desc').elastic();
	}

	if(jQuery('#how_apply').length){
		jQuery('#how_apply').elastic();
	}	
	
*/
	/*
	
		Auto Suggest
	
	*/
	
	//$("#search_value").autoSuggest("http://mysite.com/path/to/script", {minChars: 2});
	
	/*
	
		Input Tips
	
	*/
	
	$("ul.form input, ul.form textarea, ul.form div").tipTip({
		defaultPosition: 'right',
		maxWidth: '400px'
	});

	/*
	
		Input Hover Text Replacement
	
	*/
	
	jQuery('input:not([type=submit])').each(function(n, el){
	
		if(!jQuery(this).hasClass('no_remove')){
	
			var val = jQuery(el).val();
			
			jQuery(el).focus(function(){
				
				if(jQuery(this).val() == val){
					jQuery(this).val('');
					jQuery(this).addClass('input_active');
				}
				
			});
		
			jQuery(el).blur(function(){
				
				if(jQuery(this).val() == ''){
					jQuery(this).val(val);
					jQuery(this).removeClass('input_active');
				}
				
			});
	
		}
		
	});
	
	/*
	
		Sub Item Last Element
	
	*/
		
	jQuery('.sub_item ul').each(function(){
		
		jQuery(this).children('li:last').addClass('last');
				
	});

	/*
	
		Confirm dialogue
		
	*/
	
	jQuery('.confirm').click(function(e){
	
		e.preventDefault();
	
		if(confirm("Are you sure you want to do this?")){
		
			window.location.replace(jQuery(this).attr('href'));
		
		}
		
	});

}); 