
var JOB_DETAILS_FB_SID=15002;var PROFILE_DETAILS_FB_SID=16002;var MY_EXAMS_FB_SID=17002;var EXAM_FB_SID=18002;var JOB_DETAILS_FB_EVT='fb.job';var PROFILE_DETAILS_FB_EVT='fb.profile';var MY_EXAMS_FB_EVT='fb.test';var EXAM_FB_EVT='fb.test';$(function(){$(".container .innertab_bar li").click(function(){if($(this).is(':not(.innertab_current)')){$("#tabs_container_active").hide();$("#tabs_container_closed").hide();$("#tabs_container_filled").hide();$("#tabs_container_all").hide();$("#tabs_container_"+$(this).attr('alspacka')).show();$(".container .innertab_bar li.innertab_current").removeClass('innertab_current');$(this).addClass('innertab_current');}});$("li:has(.subnav)").addClass('has_subnav').not('#team_selector_container').hover(function(){trigger=$(this);l=$('a:first',this).text();menu=$(".subnav",this);$(".subnav:visible").not(menu).hide();menu.show().stopTime(l);},function(){l=$('a:first',this).text();$('.subnav',this).oneTime(750,l,function(){$(this).hide();});});$('li:has(.subnav) > a').append('<span class="icon arrow_down">&nbsp;&nbsp;</span>');if($('#for-whom-dropdown').size){$('#for-whom-dropdown').change(function(){loading_process('Please wait...',true);location.href=$(this).val();});}
$(".team_action_select").change(function(){value=$(this).val();values=value.split("[[-i-]]");action=values[0];object=values[1];if(action=='show'){parent.tb_remove();loading_process('Please, wait..',true);$("#cny").val(object);$("#action").val("show_team");$("#lt_submit").submit();}else
if(action=='hide'){parent.tb_remove();loading_process('Please, wait..',true);$("#cny").val(object);$("#action").val("hide_team");$("#lt_submit").submit();}else
if(action=='leave'){$("#item_"+object).click();}else
{location.href=$(this).val();}});if($('#team_selector_container').size){$('#team_selector_container #team_selector').click(function(){$('#team_selector_container > .subnav').toggle();return false;});$('#team_selector_container').hover(function(){$('#team_selector_container > .subnav').stopTime('teambar_selector');},function(){$('#team_selector_container > .subnav:visible').oneTime(750,'teambar_selector',function(){$(this).hide();})});$('#team_selector_container .subnav a').click(function(){$.cookie(ODESK_COOKIE_PREFIX+$('#team_selector_container').attr('name'),$(this).attr('alt'),{domain:ODESK_COOKIE_DOMAIN,path:'/'});$.cookie(ODESK_COOKIE_PREFIX+'company_id',$(this).attr('alt'),{domain:ODESK_COOKIE_DOMAIN,path:'/'});loading_process('Please wait...',true);location.href=$(this).val();});}});$('#act').ready(function(){$('#act').change(function(){if($('#act option:selected').text()!='-- Select an Action --'){var n_checked=$("input:checked").length;if(0<n_checked){$("#am_console_form").submit();}else{alert('You have to select one or more developers.');}
$('#act').selectOptions(/^$/,true);};});});$("#am_console_form").ready(function(){$("#am_console_form").submit(function(){$("#am_console_form").attr('title',$("#act option:selected").text());var t=this.title||this.name||null;var g=this.rel||false;var urlNoQuery;var subUrl='?';if($.browser.mozilla){urlNoQuery=this.action.split('?');$("input[type=checkbox][checked]").each(function(){subUrl=subUrl+'selected_acs[]='+$(this).val()+'&';});subUrl=subUrl+'act='+$("#act").val()+'&';this.action=urlNoQuery[0]+subUrl+urlNoQuery[1];}
tb_show(t,this.action,g);this.blur();$("#am_console_form").attr('target',$("#TB_iframeContent").attr("name"));return true;});});var cell='display_as';function AnalyticsDatesChange(){p=document.getElementById('preset');str=p[p.selectedIndex].value;if(str!=''){document.getElementById('from_date').value=str.slice(0,10);document.getElementById('to_date').value=str.slice(11,21);p.form.submit();disable_buttons();}}
function setOrderBy(key){document.getElementById('order_by').value=key;if(cell==key){document.getElementById('direction').value='desc';cell='';}else{document.getElementById('direction').value='asc';cell=key;}}
function submitCSV(){$("#action_do").val("Export to CSV");document.main1.submit();}
function count_score(form_name){if(document.forms[form_name].elements["score_ids"])
{var ids=document.forms[form_name].elements["score_ids"].value;ids=ids.substr(0,ids.length-1);var id_array=ids.split(',');var weights=document.forms[form_name].elements["score_weights"].value;weights=weights.substr(0,weights.length-1);var weight_array=weights.split(',');var i=0;var count=0;for(i in id_array)
{element=document.forms[form_name].elements[id_array[i]];if(typeof element=='object'){weight=weight_array[i];count=count+parseInt(element.value)*parseFloat(weight);}}
document.getElementById("scorevalue").innerHTML=(Math.round(count*100)/100).toFixed(2);if(document.getElementById("avg_score"))
{document.getElementById("avg_score").value=(Math.round(count*100)/100).toFixed(2);}}}
$.fn.extend({removeDefaultOption:function(){$(this).removeOption($(this).attr('default'));return this;},isDefault:function(){var def=$(this).attr('default')||'';return $(this).val()==def;},toDefault:function(){var def=$(this).attr('default')||'';if($(this).is('input')){$(this).val(def);}else if($(this).is('select')){$(this).selectOptions(def);}
return this;}});function disable_buttons(noBrowserDisable,noStyleDisable){$(".formbutton, .button, .linkButton").not('#search_button').addClass("disabled").attr("disabled",!noBrowserDisable);$("input[type='button'], input[type='submit']").each(function(){if(/^button\d+$/.test($(this).attr('id'))){toggle_button_status($(this),'off',noBrowserDisable,noStyleDisable);}});}
function enable_buttons(noBrowserDisable){if(!noBrowserDisable){$(".formbutton, .button, .linkButton").removeAttr("disabled");}
$(".formbutton, .button, .linkButton").removeClass("disabled");$("input[type='button'], input[type='submit']").each(function(){if(/^button\d+$/.test($(this).attr('id'))){toggle_button_status($(this),'on',noBrowserDisable);}});}
function toggle_button_status(btn,mode,noBrowserDisable,noStyleDisable){var req_mode=(mode=='on'||mode==true)?'on':(mode=='off'||mode==false)?'off':'undef';var next_mode=((true!=noBrowserDisable&&true==$(btn).attr('disabled'))||(true!=noStyleDisable&&0!=$(btn).is('.disabled')))?'on':'off';if('undef'!=req_mode){next_mode=req_mode;}
if(true!=noStyleDisable){if('on'==next_mode){$(btn).removeClass('disabled');$('#'+$(btn).attr('id')+'_').removeClass('disabled');}else{$(btn).addClass('disabled');$('#'+$(btn).attr('id')+'_').addClass('disabled');}}
if(true!=noBrowserDisable){if('on'==next_mode){$(btn).removeAttr('disabled');$('#'+$(btn).attr('id')+'_').removeAttr('disabled');}else{$(btn).attr('disabled',true);$('#'+$(btn).attr('id')+'_').attr('disabled',true);}}}
function switch_button_status(id,to_active,disable_styles){toggle_button_status($('#'+id),to_active,disable_styles);}
function enable_by_check(id){var cb=document.getElementById(id);if(cb.checked){enable_buttons();}else{disable_buttons();}}
function accept_agreement_onclick(disable){var chk=$("#accept_agreement");var subm1=$("#button1");var subm2=$("#button2");subm1.attr("disabled",(disable||!chk.attr("checked")));subm2.attr("disabled",(disable||!chk.attr("checked")));if(subm1.attr("disabled")){subm1.addClass('disabled');subm2.addClass('disabled');}else{subm1.removeClass('disabled');subm2.removeClass('disabled');}}
function check_buttons_status(){if($("#number_of_selected").attr("value")>=1){switch_button_status('btn1',true);switch_button_status('btn2',true);}else{switch_button_status('btn1',false);switch_button_status('btn2',false);}}
$(document).ready(function(){$('.button').hover(function(){if($(this).is(':not(.disabled)')){$(this).addClass('hover');}},function(){$(this).removeClass('hover');});});function show_alert(){var ids=document.forms["end_assignment"].elements["score_ids"].value;ids=ids.substr(0,ids.length-1);var id_array=ids.split(',');var weights=document.forms["end_assignment"].elements["score_weights"].value;weights=weights.substr(0,weights.length-1);var weight_array=weights.split(',');var i=0;var count=0;var scores_set=1;for(i in id_array)
{element=document.forms["end_assignment"].elements[id_array[i]];weight=weight_array[i];count=count+parseInt(element.value)*parseFloat(weight);if(parseInt(element.value)*parseFloat(weight)==0){scores_set=0;}}
if(document.getElementById('reason').value==0){scores_set=0;}
if(scores_set){result=show_form_alert('comment','form_alert1','form_alert2');return result;}else{return true;}}
function fees_from_charge(charge){fees=Math.round(100*(charge*0.1))/100;return fees;}
function fees_from_cost(cost){fees=Math.round(100*((cost/0.9)-cost))/100;return fees;}
function RemoveCommas(value){var sVal;try{sVal=new String(value);if(sVal.length<1){return sVal;}
var sRegExp=eval("/,/g");sVal=sVal.replace(sRegExp,"");}catch(exception){}
return sVal;}
form_alert_shown=false;function show_form_alert(field_name,alert1,alert2){if(false==form_alert_shown){form_alert_shown=true;f=document.getElementsByName(field_name);if(('undefined'!=typeof(FCKeditorAPI))&&('undefined'!=FCKeditorAPI.GetInstance(field_name))){var oEditor=FCKeditorAPI.GetInstance(field_name);if(0==oEditor.GetHTML().length){document.getElementById(alert1).style.display='none';document.getElementById(alert2).style.display='block';return false;}else{return true;}}else{if(''==f.item(0).value){document.getElementById(alert1).style.display='none';document.getElementById(alert2).style.display='block';return false;}else{return true;}}}else{return true;}}
var man=Array();man['name']=Array();man['label']=Array();man['type']=Array();counter=0;ac='';function changeSearchMode(new_mode){document.forms['main1'].elements['search'].value=new_mode;document.forms['main1'].elements['skip_records'].value=0;document.forms['main1'].submit();}
function setFirst(value){document.forms['main'].elements['skip_records'].value=value;if('undefined'!=typeof(document.forms['main'].elements['deny_log_search']))
{document.forms['main'].elements['deny_log_search'].value=1;}
if('jobs'==$("#lister_type").val()){search_jobs();return false;}else if('providers'==$("#lister_type").val()){ac=$("#ac").val();search_professionals();return false;}
document.forms['main'].submit();}
function changeOrder(order,dir){document.forms['main'].elements['order'].value=order;document.forms['main'].elements['dir'].value=dir;document.forms['main'].elements['skip_records'].value=0;if('jobs'==$("#lister_type").val()){search_jobs();return false;}else if('providers'==$("#lister_type").val()){ac=$("#ac").val();search_professionals();return false;}
document.forms['main'].submit();}
function setFilterFromGroup(name,value,caption){if(document.forms['main1'].elements['filter['+name+']']){ob=document.forms['main1'].elements['filter['+name+']'];if("text"==ob.type){document.forms['main1'].elements['filter['+name+']'].value=value;}else if("select-one"==ob.type){for(j=0;j<ob.options.length;j++){if(value==ob.options[j].value){ob.options[j].selected=true;}else{ob.options[j].selected=false;}}}else if("checkbox"==ob.type){ob.checked=true;}
document.forms['main1'].submit();}else if(document.forms['main1'].elements['filter['+name+'][]']){ob=document.forms['main1'].elements['filter['+name+'][]'];for(j=0;j<ob.options.length;j++){if(value==ob.options[j].value){ob.options[j].selected=true;}else{ob.options[j].selected=false;}}
document.forms['main1'].submit();}else{alert("Filter '"+name+"' not found");}}
function trim(s){while(s.substring(0,1)==' '){s=s.substring(1,s.length);}
while(s.substring(s.length-1,s.length)==' '){s=s.substring(0,s.length-1);}
return s;}
function deleteCookie(cookie_name){var cookie_date=new Date();cookie_date.setTime(cookie_date.getTime()-1);document.cookie=cookie_name+="=; expires="+cookie_date.toGMTString();return true;}
function switch_filter(type){if($('#titles_only_cb').attr('checked')){document.getElementById("data").name="filter[TitleData]";document.getElementById("titles_only").value="yes";}else{document.getElementById("data").name="filter["+type+"]";document.getElementById("titles_only").value="no";}}
$(document).ready(function(){$(".searchmode-switch").click(function(){$(".searchmode-switch").toggle();$("li.advanced").slideToggle('fast');if($.cookie(ODESK_COOKIE_PREFIX+$("#lister_type").val()+"_search")=="basic"){$.cookie(ODESK_COOKIE_PREFIX+$("#lister_type").val()+"_search","advanced",{domain:ODESK_COOKIE_DOMAIN,path:'/'});if($("#lister_type").val()=="providers"){$("#professionals_lister #search").val('advanced');}else{$("#jobs_lister #search").val('advanced');}}else{$.cookie(ODESK_COOKIE_PREFIX+$("#lister_type").val()+"_search","basic",{domain:ODESK_COOKIE_DOMAIN,path:'/'});if($("#lister_type").val()=="providers"){$("#professionals_lister #search").val('basic');}else{$("#jobs_lister #search").val('basic');}}
return false;});$("#search_button").click(function(){if("none"==$("#advanced").css("display"))
{$("#advanced select, #advanced input").each(function(){this.value="";});}
return true;});});var MIN_WIDTH=960;var MAX_WIDTH=1400;$(function(){if($('html').is('.ie6')){window.attachEvent('onload',mmwidth);window.attachEvent('onresize',mmwidth);function mmwidth(){$('#overall_wrapper').css({width:(document.body.clientWidth<MIN_WIDTH)?MIN_WIDTH+'px':((document.body.clientWidth>MAX_WIDTH)?MAX_WIDTH+'px':'auto')});};}});$(document).ready(function(){if($('.imagefit').val()==''){$('.imagefit').imagefit();}
$(".alert.dismissable").append("<a href='javascript:void(0)' class='small upper-right trigger'>close</a>");$(".dismissable .trigger").click(function(event){$(this).parent().hide("fast");});$(".alertbar.dismissable_for_session h3").append("<a href='javascript:void(0)' class='small boxlink remember_for_session'>close</a>");$(".alertbar.dismissable_for_session .remember_for_session").click(function(){var cur_alert_obj=$(this).parents(".alertbar.dismissable_for_session");if('object'==typeof(cur_alert_obj)&&'number'==typeof(MAINTENANCE_ALERT_TTL)){var service_name=cur_alert_obj.attr('service_name');$.cookie(ODESK_COOKIE_PREFIX+service_name+'_remember','announced',{path:'/'});}
cur_alert_obj.fadeOut("slow",function(){$(this).remove()});});$("dd .extra_help").hide();$("dd .extra_help:not(.with-pointer)").addClass('with-pointer').prepend('<img class="pointer" src="/images/extra_help_pointer.png" alt="" />');$("dd:has(.extra_help) input, dd:has(.extra_help) select, dd:has(.extra_help) a").filter(':not(.focus-behave)').focus(function(){var tmp=$(this).parents("dd").children(".extra_help");tmp.show();$(".extra_help").not(tmp).hide();});$("dd:has(.extra_help) .toggle_next").click(function(){var tmp=$(this).parents("dd").children(".extra_help");tmp.fadeIn("slow");$(".extra_help").not(tmp).fadeOut("slow");}).addClass('focus-behave');$(".toggle_next:not(.expanded-black)").next().hide();$(".toggle_next:not(.expanded-black)").addClass("collapsed-black");$(".toggle_next.expanded-black").toggle(function(){$(this).next().hide("fast");$(this).removeClass("expanded-black");$(this).addClass("collapsed-black");},function(){$(this).next().show("fast");$(this).removeClass("collapsed-black");$(this).addClass("expanded-black");});$(".toggle_next:not(.expanded-black)").toggle(function(){$(this).next().show("fast");$(this).removeClass("collapsed-black");$(this).addClass("expanded-black");},function(){$(this).next().hide("fast");$(this).removeClass("expanded-black");$(this).addClass("collapsed-black");});$(":radio.show_next").parent().next().hide();$(":radio.show_next").click(function(){$(this).parent().next().show();});document.positionTip=function(event){var tPosX=event.pageX-30;var tPosY=event.pageY-$("div.tip2").height()-14;if(tPosX>=$('html').width()*0.7){tPosX=event.pageX-$("div.tip2").width()+12;$("div.tip2 .downarrow").css('margin-left',($("div.tip2").width()-30));}
$("div.tip2").css({top:tPosY,left:tPosX});};document.showTip=function(event){$("div.tip2").remove();$(this).attr('title','');var $thisWords=$(this).attr('tip');$('<div class="tip2"><div class="message">'+$thisWords+'</div><div class="downarrow">&nbsp;</div></div>').appendTo('body');document.positionTip(event);};document.hideTip=function(){$("div.tip2").remove();};$("[tip]").hover(document.showTip,document.hideTip).mousemove(document.positionTip);});$(document).ready(function(){$(".empty").html('<span class="no-data">&mdash;</span>');$(".dollars").before('$ ');$(".form .required:not(.done_prepend)").addClass('done_prepend').prepend('<span style="color: red;">*</span> ');$(".devnote").click(function(){$(this).hide("fast");});$(".button").hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});$(".button").click(function(){$(this).addClass("clicked");},function(){$(this).removeClass("clicked");});$(".error h2, .showstopper h3").prepend('<span class="icon error">&nbsp;</span>');$(".warning h2").prepend('<span class="icon warning-icn">&nbsp;</span>');$(".friendly h2").prepend('<span class="icon info-icn">&nbsp;</span>');$(".success h2").prepend('<span class="icon success-icn">&nbsp;</span>');$(".fadein").hide().fadeIn("slow");$(".nice_ol").each(function(){$("li",this).each(function(i){var liNo=i+1;var liHTML=$(this).html();$(this).html("<span class='circled'>"+liNo+"</span> "+liHTML);});});$(".form .wysiwyg").val('(WYSIWYG Editor)');$(".divider").html("|");$(".select_row").click(function(){$(".select_row").parent().parent().children("td").css({backgroundColor:"inherit"});$(".select_row:checked").parent().parent().children("td").css({backgroundColor:"#E5F6FD"});});$(".reveal_next").next().hide();$(".reveal_next").click(function(event){$(this).next().show("fast");});});$(document).ready(function(){$("#cny_objective_rest_link a").click(function(){$("#cny_objective_short").toggle();$("#cny_objective_all").toggle();$("#cny_objective_rest_link a span").toggle();return false;})});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({'':'-- Select --'},true).selectOptions(/^$/,true);second_category.disabled=true;}else{sel=$("#second_category");ar=categories[category_id];$(sel).removeOption(/./,true).addOption({'':'-- Select --'},true).addOption(ar,true).selectOptions(/^$/,true);second_category.disabled=false;}}}
function createSkillInput(){skillInputCounter+=1;skillInputCount+=1;$("<div></div>").attr("id","skill_"+skillInputCounter).appendTo("#inputs_container")
$('<input type="text"/>').attr("name","input_box_"+skillInputCounter).attr("id","input_box_"+skillInputCounter).css("width","196px").appendTo("#skill_"+skillInputCounter);$("<a></a>").attr("class","icon delete small").attr("href","#").bind('click',{'skillId':skillInputCounter},function(event){removeSkillInput(event.data['skillId']);return false;}).html("remove skill").appendTo("#skill_"+skillInputCounter);$("#input_box_"+skillInputCounter).autocompleteArray(auto_skills,{maxItemsToShow:20});$("#skillsCount").attr("value",skillInputCounter);if(skillInputCount>=10){$("#add_skill").css("display","none");}}
function removeSkillInput(number){if(skillInputCount>1){skillInputCount-=1;$("#skill_"+number).remove();}else{$("#input_box_"+number).attr("value","");}}
function clickclear(thisfield,defaulttext){if(thisfield.value==defaulttext){thisfield.value="";thisfield.setAttribute("class","");thisfield.setAttribute("className","");}}
function clickrecall(thisfield,defaulttext){if(thisfield.value==""){thisfield.value=defaulttext;thisfield.setAttribute("class","example");thisfield.setAttribute("className","example");}}
$(document).ready(function(){if($('.post-job-opening').val()==''){$("#fixed_options").hide();if($("#do").val()!='update_opening'){if($("input[name='job_type']:checked").val()=='Hourly')
{$("#hourly_options").show("medium");$("#fixed_options").hide("medium");}
if($("input[name='job_type']:checked").val()=='Fixed')
{$("#hourly_options").hide("medium");$("#fixed_options").show("medium");}}else{if($("input[name='job_type']").val()=='Hourly')
{$("#hourly_options").show("fast");}
if($("input[name='job_type']").val()=='Fixed')
{$("#fixed_options").show("fast");}}
if($("#main_category").val()!=''){ajax_getProvidersCountMatchingCat();if(($("#pref_feedback").val()!=0)||($("#pref_hourly_rate_min").val()!='')||($("#pref_hourly_rate_max").val()!='')||($("#pref_location").val()!=0)||($("#pref_test").val()!=0)||($("#pref_has_portfolio").attr("checked"))||($("#pref_english_skills").val()!=0)||($("#pref_experience").val()!=0)){ajax_getProvidersCountMatchingOP();}}
$("input[name='job_type']").click(function(){if($("input[name='job_type']:checked").val()=='Hourly')
{$("#hourly_options").show("medium");$("#fixed_options").hide("medium");}
if($("input[name='job_type']:checked").val()=='Fixed')
{$("#hourly_options").hide("medium");$("#fixed_options").show("medium");}});$("input[name='visibility']").click(function(){if($("input[name='visibility']:checked").val()=='public')
{$("#search_engines").show("fast");}
if($("input[name='visibility']:checked").val()=='private')
{$("#search_engines").hide("fast");}});}});var TimerID;var Timer2ID;function run(){ajax_getProvidersCountMatchingOP();window.clearInterval(TimerID);TimerID='';}
function run2(){ajax_getProvidersCountMatchingCat();window.clearInterval(Timer2ID);Timer2ID='';}
function timer_start(){if(''!=TimerID){window.clearInterval(TimerID);}
TimerID=window.setInterval("run();",3000);}
function timer2_start(){if(''!=Timer2ID){window.clearInterval(Timer2ID);}
Timer2ID=window.setInterval("run2();",3000);}
function set_hidden_skillId(type){switch(type){case('radio'):value=$('input[name="op_skill"][checked]').val();skillSelected=$("select[name='skill_select']/option[value='"+value+"']").attr('label');break;case('select'):value=document.getElementById('skill_select').value;skillSelected=$("select[name='skill_select']/option[value='"+value+"']").attr('label');break;case('text'):skillSelected=document.getElementById('new_user_skill').value;break;}
document.getElementById('op_skill_value').value=skillSelected;timer_start();}
function openPopup(url,name,scroll,w,h,lpos,tpos,locat,menu,status,toolbar,resizeble){if(!lpos){lpos=(screen.width)?(screen.width-w)/2:20;}
if(!tpos){tpos=(screen.height)?(screen.height-h)/2:40;}
if(!resizeble){var resizeble='yes';}
if('_blank'==name){var popup=window.open(url,name);}else{var popup=window.open(url,name,'top='+tpos+',left='+lpos+',width='+w+',height='+h+',location='+locat+',status='+status+',menubar='+menu+',toolbar='+toolbar+',resizable='+resizeble+',scrollbars='+scroll);}
if(null==popup||'undefined'==typeof popup){popup=null;showStdErrorMsg();return true;}else{popup.focus();}
return false;}
function setOpenerLocationAndClose(targetUrl){if(window.opener!=null){window.opener.location.href=targetUrl;window.close();}
else{window.location=targetUrl;}
return false;}
function showStdErrorMsg(errorMsg){var d=document.getElementById('stdErrorMsg');if('string'!=typeof errorMsg||''==errorMsg){errorMsg='Popup blocking software has prevented odesk.com from opening an application window.'
+'<br /><br />'
+'To proceed with this operation please configure your popup blocking software to allow popups for odesk.com';}
d.innerHTML=errorMsg+'<a href="#" onclick="getElementById(\'stdErrorMsg\').style.display = \'none\'; return false;">OK</a>';d.style.display='block';return true;}
var ACTIVE_TAB='';$(document).ready(function(){if($('#provider_profile').val()==''){var t1=document.getElementById("navbar-left");if(null!=t1)
{t1=t1.offsetTop;var t2=document.getElementById("provider_profile").offsetTop;var top=t1+t2+30;$(".favorite_hover").css("top",top+"px")}
$("#tab_overview, #tab_resume, #tab_history, #tab_portfolio, #tab_tests").click(function(){if(this.id.slice(4)=='history'){$("#feedbacks_count_text").toggle();$("#feedbacks_count_link").toggle();}else{if($("#feedbacks_count_link").css("display")=='none'){$("#feedbacks_count_text").toggle();$("#feedbacks_count_link").toggle();}}
$("#profile_tabs li").each(function(){$(this).removeClass("innertab_current");$("#profile_"+this.id.slice(4)).css("display","none");});$(this).addClass("innertab_current");$("#profile_"+this.id.slice(4)).css("display","block");$.cookie(ODESK_COOKIE_PREFIX+'profile_tab',this.id.slice(4),{domain:ODESK_COOKIE_DOMAIN});return false;});var dev_permalink_selected=false;var aff_permalink_selected=false;$("#dev_permalink").click(function(){if(!dev_permalink_selected){this.select();dev_permalink_selected=true;}});$("#aff_permalink").click(function(){if(!aff_permalink_selected){this.select();aff_permalink_selected=true;}});$("#user_objective_rest_link a").click(function(){$("#user_objective_short").toggle();$("#user_objective_all").toggle();$("#user_objective_rest_link a span").toggle();return false;})
var url=document.location.toString();if(url.match('#')){var urlAnchor=url.split('#')[1];$("#tab_"+urlAnchor).click();}else{$("#tab_"+ACTIVE_TAB).click();}}});function showHideComment(selName,showid,commentElId){if($("select[name='"+selName+"'] option:selected").val()==showid){$("#comment_title").show();$("#reject_label").html($("#title_other").val());if(commentElId==''||"undefined"==typeof(commentElId)){$("iframe").show();}else{$('#'+commentElId).show();$('#'+commentElId).focus();}}else{$("#comment_title").hide();$("#reject_label").html($("#title_all").val());if(commentElId==''||"undefined"==typeof(commentElId)){$("iframe").hide();}else{$('#'+commentElId).hide();}}}
$(document).ready(function(){var showid=[];var selName=$("input[name='reason_select_name']").val();var commentElId=$("input[name='reason_comment_id']").val();var selEl=$("select[name='"+selName+"']");if(typeof(selEl.attr("id"))!='undefined'){showid=selEl.attr("id").split('_');showHideComment(selName,showid[1],commentElId);selEl.change(function(){showHideComment(selName,showid[1],commentElId);})}})
function switch_options(select_object,index_1,index_2){var bufer_text='';var bufer_value='';bufer_text=select_object[index_2].text;bufer_value=select_object[index_2].value;select_object.options[index_2]=new Option(select_object.options[index_1].text,select_object.options[index_1].value);select_object.options[index_1]=new Option(bufer_text,bufer_value,true,true);}
function list_up(obj_id){var opts=document.getElementById(obj_id);if(opts.options.selectedIndex>0){switch_options(opts,opts.options.selectedIndex-1,opts.options.selectedIndex);}}
function list_down(obj_id){var opts=document.getElementById(obj_id);if((opts.options.selectedIndex!=opts.options.length-1)&&(opts.options.selectedIndex>=0)){switch_options(opts,opts.options.selectedIndex+1,opts.options.selectedIndex);}}
function save_list_values(list_id,container_id){var list=document.getElementById(list_id);var container=document.getElementById(container_id);var ar=[];for(i=0;i<list.options.length;i++){ar[i]=list.options[i].value;}
container.value=ar;}
function move_list_item(from_id,to_id){var from_list=document.getElementById(from_id);var to_list=document.getElementById(to_id);if(from_list.options.selectedIndex>=0){var temp_opt=new Option(from_list.options[from_list.options.selectedIndex].text,from_list.options[from_list.options.selectedIndex].value);to_list.options[to_list.options.length]=temp_opt;for(i=from_list.options.selectedIndex;i<from_list.options.length-1;i++){from_list.options[i].text=from_list.options[i+1].text;from_list.options[i].value=from_list.options[i+1].value;}
from_list.options.selectedIndex=i;from_list.options[i]=null;}};function deselect_item(obj_id){var item=document.getElementById(obj_id);item.options.selectedIndex=-1;}
stars_tmp=new Array();star_o=new Image();star_a=new Image();star_p=new Image();for(i=0;i<=5;i++){stars_tmp[i]=new Image();}
function voteIt(act,nam,elem,stars_url,form_name,elem_pref){if('undefined'==typeof(elem_pref))
{elem_pref='';}
star_o.src=stars_url+"star_light.gif";star_a.src=stars_url+"star_active.gif";star_p.src=stars_url+"star_passive.gif";oRate=new makeObj("rate_"+nam+elem_pref);eList=oRate.elem.childNodes.length;eImg=oRate.elem.childNodes;if(!act){for(i=0;i<=elem;i++){eImg[i].src=stars_tmp[i].src;}}
if(act==1){for(i=0;i<=elem;i++){stars_tmp[i].src=eImg[i].src;eImg[i].src=star_o.src;}
oRate.elem.className="hand";}
if(act==2){oRate.elem.className="def";document.getElementById(nam).value=elem+1;count_score(form_name);for(i=0;i<eList;i++){stars_tmp[i].src=eImg[i].src=((i<=elem)?star_a.src:star_p.src);}}
if(act==3){if(''==elem_pref){tmp_pref='_all';}else{tmp_pref='';}
oRate2=new makeObj("rate_"+nam+tmp_pref);if(null!=oRate2.elem){eImg2=oRate2.elem.childNodes;}
oRate.elem.className="def";document.getElementById(nam).value=elem+1;for(i=0;i<eList;i++){stars_tmp[i].src=eImg[i].src=((i<=elem)?star_a.src:star_p.src);if(null!=oRate2.elem){eImg2[i].src=eImg[i].src;}}
ajax_updatePersonalScore(nam,elem+1);}}
function makeObj(obj){this.elem=document.getElementById(obj);this.css=this.elem?this.elem.style:null;return this;}
$(document).ready(function(){$("input[name='apply_for_whom']").click(function(){if($("input[name='apply_for_whom']:checked").val()=='me')
{$("#yourself_options:hidden").show("medium");$("#ac_options:visible").hide("medium");}
if($("input[name='apply_for_whom']:checked").val()=='ac')
{$("#yourself_options:visible").hide("medium");$("#ac_options:hidden").show("medium");}});$("input[name='apply_as_what']").click(function(){if($("input[name='apply_as_what']:checked").val()=='ic')
{$("#apply_as_team:visible").hide("medium");}
if($("input[name='apply_as_what']:checked").val()=='ac')
{$("#apply_as_team:hidden").show("medium");}});});$(document).ready(function(){$("#team_info, #profile_info, #contact_info").submit(function(){$.blockUI();return true;});$("#team_info_submit_link").click(function(){$("#team_info").submit();return false;});$("#profile_info_submit_link").click(function(){$("#profile_info").submit();return false;});$("#contact_info_submit_link").click(function(){$("#contact_info").submit();return false;});$("#descr_rest_link a").click(function(){$("#descr_short").toggle();$("#descr_all").toggle();$("#descr_rest_link a span").toggle();return false;})});$(document).ready(function(){$("#tab_alltime, #tab_month, #tab_week, #tab_today").click(function(){$("#tests_tabs li").each(function(){$(this).removeClass("current");$("#tests_"+this.id.slice(4)).css("display","none");});$(this).addClass("current");$("#tests_"+this.id.slice(4)).css("display","block");return false;});$("#tab_"+ACTIVE_TAB).click();});function trim_all(form){for(i=0;i<form.elements.length;i++){ob=form.elements[i];if("text"==ob.type||"textarea"==ob.type){ob.value=trim_one(ob.value);}}
return true;}
function trim_one(s){return s.replace(/^\s+|\s+$/g,'');}
function add_more(label){tbl=document.getElementById(label+'_tbl');tr=document.getElementById(label+'_div[1]');str=new String(tr.innerHTML);regEx=RegExp('\\[1\\]','g');str=str.replace(regEx,'['+(tbl.rows.length)+']');regEx=RegExp('selected(="selected")*','gi');str=str.replace(regEx,'');regEx=RegExp('value=("(.+)"|\\S+)\\sname=','gi');str=str.replace(regEx,'value="" name=');row=tbl.insertRow(tbl.rows.length);cell=row.insertCell(0);div=document.createElement('div');cell.appendChild(div);div.innerHTML=str;$("[name$='[to_year]']").each(function(){$(this).trigger('change');});}
function show_hear_detailed(){var hear=$("#hear").val();if("Other"==hear){$("#hear_detailed").css("display","inline").removeAttr('disabled');}else{$("#hear_detailed").css("display","none").attr('disabled',true);}}
function show_favorite_block(id,type,notes_inline){var save_favorite=document.getElementById(id+"save_favorite");var save_favorite_form=document.getElementById(id+"save_favorite_form");var remove_favorite=document.getElementById(id+"remove_favorite");var remove_favorite_form=document.getElementById(id+"remove_favorite_form");var edit_notes_form=document.getElementById(id+"edit_notes_form");var error_form=document.getElementById(id+type+"_error_msg_box");var short_notes_box=document.getElementById(id+"short_notes_box");if(notes_inline)
{notes_display="inline";}else{notes_display="block";}
error_form.style.display="none";switch(type){case('save_favorite'):save_favorite.style.display="block";remove_favorite.style.display="none";if(save_favorite_form.style.display=="none"){save_favorite_form.style.display="block";}else{save_favorite_form.style.display="none";}
break;case('edit_notes'):save_favorite.style.display="none";remove_favorite.style.display="block";remove_favorite_form.style.display="none";if(edit_notes_form.style.display=="none"){edit_notes_form.style.display="block";short_notes_box.style.display="none";}else{edit_notes_form.style.display="none";short_notes_box.style.display=notes_display;}
break;case('remove_favorite'):save_favorite.style.display="none";remove_favorite.style.display="block";edit_notes_form.style.display="none";document.getElementById(id+"edit_notes_error_msg_box").style.display='none';if(remove_favorite_form.style.display=="none"){remove_favorite_form.style.display="block";short_notes_box.style.display="none";}else{remove_favorite_form.style.display="none";short_notes_box.style.display=notes_display;}
break;}}
function hide_blocks(id,type,notes_inline){var block=document.getElementById(id+type);var block_form=document.getElementById(id+type+"_form");var error_form=document.getElementById(id+type+"_error_msg_box");if(notes_inline)
{notes_display="inline";}else{notes_display="block";}
if("save_favorite"==type){var opposite_block=document.getElementById(id+"remove_favorite");}else{var opposite_block=document.getElementById(id+"save_favorite");document.getElementById(id+'edit_notes_form').style.display="none";document.getElementById(id+'short_notes_box').style.display=notes_display;}
block.style.display="block";block_form.style.display="none";error_form.style.display="none";opposite_block.style.display="none";}
function check_errors(res){if(typeof(res['message'])!="undefined"){hide_blocks(res['id'],res['type']);document.getElementById(res['id']+'short_notes_box').style.display="none";document.getElementById(res['id']+res['type']+"_error_msg").innerHTML=res['message'];document.getElementById(res['id']+res['type']+"_error_msg_box").style.display='block';}else{if("remove_favorite"!=res['type'])
{if(document.getElementById('is_providers_lister'))
{hide_blocks(res['id'],"remove_favorite",false);}else{hide_blocks(res['id'],"remove_favorite",true);}}else{hide_blocks(res['id'],"save_favorite",false);}
document.getElementById(res['id']+"tag_id").value=res['tag_id'];}
document.getElementById(res['id']+res['type']+"_msg").style.display="none";switch_button_status(res['id']+res['type']+'_submit',true,true);switch_button_status(res['id']+res['type']+'_cancel',true,true);enable_buttons(true);check_buttons_status();}
String.prototype.wordWrap=function(m,b,c){var i,j,s,r=this.split("\n");if(m>0)for(i in r){for(s=r[i],r[i]="";s.length>m;j=c?m:(j=s.substr(0,m).match(/\S*$/)).input.length-j[0].length||m,r[i]+=s.substr(0,j)+((s=s.substr(j)).length?b:""));r[i]+=s;}
return r.join("\n");};function my_notes_tip(title,body){ddrivetip('<b>My Notes for '+title+' </b><hr />'+unescape(body).wordWrap(50,'<br>',false),'300');}
function add_to_favorite(uid,recno,notes,name){document.getElementById(recno+"save_favorite_msg").style.display="inline";document.getElementById(recno+"edit_notes").value=notes;short_notes=get_short_notes(notes);document.getElementById(recno+"short_notes").innerHTML=encode_brackets(short_notes);document.getElementById(recno+"popup").onmouseover=function event_handle(){var popup_text=nl2br(encode_brackets(notes));my_notes_tip(name,popup_text);}
try{document.getElementById(recno+"popup2").onmouseover=function event_handle(){var popup_text=nl2br(encode_brackets(notes));my_notes_tip(name,popup_text);}
document.getElementById(recno+"popup3").onmouseover=function event_handle(){var popup_text=nl2br(encode_brackets(notes));my_notes_tip(name,popup_text);}}catch(e){}
var title=document.getElementById("page_title").value;switch_button_status(recno+'save_favorite_submit',false,true);switch_button_status(recno+'save_favorite_cancel',false,true);disable_buttons(true);x_ajax_add(uid,recno,title,notes,check_errors);}
function edit_notes(tag_id,notes,recno,name){document.getElementById(recno+"edit_notes_msg").style.display="inline";document.getElementById(recno+"edit_notes").value=notes;switch_button_status(recno+'edit_notes_submit',false,true);switch_button_status(recno+'edit_notes_cancel',false,true);disable_buttons(true);short_notes=get_short_notes(notes);document.getElementById(recno+"short_notes").innerHTML=encode_brackets(short_notes);document.getElementById(recno+"popup").onmouseover=function event_handle(){var popup_text=nl2br(encode_brackets(notes));my_notes_tip(name,popup_text);}
try{document.getElementById(recno+"popup2").onmouseover=function event_handle(){var popup_text=nl2br(encode_brackets(notes));my_notes_tip(name,popup_text);}
document.getElementById(recno+"popup3").onmouseover=function event_handle(){var popup_text=nl2br(encode_brackets(notes));my_notes_tip(name,popup_text);}}catch(e){}
x_ajax_edit(tag_id,notes,recno,check_errors);}
function remove_from_favorite(uid,recno){document.getElementById(recno+"remove_favorite_msg").style.display="inline";switch_button_status(recno+'remove_favorite_submit',false,true);switch_button_status(recno+'remove_favorite_cancel',false,true);disable_buttons(true);x_ajax_remove(uid,recno,check_errors);}
function encode_brackets(string){regLt=RegExp('<','g');regGt=RegExp('>','g');string=string.replace(regLt,"&lt;");string=string.replace(regGt,"&gt;");return string;}
function nl2br(string){regEx=RegExp('\n','g')
string=string.replace(regEx,'<br />');return string;}
function get_short_notes(string){short_notes=unescape(string).replace(/\0/g,'0').replace(/\\([\\'"])/g,'$1').substring(0,42);if(short_notes!=string)
{short_notes=short_notes+"...";}
return short_notes;}
$(document).ready(function(){$('span.short_notes').each(function(i){this.innerHTML=get_short_notes(this.innerHTML)});});function ajax_getProvidersCountMatchingCat(){document.getElementById('op_candidatesCatCount').style.display='none';document.getElementById('op_categoryCount').innerHTML='';document.getElementById('op_candidatesLoadingCat').style.display='block';if(isNaN(document.getElementById('main_category').value)){var main_category=document.getElementById('main_category').value;}
if(!isNaN(document.getElementById('second_category').value)){var second_category=document.getElementById('second_category').value;}
x_ajax_getProvidersCountMatchingCat(main_category,second_category,showProvidersCountCat);if((document.getElementById('pref_feedback').value!=0)||(isNaN(document.getElementById('pref_hourly_rate_min').value))||(isNaN(document.getElementById('pref_hourly_rate_max').value))||(document.getElementById('pref_location').value!=0)||(document.getElementById('pref_test').value!=0)||(document.getElementById('pref_has_portfolio').checked)||(document.getElementById('pref_english_skills').value!=0)||(document.getElementById('pref_experience').value!=0)){ajax_getProvidersCountMatchingOP();}}
function showProvidersCountCat(res){if(document.getElementById('op_candidatesLoadingCat'))
document.getElementById('op_candidatesLoadingCat').style.display='none';document.getElementById('op_candidatesCatCount').style.display='block';document.getElementById('op_categoryCount').innerHTML=res['providersTotCount'];}
function ajax_getProvidersCountMatchingOP(){document.getElementById('op_candidates').style.display='none';if(null!=document.getElementById('op_candidatesGrCount')){document.getElementById('op_candidatesGrCount').innerHTML='';}
document.getElementById('op_candidatesFbCount').innerHTML='';document.getElementById('op_candidatesHrCount').innerHTML='';document.getElementById('op_candidatesLcCount').innerHTML='';document.getElementById('op_candidatesTstCount').innerHTML='';document.getElementById('op_candidatesEsCount').innerHTML='';document.getElementById('op_candidatesExpCount').innerHTML='';document.getElementById('op_candidatesHasPortfolioCount').innerHTML='';if(document.getElementById('op_candidatesLoading'))
document.getElementById('op_candidatesLoading').style.display='block';document.getElementById('matches').style.display='block';if(null!=document.getElementById('pref_group')&&!isNaN(document.getElementById('pref_group').value)){var pref_group=document.getElementById('pref_group').value;}
if(isNaN(document.getElementById('main_category').value)){var main_category=document.getElementById('main_category').value;}
if(!isNaN(document.getElementById('second_category').value)){var second_category=document.getElementById('second_category').value;}
if(!isNaN(document.getElementById('pref_feedback').value)){var feedback=document.getElementById('pref_feedback').value;}
if(!isNaN(document.getElementById('pref_hourly_rate_min').value)&&document.getElementById('pref_hourly_rate_min').value.replace(/ /g,'')!=''){var hourlyRate_min=document.getElementById('pref_hourly_rate_min').value;}
if(!isNaN(document.getElementById('pref_hourly_rate_max').value)&&document.getElementById('pref_hourly_rate_max').value.replace(/ /g,'')!=''){var hourlyRate_max=document.getElementById('pref_hourly_rate_max').value;}
if(!isNaN(document.getElementById('pref_location').value)){var preflocation=document.getElementById('pref_location').options[document.getElementById('pref_location').selectedIndex].text;}
if(true==(document.getElementById('pref_has_portfolio').checked)){var has_portfolio=1;}
if(!isNaN(document.getElementById('pref_test').value)){var test=document.getElementById('pref_test').value;}
if(!isNaN(document.getElementById('pref_english_skills').value)){var englishSkills=document.getElementById('pref_english_skills').value;}
if(!isNaN(document.getElementById('pref_experience').value)){var experience=document.getElementById('pref_experience').value;}
x_ajax_getProvidersCountMatchingOP(pref_group,main_category,second_category,hourlyRate_min,hourlyRate_max,preflocation,englishSkills,experience,feedback,test,has_portfolio,showProvidersCount);}
function showProvidersCount(res){if(document.getElementById('op_candidatesLoading'))
document.getElementById('op_candidatesLoading').style.display='none';document.getElementById('op_candidates').style.display='block';document.getElementById('op_candidatesCount').innerHTML=res['providersTotCount'];if('undefined'!=typeof(res['providersFbCount'])){document.getElementById('op_candidatesFbCount').innerHTML=res['providersFbCount']+' matches';}
if('undefined'!=typeof(res['providersGrCount'])){document.getElementById('op_candidatesGrCount').innerHTML=res['providersGrCount']+' matches';}
if('undefined'!=typeof(res['providersHrCount'])){document.getElementById('op_candidatesHrCount').innerHTML=res['providersHrCount']+' matches';}
if('undefined'!=typeof(res['providersLcCount'])){document.getElementById('op_candidatesLcCount').innerHTML=res['providersLcCount']+' matches';}
if('undefined'!=typeof(res['providersPtCount'])){document.getElementById('op_candidatesPtCount').innerHTML=res['providersPtCount']+' matches';}
if('undefined'!=typeof(res['providersAcCount'])){document.getElementById('op_candidatesAcCount').innerHTML=res['providersAcCount']+' matches';}
if('undefined'!=typeof(res['providersTstCount'])){document.getElementById('op_candidatesTstCount').innerHTML=res['providersTstCount']+' matches';}
if('undefined'!=typeof(res['providersEsCount'])){document.getElementById('op_candidatesEsCount').innerHTML=res['providersEsCount']+' matches';}
if('undefined'!=typeof(res['providersExpCount'])){document.getElementById('op_candidatesExpCount').innerHTML=res['providersExpCount']+' matches';}
if('undefined'!=typeof(res['providersHasPortfolioCount'])){document.getElementById('op_candidatesHasPortfolioCount').innerHTML=res['providersHasPortfolioCount']+' matches';}
if(parseInt(res['providersTotCount'])<=5)
{document.getElementById('op_candidatesUrl').style.display='inline';}else{document.getElementById('op_candidatesUrl').style.display='none';}}
function ajax_checkProviderOP(login,op_recno){document.getElementById('ajax_loading').style.display='inline';x_ajax_checkProviderOP(login,op_recno,showProviderOPMessage);}
function showProviderOPMessage(res){if(true!=res['error']){document.getElementById('ajax_loading').style.display='none';if(true!=res['match']){if(true==res['loggenIn']){prefsArray=res['prefs'];alert='<div class="section warning" id="alert"><h2><span class="icon warning-icn">&nbsp</span>You do not meet this job\'s preferred qualifications</h2>';alert+='<div class="content"><ul class="bulleted">';alert+='This buyer prefers:';for(var i in prefsArray)
{alert+='<li>'+prefsArray[i]+'</li>';}
alert+='You may still apply. However, candidates who meet all of these criteria will be displayed prominently in the buyer\'s candidate list, and therefore may have a better chance of being selected for an interview.';alert+='</ul></div></div>';document.getElementById('form_preferencesAlert').innerHTML=alert;}else{username=document.getElementById("login").value;document.getElementById('form_preferencesAlert').innerHTML="User &lt;"+username+"&gt; does not meet all of the buyer\'s qualifications. User &lt;"+username+"&gt; may still apply to the job, but chances of receiving interviews will be higher if &lt;"+username+"&gt; meets all of the preferred qualifications.";}
document.getElementById('form_preferencesAlert').style.display='';}else{document.getElementById('form_preferencesAlert').innerHTML='You meet all of the buyer\'s qualifications.';}}else{document.getElementById('ajax_loading').style.display='none';document.getElementById('form_preferencesAlert').innerHTML=res['text'];document.getElementById('form_preferencesAlert').style.display='';}}
function ajax_getProvidersCountSO(){if(document.getElementById('op_candidatesLoading'))
document.getElementById('op_candidatesLoading').style.display='inline';var main_category=document.getElementById('main_category').value;var second_category=document.getElementById('second_category').value;var feedback=document.getElementById('pref_feedback').value;var hourlyRate_min=document.getElementById('pref_hourly_rate_min').value;var hourlyRate_max=document.getElementById('pref_hourly_rate_max').value;var preflocation=document.getElementById('pref_location').value;var has_portfolio=document.getElementById('pref_has_portfolio').value;var test=document.getElementById('pref_test').value;var englishSkills=document.getElementById('pref_english_skills').value;var experience=document.getElementById('pref_experience').value;var group=document.getElementById('pref_group').value;x_ajax_getProvidersCountMatchingOP(group,main_category,second_category,hourlyRate_min,hourlyRate_max,preflocation,englishSkills,experience,feedback,test,has_portfolio,showProvidersCountSO);}
function showProvidersCountSO(res){filter='?q=';if(document.getElementById('pref_hourly_rate_min').value!=''){var hourlyRateMin=document.getElementById('pref_hourly_rate_min').value;filter+='&min='+URLEncode(hourlyRateMin);}
if(document.getElementById('pref_hourly_rate_max').value!=''){var hourlyRateMax=document.getElementById('pref_hourly_rate_max').value;filter+='&max='+URLEncode(hourlyRateMax);}
if(document.getElementById('pref_english_skills').value!=''){var englishSkills=document.getElementById('pref_english_skills').value;filter+='&eng='+URLEncode(englishSkills);}
if(document.getElementById('pref_location').value!='Anywhere'){var locationName=document.getElementById('pref_location').value;filter+='&loc='+URLEncode(locationName);}
if(document.getElementById('pref_experience').value!=''){var experience=document.getElementById('pref_experience').value;filter+='&hrs='+URLEncode(experience);}
if(document.getElementById('main_category_name').value!=''){var main_category=document.getElementById('main_category_name').value;filter+='&c1='+URLEncode(main_category);}
if(document.getElementById('second_category_name').value!=''){var second_category=document.getElementById('second_category_name').value;filter+='&c2='+URLEncode(second_category);}
if(document.getElementById('pref_feedback').value!=0){var feedback=document.getElementById('pref_feedback').value;filter+='&fb='+URLEncode(feedback);}
if(document.getElementById('pref_test').value!=''){var test=document.getElementById('pref_test').value;filter+='&test='+URLEncode(test);}
if(document.getElementById('pref_has_portfolio').value==1){filter+='&port=1';}
group_filter="";if(document.getElementById('pref_group_id').value!=""){group_filter="&g="+document.getElementById('pref_group_id').value;}
if(res['providersTotCount']>0){document.getElementById('op_providersCountDiv').innerHTML=res['providersTotCount']+' providers match preferred qualifications (<a href="'+res['WEB_ROOT']+'users/'+filter+group_filter+'">review their profiles</a>)';}else{document.getElementById('op_providersCountDiv').innerHTML=res['providersTotCount']+' providers match preferred qualifications';}
if(document.getElementById('op_candidatesLoading'))
document.getElementById('op_candidatesLoading').style.display='none';document.getElementById('op_providersCountDiv').style.display='block';}
function ajax_checkProvidersOP(){var counter_active=0;var counter_all=0;while(op_div=document.getElementById('op_candidatesLoading_active_'+counter_active))
{op_div.style.display='inline';counter_active++;};while(op_div=document.getElementById('op_candidatesLoading_all_'+counter_all))
{op_div.style.display='inline';counter_all++;}
x_ajax_checkProvidersOP(document.getElementById('op_recno_alternate').value,updateProvidersListOP);}
function updateProvidersListOP(res){var counter_active=0;var counter_all=0;while(op_div=document.getElementById('op_candidatesLoading_active_'+counter_active))
{op_div.style.display='none';candidacyMatch=false;for(key in res['candidates']){if(res['candidates'][key]==document.getElementById('hidden_active_'+counter_active).value){candidacyMatch=true;}}
if(true==candidacyMatch){document.getElementById('op_candidacy_matches_active_'+counter_active).innerHTML='<img style="margin-left:5px; vertical-align: middle; display: inline;" src="'+res['WEB_ROOT']+'images/icons/checked_v.gif" border="0" alt="V" />';}else{document.getElementById('op_candidacy_matches_active_'+counter_active).innerHTML='<img style="margin-left:5px; vertical-align: middle; display: inline;" src="'+res['WEB_ROOT']+'images/icons/checked_x.gif" border="0" alt="X" />';}
document.getElementById('op_candidacy_matches_active_'+counter_active).style.display='inline';counter_active++;};while(op_div=document.getElementById('op_candidatesLoading_all_'+counter_all))
{op_div.style.display='none';candidacyMatch=false;for(key in res['candidates']){if(res['candidates'][key]==document.getElementById('hidden_all_'+counter_all).value){candidacyMatch=true;}}
if(true==candidacyMatch){document.getElementById('op_candidacy_matches_all_'+counter_all).innerHTML='<img style="margin-left:5px; vertical-align: middle; display: inline;" src="'+res['WEB_ROOT']+'images/icons/checked_v.gif" border="0" alt="V" />';}else{document.getElementById('op_candidacy_matches_all_'+counter_all).innerHTML='<img style="margin-left:5px; vertical-align: middle; display: inline;" src="'+res['WEB_ROOT']+'images/icons/checked_x.gif" border="0" alt="X" />';}
document.getElementById('op_candidacy_matches_all_'+counter_all).style.display='inline';counter_all++;}}
function ajax_updatePersonalScore(cn_recno,private_rating){var message=document.getElementById('text_'+cn_recno);var message2=document.getElementById('text_'+cn_recno+"_all");message.innerHTML='updating...';message.style.display='inline';if(null!=message2){message2.innerHTML=message.innerHTML;message2.style.display=message.style.display;};x_ajax_updatePersonalScore(cn_recno,private_rating,ajax_status_updatePersonalScore);}
function ajax_status_updatePersonalScore(res){if(typeof(res['message'])!="pr"){document.getElementById(res['cn_recno']).value=res['pr'];document.getElementById(res['cn_recno']+'_all').value=res['pr'];}
var message=document.getElementById('text_'+res['cn_recno']);var message2=document.getElementById('text_'+res['cn_recno']+'_all');if(typeof(res['message'])!="undefined"){document.getElementById('text_'+res['cn_recno']).innerHTML='Failed.';if(null!=message2){message2.innerHTML='Failed.';}
if(null!=message){message.innerHTML='Failed.';}}else{if(null!=message2){message2.style.display="none";message2.innerHTML='';}
if(null!=message){message.style.display="none";message.innerHTML='';}}}
function generate_teamid(type){var company_id,team_name,company_name;if(type=="team"){company_id=rollup_teams[$('#select_rollup_company').val()]['company_id'];team_name=$("#team_name").val();}
company_name=$("#company_name").val();if("undefined"!=typeof(team_name))
{team_name.replace(/\s+/g,'');}
if("undefined"!=typeof(company_name))
{company_name.replace(/\s+/g,'');}
if(type=="team"){x_ajax_generate_teamid(company_id,team_name,show_me);}
else{x_ajax_generate_companyid2(company_name,show_me);}}
function generate_companyid(){var company_name=$("#company_name").val();if("undefined"!=typeof(company_name))
{company_name.replace(/\s+/g,'');}
x_ajax_generate_companyid2(company_name,show_me);}
function show_me(res){if(typeof(res)!="undefined"&&res!=false){if($('#team_id').length==0){$('#company_id').val(res);}else{$('#team_id').val(res);}}}
function check_companyid(id){$("#ajax_loading").show();$("#check_link").hide();if(""!=id)
{x_ajax_check_companyid(id,show_confirmation);}else{show_confirmation(false);}}
function show_confirmation(res){if(typeof(res)!="undefined"&&res!=false){$("#available").show();$("#not_available").hide();$("#ajax_loading").hide();}else{$("#available").hide();$("#not_available").show();$("#ajax_loading").hide();}}
function ER_healthcheck_success(){x_ajax_ER_healthcheck_success(ER_healthcheck_alert);}
function ER_healthcheck_alert(res){if(res==true){$('input[btn=gotest]').each(function(){$(this).attr('disabled',false);$(this).removeClass('disabled');});}else{$('div[service_name=TestingService]').css('display','block');}}
function count_max_bill(sum_rate){var charge_rate=parseFloat(sum_rate);var limit=parseFloat($('#week_limit').val());var max_bill=charge_rate*limit;if(isNaN(max_bill)||($('#week_limit').val()=='1-168')){$('#max_bill').text('No limit set').css('color','#F00');}else{$('#max_bill').text('$'+max_bill.toFixed(2)).css('color','#000');$('#week_limit').val(limit);}}
function enable_limit(sum_rate){if($('#set_week_limit').is(':checked')){$('#week_limit').removeAttr("disabled");count_max_bill(sum_rate);}else{$('#week_limit').attr("disabled",true);$('#max_bill').text('No limit set');}}
function checkWeeklyLimit(disabled){if(!disabled){if($('#set_week_limit').is(':checked')){$('#teams_group input[type=checkbox]').attr('checked',false);$('#teams_group_parent').attr('checked',true);$('#week_limit').removeAttr("readonly").removeAttr("disabled");$('#max_bill').css('color','#F00');}else{$('#week_limit').attr("readonly",true).attr("disabled",true).val('1-168');$('#max_bill').text('No limit set').css('color','#000');}}else{$('#set_week_limit').attr('checked',false);$('#week_limit').attr("readonly",true).attr("disabled",true);}}
var css_browser_selector=function(){var
ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t)!=-1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js';h.className+=h.className?' '+c:c;}();var offsetfromcursorX=12
var offsetfromcursorY=10
var offsetdivfrompointerX=10
var offsetdivfrompointerY=14
document.write('<div id="dhtmltooltip"></div>')
if(typeof ODESK_CONSOLE_ROOT=='undefined'){var ODESK_CONSOLE_ROOT='/console/';}
document.write('<img id="dhtmlpointer" src="'+ODESK_CONSOLE_ROOT+'images/tooltip_arrow.png">')
var ie=document.all
var ns6=document.getElementById&&!document.all
var enabletip=false
if(ie||ns6)
var tipobj=document.all?document.all["dhtmltooltip"]:document.getElementById?document.getElementById("dhtmltooltip"):""
var pointerobj=document.all?document.all["dhtmlpointer"]:document.getElementById?document.getElementById("dhtmlpointer"):""
function ietruebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}
function ddrivetip(thetext,thewidth,thecolor,ontop){if(typeof ontop!="undefined"&&ontop==1)
{tipobj.style.ontop=true;}
if(ns6||ie){if(typeof thewidth!="undefined")tipobj.style.width=thewidth+"px"
if(typeof thecolor!="undefined"&&thecolor!="")tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false}}
function positiontip(e){if(enabletip){var nondefaultpos=false
var curX=(ns6)?e.pageX:event.clientX+ietruebody().scrollLeft;var curY=(ns6)?e.pageY:event.clientY+ietruebody().scrollTop;var winwidth=ie&&!window.opera?ietruebody().clientWidth:window.innerWidth-20
var winheight=ie&&!window.opera?ietruebody().clientHeight:window.innerHeight-20
var rightedge=ie&&!window.opera?winwidth-event.clientX-offsetfromcursorX:winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera?winheight-event.clientY-offsetfromcursorY:winheight-e.clientY-offsetfromcursorY
var leftedge=(offsetfromcursorX<0)?offsetfromcursorX*(-1):-1000
if(rightedge<tipobj.offsetWidth){tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true}
else if(curX<leftedge)
tipobj.style.left="5px"
else{tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"}
if(bottomedge<tipobj.offsetHeight||tipobj.style.ontop==true){tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true}
else{tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"}
tipobj.style.visibility="visible"
if(!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"}}
function hideddrivetip(){if(ns6||ie){enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''}}
document.onmousemove=positiontip;$('#tdnavbar').ready(function(){$('div.navbox h2.toggler > span.icon').toggle(function(){$('.content',$(this).parents('div.navbox')).hide('fast');$(this).removeClass('expanded').addClass('collapsed');},function(){$('.content',$(this).parents('div.navbox')).show('fast');$(this).removeClass('collapsed').addClass('expanded');});});function search_professionals(){disable_buttons();switch_filter('ProfileData');form_action=$("#professionals_search").attr("action");query=$("#data").val();ac=$("#ac").val();c1=$("#main_category").val();c2=$("#second_category").val();fb=$("#adjusted_score").val();hrs=$("#ui_total_hours").val();ir=$("#is_recent").val();min=$("#hourly_charge_rate_min").val();max=$("#hourly_charge_rate_max").val();reg=$("#country_region").val();pt=$("#provider_type").val();last=$("#last_provider_activity").val();test=$("#cmp_ref").val();port=$("#total_portfolio_items").val();rdy=$("#is_ready").val();eng=$("#ui_english").val();to=$("#titles_only").val();pg=$("#number_of_selected").val();skip=$("#skip_records").val();sort=$("#order").val();sid=$("#sid").val();direction=$("#dir").val();location_href=form_action+'?q='+URLEncode(query);if(c1!=''){location_href+='&c1='+URLEncode(c1)}
if(ac!=''){location_href+='&ac='+URLEncode(ac)}
if(c2!=''){location_href+='&c2='+URLEncode(c2)}
if(fb!=''){location_href+='&fb='+URLEncode(fb)}
if(hrs!=''){location_href+='&hrs='+URLEncode(hrs)}
if(ir!='no'){location_href+='&ir='+URLEncode(ir)}
if(min!=''){location_href+='&min='+URLEncode(min)}
if(max!=''){location_href+='&max='+URLEncode(max)}
if(reg!=''){location_href+='&loc='+URLEncode(reg)}
if(pt!=''){location_href+='&pt='+URLEncode(pt)}
if(last!=''){location_href+='&last='+URLEncode(last)}
if(test!=''){location_href+='&test='+URLEncode(test)}
if(port!=0){location_href+='&port='+URLEncode(port)}
if(rdy!=0){location_href+='&rdy='+URLEncode(rdy)}
if(eng!=''){location_href+='&eng='+URLEncode(eng)}
if(to!='no'){location_href+='&to='+URLEncode(to)}
if(pg!=0){location_href+='&pg='+URLEncode(pg)}
if(skip!=0){location_href+='&skip='+URLEncode(skip)}
if(sid!=''){location_href+='&sid='+URLEncode(sid)}
if(sort!='Adjusted Score'){location_href+='&sort='+URLEncode(sort)}
if(direction!='desc'){location_href+='&dir='+URLEncode(direction)}
window.location.href=location_href;return false;}
function search_jobs(){disable_buttons();switch_filter('OpeningData');form_action=$("#jobs_search").attr("action");query=$("#data").val();c1=$("#main_category").val();c2=$("#second_category").val();t_h=$("#filter_jobtype_hourly").val();t_f=$("#filter_jobtype_fixed").val();wl=$("#hours_per_week").val();dur=$("#engagement_duration").val();min=$("#min_budget").val();max=$("#max_budget").val();dp=$("#Date_Posted").val();st=$("#status_for_search").val();fb=$("#adjusted_score").val();tba=$("#total_billed_assignments").val();to=$("#titles_only").val();skip=$("#skip_records").val();sort=$("#order").val();sid=$("#sid").val();direction=$("#dir").val();location_href=form_action+'?q='+URLEncode(query);if(c1!=''){location_href+='&c1='+URLEncode(c1)}
if(c2!=''){location_href+='&c2='+URLEncode(c2)}
if($("#filter_jobtype_hourly").is(":checked")){location_href+='&t='+URLEncode(t_h);if(wl!=''){location_href+='&wl='+URLEncode(wl)}
if(dur!=''){location_href+='&dur='+URLEncode(dur)}}else if($("#filter_jobtype_fixed").is(":checked")){location_href+='&t='+URLEncode(t_f);if(min!=''){location_href+='&min='+URLEncode(min)}
if(max!=''){location_href+='&max='+URLEncode(max)}}
if(dp!=''){location_href+='&dp='+URLEncode(dp)}
if(st!='Open'){location_href+='&st='+URLEncode(st)}
if(fb!=''){location_href+='&fb='+URLEncode(fb)}
if(tba!=''){location_href+='&tba='+URLEncode(tba)}
if(to!='no'){location_href+='&to='+URLEncode(to)}
if(skip!=0){location_href+='&skip='+URLEncode(skip)}
if(sort!='Date Created'){location_href+='&sort='+URLEncode(sort)}
if(direction!='desc'){location_href+='&dir='+URLEncode(direction)}
if(sid!=''){location_href+='&sid='+URLEncode(sid)}
window.location.href=location_href;return false;}
$(document).ready(function(){$("#professionals_search").submit(function(){$("#skip_records").val(0);$("#ag").val(0);search_professionals();return false;});$("#jobs_search").submit(function(){$("#skip_records").val(0);search_jobs();return false;});$("#group_profile input[name=q]").focus(function(){if($(this).val()=='search skills or keywords')
$(this).val('').css({'font-style':'normal','color':'#000000'});})
$("#group_profile input[name=q]").blur(function(){if($(this).val()=='')
$(this).css({'font-style':'italic','color':'#cccccc'}).val('search skills or keywords');})});function URLEncode(unencodedValue){var SAFECHARS="0123456789"+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"+"abcdefghijklmnopqrstuvwxyz"+"-_.!~*'()";var HEX="0123456789ABCDEF";var plaintext=unencodedValue;var encoded="";if(typeof(plaintext)!='undefined'){for(var i=0;i<plaintext.length;i++){var ch=plaintext.charAt(i);if(ch==" "){encoded+="+";}else if(SAFECHARS.indexOf(ch)!=-1){encoded+=ch;}else{var charCode=ch.charCodeAt(0);if(charCode>255){encoded+="+";}else{encoded+="%";encoded+=HEX.charAt((charCode>>4)&0xF);encoded+=HEX.charAt(charCode&0xF);}}}}
return encoded;};$(document).ready(function(){$("#gp_search_jobs,#gp_search_providers").submit(function(){var item=$(this).find("input[name=q]");if($(item).val()=="search skills or keywords"){$(item).val('');}});});$("#send_message_submit").ready(function(){$("#send_message_submit").click(function(){$(this).removeClass('clicked');if(""==$("#sm_message").val()){alert('Please enter the message');return false;}else{disable_buttons(true);return true;}});});$(".group_admin_buttons").ready(function(){$(".group_admin_buttons").click(function(){$(this).removeClass('clicked');return true;});});$("#leave_group_submit").ready(function(){$("#leave_group_submit").click(function(){$(this).removeClass('clicked');disable_buttons(true);return true;});});$("#groupadmin_paging li").ready(function(){$("#groupadmin_paging li").click(function(){if(!$(this).hasClass("disabled")&&!$(this).hasClass("current")){loading_process('Please wait...',true);location.href=$("#pager_path").val()+$(this).attr('pid');}});});$(".member_cb").ready(function(){$(".member_cb").bind("click",function(){var checked=$(".member_cb:checked");if(0<checked.length){if($("#groupadmin_controlbar .button").hasClass("disabled")){$("#groupadmin_controlbar .button").removeClass("disabled").removeAttr("disabled");}}else{if(!$("#groupadmin_controlbar .button").hasClass("disabled")){$("#groupadmin_controlbar .button").addClass("disabled").attr("disabled","disabled");}}});});$("#groupadmin_controlbar .button").ready(function(){$("#groupadmin_controlbar .button").click(function(){var checked=$(".member_cb:checked");var names_string="";var ids_string="";for(i=0;i<checked.length;i++){names_string+=$("#n_"+checked[i].value).val()+", ";ids_string+=checked[i].value+",";}
$(".members_names").text(names_string.substr(0,names_string.length-2));$(".members_ids").val(ids_string.substr(0,ids_string.length-1));});});var timerf;function setf(elem){$("#"+elem).focus();window.clearInterval(timerf);timerf='';}
$("a.remove_single, a.change_role_single, a.approve_single, a.deny_single").ready(function(){$("a.remove_single, a.change_role_single, a.approve_single, a.deny_single").click(function(){$(".members_names").text($("#n_"+$(this).attr("mid")).val());$(".members_ids").val($(this).attr("mid"));});});$(".remove_single, .remove_multiple").ready(function(){$(".remove_single, .remove_multiple").click(function(){if(''!=timerf){window.clearInterval(timerf);}
timerf=window.setInterval("setf('rm_message');",10);});});$(".approve_single, .approve_multiple").ready(function(){$(".approve_single, .approve_multiple").click(function(){if(''!=timerf){window.clearInterval(timerf);}
timerf=window.setInterval("setf('a_message');",10);});});$(".deny_single, .deny_multiple").ready(function(){$(".deny_single, .deny_multiple").click(function(){if(''!=timerf){window.clearInterval(timerf);}
timerf=window.setInterval("setf('d_message');",10);});});$("#group_send_message_link").ready(function(){var groups_app={group_id:'',announce_ttl:7,data:{},init:function(){this.group_id=$('input[name="odeskgroupid"]:first').val();this.set_handlers();},api:{_proc_callback:function(status,data,callback,fmt,params){if(fmt=='json'){if(typeof(data)=='string'&&data.charAt(0)=='{'){var edata;eval('edata = '+data);if(typeof(callback)=='function')callback(status,edata,params);}else if(typeof(callback)=='function')callback(status,data,params)}else{if(typeof(callback)=='function')callback(status,data,params);}},get_announcement:function(group_id,callback,params){httpReq.request(GROUPS_REST_URI
+'/groups/'
+group_id
+'.json','get',null,function(status,data,arg){groups_app.api._proc_callback(status,data,arg.cb,arg.fmt);},{cb:callback,fmt:'json',obj:this})},send_announcement:function(group_id,msg_data,callback){httpReq.request(GROUPS_REST_URI
+'/groups/'
+group_id
+'/messages'
+'.json','post',msg_data,function(status,data,arg){arg.obj._proc_callback(status,data,arg.cb,arg.fmt);},{cb:callback,fmt:'json',obj:this})}},ui:{request_start:function(){loading_process('Loading...');},request_done:function(){loading_process();$('#loading_throbber').remove();},save_announcement:function(){var msg=check_form($('#compose_mail_form input:text,input:hidden, textarea'),{subject:'Please enter message subject',body:'Please enter message'},null,null);if(msg.error.length){alert(msg.error.join('\n'));return false;}
groups_app.ui.request_start();groups_app.api.send_announcement(groups_app.group_id,{subject:msg.data.subject,body:msg.data.body},function(status,data,param){winbox.close('announcement_popup');switch(status){case 200:groups_app.ui.request_done();showbox('Message Status','Your announcement has been successfully sent','success',5000);break;case 403:groups_app.ui.request_done();showbox('Group announcement','You are not allowed to send a group announcement','error',30000);break;default:groups_app.ui.request_done();showbox('Group announcement','Sending announcement error','error',30000);break;}});},show_announcement:function(){winbox.open('Send an announcement',proc_tpl('show_announcement_tpl',{remain_time:groups_app.data.remain_time+groups_app.data.remain_period,last_date:futime(parseInt(groups_app.data.last_announcement_on),'%m/%d/%Y')}),null,'announcement_popup');},compose_announcement:function(){winbox.open('Send an announcement',proc_tpl('send_announcement_tpl',{}),null,'announcement_popup');if($.browser.msie){var subj_width=$('#subject').parent('td').width();if('undefined'!=typeof(subj_width))$('#subject').width(subj_width-4);}
$('#subject').focus();}},set_handlers:function(){$("#group_send_message_link").click(function(){if(groups_app.group_id){groups_app.ui.request_start();groups_app.api.get_announcement(groups_app.group_id,function(status,data,param){switch(status){case 200:groups_app.ui.request_done();var expired=true;groups_app.data=data.group;if(data.group.last_announcement_on){var cur_date=new Date();groups_app.data.last_date=new Date(parseInt(data.group.last_announcement_on));groups_app.data.exp_date=new Date(groups_app.data.last_date.setDate(groups_app.data.last_date.getDate()+groups_app.announce_ttl));if(groups_app.data.exp_date>=cur_date){expired=false;groups_app.data.remain_time=groups_app.data.exp_date.getDate()-cur_date.getDate();groups_app.data.remain_period=((1<groups_app.data.remain_time)?' days':'day');if(0==groups_app.data.remain_time){groups_app.data.remain_time=groups_app.data.exp_date.getHours()-cur_date.getHours();groups_app.data.remain_period=((1<groups_app.data.remain_time)?' hours':' hour');}
if(0==groups_app.data.remain_time){groups_app.data.remain_time=groups_app.data.exp_date.getMinutes()-cur_date.getMinutes();groups_app.data.remain_period=((1<groups_app.data.remain_time)?' minutes':' minute');}}}
if(expired){groups_app.ui.compose_announcement();}else{groups_app.ui.show_announcement();}
break;default:groups_app.ui.request_done();showbox('Group announcement','Error in Announcement retrieve processing','error',30000);break;}});}else{showbox('Group announcement','Error: wrong group id.','error',30000);}});$('#submit_group_announcement').live('click',function(){groups_app.ui.save_announcement();winbox.close('announcement_popup');});}};groups_app.init();});$(".requestee_cb").ready(function(){$(".requestee_cb").bind("click",function(){var checked=$(".requestee_cb:checked");if(0<checked.length){if($("#groupadmin_controlbar .button").hasClass("disabled")){$("#groupadmin_controlbar .button").removeClass("disabled").removeAttr("disabled");}}else{if(!$("#groupadmin_controlbar .button").hasClass("disabled")){$("#groupadmin_controlbar .button").addClass("disabled").attr("disabled","disabled");}}});});$("#groupadmin_controlbar .button").ready(function(){$("#groupadmin_controlbar .button").click(function(){var checked=$(".requestee_cb:checked");var names_string="";var recnos_string="";for(i=0;i<checked.length;i++){names_string+=$("#n_"+checked[i].value).val()+", ";recnos_string+=checked[i].value+",";}
$(".requestees_names").text(names_string.substr(0,names_string.length-2));$(".requestees").val(recnos_string.substr(0,recnos_string.length-1));});});$("a.approve_single, a.deny_single").ready(function(){$("a.approve_single, a.deny_single").click(function(){$(".requestees_names").text($("#n_"+$(this).attr("r_recno")).val());$(".requestees").val($(this).attr("r_recno"));});});$("#group_settings_submit .button").ready(function(){$("#group_settings_submit .button").click(function(){disable_buttons(true);});});$(document).ready(function(){$(".inv_message_switch_link").click(function(){recno=$(this).attr("rel");$("#inv_message_short_"+recno).toggle();$("#inv_message_full_"+recno).toggle();$("#inv_message_switch_link_container_"+recno+" a span").toggle();return false;});function adjust_ga_tb_height(res,box_height){var alt=res.attr("alt");alt=alt.substr(0,alt.length-3);names_height=$("#names_holder").height();names_height=parseInt(names_height)+box_height;res.attr("alt",alt+names_height);}
$("#ga_change_role_multiple").click(function(){adjust_ga_tb_height($(this),309);});$("#ga_remove_multiple, .group_admin_buttons.deny_multiple, .group_admin_buttons.approve_multiple").click(function(){adjust_ga_tb_height($(this),242);});});$(document).ready(function(){if($('html').hasClass('ie8')){$('wbr').replaceWith('<span style="font-size:0.1em"> </span>');}});function check_show_jobs_in_progress(type){if($("#jobs_in_progress").attr('checked')==true){$.cookie(ODESK_COOKIE_PREFIX+'show_jobs_in_progress_'+type,'yes');$(".job_in_progress").css("display","none");$(".job_finished").css("display","none");$(".all_jobs").css("display","");}else{$.cookie(ODESK_COOKIE_PREFIX+'show_jobs_in_progress_'+type,'no');$(".job_in_progress").css("display","none");$(".all_jobs").css("display","none");$(".job_finished").css("display","");}}
function update_editor_value(id){if(typeof(FCKeditorAPI)!="undefined"&&typeof(FCKeditorAPI.GetInstance(id))!="undefined"){FCKeditorAPI.GetInstance(id).UpdateLinkedField();}}
function is_valid_url(url){if(url.match(/((?:(?:ftp|http|https):\/\/[a-z0-9-]+|www|ftp)(?:\.[a-z0-9-]+)+(?::\d+)?(?:[\?\/\#](?:[\x5b\x5d\w~\/\?&%\@\#|;:=\+-]|\.(?=\S))*)?)/)){return true;}else{return false;}}
function bytes_to(value,precision,unit){if(typeof(precision)=="undefined"){precision=3;}
if(typeof(unit)=="undefined"){unit="MB";}
switch(trim(unit)){case"B":return value;case"KB":value=value/1024;return value.toFixed(precision)+'KB';case"MB":value=value/1048576;return value.toFixed(precision)+'MB';case"GB":value=value/1048576;return value.toFixed(precision)+'GB';default:return 0;}}
function add_param(url,param){separator='';if(url.toString().indexOf('?')==-1)separator='?';return url+separator+param;}
var evt={log:function(event_name,sid){httpReq.request('/api/evt/v1/'+event_name+'.json','post',{sid:sid},function(status,data){switch(status){case 200:return true;break;default:logger.error('event saving error:\n'+status+'/'+http_status2str(status)+'');break;}});}}
var facebook={uid:null,cookie_type:null,callback:null,tpl:null,data:{},set_cookie:function(){$.cookie(ODESK_COOKIE_PREFIX+'fb_share_'+facebook.type+'_'+facebook.uid,1,{domain:ODESK_COOKIE_DOMAIN,path:'/'});var data={ajax:1};data['do']='fb_set_relation';$.post(ODESK_CONSOLE_ROOT+'extending_odesk.php',data,null,'json');},after_share:function(){facebook.set_cookie();if('function'==typeof(callback))callback();},share_test:function(fb_tpl,uid,is_ort,exam_url,exam_title,test_title,percentile,score,max_score,icon,icon_href,callback){var url=document.location.toString();var sid=(url.match('exam_history'))?MY_EXAMS_FB_SID:EXAM_FB_SID;evt.log('fb.test',sid);facebook.uid=uid;facebook.cookie_type='exam';facebook.callback=callback;facebook.tpl=fb_tpl;facebook.data={test_title:test_title,exam_url:add_param(exam_url,'&wsrc=fb_exam&wlnk=exam_url'),exam_title:'Certified '+exam_title,percentile:percentile,score:score,max_score:max_score};if(icon!=null&&icon!='undefined'){facebook.data['images']=[{src:icon,href:add_param(icon_href,'&wsrc=fb_exam&wlnk=exam_icon')}];}
facebook.share();return true;},share_job:function(fb_tpl,uid,op_title,op_url,op_duration,op_budget){evt.log('fb.job',JOB_DETAILS_FB_SID);facebook.uid=uid;facebook.type='job';facebook.tpl=fb_tpl;facebook.data={url:add_param(op_url,'&wsrc=fb_job&wlnk=job_url'),title:op_title,duration:op_duration,budget:op_budget};facebook.share();return false;},share_profile:function(fb_tpl,uid,profile_url,profile_title,short_overview,photo,photo_href){evt.log('fb.profile',PROFILE_DETAILS_FB_SID);facebook.uid=uid;facebook.type='profile';facebook.tpl=fb_tpl;facebook.data={profile_url:add_param(profile_url,'&wsrc=fb_profile&wlink=profile_url'),profile_title:profile_title,short_overview:short_overview};if(photo!=''){facebook.data['images']=[{src:photo,href:add_param(photo_href,'&wsrc=fb_profile&wlink=photo')}];}
facebook.share();return false;},share:function(){FB.ensureInit(function(){FB.Connect.showFeedDialog(facebook.tpl,facebook.data,null,null,null,FB.RequireConnect.promptConnect,facebook.after_share);});}};function is_fb_access(cont){var cookie_name=ODESK_COOKIE_PREFIX+'fb_access_error';if('function'==typeof(FB_RequireFeatures)){return true;}else{if($.cookie(cookie_name))return false;var error='<div class="alert warning" id="fb_access_error"><h2 style="padding-left:10px; background-image:none"><span class="icon warning-icn">&nbsp;</span><span class="close" style="float: right;">close</span>Facebook Connect is not accessible.</h2></div>';if(cont==null)cont='.pageBreadcrumb';$(cont).before(error);$('.close','#fb_access_error').click(function(){$('#fb_access_error').hide();$.cookie(cookie_name,1,{path:'/',domain:ODESK_COOKIE_DOMAIN});});return false;}}
$(document).ready(function(){if($("#big_logo_upload").length>0){var n=new Image();var n1=new Image();n.src=ODESK_CONSOLE_ROOT+'images/group_placeholder_big.gif';n1.src=ODESK_CONSOLE_ROOT+'images/group_placeholder_small.gif';var options={iframe:true,dataType:'json',beforeSubmit:function(){$("#big_logo_loading").show();$("#group_big_logo").hide();$("#big_logo_errors").hide();if(1!=$("#has_small_logo").val()){$("#small_logo_loading").show();$("#group_small_logo").hide();$("#small_logo_errors").hide();}
return true;},success:function(data){if("success"==data.result){$("#group_big_logo").attr("src",n.src);$("#group_big_logo").attr("src",data.group_logo);$("#group_big_logo").show();if(1!=$("#has_small_logo").val()){$("#group_small_logo").attr("src",n1.src);$("#group_small_logo").attr("src",data.group_small_logo);$("#group_small_logo").show();$("#has_small_logo").val("1");}}else{$("#big_logo_errors .content").empty().append("<p>"+data.errors.join('<br />')+"</p>");$("#big_logo_errors").show();}
$("#big_logo_loading").hide();$("#small_logo_loading").hide();}}
$('#big_logo_upload').ajaxForm(options);$(".big_logo").livequery("change",function(){var a=$("#big_logo").clone();$("#big_logo_upload .group_logo_input_hidden").empty().append($("#big_logo").attr("id","big_logo_tmp"));$("#big_logo_input_displayed").append(a);$("#big_logo_upload").submit();});var n=new Image();n.src=ODESK_CONSOLE_ROOT+'images/group_placeholder_small.gif';var options={iframe:true,dataType:'json',beforeSubmit:function(){$("#small_logo_loading").show();$("#group_small_logo").hide();$("#small_logo_errors").hide();return true;},success:function(data){if("success"==data.result){$("#group_small_logo").attr("src",n.src);$("#group_small_logo").attr("src",data.group_small_logo);$("#group_small_logo").show();$("#has_small_logo").val("1");}else{$("#small_logo_errors .content").empty().append("<p>"+data.errors.join('<br />')+"</p>");$("#small_logo_errors").show();}
$("#small_logo_loading").hide();}}
$('#small_logo_upload').ajaxForm(options);$(".small_logo").livequery("change",function(){var a=$("#small_logo").clone();$("#small_logo_upload .group_logo_input_hidden").empty().append($("#small_logo").attr("id","small_logo_tmp"));$("#small_logo_input_displayed").append(a);$("#small_logo_upload").submit();});}});function getScrollY()
{scrollY=0;if(typeof window.pageYOffset=="number"){scrollY=window.pageYOffset;}else if(document.documentElement&&document.documentElement.scrollTop){scrollY=document.documentElement.scrollTop;}else if(document.body&&document.body.scrollTop){scrollY=document.body.scrollTop;}else if(window.scrollY){scrollY=window.scrollY;}
return scrollY;}
jQuery.expr[':']['modified']=function(elem){return(elem.nodeName=='INPUT'&&(elem.type=='checkbox'||elem.type=='radio')&&elem.defaultChecked!=elem.checked)||(elem.nodeName=='INPUT'&&elem.defaultValue!=elem.value&&{'text':true,'hidden':true,'file':true,'password':true}[elem.type])||(elem.nodeName=='TEXTAREA'&&elem.defaultValue!=a.value)||(elem.nodeName=='SELECT'&&jQuery('option:option-mod',elem).length);};jQuery.expr[':']['option-mod']=function(elem){return(elem.nodeName=='OPTION'&&elem.defaultSelected!=elem.selected)||(elem.nodeName=='INPUT'&&(elem.type=='checkbox'||elem.type=='radio')&&elem.defaultChecked!=elem.checked);};jQuery(document).ready(function(){if(typeof(jQuery.bt)!='undefined'){jQuery(".feedbackRating").bt({fill:"#fffee6",shadow:true,shadowColor:"#999",overlap:"-2px",cssStyles:{fontSize:"90%"},width:"500px",shrinkToFit:true});}});