function pause(milliseconds) {
	var dt = new Date();
	while ((new Date()) - dt <= milliseconds) { /* Do nothing */ }
}



jQuery(document).ready(function($){	

	$("#mid-right").easySlider({
		auto:true,
		speed:5000,
		continuous:true,
		numeric:true
		});
	$(".newsticker-jcarousellite").jCarouselLite({
		auto:true,
		speed:2000,
		vertical:true,
		circular:true,
		visible:4
	});

  var optionsEmail = {
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       emailResponse  // post-submit callback 
};
 $('#emailForm').validate({
	errorClass: "invalid"
	});
$("#emailForm").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsEmail);
	}
	return false;
});
function emailResponse(){
		$(".ajaxloadimg").hide();
		$('#email-us-form').fadeOut('slow', function(){
		$(this).html('<h4 class="gray">Thank You</h4><p>Your message was sent successfully. Thanks.</p>');
            }).fadeIn('slow').parents('#lightview').add('#lv_overlay').fadeIn('fast').delay(5000).fadeOut('slow', function() {
    			// Animation complete.
    			Lightview.hide();
				$("input[type='submit']").show();
  			});
		
}

var optionsInfo = {
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       infoResponse  // post-submit callback 
};
 $('#infoForm').validate({
	errorClass: "invalid"
	});
$("#infoForm").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsInfo);
	}
	return false;
});
function infoResponse(){
		$(".ajaxloadimg").hide();
		$('#info-request-form').fadeOut('slow', function(){
		$(this).html('<h4 class="gray">Thank You</h4><p>Thank You! Your Information Request was sent successfully. A member of our staff will contact you shortly.</p>');
            }).fadeIn('slow').parents('#lightview').add('#lv_overlay').fadeIn('fast').delay(5000).fadeOut('slow', function() {
    			// Animation complete.
    			Lightview.hide();
				$("input[type='submit']").show();
  			});
		
}






var optionsResume = { 
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       resumeResponse  // post-submit callback 
};
$("#resumeForm").validate({
	errorClass: "invalid"
	});
$("#resumeForm").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsResume);
	}
	return false;
});
function showRequest(){
	$(".ajaxloadimg").show();
	$("input[type='submit']").hide();
}
function resumeResponse(){
		$(".ajaxloadimg").hide();
		$('#submit-resume-form').fadeOut('slow', function(){
		$(this).html('<br><h4 class="gray">Thank You</h4><p>Thank You! Your resume submission has been received and a staffing specialist will contact you shortly if our current database of open positions matches your skills and background. All user submitted data and information is kept 100% confidential and is stored in our encrypted database.</p><br><h4>Areas of Specialty</h4><p>Our niche focus, recruiting expertise and market knowledge combine to give you the tools and edge you need in a competitive candidate market.</p><p><b>Placement Specialties</b><br>Perm / Full Time / Direct / Temp-Perm<br />Contract-Hire / Contract / Consulting</p><p><b>Technology Specialties</b><br>.NET Framework - <em>all tools and technologies</em><br>LAMP &amp; JAVA/J2EE - <em>all tools and technologies</em></p><p><b>Position Specialties</b><br>Web/Desktop Application Development<br />Software Engineering/Archtecture<br />User Interface (UI)<br />Database Development/Administration<br />Business Systems Analysis<br />IT Consulting</p>');
           }).fadeIn('slow').parents('#lightview').add('#lv_overlay').fadeIn('fast').delay(5000).fadeOut('slow', function() {
   			// Animation complete.
   			Lightview.hide();
				$("input[type='submit']").show();
 			});
		
}




var optionsSideResume = { 
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       resumeSideResponse  // post-submit callback 
};
$("#sideResumeForm").validate({
	errorClass: "invalid"
    });
$("#captcha").change(function(){
	if (document.getElementById("send-captcha").value == '') {
	getCaptcha(document.getElementById("captcha").value);
	}
	jQuery('input#send-captcha').flushCache();
});
$("#sideResumeForm").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsSideResume);
	}
	return false;
});
function showRequest(){
	$(".ajaxloadimg").show();
	$("input[type='submit']").hide();
}
function getCaptcha(str){
	$.ajax({
		  type: 'POST',
		  url: "api-captcha.php",
		  data: { captcha: str },
		  success: function(data){
		        document.getElementById("send-captcha").value=data;
		    }
		}); 
}
function resumeSideResponse(){
		$(".ajaxloadimg").hide();
		$('#resume-form').fadeOut('slow', function(){
		$(this).html('<br><h4 class="gray">Thank You</h4><p>Thank You! Your resume submission has been received and a staffing specialist will contact you shortly if our current database of open positions matches your skills and background. All user submitted data and information is kept 100% confidential and is stored in our encrypted database.</p><br><h4>Areas of Specialty</h4><p>Our niche focus, recruiting expertise and market knowledge combine to give you the tools and edge you need in a competitive candidate market.</p><p><b>Placement Specialties</b><br>Perm / Full Time / Direct / Temp-Perm<br />Contract-Hire / Contract / Consulting</p><p><b>Technology Specialties</b><br>.NET Framework - <em>all tools and technologies</em><br>LAMP &amp; JAVA/J2EE - <em>all tools and technologies</em></p><p><b>Position Specialties</b><br>Web/Desktop Application Development<br />Software Engineering/Archtecture<br />User Interface (UI)<br />Database Development/Administration<br />Business Systems Analysis<br />IT Consulting</p>');
           }).fadeIn('slow');
		
}





 var optionsQuestion = { 
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       questionResponse  // post-submit callback 
};
$("#questionForm").validate({
	errorClass: "invalid"
	});
$("#questionForm").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsQuestion);
	}
	return false;
});
function questionResponse(){
		$(".ajaxloadimg").hide();
		$('#ask-question-form').fadeOut('slow', function(){
		$(this).html('<h4 class="gray">Thank You</h4><p>Thank You! A highly qualified staffing professional will be in contact with your answer within 24 hours.</p>');
            }).fadeIn('slow').parents('#lightview').add('#lv_overlay').fadeIn('fast').delay(5000).fadeOut('slow', function() {
    			// Animation complete.
    			Lightview.hide();
				$("input[type='submit']").show();
  			});
		
}


 var optionsReferral = { 
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       referralResponse  // post-submit callback 
};
$("#referralForm").validate({
	errorClass: "invalid"
	});
$("#referralForm").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsReferral);
	}
	return false;
});
function referralResponse(){
		$(".ajaxloadimg").hide();
		$('#submit-referral-form').fadeOut('slow', function(){
		$(this).html('<h4 class="gray">Thank You</h4><p>Thank you! Your referral has been accepted. A staffing specialist will notify you when we contact your referral. All data submitted is kept 100% confidential and is stored in our encrypted database for your protection</p>');
            }).fadeIn('slow').parents('#lightview').add('#lv_overlay').fadeIn('fast').delay(5000).fadeOut('slow', function() {
    			// Animation complete.
    			Lightview.hide();
				$("input[type='submit']").show();
  			});
		
}



 var optionsSideEmail = { 
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       sideEmailResponse  // post-submit callback 
};
$("#emailFormSide").validate({
	errorClass: "invalid"
	});
$("#emailFormSide").submit(function(){
	if ( $(this).valid() ) {
		$(this).ajaxSubmit(optionsSideEmail);
	}
	return false;
});
function sideEmailResponse(){
		$(".ajaxloadimg").hide();
		$('#email-side-wrap').fadeOut('slow', function(){
		$(this).html('<h4>Thank You</h4><p>Your message was sent successfully. Thanks.</p>');
            }).fadeIn('slow', function() {
				$("input[type='submit']").show();
  			});
		
}
// $('#emailFormSide').ajaxForm(function() { 
   //             alert("Thank you for your comment!"); 
     //       }); 


});




// New code 4/10 - D Thombs

function targetApplyNow(){
	document.getElementById("resume_focus").focus();
	document.getElementById("formFirstName").style.color='red';
	document.getElementById("formFirstName").style.fontWeight='bold';
}




function copyToClipboard(s)
{
	if( window.clipboardData && clipboardData.setData )
	{
		clipboardData.setData("Text", s);
	}
/*	else
	{
		// You have to sign the code to enable this or allow the action in about:config by changing
		user_pref("signed.applets.codebase_principal_support", true);
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

		var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) return;

		// create a transferable
		var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
		if (!trans) return;

		// specify the data we wish to handle. Plaintext in this case.
		trans.addDataFlavor('text/unicode');

		// To get the data from the transferable we need two new objects
		var str = new Object();
		var len = new Object();

		var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);

		var copytext=meintext;

		str.data=copytext;

		trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);

		var clipid=Components.interfaces.nsIClipboard;

		if (!clip) return false;

		clip.setData(trans,null,clipid.kGlobalClipboard);	   
	}
	*/
}
