/* --------- /javascripts/application.js --------- */ 

function setCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else{expires="";}
document.cookie=name+"="+escape(value)+expires+"; path=/;";};function getCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)==0){return unescape(c.substring(nameEQ.length,c.length));}}
return null;};function setActiveStyleSheet(prefix,title){if(!document.getElementsByTagName){return;}
var i,a,main;var links=document.getElementsByTagName("link");var prefix_len=prefix.length;for(i=0;(a=links[i]);i++){if(a.getAttribute("rel").indexOf("style")!=-1&&(t=a.getAttribute("title"))){if(t.substr(0,prefix_len)==prefix){a.disabled=true;if(t==title)a.disabled=false;}}}};function setFontSize(size){setActiveStyleSheet('font',size);setCookie('font_size',size);};function checkAll(ob,checked){ob=Element.extend(ob);ul=ob.up("ul");ul.getElementsBySelector("input").each(function(input){input.checked=checked;})};document.observe('dom:loaded',function(){font_size=getCookie('font_size');if(font_size&&font_size!='font_normal'){setActiveStyleSheet('font',font_size);}});dom_load_funcs=[];function doOnDomLoad(func){dom_load_funcs.push(func);};document.observe('dom:loaded',function(){for(var i=0;i<dom_load_funcs.length;i++){setTimeout(dom_load_funcs[i],500);}});function floatADivOnDomLoad(id,parentid){doOnDomLoad(function(){if($(id))document.observe('scroll',floatADivOnScrollHandler.bind(this,id,parentid));if(window.attachEvent&&$(id))window.attachEvent("onscroll",floatADivOnScrollHandler.bind(this,id,parentid));});};function floatADivOnScrollHandler(id,parentid){var b=$(id);var par=$(parentid);var coff=par.cumulativeOffset()[1];var csoff=par.cumulativeScrollOffset()[1];if(coff<csoff){b.style.position="fixed";}else
b.style.position="static";};function getEditorMimeTypesCallback(textarea){var textarea_div=textarea;var mimetype_div=textarea.next();return function(){mimetype_div.select("input.format_html")[0].checked=true;mimetype_div.hide();}};function textToHtml(textarea){text=$F(textarea);text=text.replace(/&/g,"&amp;");text=text.replace(/</g,"&lt;");text=text.replace(/>/g,"&gt;");text=text.replace(/\r\n/g,"\n");text=text.replace(/\n/g,"<br />");textarea.value=text;};/* --------- /javascripts/search_filters.js --------- */ 

document.observe('dom:loaded',function(){SearchFilters.toggle_filters_on_page_load();});var SearchFilters={toggle_filters_on_page_load:function(){['job_category','discipline','sector','job_type','location','keywords'].each(function(e){filter=$('search_filter_'+e)
if(filter&&!filter.getElementsBySelector('li.active').any()&&!filter.getElementsBySelector('li.remove').any())
SearchFilters.toggle_filter_block('search_filter_'+e);})},toggle_filter_block:function(id){filters=$(id);link=$(id+'_link');if(filters.visible()){filters.hide();link.classNames().remove('open');link.classNames().add('closed');}else{filters.show();link.classNames().remove('closed');link.classNames().add('open');}}};/* --------- /javascripts/search_panel.js --------- */ 

document.observe('dom:loaded',function(){SearchPanel.set_colors();SearchPanel.attach_handlers();});var SearchPanel={attach_handlers:function(){Event.observe('location','click',function(){SearchPanel.clear_value($('location'),'All locations')});Event.observe('keywords','click',function(){SearchPanel.clear_value($('keywords'),'All keywords')});},set_colors:function(){if($('keywords').value=='All keywords')$('keywords').style.color='#999';if($('location').value=='All locations')$('location').style.color='#999';},clear_value:function(field,value){if(value==field.value){field.value='';field.style.color='';field.select();}}};
