eval(function(a,b,c,d){while(b--)if(c[b])a=a.replace(new RegExp(d+b+d,'g'),c[b]);return a}("function ajaxFormatURL(1){2 3=document.getElementById(1);2 4='';for(2 a=0;a<3.5.6;a++){switch(3.5[a].type){7'checkbox':{8(3.5[a].9==10){8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13}14}7'file':{14}7'hidden':{8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13;14}7'image':{14}7'password':{8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13;14}7'radio':{8(3.5[a].9==10){8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13}14}7'15-multiple':{14}7'15-one':{8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13;14}7'text':{8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13;14}7'textarea':{8(4.6>0)4=4+'*11*';4=4+3.5[a].12+'='+3.5[a].13;14}}}4=encodeURI(4);4=4.16(/\\+/g,'% 2B');4=4.16(/&/g,'% 26');4=4.16(/\\*11\\*/g,'&');return 4}",17,'|the_form_name|var|the_form|to_be_returned|elements|length|case|if|checked|true|AMP|name|value|break|select|replace'.split('|'),'\\b'))
function ajaxSubmit(method,target,asynchronous,variables_to_send){var req=null;if(window.XMLHttpRequest){req=new XMLHttpRequest()}else{if(window.ActiveXObject){req=new ActiveXObject("Microsoft.XMLHTTP")}}req.onreadystatechange=function(){if(req.readyState==4){if(req.status==200){var returned_value=req.responseText;eval(returned_value)}else{}}};req.open(method,target,asynchronous);if(method=='POST'){req.setRequestHeader('Content-Type','application/x-www-form-urlencoded')}req.send(variables_to_send)}

function applyCropImage() {
  var x = document.getElementById('jcrop_x').value;
  var y = document.getElementById('jcrop_y').value;
  var w = document.getElementById('jcrop_w').value;
  var h = document.getElementById('jcrop_h').value;
  ajaxSubmit('POST', webpage_url + 'oddsandends.php', true, 'page=Crop%20Profile%20Image&x=' + x + '&y=' + y + '&w=' + w + '&h=' + h);
}

function applyForJob(job_number) {
  if(confirm('You are about to send your profile information to this employer. In order to help ensure you make the best impression possible, please make sure your profile is completely up to date. If you are ready to initiate contact with this employer, simply click the Of button below.')) {
    ajaxSubmit('POST', webpage_url + 'oddsandends.php', true, 'page=Apply%20For%20Job&job_number=' + job_number);
	alert('This employer has been notified of your interest in this position and will be getting in contact shortly.');
  }
  return false;
}

function calculatePostingCost(number_of_jobs) {
  cost_of_posting = '';
  if(number_of_jobs == 1) { cost_of_posting = '$295.00'; }
  if(number_of_jobs == 2) { cost_of_posting = '$' + (number_of_jobs * 289) + '.00'; }
  if(number_of_jobs == 3) { cost_of_posting = '$' + (number_of_jobs * 280) + '.00'; }
  if(number_of_jobs == 4) { cost_of_posting = '$' + (number_of_jobs * 263) + '.00'; }
  if(number_of_jobs >= 5 && number_of_jobs <= 9) { cost_of_posting = '$' + (number_of_jobs * 242) + '.00'; }
  if(number_of_jobs >= 10 && number_of_jobs <= 24) { cost_of_posting = '$' + (number_of_jobs * 201) + '.00'; }
  if(number_of_jobs >= 25 && number_of_jobs <= 49) { cost_of_posting = '$' + (number_of_jobs * 150) + '.00'; }
  if(number_of_jobs >= 50 && number_of_jobs <= 99) { cost_of_posting = '$' + (number_of_jobs * 124) + '.00'; }
  if(number_of_jobs >= 100 && number_of_jobs <= 250) { cost_of_posting = '$' + (number_of_jobs * 103) + '.00'; }
  document.getElementById('how_many_employees__calculation__ammount').value = cost_of_posting;
}

function contactEmployee(job_seeker_number) {
  openShadowbox(webpage_url + 'contact_member.php?job_seeker_number=' + job_seeker_number, 'Job Seeker Contact Form');
  return false;
}

function cropProfileImage() {
  document.getElementById('hideable__current_profile_image').style.display = 'none';
  document.getElementById('hideable__crop_profile_image').style.display = '';
  document.getElementById('original_profile_image').style.display = '';
  $('#original_profile_image').Jcrop({
    setSelect: [10, 10, 160, 160],
	onChange: setJcropCoords,
	onSelect: setJcropCoords
  });
}

function emailJobInfo(job_number) {
//  var email_address = prompt('What is the email address that you would like info about this job sent to?');
  var email_address = prompt('Please Enter Email Address');
  if(email_address.length > 5) { ajaxSubmit('POST', webpage_url + 'oddsandends.php', true, 'email_to_me=Yes&job_number=' + job_number + '&email_address=' + email_address); }
  return false;
}

function emailJobSeekerInfo(job_seeker_number) {
//  var email_address = prompt('What is the email address that you would like info about this job seeker sent to?');
  var email_address = prompt('Please Enter Email Address');
  if(email_address.length > 5) { ajaxSubmit('POST', webpage_url + 'oddsandends.php', true, 'email_to_me=Yes&job_seeker_number=' + job_seeker_number + '&email_address=' + email_address); }
  return false;
}

function iAgreeProcessPayment() {
  if(document.getElementById('i_agree__bill_my_card').checked) {
    if(document.getElementById('i_agree__terms_and_conditions').checked) {
	  return true;
    }
	else {
	  alert('Please check the box indicating that you agree to the terms and conditions.');
	}
  }
  else {
    alert('Please check the box indicating that you agree to have your card charged for the amount stipulated.');
  }
  return false;
}

function iAgreeToRecruitmentTerms() {
  if(document.getElementById('i_have_read__recruiting_tac').checked) {
    document.getElementById('recruiting_services_agree_to_terms').style.display = 'none';
    document.getElementById('new_job_posting_form').style.display = '';
  }
  else {  
    alert('You must read, and agree with our Recruiting Services Terms and Conditions before you may continue.');
  }
}

function jobPostingTypeSelected(the_type) {
  document.getElementById('job_posting_container__type_of_posting').style.display = 'none';
  if(the_type == 'Recruitment') {
    document.getElementById('job_posting_container__recruitment').style.display = '';
  }
  else {
    ajaxSubmit('POST', webpage_url + 'oddsandends.php', true, 'check_for_available_credits=Yes');


//    document.getElementById('job_posting_container__posting').style.display = '';
//    document.getElementById('job_posting_container__recruitment').style.display = 'none';
  }
}

function limitTextLength(textarea_id, max_length) {
  the_textarea = document.getElementById(textarea_id)
  if(the_textarea.value.length > max_length) {
    the_textarea.value = the_textarea.value.substring(0, max_length);
  }
  else {
    document.getElementById(textarea_id + '__remainingchars').value = max_length - the_textarea.value.length;
  }
}

function openShadowbox( p, t ){
  Shadowbox.open({
    player:     'iframe',
    title:      t,
    content:    p,
    height:     450,
    width:      850
  });
}

function setJcropCoords(c) {
  jQuery('#jcrop_x').val(c.x);
  jQuery('#jcrop_y').val(c.y);
  jQuery('#jcrop_w').val(c.w);
  jQuery('#jcrop_h').val(c.h);
}

function showHideResumeUpload(the_value) {
  if(the_value) {
    document.getElementById('hideable__resume_as_file').style.display = '';
  }
  else {
    document.getElementById('hideable__resume_as_file').style.display = 'none';
  }
}

function waitCursor() {
  document.body.style.cursor = 'wait';
}
