if(!window.addEventListener){window.attachEvent('onmessage',function(e){flagma_receiveMessage2(e);});}
else{window.addEventListener("message",flagma_receiveMessage2,false);}
function flagma_receiveMessage2(event){var message=event.data;var iFrame=document.getElementById('flagma-iframe');if(message.match(/^h(\d+)$/)){var h=RegExp.$1;iFrame.style.height=h+'px';}else if(message=='scroll'){scrollTo(0,iFrame.offsetTop);}}
function flagma_on_load(th){setTimeout(function(){var h=null;if(!h){if(location.hash.match(/^#h(\d+)/)){h=RegExp.$1;}}
if(!h)
for(var i=12000;i>0;i-=10)
if(top.frames['h'+i]){top.frames['h'+i]=0;h=i;break;}
if(h)
th.style.height=h+'px';},10);}
var flagma_htmlcode="<iframe id='flagma-iframe' src='' height='1' width='560' style='padding:0; margin:0' scrolling='no' frameborder='0' onload='flagma_on_load(this)' ><\/iframe>";document.write(flagma_htmlcode);if(typeof(flagma_domain)=='undefined')flagma_domain='http://flagma.ru';var iframe=document.getElementById('flagma-iframe');if(document.URL.match(/from=([a-z\-]+)/))
var from=RegExp.$1;if(document.URL.match(/to=([a-z\-]+)/))
var to=RegExp.$1;if(document.URL.match(/price_type=([a-z]+)/)){var price_type=RegExp.$1;if(price_type=='length')
var t=1;else
var t='';}
if(from&&to&&price_type)
iframe.src=flagma_domain+'/raschet-rasstoyaniy.html?iframe=1&account='+account+'&from_terr='+from+'&to_terr='+to+'&t='+t;else
iframe.src=flagma_domain+'/raschet-rasstoyaniy.html?iframe=1&account='+account;function flagma_fix_export_link(){if(navigator.appName.match(/Internet Explorer/)&&navigator.appVersion.match(/MSIE/)){var doctype=document.all[0].text;if(doctype&&!doctype.match(/Transitional/)&&!doctype.match(/Frameset/)){var el=document.getElementById('flagma-export-link');if(el)el.style.top="-5px";}}
else{var doctype=document.documentElement.previousSibling;if(doctype){var p=doctype.publicId;if(!p.match(/Transitional/)&&!p.match(/Frameset/)){var el=document.getElementById('flagma-export-link');if(el)el.style.top="-5px";}}}}
setTimeout(function(){flagma_fix_export_link();},100);
