
function check_is_recent(){if($("#checkbox_is_recent").attr('checked')==true){$.cookie(ODESK_COOKIE_PREFIX+'checkbox_is_recent','yes');if($("#checkbox_is_recent").attr('disabled')==true){$("input#is_recent").val("no");}else{$("input#is_recent").val("yes");}}else{$("input#is_recent").val("no");$.cookie(ODESK_COOKIE_PREFIX+'checkbox_is_recent','no');}}
function switch_recent(selected,selected2){if((selected!=''&&selected>0)||(selected2!=''&&selected2>0)){if($.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank')!='yes'){$("input#checkbox_is_recent").attr('disabled',false);}}else{$("input#checkbox_is_recent").attr('disabled',true);}
check_is_recent();}
function set_relevant(){if($("#checkbox_is_relevant").attr('checked')==true){if($.cookie(ODESK_COOKIE_PREFIX+$("#lister_type").val()+"_search")=="basic"){$(".searchmode-switch").toggle();$("li.advanced").slideToggle('fast');$.cookie(ODESK_COOKIE_PREFIX+$("#lister_type").val()+"_search","advanced",{domain:ODESK_COOKIE_DOMAIN,path:'/'});$("#professionals_lister #search").val('advanced');}
$.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank','yes');$.cookie(ODESK_COOKIE_PREFIX+'checkbox_is_recent','yes');$("input#is_recent").val("yes");$("#titles_only_cb").attr('checked',false);$("input#checkbox_is_recent").attr('checked',true);$("input#checkbox_is_recent").attr('disabled',true);$("#adjusted_score").removeOption(0);$("#ui_total_hours").removeOption(0);$("input#order1").attr('value','Rank');$("input#order1").attr('dir1','desc');}else{$.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank','no');$("input#checkbox_is_recent").attr('disabled',false);$("input#order1").attr('value','Adjusted Score - Recent');$("#adjusted_score").prepend('<option value="">Any score</option>');$("#ui_total_hours").prepend('<option value="">Any amount</option>');}}
function check_relevant(select_id){if($.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank')=='yes'){$("#adjusted_score").removeOption(0);$("#ui_total_hours").removeOption(0);}}
function uncheck_relevant(uncheck){if(($("#titles_only_cb").attr('checked')==true)||(uncheck==true)){if($.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank')=='yes'){$.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank','no');$("#adjusted_score").prepend('<option value="">Any score</option>');$("#ui_total_hours").prepend('<option value="">Any amount</option>');$("input#checkbox_is_recent").attr('disabled',false);}
$("#checkbox_is_relevant").attr('checked',false);}}
function is_recent_status(){var selected=$("#adjusted_score").val();var selected2=$("#ui_total_hours").val();if((selected!=''&&selected>0)||(selected2!=''&&selected2>0)){if($.cookie(ODESK_COOKIE_PREFIX+'provider_search_rank')!='yes'){$("input#checkbox_is_recent").attr('disabled',false);}}else{if($.cookie(ODESK_COOKIE_PREFIX+'checkbox_is_recent')=='yes'){$("input#checkbox_is_recent").attr('checked',true);}
$("input#checkbox_is_recent").attr('disabled',true);}}
$(document).ready(function(){switch_filter('ProfileData');is_recent_status();$("#checkbox_total_portfolio").change(function(){if($(this).attr('checked')==true){$("input#total_portfolio_items").val("1");}else{$("input#total_portfolio_items").val("0");}})
$("#checkbox_is_ready").change(function(){if($(this).attr('checked')==true){$("input#is_ready").val("1");}else{$("input#is_ready").val("0");}})
$("#checkbox_is_recent").change(function(){check_is_recent();})
$("#adjusted_score").change(function(){var selected=$("#adjusted_score").val();var selected2=$("#ui_total_hours").val();switch_recent(selected,selected2);});$("#ui_total_hours").change(function(){var selected=$("#adjusted_score").val();var selected2=$("#ui_total_hours").val();switch_recent(selected,selected2);});$("a.tip_notice").Tooltip({track:true,showURL:false});});$("#main_category").addOption('','All Categories',document.getElementById("main_category").options[0].selected);$("#country_region").addOption('','Anywhere',document.getElementById("country_region").options[0].selected);$("#adjusted_score").addOption('','Any score',document.getElementById("adjusted_score").options[0].selected);$("#ui_total_hours").addOption('','Any amount',document.getElementById("ui_total_hours").options[0].selected);$("#provider_type").addOption('','Individuals and Affiliates',document.getElementById("provider_type").options[0].selected);$("#last_provider_activity").addOption('','Whenever',document.getElementById("last_provider_activity").options[0].selected);$("#cmp_ref").addOption('','Don\'t display',document.getElementById("cmp_ref").options[0].selected);$("#ui_english").addOption('','Any level',document.getElementById("ui_english").options[0].selected);function updateSCategory(){second_category=document.getElementById('second_category');if(null!=second_category){category_id=$("#main_category").val();if(''===category_id){sel=$("#second_category");$(sel).removeOption(/./,true).addOption({'':'All Subcategories'},true).selectOptions(/^$/,true);}else{sel=$("#second_category");ar=categories[category_id];$(sel).removeOption(/./,true).addOption({'':'All Subcategories'},true).addOption(ar,true).selectOptions(/^$/,true);}
enableSCategory();}}
function enableSCategory(){if($("#main_category").val()!=''){$("#second_category").removeAttr('disabled');}else{$("#second_category").attr('disabled','disabled');}}
var clear_focused=false;function disable_action_buttons(){var i=1;while(btn=document.getElementById('btn'+i)){btn.style.backgroundImage="url({$WEB_ROOT}images/buttonBgGray.gif)";btn.style.color="#ffffff";btn.style.backgroundColor="#cccccc";btn.style.borderColor="#cccccc";btn.disabled=true;{literal}
i++;}}
function highLight(elem){var table=elem.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;var n_of_selected=document.getElementById("number_of_selected")
if(elem.checked){table.style.background="#DEEFFF";n_of_selected.value++;}else{table.style.background="";n_of_selected.value--;}}
function testEnter()
{var e=window.event;if(e){if(e.keyCode){code=e.keyCode;}else if(e.which){code=e.which;}
if(13==code&&clear_focused!=true){document.forms['main1'].appendChild(document.createElement("<input type='hidden' name='search_button.x' value='1'>"));}}}
function setAffiliate(value)
{for(i=0;i<document.forms['main1'].elements.length;i++){element=document.forms['main1'].elements[i];var reg=new RegExp("filter");if(element.name.match(reg)){if("text"==element.type){element.value="";}else if("select-one"==element.type){for(j=0;j<element.options.length;j++){if(j==0){element.options[j].selected=true;}else{element.options[j].selected=false;}}}else if("checkbox"==element.type){element.checked=false;}}}
document.forms['main1'].elements['search'].value='advanced';el=document.createElement("input");el.type="hidden";el.name="filter[UI - Agency Ref]";el.value=value;document.forms['main1'].appendChild(el);document.forms['main1'].submit();}
