function fmaxlength(textval,mlength,elname)
{var textvallength=textval.length;mlength=mlength-1;if(textvallength>mlength)
{elname.value=elname.value.substr(0,mlength);}}function urlencode(s){s=encodeURIComponent(s);return s.replace(/~/g,'%7E').replace(/%20/g,'+');}function val_url(tval,elname){elname.value="";var ill=/\W/;for(ctr=0;ctr<=tval.length;ctr=ctr+1){chr=tval.charAt(ctr);if(!ill.test(chr)){elname.value=elname.value+chr;}}}function onKeyPressBlockNumbers(e)
{var key=window.event?e.keyCode:e.which;var keychar=String.fromCharCode(key);reg=/\w/;return reg.test(keychar);}function check_email(input){error="";var emailFilter=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!(emailFilter.test(input))){error="Please enter a valid email address.\n";}if(error){return false;}else{return true;}}function ChangeColor(tableRow,highLight)
{if(highLight)
{tableRow.style.backgroundColor='#dcfac9';}else
{tableRow.style.backgroundColor='white';}}function show_help(what){switch(what){case"apps":document.getElementById('help_head').innerHTML="Why are my applications limited?";document.getElementById('help_text').innerHTML='
You can apply to up to 3 Jobs in any 7 days.
This is to keep applications for Jobs relevant. Applying for Jobs you aren\'t suitable for wastes the Job Poster\'s time, and means they are less likely to post Jobs in the future.
This should be plenty in normal circumstances, however you can request more.
Be careful with your applications, and only apply for Jobs you\'re suitable for. If you use them up either wait a few days, or you can request an extra one if you have a good reason. However, the request may not be processed immediately, and is not automatic.
';break;case"rep":document.getElementById('help_head').innerHTML="Delete or report applications.";document.getElementById('help_text').innerHTML='You can delete unwanted applications.
This will help you manage the applications you do want. You have the option of sending the applicant a message to let them know they aren\'t being considered, and why.
You can also report applications.
This wil let Crewspace know that you think this applicant is really wasting your time.
';break;case"rate":document.getElementById('help_head').innerHTML="Rate applications.";document.getElementById('help_text').innerHTML='You can rate applications.
This will help you manage the applications you like. Hover the mouse over the stars, and click the rating you want.
You can then sort applications by rating.
This wil help you find your preferred applications quickly and easily. Just click the "Rating" heading when viewing all aplications for a Job.
';break;case"askforrate":document.getElementById('help_head').innerHTML="";document.getElementById('help_text').innerHTML='The Job post asks for your usual rate, have you included it in \"Extra Info\"?
Click "Yes" if you have, or "No" to add it.
';break;default:break;}document.getElementById('help_div').style.display="";document.getElementById('xg_overlay').style.display="";}function hide_help(){document.getElementById('help_div').style.display="none";document.getElementById('xg_overlay').style.display="none";}function show_dialog(what,but1,but2,action,stuff){var headEl=document.getElementById('dialog_head');var textEl=document.getElementById('dialog_text');switch(what){case"askforrate":headEl.innerHTML="";textEl.innerHTML='This Job post asks for your usual rate, have you included it in \"Extra Info\"?
Click "Yes" if you have, or "No" to add it.
';break;case"location":headEl.innerHTML="The crewspace jobs board is international.";textEl.innerHTML='This job is based in '+stuff+'.
Do you have the necessary work permits / visas?
';break;default:break;}document.getElementById('button1').value=but1;document.getElementById('button2').value=but2;document.getElementById('button2').onclick=Function(action);document.getElementById('dialog_div').style.display="";document.getElementById('xg_overlay').style.display="";}function hide_dialog(){document.getElementById('dialog_div').style.display="none";document.getElementById('xg_overlay').style.display="none";}function rate(rating,app,hover){if(hover==2){rating=current_rating;}else if(!hover){current_rating=rating;do_rate(rating,app);}if(document.getElementById){document.getElementById('rating_div').className="rating rated_"+rating;}else{document.all.rating_div.className="rating rated_"+rating;}}function rate_small(rating,app,hover){if(hover==2){rating=current_rating[app];}else if(!hover){current_rating[app]=rating;do_rate(rating,app);}if(document.getElementById){document.getElementById('rating_div_'+app).className="small_rating small_rated_"+rating;}else{document.all.rating_div.className="small_rating small_rated_"+rating;}}function set_xml(){if(window.XMLHttpRequest){var s_xmlhttp=new XMLHttpRequest();}else if(window.ActiveXObject){var s_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}return s_xmlhttp;}function do_rate(rating,app){var loadimg=document.getElementById('loadimg');var placeholder=document.getElementById('placeholder');placeholder.style.display="none";loadimg.style.display="";var xmlhttp=set_xml();if(xmlhttp!=null){var params="r="+rating+"&a="+app;xmlhttp.onreadystatechange=state_Change;xmlhttp.open("POST",rate_url,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",params.length);xmlhttp.setRequestHeader("Connection","close");xmlhttp.send(params);}else{alert("Your browser does not support XMLHTTP. Download Firefox or Safari.");loadimg.style.display="none";placeholder.style.display="";}function state_Change(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){switch(xmlhttp.responseText){case"SLOW":case"INVALID":alert("An unusual error has occured. Please refresh the page and try again.");break;case"ok":break;default:alert("Apologies, error 7 has occured. Please refresh the page and try again. ");break;}}else{alert("Problem saving data, please try again, or \"Report an Issue\" below "+xmlhttp.statusText);}loadimg.style.display="none";placeholder.style.display="";}}}function enable_submit(what){if(what.value){document.reasonform.submit.disabled=false;document.reasonform.submit.title="";document.getElementById('explndel').innerHTML=" ";}}var imgTimeOut;function show_img(what){document.getElementById('imgfloatdiv').style.display="";document.getElementById(what).style.display="";clearTimeout(imgTimeOut);imgTimeOut=setTimeout("hide_img()",5000);}function hide_img(){document.getElementById('imgfloatdiv').style.display="none";document.getElementById('app').style.display="none";document.getElementById('apps').style.display="none";document.getElementById('apply').style.display="none";}function f_clientWidth(){return f_filterResults(window.innerWidth?window.innerWidth:0,document.documentElement?document.documentElement.clientWidth:0,document.body?document.body.clientWidth:0);}function f_clientHeight(){return f_filterResults(window.innerHeight?window.innerHeight:0,document.documentElement?document.documentElement.clientHeight:0,document.body?document.body.clientHeight:0);}function f_scrollLeft(){return f_filterResults(window.pageXOffset?window.pageXOffset:0,document.documentElement?document.documentElement.scrollLeft:0,document.body?document.body.scrollLeft:0);}function f_scrollTop(){return f_filterResults(window.pageYOffset?window.pageYOffset:0,document.documentElement?document.documentElement.scrollTop:0,document.body?document.body.scrollTop:0);}function f_filterResults(n_win,n_docel,n_body){var n_result=n_win?n_win:0;if(n_docel&&(!n_result||(n_result>n_docel))){n_result=n_docel;}return n_body&&(!n_result||(n_result>n_body))?n_body:n_result;}function do_submit_add(isedit){var formEl=document.subm_form;var ignoreme=">";if(formEl.jobtitle.value.length<2){formEl.jobtitle.focus();alert("Please enter a job title");}else if(!formEl.cat.value){formEl.cat.focus();alert("Please select a category.");}else if(formEl.country.value.length<2){formEl.country.focus();alert("Please select a country / region.");}else if(formEl.startdate.value.length<2){formEl.startdate.focus();alert("Please enter a start date\r\nThis can be a date, or ASAP, or e.g. Next week "+formEl.startdate.value);}else if(!isedit&&formEl.start_type[0].checked&&new Date(formEl.year.value,formEl.month.value,formEl.day.value)1&&formEl.duration.value.length<2){formEl.duration.focus();alert("Please enter a duration.");}else if(formEl.description.value.length<7){formEl.description.focus();alert("Please enter a description.");}else if(!formEl.negotiable.checked){if(!formEl.period.value){formEl.period.focus();alert("Please select an approximate pay period.");}else if(!formEl.currency.value){formEl.currency.focus();alert("Please select an approximate pay currency.");}else if(!formEl.rate.value){formEl.rate.focus();alert("Please select an approximate pay grade.");}else{formEl.submit();}}else{formEl.submit();}}function do_submit_reg(){if(check_email(document.reg_form.emailinput.value)==false){document.reg_form.emailinput.focus();alert("Please enter a valid email address.");}else if(document.reg_form.email2input.value!=document.reg_form.emailinput.value){document.reg_form.email2input.focus();alert("The emails you entered don't match, please check them.");}else if(document.reg_form.p1.length<7||isAlphanumeric(document.reg_form.p1.value)==false){document.reg_form.p1.focus();alert("The password must be 6 - 15 characters in length and contain only numbers and letters.");}else if(document.reg_form.p2.value!=document.reg_form.p1.value){document.reg_form.p2.focus();alert("The passwords you entered don't match, please check them.");}else{if(confirm("You are registering to be able to post jobs on the jobs board. You are NOT signing up to the main crewspace site, or to be able to apply for jobs. Are you SURE you wish to continue?")){document.reg_form.submit();}}}function check_return(e){var target=e.target?e.target:e.srcElement;var keyCode=e.keyCode?e.keyCode:e.which;if(keyCode==13&&(!target.type||(target.type!='textarea'))){event.returnValue=false;event.cancel=true;do_submit();}else if(keyCode==220){event.returnValue=false;event.cancel=true;}}function isAlphanumeric(val){var test=/^[0-9a-zA-Z]+$/;if(val.match(test)){return true;}else{return false;}}function do_submit_email(){if(check_email(document.email_form.emailinput.value)==false){document.email_form.emailinput.focus();alert("Please enter a valid email address.");}else if(document.email_form.email2input.value!=document.email_form.emailinput.value){document.email_form.email2input.focus();alert("The emails you entered don't match, please check them.");}else{document.email_form.submit();}}function do_submit_pwd(){if(document.pwd_form.l2n8oxg2h.length<7||isAlphanumeric(document.pwd_form.l2n8oxg2h.value)==false){document.pwd_form.l2n8oxg2h.focus();alert("Please enter your current password for security.");}else if(document.pwd_form.p1.length<7||isAlphanumeric(document.pwd_form.p1.value)==false){document.pwd_form.p1.focus();alert("The password must be 6 - 15 characters in length and contain only numbers and letters.");}else if(document.pwd_form.p2.value!=document.pwd_form.p1.value){document.pwd_form.p2.focus();alert("The passwords you entered don't match, please check them.");}else{document.pwd_form.submit();}}function do_submit_app(){if(check_email(document.subm_form.email.value)==false){document.subm_form.email.focus();alert("Please enter a valid email address.");}else{document.subm_form.submit();}}function swap(what){var whatc=what+"_c";var obj=document.getElementById(what);if(document.getElementById(whatc).checked){obj.readOnly=true;}else{obj.readOnly=false;}}function toggle(){var obj=document.getElementById('job_desc');var anch=document.getElementById('toggle');if(obj.style.display=="none"){obj.style.display="";anch.innerHTML="▼ hide job description";}else{obj.style.display="none";anch.innerHTML='► show job description';}}function more_opts(){var obj=document.getElementById('more_opt');var anch=document.getElementById('toggle');if(obj.style.display=="none"){obj.style.display="";anch.innerHTML="▼ more options:";}}function check_app(req_rate){if(req_rate){show_dialog('askforrate','No','Yes','document.subm_form.submit();');}else{document.subm_form.submit();}}function switch_acc_div(val){if(val=="email"){document.getElementById('emaildiv').style.display="block";document.getElementById('pwddiv').style.display="none";visible_flag=true;}else{document.getElementById('emaildiv').style.display="none";document.getElementById('pwddiv').style.display="block";visible_flag=false;}}function do_submit_report(){if(check_email(document.subm_form.emailinput.value)==false){document.subm_form.emailinput.focus();alert("Please enter a valid email address.");}else if(document.subm_form.email2input.value!=document.subm_form.emailinput.value){document.subm_form.email2input.focus();alert("The emails you entered don't match, please check them.");}else if(document.subm_form.description.value.length<7){document.subm_form.description.focus();alert("Please enter a detailed description.");}else{document.subm_form.submit();}}function check_other(what,which){which=(which?which:"");if(what.value=="oth"){document.getElementById('other_rsn_div'+which).style.display="";}else{document.getElementById('other_rsn_div'+which).style.display="none";}var rsn;document.getElementById('sample_div'+which).style.display="";switch(what.value){case"gen":rsn="No specific reason.";break;case"fil":rsn="The position has been filled.";break;case"inn":rsn="Your application was innapropriate or unsuitable for the job.";break;case"rgn":rsn="You aren't in the right country / region.";break;case"fls":rsn="Your application was inaccurate / misleading.";break;case"oth":rsn="";break;case"not":document.getElementById('sample_div'+which).style.display="none";rsn="";break;default:break;}document.getElementById('reason_span'+which).innerHTML=rsn;}function check_more(){if(document.subm_form.description.value.length<7){alert("Please say why you need an extra application.");document.subm_form.description.focus();}else{document.subm_form.submit();}}function scancel(){alert("Preferences not changed.");window.location="index.php";}function mclear(what){var obj=document.s_form.elements[what+"[]"];for(var loop=0;loop1&&selectedOptions.length<1){alert("Please select at least one category.");document.s_form.cat[0].focus();return false;}else if(2>1&&selectedOptions.length>3){alert("Please select no more than 2 categories."+document.s_form.cat.value.length);return false;}else{document.s_form.submit();}}function countSelected(what,maxNumber){var obj=document.s_form.elements["cat[]"];for(var i=0;imaxNumber){var throwAlert=true;var toremove=selectedOptions.shift();obj[toremove].checked=false;}}}function sel(what){var nr=0;var maxnr=2;for(var i=0;imaxnr){alert('you have selected '+nr+' options'+what.value);return false;}}var selectedOptions=[];function do_submit_pwd_reset(){if(document.pwd_form.p1.length<7||isAlphanumeric(document.pwd_form.p1.value)==false){document.pwd_form.p1.focus();alert("The password must be 6 - 15 characters in length and contain only numbers and letters.");}else if(document.pwd_form.p2.value!=document.pwd_form.p1.value){document.pwd_form.p2.focus();alert("The passwords you entered don't match, please check them.");}else{document.pwd_form.submit();}}function noapps(){document.getElementById('floatdiv').style.display="";setTimeout('document.getElementById("floatdiv").style.display="none";',2500);}function do_submit_reset(){if(check_email(document.sform.ao874ntcigw4u.value)==false){document.sform.ao874ntcigw4u.focus();alert("Please enter a valid email address.");}else{document.sform.submit();}}function blank_rates(){rate_opt[1].text="Select currency and period";rate_opt[2].text="Select currency and period";rate_opt[3].text="Select currency and period";rate_opt[4].text="Select currency and period";rate_opt[5].text="Select currency and period";rate_opt[6].text="Select currency and period";}function do_daily(){var raa;var ra;var rb;var rc;var rd;var re;switch(document.subm_form.currency.value){case"GBP":case"EUR":raa='350';ra='250';rb='200';rc='150';rd='100';re=' 75';break;case"AUD":case"CAD":case"USD":raa='500';ra='400';rb='300';rc='200';rd='150';re='100';break;case"JPY":raa='70,000';ra='60,000';rb='50,000';rc='40,000';rd='30,000';re='20,000';break;default:blank_rates();break;}document.subm_form.rate.disabled="";rate_opt[1].text="A+ - e.g. "+raa+"+ a day";rate_opt[2].text="A - e.g. "+ra+" - "+raa+" a day";rate_opt[3].text="B - e.g. "+rb+" - "+ra+" a day";rate_opt[4].text="C - e.g. "+rc+" - "+rb+" a day";rate_opt[5].text="D - e.g. "+rd+" - "+rc+" a day";rate_opt[6].text="E - e.g. "+re+" - "+rd+" a day";}function do_weekly(){var raa;var ra;var rb;var rc;var rd;var re;switch(document.subm_form.currency.value){case"GBP":case"EUR":raa='2500';ra='1750';rb='1200';rc=' 900';rd=' 500';re=' 350';break;case"AUD":case"CAD":case"USD":raa='3500';ra='2500';rb='1800';rc='1200';rd=' 800';re=' 500';break;case"JPY":raa='600,000';ra='500,000';rb='400,000';rc='300,000';rd='200,000';re='100,000';break;default:blank_rates();break;}document.subm_form.rate.disabled="";rate_opt[1].text="A+ - e.g. "+raa+"+ a week";rate_opt[2].text="A - e.g. "+ra+" - "+raa+" a week";rate_opt[3].text="B - e.g. "+rb+" - "+ra+" a week";rate_opt[4].text="C - e.g. "+rc+" - "+rb+" a week";rate_opt[5].text="D - e.g. "+rd+" - "+rc+" a week";rate_opt[6].text="E - e.g. "+re+" - "+rd+" a week";}function change_rates(){switch(document.subm_form.period.value){case"weekly":document.subm_form.currency.disabled="";do_weekly();break;case"daily":document.subm_form.currency.disabled="";do_daily();break;default:blank_rates();break;}}function negotiate(what){if(what.checked){document.subm_form.currency.disabled="disabled";document.subm_form.period.disabled="disabled";document.subm_form.rate.disabled="disabled";}else{document.subm_form.currency.disabled="";document.subm_form.period.disabled="";document.subm_form.rate.disabled="";}}function store_start(){var formEl=document.subm_form;var day=formEl.day.value;var month=formEl.month.value;var year=formEl.year.value;formEl.startdate.value=day+" "+month+" "+year;}function swap_start(what){var formEl=document.subm_form;if(what){formEl.day.disabled="disabled";formEl.month.disabled="disabled";formEl.year.disabled="disabled";formEl.freeinput.readOnly=false;formEl.freeinput.focus();formEl.startdate.value=formEl.freeinput.value;}else{formEl.day.disabled="";formEl.month.disabled="";formEl.year.disabled="";formEl.freeinput.readOnly="readOnly";formEl.day.focus();store_start();}}function populate_day(what){var days=31;var sel_obj=document.subm_form.day;var selected_day=sel_obj.value;switch(1*what.value){case 1:case 3:case 5:case 7:case 8:case 10:case 12:days=31;break;case 4:case 6:case 9:case 11:days=30;break;case 2:var leap=(document.subm_form.year.value/4);if(Math.ceil(leap)==Math.floor(leap)){days=29;}else{days=28;}break;default:break;}sel_obj.options.length=0;for(i=1;i<=days;i++){createOption(sel_obj,i,i,(selected_day==i?1:0));}}function createOption(obj,value,inner,issel){var option=document.createElement("option");option.value=value;option.innerHTML=inner;if(issel){option.selected="selected";}obj.appendChild(option);}function strip_tags(str,allowed_tags){var key='',allowed=false;var matches=[];var allowed_array=[];var allowed_tag='';var i=0;var k='';var html='';var replacer=function(search,replace,str){return str.split(search).join(replace);};if(allowed_tags){allowed_array=allowed_tags.match(/([a-zA-Z]+)/gi);}str+='';matches=str.match(/(<\/?[^>]+>)/gi);for(key in matches){if(isNaN(key)){continue;}html=matches[key].toString();allowed=false;for(k in allowed_array){allowed_tag=allowed_array[k];i=-1;if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+'>');}if(i!=0){i=html.toLowerCase().indexOf('<'+allowed_tag+' ');}if(i!=0){i=html.toLowerCase().indexOf('<'+'/'+allowed_tag);}if(i==0){allowed=true;break;}}if(!allowed){str=replacer(html,"",str);}}return str;}function free_val(what){if(document.subm_form.start_type[1].checked){document.subm_form.startdate.value=what.value;}}