
var currentUrl=location.href,first=true,months=['января','февраля','марта','апреля','мая','июня','июля','августа','сентября','октября','ноября','декабря'],down=0,cx=0,cy=0;function linkEqual(l1,l2){var p1=parseInt(/\d+/.exec(l1)||'1'),p2=parseInt(/\d+/.exec(l2)||'1');return(l1==l2)&&(p1==p2)}
function validInput(wnd){var correct=1;if(!($('input.required, textarea.required',wnd).length))return;$('input.required, textarea.required',wnd).each(function(){correct=(correct&&this.value)});$('.yellow2',wnd)[(correct?'remove':'add')+'Class']('yellow_dis')}
function sendForm(frm,callback,error){var data=[],loader=$('.loader',$(frm).parents('div.dialog')[0]);error=error||function(){};$.each(frm.elements,function(i,v){if(!(/check/.test(v.type)&&!(v.checked)))data.push(v.name+'='+encodeURIComponent(v.value))});loader.show().html('<img src="template/taxi/img/ajax-loader.gif" alt="" />'+ajax_load);data=data.join('&');$.ajax({type:'post',data:data,url:frm.action,dataType:'json',success:function(json){loader.html(json['message']);(json['status']=='OK'?callback:error)(json);if(json['status']=='OK')setTimeout(function(){$.fancybox.close()},1000)}})}
function parseDate(d){return/\d{2}$/.exec(d)+' '+months[parseInt(/-\d{2}-/.exec(d).toString().replace('-','').replace(/^0/,''))-1]+' '+/\d{4}/.exec(d)}
function taxiLoad(link){var pnum=/\d+/.exec(link.substring(link.length-1,link.length));if(first&&linkEqual(location.href.replace(/#.*/,''),link))return;currentUrl=link;if(!link){link=location.href.replace(/\/$/,'');if(first)return}
$.fancybox($('#loader')[0],{overlayShow:0,hideOnContentClick:0,padding:0,transitionIn:'none',transitionOut:'none'})
$.ajax({type:'get',dataType:'json',url:link,success:function(json){$('#no_taxi')[json['taxi'][0]?'hide':'show']();$('.taxi tr').each(function(i,v){if(i==0)return;$('td:nth-child(2) a[rel]',v).attr('rel',json['taxi'][i-1]?json['taxi'][i-1]['id']:'rel');$('.yellow, .edit, .delete',v)[(json['taxi'][i-1]?'remove':'add')+'Class']('none');if($('.adm_menu').length){if($('#add_edit_user').length){$('td',v)[0].innerHTML=json['taxi'][i-1]?json['taxi'][i-1]['login']:'';$('td',v)[1].innerHTML=json['taxi'][i-1]?json['taxi'][i-1]['title']:''}else{$.each(['city','airport','city_rod','price','currency','uri_part'],function(j,w){$('td',v)[j].innerHTML=json['taxi'][i-1]?json['taxi'][i-1][w]:''})}
return}
$('td',v)[0].innerHTML=json['taxi'][i-1]?json['taxi'][i-1]['time']+'<input type="hidden" name="date" value="'+json['taxi'][i-1]['date']+'" />':'';$('td',v)[1].innerHTML=json['taxi'][i-1]?json['taxi'][i-1]['car']:'';$('td.last a[rel]',v).attr('rel',json['taxi'][i-1]?json['taxi'][i-1]['id']:'rel');if($('.dsp_menu').length){if(!(json['taxi'][i-1]))$('td:first-child',v).removeClass('in').removeClass('out');if(json['taxi'][i-1])$('td:first-child',v).addClass(/in|out/.exec(json['taxi'][i-1]['direction']).toString());$('td',v)[2].innerHTML=json['taxi'][i-1]?json['taxi'][i-1]['status']:'';$(v)[(json['taxi'][i-1]?(json['taxi'][i-1]['state']=='accept'?'add':'remove'):'remove')+'Class']('accept');$(v)[(json['taxi'][i-1]?(json['taxi'][i-1]['state']=='process'?'add':'remove'):'remove')+'Class']('process');$('.accept1',v)[(json['taxi'][i-1]?(json['taxi'][i-1]['state']=='accept'?'remove':'add'):'add')+'Class']('none')
$('td:last-child input',v).val(json['taxi'][i-1]?json['taxi'][i-1]['direction']:'')}
$('.yellow_dis',v).addClass('none')});$.fancybox.close();if(!($('.adm_menu').length)){$('.topmenu a').removeClass('act');$('.topmenu a[href*='+(/\/in|out|accept|process|all/.exec(link)||($('.dsp_menu').length?'all':'out'))+']').addClass('act');if(!($('.dsp_menu').length)){$('tr.head td:first-child').html(/\/in/.test(link)?to_kiev:to_airport);$('.topmenu a').each(function(){$(this).html($(this).html().replace(/\d+/,json['taxi_count'][this.href.replace(/.*\//,'')]))})}}
var base=link.replace(/\/page\/\d+/,'')
$('.paginator a').remove();if(json['page_count']>1)for(var j=1;j<=json['page_count'];j++)
$('<a href="'+base+'/page/'+j+'">'+j+'</a>').appendTo('.paginator');pagesReady();$('.paginator a').removeClass('act');$($('.paginator a')[(pnum||1)-1]).addClass('act')},error:function(req,status){}})}
function afterDelete(){if($('.taxi td.first:empty').length<13||!(/\d+/.test(currentUrl)))
taxiLoad(currentUrl);else{var num=parseInt(/\d+/.exec(currentUrl));if(num>1)
$.historyLoad(currentUrl.replace(/\d+/,num-1))}}
var callbacks={'taxi_order':function(json){$('td.last a[rel='+json['id']+']').hide().next().removeClass('none');afterDelete()},'login':function(){location.reload()},'add_edit_taxi':function(json){if($('#add_edit_taxi input[name=id]').val()){var id=$('#add_edit_taxi input[name=id]').val(),tr=$('.button[rel='+id+']').parents('tr')[0];$('input',tr).val($('#add_edit_taxi input[name=dir]').val());var time=$('#add_edit_taxi input[name=time]').val(),date=$('#add_edit_taxi input[name=date]').val(),dt=new Date();if(date&&date==(dt.getFullYear()+'-'+((dt.getMonth()+1)>9?(dt.getMonth()+1):'0'+(dt.getMonth()+1))+'-'+(dt.getDate()+1>9?dt.getDate()+1:'0'+dt.getDate()+1)))
time=time+'&nbsp;&nbsp;&nbsp;Завтра';else if(date&&date!=(dt.getFullYear()+'-'+((dt.getMonth()+1)>9?(dt.getMonth()+1):'0'+(dt.getMonth()+1))+'-'+(dt.getDate()>9?dt.getDate():'0'+dt.getDate())))
time=time+'&nbsp;&nbsp;&nbsp;'+parseDate(date);else if(date)
time=time+'&nbsp;&nbsp;&nbsp;Сегодня';$('td:first-child',tr).html(time+'<input type="hidden" name="date" value="'+date+'" />').removeClass('in').removeClass('out').addClass($('#add_edit_taxi input[name=dir]').val());$('td:nth-child(2)',tr).html($('#add_edit_taxi input[name=car]').val())}else{if($('.taxi td:empty').length>1){var tr2=$('.taxi td:empty').parents('tr')[1];$('input',tr2).val($('#add_edit_taxi input[name=dir]').val());var time=$('#add_edit_taxi input[name=time]').val(),date=$('#add_edit_taxi input[name=date]').val(),dt=new Date();if(date&&date!=(dt.getFullYear()+'-'+((dt.getMonth()+1)>9?(dt.getMonth()+1):'0'+(dt.getMonth()+1))+'-'+(dt.getDate()>9?dt.getDate():'0'+dt.getDate())))
time=time+'&nbsp;&nbsp;&nbsp;'+parseDate(date);$('td:first-child',tr2).html(time+'<input type="hidden" name="date" value="'+date+'" />').removeClass('in').removeClass('out').addClass($('#add_edit_taxi input[name=dir]').val());;$('td:nth-child(2)',tr2).html($('#add_edit_taxi input[name=car]').val());$('td:nth-child(3)',tr2).html(active);$('.button',tr2).attr('rel',json['id']);$('.edit, .delete',tr2).removeClass('none')}else{var page=json['page'];$.historyLoad(/page/.test(currentUrl)?currentUrl.replace(/\d+/,page):currentUrl+'/page/'+page)}}},'delete_taxi':function(json){$.fancybox.close();afterDelete()},'delete_user':function(json){$.fancybox.close();afterDelete()},'taxi_accept':function(){var frm=$('form',$('#taxi_accept')[0])[0];var tr=$('.button[rel='+$('#taxi_accept input[name=id]').val()+']').parents('tr');tr.removeClass('accept').addClass(frm.act.value=='denied'?'active':'process');$('.accept1',tr).addClass('none');$('td:nth-child(3)',tr).html(frm.act.value=='denied'?active:process);if(/accept/.test(currentUrl))
afterDelete()},'adm_login':function(){location.reload()},'change_pass':function(){},'save_set':function(){},'register':function(){},'question':function(){},'add_edit_user':function(json){if($('#add_edit_user input[name=id]').val()){var tr=$('.button[rel='+$('#add_edit_user input[name=id]').val()+']').parents('tr')[0];$('td:first-child',tr).html($('#add_edit_user input[name=login]').val());$('td:nth-child(2)',tr).html($('#add_edit_user input[name=title]').val());$('td:nth-child(3)',tr).html($('#add_edit_user select[name=city] option:selected').text());$('input[name=email]',tr).val($('#add_edit_user input[name=email]').val());$('input[name=city]',tr).val($('#add_edit_user select[name=city]').val())}else{if($('.taxi td:empty').length>1){var tr2=$('.taxi td:empty').parents('tr')[1];$('td:first-child',tr2).html($('#add_edit_user input[name=login]').val());$('td:nth-child(2)',tr2).html($('#add_edit_user input[name=title]').val());$('td:nth-child(3)',tr2).html($('#add_edit_user select[name=city] option:selected').text());$('input[name=email]',tr2).val($('#add_edit_user input[name=email]').val());$('input[name=city]',tr2).val($('#add_edit_user select[name=city]').val());$('.button',tr2).attr('rel',json['id']);$('.edit, .delete',tr2).removeClass('none')}else{var page=json['page'];$.historyLoad('admin/users/page/'+page)}}},'add_edit_city':function(json){if($('#add_edit_city input[name=id]').val()){var tr2=$('.button[rel='+$('#add_edit_city input[name=id]').val()+']').parents('tr')[0];$.each(['city','airport','city_rod','price','currency','uri_part'],function(i,v){$('td',tr2)[i].innerHTML=$('#add_edit_city input[name='+v+']').val()})}else{if($('.taxi td:empty').length>1){var tr2=$('.taxi td:empty').parents('tr')[1];$.each(['city','airport','city_rod','price','currency','uri_part'],function(i,v){$('td',tr2)[i].innerHTML=$('#add_edit_city input[name='+v+']').val()});$('.button',tr2).removeClass('none').attr('rel',json['id'])}}},'delete_city':function(){afterDelete()}},fancySetup={hideOnContentClick:0,overlayShow:1,overlayOpacity:0.7,overlayColor:'#000',transitionIn:'none',transitionOut:'none',padding:0},handlers={'accept1':function(){var sel='#'+this.href.replace(/.*#/,''),w=$(sel)[0];$('form',w)[0].reset();if(this.rel)$('form',w)[0].id.value=this.rel;$('#taxi_accept td:nth-child(2)').html('');var tr=$(this).parents('tr')[0];$('#taxi_accept .red, #taxi_accept .yellow, #taxi_accept .yellow2')[/process/.test(tr.className)?'hide':'show']();$('#taxi_accept .title').html(/process/.test(tr.className)?order_info:accept_taxi);$('#taxi_accept tr:nth-child(2) td:last-child').html($('td.first',tr).html());$('#taxi_accept tr:nth-child(3) td:last-child').html($('td:nth-child(2)',tr).html());$.ajax({url:'dispatch/order/'+this.rel,type:'get',dataType:'json',success:function(j){$.each({4:'comment',5:'name',6:'address',7:'phone'},function(i,v){$('#taxi_accept tr:nth-child('+i+') td:nth-child(2)').html(j[v])});$('#taxi_accept tr:first-child td:last-child').html(j['punkt'])}})},'edit':function(){var sel='#'+this.href.replace(/.*#/,''),w=$(sel)[0];$('form',w)[0].reset();if(this.rel)$('form',w)[0].id.value=this.rel;else $('form',w)[0].id.value='';$('.loader',w).hide();if($('input#first',w)[0])
$('input#first',w)[0].focus();if(/edit/.test(this.className)){if(!($('.adm_menu').length)){var inp=$(this).next(),inp2=$(this).next().next();$('#add_edit_taxi input[name=date]').val(this.rel?$('td:first-child input',$(this).parents('tr')[0]).val():'');var dt=$('#add_edit_taxi input[name=date]').val(),d=new Date(),format=function(v){return v>9?v:'0'+v.toString()};$('#add_edit_taxi .title, #add_edit_taxi .yellow2').html(this.rel?taxi_edit:taxi_add);$('#add_edit_taxi input[name=time]').val(this.rel?/\d{2}:\d{2}/.exec($('td:first-child',$(this).parents('tr')[0]).html()):format(d.getHours())+':'+format(d.getMinutes()));if(dt)setDate({selectedYear:(parseInt(/\d{4}/.exec(dt))||d.getFullYear()),selectedMonth:(parseInt((/-\d{2}-/.exec(dt)||'').toString().replace('-','').replace(/^0/,''))||d.getMonth()+1)-1,selectedDay:(parseInt((/-\d{2}$/.exec(dt)||'').toString().replace('-','').replace(/^0/,''))||d.getDate())},$('#add_edit_taxi input[name=date_show]')[0])
$('#add_edit_taxi input[name=car]').val(this.rel?$('td:nth-child(2)',$(this).parents('tr')[0]).html():'');$('.radio').css({backgroundPosition:(inp.val()=='in'?'0 -35px':'top left')});$('#add_edit_taxi form')[0].dir.value=(inp.val()=='in'?'in':'out');var sel=$('select[name=route]')[0];$('.radio .b').html(/\s.*\s(.*)/.exec($('option[value='+inp2.val()+']')[0].text).toString().split(',')[1]);$('.radio .k').html(/(.*)\s.*\s/.exec($('option[value='+inp2.val()+']')[0].text).toString().split(',')[1]);sel.value=inp2.val();validInput(w)}else{$('#add_edit_city .title, #add_edit_city .yellow2').html(this.rel?taxi_edit:city_add);if($('#add_edit_user').length){$('#add_edit_user .title, #add_edit_user .yellow2').html(this.rel?taxi_edit:user_add);$('form',w)[0].login.value=$('td:first-child',$(this).parents('tr')[0]).html();$('form',w)[0].title.value=$('td:nth-child(2)',$(this).parents('tr')[0]).html();$('form',w)[0].email.value=$('input[name=email]',$(this).parents('tr')[0]).val();$('form',w)[0].city.value=$('input[name=city]',$(this).parents('tr')[0]).val()}else{var tr2=$(this).parents('tr')[0];$.each(['city','airport','city_rod','price','currency','uri_part'],function(i,v){$('#add_edit_city input[name='+v+']').val($('td',tr2)[i].innerHTML)})}
$('input[name*=pass]',w)[(this.rel?'remove':'add')+'Class']('required')}
validInput($('#'+this.href.replace(/.*#/,''))[0]);if($('input, textarea',w)[0]&&!($('input[name=date_show]',w).length))
$('input, textarea',w)[0].focus()}else{if(!($('.adm_menu').length)){var d=new Date(),m=d.getMonth(),format=function(v){return v>9?v:'0'+v.toString()};setDate({selectedYear:d.getFullYear(),selectedMonth:d.getMonth(),selectedDay:d.getDate()},$('#add_edit_taxi input[name=date_show]')[0]);$('#add_edit_taxi input[name=date]').val(d.getFullYear()+'-'+((m+1)>9?(m+1):'0'+(m+1))+'-'+d.getDate());$('#add_edit_taxi input[name=time]').val(format(d.getHours())+':'+format(d.getMinutes()));var sel=$('select[name=route]')[0];$('.radio .b').html(/\s.*\s(.*)/.exec(sel.options[sel.selectedIndex].text).toString().split(',')[1]);$('.radio .k').html(/(.*)\s.*\s/.exec(sel.options[sel.selectedIndex].text).toString().split(',')[1])}}
return false},'yellow':function(){var sel='#'+this.href.replace(/.*#/,''),w=$(sel)[0];$('form',w)[0].reset();if(this.rel)$('form',w)[0].id.value=this.rel;else $('form',w)[0].id.value='';$('.loader',w).hide();if($('input, textarea',w)[0])
$('input, textarea',w)[0].focus();validInput(w);return false}}
function pageClick(){$.historyLoad(this.href);return false}
function pagesReady(){$('.paginator a').click(pageClick)}
function setDate(i,inp){var d=new Date();inp.value=i.selectedDay+' '+months[i.selectedMonth]+' '+i.selectedYear;if(i.selectedYear==d.getFullYear()&&i.selectedMonth==d.getMonth()){if(i.selectedDay==d.getDate())
inp.value='Сегодня '+String.fromCharCode(8212)+' '+inp.value;else if(i.selectedDay==d.getDate()+1)
inp.value='Завтра '+String.fromCharCode(8212)+' '+inp.value}}
$(function(){$('td.last a[rel], .disp a').fancybox(fancySetup);$('td.last a[rel], .disp a').click(handlers['edit']);if($('.adm_menu').length){$('.edit, #middle>.yellow2, .delete').click(function(){var sel='#'+this.href.replace(/.*#/,''),w=$(sel)[0];$.fancybox($('#'+this.href.replace(/.*#/,''))[0],fancySetup);$('form',w)[0].reset();if($('#add_edit_user').length){$('#add_edit_user .title, #add_edit_user .yellow2').html(this.rel?taxi_edit:user_add);if(this.rel){$('form',w)[0].id.value=this.rel;if($('form',w)[0].login){$('form',w)[0].login.value=$('td:first-child',$(this).parents('tr')[0]).html();$('form',w)[0].title.value=$('td:nth-child(2)',$(this).parents('tr')[0]).html();$('form',w)[0].email.value=$('input[name=email]',$(this).parents('tr')[0]).val();$('form',w)[0].city.value=$('input[name=city]',$(this).parents('tr')[0]).val()}}
else $('form',w)[0].id.value='';$('input[name*=pass]',w)[(this.rel?'remove':'add')+'Class']('required')}else{$('#add_edit_city .title, #add_edit_city .yellow2').html(this.rel?taxi_edit:city_add);if(this.rel){var tr2=$(this).parents('tr')[0];$('form',w)[0].id.value=this.rel;$.each(['city','airport','city_rod','price','currency','uri_part'],function(i,v){$('#add_edit_city input[name='+v+']').val($('td',tr2)[i].innerHTML)})}
else $('form',w)[0].id.value=''}
validInput(w);$('.loader',w).hide();if($('input, textarea',w)[0])
$('input, textarea',w)[0].focus();return false})}
if(!($('.adm_menu').length))
$('.edit, .disp a').click(handlers['edit']);$('td.last a.yellow_dis').click(function(){return false});$('a[href*=add_edit_taxi]').click(function(){$('#add_edit_taxi .title, #add_edit_taxi .yellow2').html(taxi_add)})
$('.grey').click(function(){$.fancybox.close();return false});$('.dialog input, .dialog textarea').keyup(function(e){if((e.keyCode)==13){if((!($('textarea:focus',$(this).parents('.dialog')[0]).length))||e.ctrlKey)
$('form',$(this).parents('.dialog')[0])[0].onsubmit()}
validInput($(this).parents('div.dialog')[0])});$(document).keyup(function(e){var num;if((e.keyCode==39||e.keyCode==37)&&e.ctrlKey){var num=parseInt(/\d+/g.exec(currentUrl)||'1'),step=-(38-e.keyCode);if((num+step)>0&&(num+step)<=parseInt($('.paginator a:last-child').html()||'1'))
$.historyLoad((currentUrl||location.href).replace(/\/page\/\d+/,'')+'/page/'+(num+step))}});var listener=function(){var predok=$(this).parents('div.dialog')[0],frm=$('form',predok)[0],link=$('.yellow2',predok)[0];if(/yellow_dis/gi.test(link.className))return false;sendForm(frm,callbacks[predok.id],function(){});return false}
$('form, .dialog .yellow2').each(function(){if(this.action)
this.onsubmit=listener;else
$(this).click(listener)});$('#enter').click(function(){$.fancybox($('#login')[0],fancySetup);$('#login .loader').hide();$('#login form')[0].reset();$('input[name=login]').focus();return false});$('.radio div').click(function(){var ind=$('.radio div').index(this)
$('form',$(this).parents('.dialog')[0])[0].dir.value=ind?'in':'out';$('.radio').css({backgroundPosition:(ind?'0 -35px':'top left')})});$('.updown div').click(function(){var value=$('.updown div').index(this)?1:-1,r=/^\d(?:|\d)(?:|:)(?:|\d)(?:|\d)$/,part=(r.exec($('#add_edit_taxi input[name=time]').val())||'').toString(),nul='00:00';$('#add_edit_taxi input[name=time]').val($('#add_edit_taxi input[name=time]').val()+nul.substring(part.length,nul.length));var time=$('#add_edit_taxi input[name=time]').val().split(':');time[0]=parseInt(time[0]);time[1]=parseInt(time[1])+value;if(time[1]<0){time[0]--;time[1]=59}else if(time[1]>59){time[0]++;time[1]=0}
if(time[0]<0)
time[0]=23;else if(time[0]>23)
time[0]=0;$('#add_edit_taxi input[name=time]').val(((time[0]>9?'':'0')+time[0])+':'+((time[1]>9?'':'0')+time[1]))});$('.accept1').click(handlers['accept1']);$.historyInit(taxiLoad,location.href);if(!($('.adm_menu').length)){$('.topmenu a').click(function(){$.historyLoad(this.href);return false})}
pagesReady();first=false;if($('#add_edit_taxi').length&&$('.dsp_menu').length)$('#add_edit_taxi input[name=car]').autocomplete('complete/car',{cacheLength:1,width:316,autoFill:1});if($('#add_edit_city').length){$('#add_edit_city input[name=city]').autocomplete('complete/city',{cacheLength:1,width:316,autoFill:1});$('#add_edit_city input[name=city_rod]').autocomplete('complete/city_rod',{cacheLength:1,width:316,autoFill:1});$('#add_edit_city input[name=currency]').autocomplete('complete/currency',{cacheLength:1,width:316,autoFill:1})}
if($('#taxi_order input[name=address]').length&&($('dsp_menu').length))$('#taxi_order input[name=address]').autocomplete('complete/addr',{cacheLength:1,width:316,autoFill:1,scroll:true,scrollHeight:220,extraParams:{city:current_city},formatItem:function(r,i,num){return r[0]},});if($('.dsp_menu').length)
$('#add_edit_taxi input[name=date_show]').datepicker({dateFormat:'yy-mm-dd',changeYear:1,monthNames:['Январь','Февраль','Март','Апрель','Май','Июнь','Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],dayNamesMin:['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],onSelect:function(dText,i){setDate(i,this);$('#add_edit_taxi input[name=date]').val(dText)},minDate:new Date()});$('.taxi tr').click(function(){if($('.adm_menu').length&&!($('.edit',this).length))return;var t=this;var cls=$('.dsp_menu').length?(/accept|process/.test(this.className)?'accept1':'edit'):($('.adm_menu').length?'edit':'yellow');if(!(/none/.test($('.'+cls,this)[0].className))||/process/.test(this.className)){$('#taxi_accept .loader').parent()[/process/.test(this.className)?'hide':'show']();$.fancybox($('#'+$('.'+cls,this)[0].href.replace(/.*#/,''))[0],fancySetup);handlers[cls].apply($('.'+cls,this)[0])}});$('#head_in #title').click(function(){location=$('.dsp_menu').length?'/dispatch':'/'});$('#foot_in > a').attr('target','top');$('.red').click(function(){var frm=$('form',$(this).parents('div.dialog')[0])[0];frm.act.value='denied';sendForm(frm,callbacks['taxi_accept']);return false});if($('#add_edit_taxi select').length)$('#add_edit_taxi select')[0].onchange=function(){$('.radio .b').html(/\s.*\s(.*)/.exec(this.options[this.selectedIndex].text).toString().split(',')[1]);$('.radio .k').html(/(.*)\s.*\s/.exec(this.options[this.selectedIndex].text).toString().split(',')[1])}
$('#cities a.open').click(function(){var f=$('#cities div a.open').index(this);$('#cities div')[f?'slideDown':'slideUp']('fast');$('#cities>a.open')[f?'hide':'show']();return false});$(document).click(function(){$('#cities div').slideUp('fast');$('#cities>a.open').show()});$('[name=date_show]').keyup(function(e){if(e.keyCode==8)
this.value=''});$('a[href*=dispatch], a[href*=mailto]').each(function(){this.href=/(?:dispatch|mailto).*/.exec(this.href)})})