function clearText(field,text) {
	 $(field).val(text==false ? '' : ($(field).val().length==0 ? text : $(field).val())); 
}

function setSidebarQuote(){
   
	var header_title_options = new Array(
		'Professional resumes get results.', 
		'"My sincerest thanks to you for taking the time to work with me on my resume and job search strategy."',
		'Check out our <a href="/resume-templates">Resume Template options.</a>',
		'"Having me do all of the work on my resume with your template and feedback was an excellent way to go."',
		'"Your very direct feedback and advice was very important during my job search."'
		)
	
	var quote = header_title_options[Math.floor(Math.random()*header_title_options.length)];
	
	return quote;
}


$(document).ready(function() {
	$("div.sf-menu ul").superfish(
	{
		delay:300,
		speed:'fast',
		autoArrows:false,
		dropShadows:false,
		oninit:function() { $('.sf-menu ul').css('display','block'); }
	});

	$('#slider').nivoSlider({effect:'fade',animSpeed:300,directionNav:false,directionNavHide:false,controlNav:true,pauseTime:5000});
	
	
	$('.quote .middle').html(setSidebarQuote());
	
	
	/*---------------------------------------------------------------------------------------- */
	/*	Fancy Box
	/*---------------------------------------------------------------------------------------- */
	
	
	$(".iframe").fancybox({
		'width'				: '50%',
		'height'			: '75%',
	    'autoScale'     	: false,
	    'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	
	
	
	/*---------------------------------------------------------------------------------------- */
	/*	Resume Templates
	/*---------------------------------------------------------------------------------------- */
	
	$('#resume-templates a.toc').attr("target","_blank");
	
	
	// Resume template buttons
	
	
	$('.productSubmitInput').each(function(){
	    
	    $(this).data('onclick', this.onclick);
	    var cb = $(this).parents('.pricing-footer').first().find(':checkbox').first();
	    
	
	    this.onclick = function(event) {
	    
			if(cb.is(':checked')){
				$(cb).parents('form').first().removeClass('fail');
	
			} else {
				$(cb).parents('form').first().addClass('fail');
				alert('Please confirm you have read and agree to the Terms and Conditions.');	
				return false;
			}
	
	      $(this).data('onclick').call(this, event || window.event)
	    }
	  })
	
	
	
	
	// Resume rewrite button
	
	$('#toggle-quote-form').click(function(e){
		
		e.preventDefault();
		
		cb = $(this).prev('form').find(':checkbox');
		pf = $(this).parents('.pricing-footer').first();
		
		if(cb.is(':checked')){
			
			$(this).prev('form').removeClass('fail');
			
			pf.slideUp(300);
			
			btnText = $(this).find('span').text();
			$('#free-quote-wrap').stop().slideDown(300);	
		
		} else {
		
			$(this).prev('form').addClass('fail');
			alert('Please confirm you have read and agree to the Terms and Conditions.');	
			
		}
		
		
	})
	
	
	
	
	
	
	
	
	
	
	
	
//	
//	$('#resume-templates a.toc').attr("target","_blank");
//	
//	$('#resume-templates .purchase').click(function(e){
//
//		cb = $(this).prev('form').find(':checkbox');
//		
//		if(cb.is(':checked')){
//			$(this).prev('form').removeClass('fail');
//			
//			pf = $(this).parents('.pricing-footer').first();
//			
//			if($(this).attr('id') == 'toggle-quote-form'){
//				e.preventDefault();
//				
//				pf.slideUp(300, 'easeOutQuint');
//				
//				btnText = $(this).find('span').text();
//				$('#free-quote-wrap').stop().slideDown(300, 'easeOutQuint');
//			}
//			
//		} else {
//			e.preventDefault();
//			$(this).prev('form').addClass('fail');
//			alert('Please confirm you have read and agree to the Terms and Conditions.');	
//		}
//	
//	});
//
//	
	
	
	
	
});
